Problem in Joint Trajectory Message

asked 2018-03-08 04:54:01 -0500

saurabh gravatar image

Hello All,

I am using Joint Trajectory message to control my robot's trajectory. And I am using below code:

trajectory_msgs::JointTrajectory traj;
    trajectory_msgs::JointTrajectoryPoint point;

    traj.header.stamp = ros::Time::now();
    traj.header.frame_id = "/world";
    traj.joint_names.resize(5);

    traj.points.resize(2);
    traj.joint_names[0] = "joint1";
    traj.joint_names[1] = "joint2";
    traj.joint_names[2] = "joint3";
    traj.joint_names[3] = "joint4";
    traj.joint_names[4] = "joint5";

    point.positions.resize(5);
    point.positions[0] = 0.0;
    point.positions[1] = 0.0;
    point.positions[2] = 0.732117317612;
    point.positions[3] = -0.6;
    point.positions[4] = 0.0;
    point.time_from_start = ros::Duration(4.0);
    traj.points[0] = point;

    point.positions.resize(5);
    point.positions[0] = 0.0;
    point.positions[1] = 0.0;
    point.positions[2] = 0.732117317612;
    point.positions[3] = 0.0;
    point.positions[4] = 0.0;
    point.time_from_start = ros::Duration(4.0);
    traj.points[1] = point;

    joint_pub.publish(traj);
    ROS_INFO("Moving joint in sync to %f", value);
    ros::spinOnce();

Here it seems to be working partially. But I am facing 2 problems:

  1. There is an error message as below:

    [ERROR] [1520506336.975420]: Attempt to get a goal id on an uninitialized ServerGoalHandle [ERROR] [1520506336.977216]: Attempt to get a goal id on an uninitialized ServerGoalHandle [ERROR] [1520506336.982781]: Attempt to set status on an uninitialized ServerGoalHandle

    I don't know why this error message, and how it will affect my system.

  2. It is taking only first point in the trajectory and not reaching to second point.

Can somebody please let me know how to resolve these problems.

Thanks, Saurabh

edit retag flag offensive close merge delete