Moveit: output Cartesian trajectories

asked 2023-05-30 07:36:26 -0500

torydebra gravatar image

Hi,

I am wondering if it is possible to use moveit (ROS1) to generate Cartesian trajectories (not joint ones), that then will be handled separately.

For example, I was looking at the cartesian_trajectory_controller, which should accept Cartesian Trajectories, but how to provide them from the moveit pipelines?

I looked at the custom controller manager but the sendTrajectory method of moveit_controller_manager::MoveItControllerHandle accepts a moveit_msgs::RobotTrajectory which is a joint trajectory.

At the moment, after planning, I simply extract the waypoints from the RobotTrajectory and I publish them:

auto solution = planning_components->plan();

moveit_msgs::CartesianTrajectory cartesian_traj_msg;
cartesian_traj_msg.header.frame_id = moveit_cpp_ptr->getRobotModel()->getRootLinkName();
cartesian_traj_msg.header.stamp = ros::Time::now();
cartesian_traj_msg.tracked_frame = "arm1_6";

for (int i =0; i< solution.trajectory_->getWayPointCount(); i++ ) {
    moveit_msgs::CartesianTrajectoryPoint cartesian_traj_point_msg;
    cartesian_traj_point_msg.time_from_start = ros::Duration(solution.trajectory_->getWayPointDurationFromStart(i));

    const Eigen::Isometry3d& tip_pose = solution.trajectory_->getWayPoint(i).getGlobalLinkTransform(cartesian_traj_msg.tracked_frame);

    tf::poseEigenToMsg(tip_pose, cartesian_traj_point_msg.point.pose);

    cartesian_traj_msg.points.push_back(cartesian_traj_point_msg);
}

to_cartesian_pub.publish(cartesian_traj_msg);

but it does not seem the right way to do it

edit retag flag offensive close merge delete

Comments

quick comment: I'm not aware of any built-in support for this.

It (ie: support for interfacing with Cartesian interfaces) would make for a great addition to MoveIt though.

I'd suggest to open a discussion on either the MoveIt 1 or MoveIt 2 issue trackers. The maintainers there should certainly be able to help you (as in: have a meaningful discussion, not do all the work).

gvdhoorn gravatar image gvdhoorn  ( 2023-05-31 02:18:37 -0500 )edit