mirror of https://github.com/fan-ziqi/rl_sar.git
fix: mutex will cause thread timeout
This commit is contained in:
parent
5b05b05529
commit
44f8f5324f
|
@ -139,7 +139,7 @@ void RL_Real::SetCommand(const RobotCommand<double> *command)
|
||||||
|
|
||||||
void RL_Real::RobotControl()
|
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++;
|
this->motiontime++;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void RL_Real::RobotControl()
|
||||||
|
|
||||||
void RL_Real::RunModel()
|
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)
|
if (this->running_state == STATE_RL_RUNNING)
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ void RL_Real::SetCommand(const RobotCommand<double> *command)
|
||||||
|
|
||||||
void RL_Real::RobotControl()
|
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++;
|
this->motiontime++;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void RL_Real::RobotControl()
|
||||||
|
|
||||||
void RL_Real::RunModel()
|
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)
|
if (this->running_state == STATE_RL_RUNNING)
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,7 +153,7 @@ void RL_Sim::SetCommand(const RobotCommand<double> *command)
|
||||||
|
|
||||||
void RL_Sim::RobotControl()
|
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)
|
if (this->control.control_state == STATE_RESET_SIMULATION)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ void RL_Sim::JointStatesCallback(const sensor_msgs::JointState::ConstPtr &msg)
|
||||||
|
|
||||||
void RL_Sim::RunModel()
|
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)
|
if (this->running_state == STATE_RL_RUNNING && simulation_running)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue