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
validate trajectory before execution #63
Conversation
@@ -288,6 +291,7 @@ class TrajectoryExecutionManager | |||
bool execution_duration_monitoring_; | |||
double allowed_execution_duration_scaling_; | |||
double allowed_goal_duration_margin_; | |||
double allowed_start_deviation_; |
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.
add comment here explaining units - for revolute joints this would be tolerance of radians amount correct?
Looks like a great improvement, thanks |
+1 |
@v4hn Could you have a look too? |
On Thu, Aug 18, 2016 at 04:02:10AM -0700, Robert Haschke wrote:
I will do that over the weekend. |
Great. Thanks. |
@@ -7,5 +7,6 @@ gen.add("execution_duration_monitoring", bool_t, 1, "Monitor the execution durat | |||
gen.add("allowed_execution_duration_scaling", double_t, 2, "Accept durations that take a little more time than specified", 1.1, 1, 10) | |||
gen.add("allowed_goal_duration_margin", double_t, 3, "Allow more than the expected execution time before triggering a trajectory cancel (applied after scaling)", 0.5, 0.1, 5) | |||
gen.add("execution_velocity_scaling", double_t, 4, "Multiplicative factor for execution speed", 1, 0.1, 10) | |||
gen.add("allowed_start_tolerance", double_t, 5, "Allowed joint-value tolerance for validation of trajectory's start point against current robot state", 1e-3, 0); |
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.
1e-3
feels rather small for a hard threshold.
Everyone can adapt this if required, but I would prefer 0.01
as the default in order to prevent false-positives.
We don't want people to trip over it, we want it to support the user.
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.
1e-3
is exactly the value you proposed previously: moveit/moveit_ros#728 (comment). With a 1m lever this is about 1mm, which is fine, while 1e-2
would be 1cm already.
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 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 noise in the reported joint states of the ur5 at rest is around 8e-5
.
What about other platforms?
@davetcoleman what do you think about the value of the threshold?
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.
considering 8e-5
is what UR5 has, seems like a good number. let's set it to whatever the noise of baxter is... i doubt any robot could be nosier, lol
if this is a tricky parameter to tune we should document it for others to tune themselves per robot. i'd recommend a new tutorial named "Tuning Magic Numbers for Real Robots" and list all the parameters in our various yaml and roslaunch files
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.
Having 8e-5
on UR5, the suggested 1e-3
seems to be a good compromise. It's safe with regard to a 1m lever only "jumping" 1mm in that case. I agree to @v4hn that the value can be made more restrictive if necessary. I wouldn't increase further (e.g. to 1e-2
as suggested in https://github.com/ros-planning/moveit/pull/63/files#r75665102), because that would move by 1cm.
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.
can you add a comment in the code re-capping how we've arrived at this default value?
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.
Looking at this again, I believe it is unnecessarily complex to have this parameter in dynamic reconfigure.
- it's one more place where the default value has to be provided
- if anyone wants to add per-joint thresholds later on, the meaning of this parameter becomes "default if none is specified"
This meaning does not deserved to be changed dynamically imho - Personally I don't see a reason why anyone would ever change that value during runtime. This is what dynamic reconfigure is for.
Opinions?
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 think I would lean toward leaving this out of dyn reconfig. Your bullets sum up the arguments I would've used as well.
Beyond this one PR though, I can see making things like this dynamically (re)configurable being useful when requirements change during runtime. Two examples:
-
I know of people using MoveIt with drones and other more mobile robots. These robots are mobile perhaps even just to add some 'temporary' mobility to an otherwise static manipulator, but still. I would expect -- but cannot back it up with nrs right now -- that noise in joint states would increase during motion. Manipulation during motion would then need to have (a slightly more) relaxed threshold(s). Afterwards, the old setting could be restored.
-
(slightly more of a stretch, as considering MoveIt as part of the safety features of any robot system is currently not even considerable): in the context of co-robots, changing thresholds / safety related distances and things like maximum velocities and forces based on the proximity of humans becomes more and more common place.
I don't see MoveIt used for these things (in production systems at least), but dynamically changeable parameters would seem to be a requirement for this kind of functionality.
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.
On Tue, Sep 13, 2016 at 04:02:28AM -0700, G.A. vd. Hoorn wrote:
I would expect -- but cannot back it up with nrs right now -- that noise in joint states would increase during motion. Manipulation during motion would then need to have (a slightly more) relaxed threshold(s). Afterwards, the old setting could be restored.
Feel free to correct me on this, but this is not state-of-the-art but cutting-edge research and people doing research in this field, they can always disable this additional safety feature if they exceed this threshold and enforce it in their drivers (this is where it actually belongs).
in the context of co-robots, changing thresholds / safety related distances and things like maximum velocities and forces based on the proximity of humans becomes more and more common place.
Yes, I don't believe the parameter under discussion falls into this category though. At least not for now.
Overall, this looks great. As mentioned, this breaks API and I'm not sure there is a way around it. |
Good idea. I will also add a deprecation warning during compile time then. |
On Tue, Aug 23, 2016 at 01:58:45AM -0700, Robert Haschke wrote:
+1
+1 as soon as the threshold got somewhat tested. (We'll try to test the ur5 here today) |
With the changes suggested in #63 (comment), API compatibility can be maintained, but ABI will break anyway, because we need to add a new class member. Alternatively, we could fallback to the version before 9f77f91, which is ABI and API compatible because it adds the validateTrajectory method at the level of The plan/move capability enforces setting the start state of the robot, such that it shouldn't happen that the start state deviates there. However, other capability plugins would need to call the validation method themselves if necessary. I think, this could be a compromise to maintain ABI compatibility and having the trajectory validation in most cases. UPDATE: |
return false; | ||
} | ||
// TODO: check multi-DoF joints ? | ||
if (fabs(current_state->getJointPositions(jm)[0] - positions[i]) > allowed_start_tolerance_) |
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.
Would it be a good idea to skip this check if the allowed tolerance is set to 0.0
?
This would disallow setting it to 0.0
if you think you have a perfectly unnoisy robot,
but it would give a well-defined and simple way to disable the safety check from the launch file.
I suppose I would want to do that if I'm sure my controller does this in a better way...
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.
+1 to skipping the for loop if the tolerance is smaller than epsilon
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 will do that.
You misunderstood. I'm fine with breaking the ABI once in indigo to fix safety hazards. So I was waiting for some more measurements from other robot setups. |
I haven't read the code completely, but have we thought about the impact of this on things like dynamic trajectory replacement? Are we expecting users to disable the traj.mon. in case they want to do something like that? |
By now, I heard the argument twice that this threshold should be specified per joint instead of having one value. In both cases it was suggested to make this an optional new field in the The most important use-case I see for this are prismatic joints. We might not want to use the same threshold for validation of rotational and prismatic joints, but we can't differentiate them at this point (and I still think this is the correct place to add the checks). Up to now my reaction to this was: if the simple value proofs inappropriate, we can always put a per-joint mechanism on top of it and make the ros-param the default for unspecified limits. |
@gavanderhoorn Thanks! @rhaschke why did you add the validation to the |
@v4hn wrote:
hm? For what? :) |
On Wed, Aug 24, 2016 at 07:59:24AM -0700, G.A. vd. Hoorn wrote:
Looking at this :-) |
@guihomework wrote:
slightly off-topic: with PA-10, you mean a Mitsubishi PA-10? |
+1 I would not add a configuration dialog to the assistant until we change this mechanism to one-value-per-joint, because the semantics of this one value are not very intuitive and the mechanism should "just work" by default. If you want to have a "magic numbers" widget in the assistant, that sounds pretty cool actually, but I would opt to have support for parsing the files in the loaded robot config before that and this is quite some work. Without this, we would just end up with storing all the parameters in the files and in @guihomework Thanks a lot for the test results! |
@gavanderhoorn , indeed this is a Mitsubishi PA-10 7c with a too heavy payload (shakes when moving fast) but is stable when maintaining position. |
@guihomework: interesting. I might email you off-list. |
* validate trajectory before execution * addressed review comments * moved validateTrajectory to TrajectoryExecutionManager * addressed @davetcoleman's comments * make allowed_start_tolerance dynamically configurable * addressed @v4hn's comments * moved validate to executeThread * allow_start_tolerance == 0 disables trajectory validation * moved validate to execute() * add validation test * increased default value for allowed_start_tolerance to 0.01
* validate trajectory before execution * addressed review comments * moved validateTrajectory to TrajectoryExecutionManager * addressed @davetcoleman's comments * make allowed_start_tolerance dynamically configurable * addressed @v4hn's comments * moved validate to executeThread * allow_start_tolerance == 0 disables trajectory validation * moved validate to execute() * add validation test * increased default value for allowed_start_tolerance to 0.01
I just realized this is not API-compatible - my downstream packages are failing in Jade because of this line Previously in this thread @rhaschke suggested this could be directly cherry-picked into Jade, which I just did, but now that Jade is "officially" released I think we should discuss this further. And there is a C++11 |
This reverts commit 36bbf74.
* validate trajectory before execution * addressed review comments * moved validateTrajectory to TrajectoryExecutionManager * addressed @davetcoleman's comments * make allowed_start_tolerance dynamically configurable * addressed @v4hn's comments * moved validate to executeThread * allow_start_tolerance == 0 disables trajectory validation * moved validate to execute() * add validation test * increased default value for allowed_start_tolerance to 0.01
@davetcoleman This should be API-, but not ABI-compatible and we agreed to accept the ABI breakage for more safety. Which compilation issues do you observe in your downstream projects? |
it's not API compatible, because you didn't add the old constructor back in the kinetic request. |
It broke some of my downstream released packages in Jade because of the change in the constructor, so I think we want it in Jade also |
* Port trajectory_processing to ROS 2 * trajectory_processing, fix logging according to moveit/moveit2#21 * moveit_core trajectory processing - library as SHARED * Fixing trajectory_processing tests * moveit_core trajectory_processing - fixing time
* Add service file to control moveit_jog_arm free dimensions * A better-sounding description * Change service name to ChangeDriftDimensions * Reword control_x_translation -> drift_x_translation * Add a transform to the service * Update srv/ChangeDriftDimensions.srv comment Co-Authored-By: Dave Coleman <dave@picknik.ai> Co-authored-by: Dave Coleman <dave@picknik.ai>
Extracted trajectory validation from moveit/moveit_ros#716 and moveit/moveit_ros#728. First point of trajectory is validated to match current robot state just before execution.
This should be cherry-picked into Indigo/Jade finally.