Dropping all 1 trajectory point(s), as they occur before the current time. last time 580.02s

asked 2019-02-12 09:48:09 -0500

segalome gravatar image

updated 2019-02-13 04:15:33 -0500

Hi. While trying to use FollowJointTrajectory, running from another system, setting the ROS_MASTER_URI to be the robot's IP. I am encountering a problem where trying to tilt the arm fails with either

1) Dropping all 1 trajectory point(s), as they occur before the current time. last time 580.02s.

or

2) [ERROR] Unexpected exception caught when initializing trajectory from ROS message data.

I guess it has to do with the difference of times on my PC and on the robot?

edit: The code is working perfectly fine on the gazebo simulation.

the code I use:

_armClient.sendGoal(setGoalTja(rotate1,shoulder1,shoulder2,rotate2,shoulder3,wrist_joint));

control_msgs::FollowJointTrajectoryGoal setGoalTja(double rotate1, double shoulder1, double shoulder2, double rotate2, double shoulder3, double wrist_joint) {
    control_msgs::FollowJointTrajectoryGoal goal;
    trajectory_msgs::JointTrajectoryPoint point;

    goal.trajectory.header.frame_id = "";
    goal.trajectory.header.stamp = ros::Time::now();
    goal.trajectory.joint_names.push_back("rotation1_joint");
    goal.trajectory.joint_names.push_back("shoulder1_joint");
    goal.trajectory.joint_names.push_back("shoulder2_joint");
    goal.trajectory.joint_names.push_back("rotation2_joint");
    goal.trajectory.joint_names.push_back("shoulder3_joint");
    goal.trajectory.joint_names.push_back("wrist_joint");

    point.time_from_start = ros::Duration(10.0);
    point.accelerations.resize(6);
    point.accelerations[4] = 2;
    point.positions.resize(goal.trajectory.joint_names.size());
    point.positions[0] = rotate1;
    point.positions[1] = shoulder1;
    point.positions[2] = shoulder2;
    point.positions[3] = rotate2;
    point.positions[4] = shoulder3;
    //point.positions[5] = joints[5]+pos;
    point.positions[5] = wrist_joint; //pos
    goal.trajectory.points.push_back(point);
    return goal;
}
edit retag flag offensive close merge delete

Comments

1

I guess it has to do with the difference of times on my PC and on the robot?

As you note yourself: time synchronisation between the robot and the PC would be something to check.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-13 04:39:42 -0500 )edit

If you mean time synchronisation as checking that the robot's and the PC's system has the same time. So yes I checked that, and that didn't help.

segalome gravatar image segalome  ( 2019-02-13 04:44:17 -0500 )edit

Can you describe how you checked that? (At least) millisecond synchronisation would be required, so without specialised tools/infrastructure this is impossible to achieve.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-13 04:45:19 -0500 )edit

In the FollowJointTrajectory I set Time_From_Start to be a several seconds so syncing by miliseconds wont be necessary I guess.

segalome gravatar image segalome  ( 2019-02-13 04:49:46 -0500 )edit

That doesn't seem to answer my question? In general when working with multi-host setups in ROS, having synchronised clocks is advisable, as anything with timestamps cannot be compared or data interpolated properly without that. TF lookups failing is one of the other problems. Not saying it's the ..

gvdhoorn gravatar image gvdhoorn  ( 2019-02-13 05:01:04 -0500 )edit

.. cause here, but worthwhile to check in any case.

Note btw that this is not necessarily ROS-specific: distributed control systems without synchronised clocks are a lot more complex and require different approaches.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-13 05:01:16 -0500 )edit

How would you recommend to sync my PC's time with the robot's?

segalome gravatar image segalome  ( 2019-02-13 07:03:49 -0500 )edit

Chrony is being used a lot (see here) or you could go for plain ntp.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-13 07:35:40 -0500 )edit