use waitForCurrentState(ros::Time::now(), instead of waitForCurrentSt…#717
use waitForCurrentState(ros::Time::now(), instead of waitForCurrentSt…#717davetcoleman merged 3 commits intomoveit:indigo-develfrom
Conversation
…ate(1.0) in TrajectoryExecutionManager::validate, cherry pick part of moveit#350
|
#350 fixed race conditions with planning scene updates. To this end, #350 also renamed #63 introduced trajectory validation before execution, which calls the new The current PR introduces the new semantics of Hence, I suggest to either go for a full back-port of #350, accepting ABI breakage or to solve the issue by some other means (e.g. hoping that we already received the latest robot state). @v4hn: Can you give me a call to discuss this? |
rhaschke
left a comment
There was a problem hiding this comment.
Dear @k-okada,
I had a phone call with @v4hn and we agreed to accept this PR with some minor changes to stay ABI-compatible. Basic idea is to replace the condition variable with busy waiting (see inline comments for details).
Subsequently, I will change other usages of waitForCurrentState() requiring the new semantics as well.
moveit_ros/planning/CMakeLists.txt
Outdated
| endif() | ||
|
|
||
| find_package(Boost REQUIRED system filesystem date_time program_options signals thread) | ||
| find_package(Boost REQUIRED system filesystem date_time program_options signals thread chrono) |
| #include <boost/function.hpp> | ||
| #include <boost/shared_ptr.hpp> | ||
| #include <boost/thread/mutex.hpp> | ||
| #include <boost/thread/condition_variable.hpp> |
| ros::Time last_tf_update_; | ||
|
|
||
| mutable boost::mutex state_update_lock_; | ||
| mutable boost::condition_variable state_update_condition_; |
| boost::mutex::scoped_lock lock(state_update_lock_); | ||
| while (current_state_time_ < t) | ||
| { | ||
| state_update_condition_.wait_for(lock, boost::chrono::nanoseconds((timeout - elapsed).toNSec())); |
There was a problem hiding this comment.
Implement this using busy waiting, inserting here a sleep(0.1) for example
This allows us to get rid of the ABI-breaking insertion of state_update_condition_.
|
|
||
|
|
||
| // notify waitForCurrentState() *after* potential update callbacks | ||
| state_update_condition_.notify_all(); |
replace conditional waiting with busy waiting
|
@k-okada @saurabhbansal90 Please could you verify that this latest change fixes your issues, e.g. #501?. |
…ate(1.0) in TrajectoryExecutionManager::validate, cherry pick part of #350
Description
Current indigo moveit has regression compare to hydro, which you could find very easily at answers.ros.org, such as
and interestingly this problem was fixed in Kinetic
that is because indigo moveit requires update of entire joints from
/joint_statesby usinghaveCompleteState()function, whereas kinetic moveit usesstate_update_condition_.wait_for(lock, boost::chrono::nanoseconds((timeout - elapsed).toNSec()));in #63 which uses https://github.com/ros-planning/moveit/blob/0.9.9/moveit_ros/planning/planning_scene_monitor/src/current_state_monitor.cpp#L265-L280 with basicall wait forThis change has been introduced in #350
To summarize, if
/joint_statesis not complite,Failed to validate trajectory: couldn't receive full current joint state within 1sand do not moveThe complete state of the robot is not yet known. Missing RHAND_JOINT0, JOINT1, JOINT2, ...and robot can moveChecklist