-
Notifications
You must be signed in to change notification settings - Fork 525
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
Hold joint position if tolerances were violated #395
base: kinetic-devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1244,6 +1244,17 @@ TEST_F(JointTrajectoryControllerTest, pathToleranceViolation) | |
EXPECT_TRUE(waitForState(action_client, SimpleClientGoalState::ABORTED, long_timeout)); | ||
EXPECT_EQ(action_client->getResult()->error_code, control_msgs::FollowJointTrajectoryResult::PATH_TOLERANCE_VIOLATED); | ||
|
||
// Check that we're not moving | ||
StateConstPtr state1 = getState(); | ||
ros::Duration(0.5).sleep(); // Wait | ||
StateConstPtr state2 = getState(); | ||
for (unsigned int i = 0; i < n_joints; ++i) | ||
{ | ||
EXPECT_NEAR(state1->desired.positions[i], state2->desired.positions[i], EPS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the failure log, the velocity in I would make the test check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few other test cases that check for movement, for example here. I made my check similar for consistency. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests don't have the delay enabled and a big delay before acquiring the states. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will update the test with your proposal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
state1 velocity and acceleration are only non-zero, if
Do you know how to find this value? The actual implementation samples a trajectory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sounds good. I think we should strive for an assertion that reliably checks, if a hold trajectory is executed as expected. This could then be used in all relevant test cases. However, I would separate it from this PR. |
||
EXPECT_NEAR(state1->desired.velocities[i], state2->desired.velocities[i], EPS); | ||
EXPECT_NEAR(state1->desired.accelerations[i], state2->desired.accelerations[i], EPS); | ||
} | ||
|
||
// Restore perfect control | ||
{ | ||
std_msgs::Float64 smoothing; | ||
|
@@ -1266,7 +1277,7 @@ TEST_F(JointTrajectoryControllerTest, goalToleranceViolation) | |
// Make robot respond with a delay | ||
{ | ||
std_msgs::Float64 smoothing; | ||
smoothing.data = 0.95; | ||
smoothing.data = 0.98; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you chnage this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I do not make the movement slower, the joints are too close to the goal position and the position check always passes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the movement faster. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A smoothing value of 0 corresponds to direct control whereas a value of 1 makes the robot not respond at all. Therefore, we movement is delayed more. "Slower" was the wrong term, I guess. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, you are right, my bad! |
||
smoothing_pub.publish(smoothing); | ||
ros::Duration(0.5).sleep(); | ||
} | ||
|
@@ -1289,13 +1300,23 @@ TEST_F(JointTrajectoryControllerTest, goalToleranceViolation) | |
EXPECT_TRUE(waitForState(action_client, SimpleClientGoalState::ABORTED, long_timeout)); | ||
EXPECT_EQ(action_client->getResult()->error_code, control_msgs::FollowJointTrajectoryResult::GOAL_TOLERANCE_VIOLATED); | ||
|
||
// Check that we're not moving after restoring perfect control | ||
StateConstPtr state1 = getState(); | ||
|
||
// Restore perfect control | ||
{ | ||
std_msgs::Float64 smoothing; | ||
smoothing.data = 0.0; | ||
smoothing_pub.publish(smoothing); | ||
ros::Duration(0.5).sleep(); | ||
} | ||
|
||
StateConstPtr state2 = getState(); | ||
for (unsigned int i = 0; i < n_joints; ++i) | ||
{ | ||
EXPECT_NEAR(state1->actual.positions[i], state2->actual.positions[i], EPS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You check it the same way as in the other test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, taking the desired values is not possible. The trajectory has already finished when the goal tolerance is checked. Therefore, desired values do not change anymore. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should check the behavior of the controller (=desired value). And according to the test output, this code samples the hold trajectory properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The desired position should match the actual position at the time of the goal tolerance violation. I could rewrite the test to check that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The final position is based on the hold trajectory -> will move a little bit to obey the speed limits etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure, if I understand you correctly. Before my fix, the desired velocity and acceleration of state1 would be 0, because that is the final state of the trajectory. After my fix and with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before your fix, the desired velocity and acceleration of state1 would ne non-zero, because the controller is still moving towards the goal and motion does not stop. The tests must command a goal that takes much longer to reach than the hold trajectory (to stop the motion). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think, we are talking about the same problem here. I try to summarize the scenario to clarify the situation: I think what should be tested here, is that the robot stays close to its current position after the goal tolerance violation occurred. I agree, that the desired trajectory should be checked, but simply checking velocity/acceleration is not an option as the original behavior also commands a zero velocity/acceleration in its final state, as the trajectory has finished. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I thought the same. This could be done in the path-tolerance test case. I suggest to synchronize with #457 in order to avoid doubling the effort. @Martin-Oehler Are you still interested in continuing on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, I am currently occupied by other projects and won't have time to further look into this. Feel free to take over if you are interested. |
||
EXPECT_NEAR(state1->actual.velocities[i], state2->actual.velocities[i], EPS); | ||
} | ||
} | ||
|
||
int main(int argc, char** argv) | ||
|
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 might be a little bit too high for the hold trajectory to be effective, but with the position plausibility checks this does not matter (apart from longer test 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.
I made this consistent with the other tests. See my other reply.
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.
As long as system time is used, it is difficult to check that the robot stopped in time.
Because there can be delay in the state-publisher.