From eb3f07a80cc0df74ae7a87943b79f2ef1e6e2a5d Mon Sep 17 00:00:00 2001 From: fan-ziqi Date: Tue, 8 Oct 2024 18:12:03 +0800 Subject: [PATCH] fix: set rl_real_a1's default running_state to STATE_WAITING --- src/rl_sar/src/rl_real_a1.cpp | 3 ++- src/rl_sar/src/rl_sim.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rl_sar/src/rl_real_a1.cpp b/src/rl_sar/src/rl_real_a1.cpp index 6d6c57e..c3c4429 100644 --- a/src/rl_sar/src/rl_real_a1.cpp +++ b/src/rl_sar/src/rl_real_a1.cpp @@ -21,6 +21,7 @@ RL_Real::RL_Real() : unitree_safe(UNITREE_LEGGED_SDK::LeggedType::A1), unitree_u this->InitObservations(); this->InitOutputs(); this->InitControl(); + running_state = STATE_WAITING; // model 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_control->start(); this->loop_rl->start(); - + #ifdef PLOT this->plot_t = std::vector(this->plot_size, 0); diff --git a/src/rl_sar/src/rl_sim.cpp b/src/rl_sar/src/rl_sim.cpp index 2b06672..b01ad82 100644 --- a/src/rl_sar/src/rl_sim.cpp +++ b/src/rl_sar/src/rl_sim.cpp @@ -35,6 +35,7 @@ RL_Sim::RL_Sim() this->InitObservations(); this->InitOutputs(); this->InitControl(); + running_state = STATE_RL_RUNNING; // model 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 *command) this->joint_publishers_commands[i].kd = command->motor_command.kd[i]; this->joint_publishers_commands[i].tau = command->motor_command.tau[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]);