ZebraDevs / robot_controllers

Robot control infrastructure
92 stars 79 forks source link

add init trajectory for future start time #40

Closed knorth55 closed 5 years ago

knorth55 commented 5 years ago

Future motion trajectory support

Background

this PR supports FollowJointTrajectoryGoal with future start time. For example, I want to send FollowJointTrajectoryGoal for 3 seconds ahead from now, to reserve future motion like below. We can reserve future motion FollowJointTrajectory server by giving trajectory with future time.

The most important point is msg.trajectory.header.stamp is 3 seconds ahead from msg.header.stamp.

Problem

When I send the FollowJointTrajectoryGoal as above, fetch robot stays in arm servo off before motion. That is because there is no arm effort command after FollowJointTrajectoryGoal is received and before motion starts. In Gazebo simulation, fetch arm is sinking into its body. I confirm that same problem happens with real robot, too.

fetch_future_motion_before

This PR

This PR put current position as trajectory at the top of the trajectory when there is gap between motion start time and motion request receiving time. With this PR, Fetch robot arm does not stay in arm survo off as below. fetch_future_motion

Related issue

https://github.com/jsk-ros-pkg/jsk_robot/pull/1070#issuecomment-486311568

cc. @pazeshun

knorth55 commented 5 years ago

I also want to backport this PR to indigo-devel branch.

knorth55 commented 5 years ago

@rctoris can you review this PR? This bug may cause robot malfunction

knorth55 commented 5 years ago

@moriarty can you review this PR? this error may cause robot malfunction. (i.e. robot arm moves quickly after servo off)

knorth55 commented 5 years ago

@moriarty kindly ping. can you review this PR?

knorth55 commented 5 years ago

kindly ping. can anyone review this PR?

moriarty commented 5 years ago

Hi sorry you've pinged me a couple times but I didn't see any of these until now.

I'm currently working remotely and can't test this on a Fetch. The change looks fine.

I'll ping @erelson otherwise I'll be able to test in on Monday.

erelson commented 5 years ago

Looking at the code, and your example, this looks good and makes sense. I unfortunately won't have time to test it this week, so I'll leave that to @moriarty...

knorth55 commented 5 years ago

I updated to use executable_trajectory.points[0].time and tested on Gazebo.

knorth55 commented 5 years ago

How is this PR review going?

knorth55 commented 5 years ago

Kindly ping

erelson commented 5 years ago

As expected, no effect on regular operation of a live robot (18.04). Sorry for the delay in getting this tested!

knorth55 commented 5 years ago

@erelson Thank you for merging this PR!