-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for nonzero joint states in PSM in Servo CPP integration test #3056
Conversation
@ibrahiminfinite tagging you too! |
The results seem encouraging I ran CI 15 times, seeing 2 failures not related to this test. Once, one of the jobs simply got stuck so I cancelled it. The other time, some other kinematics set failed -- unsure why, maybe another super rare flake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I will note is that the API docs for getPlanningScene() says "Avoid this function! Returns an unsafe pointer to the current planning scene."
Yeah, probably should change it -- I'll poke through this when I get a chance. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that you could track down that issue. Unfortunately, you introduced a new issue. Addressed in #3058.
planning_scene_monitor::LockedPlanningSceneRO locked_scene(planning_scene_monitor_); | ||
std::vector<double> joint_positions; | ||
locked_scene->getCurrentState().copyJointGroupPositions(group_name, joint_positions); | ||
return Eigen::Map<Eigen::VectorXd>(joint_positions.data(), joint_positions.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns a pointer to the local vector joint_positions
, which is destroyed when leaving the function!
@@ -62,14 +62,42 @@ class ServoCppFixture : public testing::Test | |||
|
|||
planning_scene_monitor_ = moveit_servo::createPlanningSceneMonitor(servo_test_node_, servo_params_); | |||
|
|||
// Wait until the joint configuration is nonzero before starting MoveIt Servo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a function for this:
planning_scene_monitor_->getStateMonitor()->waitForCompleteState(group_name, wait_time);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we're not using the state monitor anymore, which was the original issue right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was not with the StateMonitor itself, but asking for the current state before it was updated the first time.
Description
I finally chased down the source of the flakiness of the servo integration tests in #3005... I think.
Turns out that the collision monitor thread gets the robot state with the following due to #2747 / #2748:
robot_state_ = planning_scene_monitor_->getPlanningScene()->getCurrentState();
However, the Servo integration CPP tests were using
Switching to the first implementation in the tests caused our "flake" to be a consistently reproducible failure. The initial robot state was all zero since the test instantiates servo and immediately computes some stuff really quick. Actually, what we thought was a flake in failing was the collision monitor sometimes getting a chance to run once before servo computed, and immediately tell us the robot was at in collision, and fail!
So this PR adds some waits for the robot joint configuration to become nonzero.
This was not a problem in the ROS integration tests since there is a function that waits for a robotstate message.
Closes #3005
Checklist