Skip to content

Commit

Permalink
fix: mutex will cause thread timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
fan-ziqi committed Dec 19, 2024
1 parent 5b05b05 commit 44f8f53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/rl_sar/src/rl_real_a1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void RL_Real::SetCommand(const RobotCommand<double> *command)

void RL_Real::RobotControl()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

this->motiontime++;

Expand All @@ -150,7 +150,7 @@ void RL_Real::RobotControl()

void RL_Real::RunModel()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

if (this->running_state == STATE_RL_RUNNING)
{
Expand Down
4 changes: 2 additions & 2 deletions src/rl_sar/src/rl_real_go2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void RL_Real::SetCommand(const RobotCommand<double> *command)

void RL_Real::RobotControl()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

this->motiontime++;

Expand All @@ -155,7 +155,7 @@ void RL_Real::RobotControl()

void RL_Real::RunModel()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

if (this->running_state == STATE_RL_RUNNING)
{
Expand Down
4 changes: 2 additions & 2 deletions src/rl_sar/src/rl_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void RL_Sim::SetCommand(const RobotCommand<double> *command)

void RL_Sim::RobotControl()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

if (this->control.control_state == STATE_RESET_SIMULATION)
{
Expand Down Expand Up @@ -218,7 +218,7 @@ void RL_Sim::JointStatesCallback(const sensor_msgs::JointState::ConstPtr &msg)

void RL_Sim::RunModel()
{
std::lock_guard<std::mutex> lock(robot_state_mutex);
// std::lock_guard<std::mutex> lock(robot_state_mutex); // TODO will cause thread timeout

if (this->running_state == STATE_RL_RUNNING && simulation_running)
{
Expand Down

0 comments on commit 44f8f53

Please sign in to comment.