1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 10:00:48 +02:00

reset controllers only on when robot program is started

This commit is contained in:
Tristan Schnell
2019-06-12 11:28:24 +02:00
committed by Felix Mauch
parent b2503352a9
commit ad129da4c1
3 changed files with 22 additions and 2 deletions

View File

@@ -344,10 +344,27 @@ bool HardwareInterface ::isRobotProgramRunning() const
void HardwareInterface ::handleRobotProgramState(bool program_running)
{
if (robot_program_running_ == false && program_running)
{
controller_reset_necessary_ = true;
}
robot_program_running_ = program_running;
std_msgs::Bool msg;
msg.data = robot_program_running_;
program_state_pub_.publish(msg);
}
bool HardwareInterface ::shouldResetControllers()
{
if (controller_reset_necessary_)
{
controller_reset_necessary_ = false;
return true;
}
else
{
return false;
}
}
} // namespace ur_driver

View File

@@ -141,8 +141,7 @@ int main(int argc, char** argv)
period.fromSec(std::chrono::duration_cast<std::chrono::duration<double>>(stopwatch_now - stopwatch_last).count());
stopwatch_last = stopwatch_now;
// cm.update(timestamp, period, !g_hw_interface->isRobotProgramRunning());
cm.update(timestamp, period);
cm.update(timestamp, period, g_hw_interface->shouldResetControllers());
g_hw_interface->write(timestamp, period);
// if (!control_rate.sleep())