yeah it work

This commit is contained in:
fan-ziqi 2024-03-19 20:29:42 +08:00
parent a46a5b99ff
commit f7e0e7253d
2 changed files with 7 additions and 5 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ devel
logs logs
.catkin_tools .catkin_tools
.vscode .vscode
old

View File

@ -1,6 +1,6 @@
#include "../include/rl_real.hpp" #include "../include/rl_real.hpp"
#define PLOT // #define PLOT
RL_Real rl_sar; RL_Real rl_sar;
@ -78,6 +78,7 @@ void RL_Real::RobotControl()
for(int i = 0; i < 12; ++i) for(int i = 0; i < 12; ++i)
{ {
cmd.motorCmd[i].mode = 0x0A; cmd.motorCmd[i].mode = 0x0A;
// cmd.motorCmd[i].q = 0;
cmd.motorCmd[i].q = output_dof_pos[0][dof_mapping[i]].item<double>(); cmd.motorCmd[i].q = output_dof_pos[0][dof_mapping[i]].item<double>();
cmd.motorCmd[i].dq = 0; cmd.motorCmd[i].dq = 0;
// cmd.motorCmd[i].Kp = Kp[dof_mapping[i]]; // cmd.motorCmd[i].Kp = Kp[dof_mapping[i]];
@ -165,10 +166,10 @@ RL_Real::RL_Real() : safe(LeggedType::A1), udp(LOWLEVEL)
20.0, 55.0, 55.0}}); 20.0, 55.0, 55.0}});
// hip, thigh, calf // hip, thigh, calf
this->params.default_dof_pos = torch::tensor({{-0.1000, 0.8000, -1.5000, // front right this->params.default_dof_pos = torch::tensor({{ 0.1000, 0.8000, -1.5000, // FL
0.1000, 0.8000, -1.5000, // front left -0.1000, 0.8000, -1.5000, // FR
-0.1000, 1.0000, -1.5000, // rear right 0.1000, 1.0000, -1.5000, // RR
0.1000, 1.0000, -1.5000}});// rear left -0.1000, 1.0000, -1.5000}});// RL
this->history_obs_buf = ObservationBuffer(1, this->params.num_observations, 6); this->history_obs_buf = ObservationBuffer(1, this->params.num_observations, 6);