fix: set rl_real_a1's default running_state to STATE_WAITING

This commit is contained in:
fan-ziqi 2024-10-08 18:12:03 +08:00
parent 561864ad08
commit eb3f07a80c
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,7 @@ RL_Real::RL_Real() : unitree_safe(UNITREE_LEGGED_SDK::LeggedType::A1), unitree_u
this->InitObservations(); this->InitObservations();
this->InitOutputs(); this->InitOutputs();
this->InitControl(); this->InitControl();
running_state = STATE_WAITING;
// model // model
std::string model_path = std::string(CMAKE_CURRENT_SOURCE_DIR) + "/models/" + this->robot_name + "/" + this->params.model_name; std::string model_path = std::string(CMAKE_CURRENT_SOURCE_DIR) + "/models/" + this->robot_name + "/" + this->params.model_name;
@ -37,7 +38,7 @@ RL_Real::RL_Real() : unitree_safe(UNITREE_LEGGED_SDK::LeggedType::A1), unitree_u
this->loop_keyboard->start(); this->loop_keyboard->start();
this->loop_control->start(); this->loop_control->start();
this->loop_rl->start(); this->loop_rl->start();
#ifdef PLOT #ifdef PLOT
this->plot_t = std::vector<int>(this->plot_size, 0); this->plot_t = std::vector<int>(this->plot_size, 0);

View File

@ -35,6 +35,7 @@ RL_Sim::RL_Sim()
this->InitObservations(); this->InitObservations();
this->InitOutputs(); this->InitOutputs();
this->InitControl(); this->InitControl();
running_state = STATE_RL_RUNNING;
// model // model
std::string model_path = std::string(CMAKE_CURRENT_SOURCE_DIR) + "/models/" + this->robot_name + "/" + this->params.model_name; std::string model_path = std::string(CMAKE_CURRENT_SOURCE_DIR) + "/models/" + this->robot_name + "/" + this->params.model_name;
@ -138,7 +139,7 @@ void RL_Sim::SetCommand(const RobotCommand<double> *command)
this->joint_publishers_commands[i].kd = command->motor_command.kd[i]; this->joint_publishers_commands[i].kd = command->motor_command.kd[i];
this->joint_publishers_commands[i].tau = command->motor_command.tau[i]; this->joint_publishers_commands[i].tau = command->motor_command.tau[i];
} }
for(int i = 0; i < this->params.num_of_dofs; ++i) for(int i = 0; i < this->params.num_of_dofs; ++i)
{ {
this->joint_publishers[this->params.joint_controller_names[i]].publish(this->joint_publishers_commands[i]); this->joint_publishers[this->params.joint_controller_names[i]].publish(this->joint_publishers_commands[i]);