ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to get a conversion matrix?

asked 2020-05-02 10:08:32 -0500

dxp397@foxmail.com gravatar image

updated 2020-05-02 10:09:31 -0500

I want to get a conversion matrix from a link to base coordinate system. I used the following statement:

robot_state::RobotStatePtr kinematic_state(new robot_state::RobotState(kinematic_model));
kinematic_state->update();
ROS_INFO_STREAM("telescopic_arm_link  transfrom : \n" << kinematic_state-》getFrameTransform("telescopic_arm_link").matrix()<<"\n");

The conversion matrix I get is fixed and not real-time. But when I use the following code to get the coordinate position, it is right.

moveit::planning_interface::MoveGroupInterface group("manipulator");
std::vector<geometry_msgs::Pose> wayPoints;
geometry_msgs::PoseStamped currentPoseValues = group.getCurrentPose("telescopic_arm_link");
ROS_INFO_STREAM("telescopic_arm_link:\n"<<currentPoseValues.pose.orientation);
ROS_INFO_STREAM("telescopic_arm_link:\n"<<currentPoseValues.pose.position);
ROS_INFO("frame_id:%s",currentPoseValues.header.frame_id.c_str());

Therefore, I think it may not be because my coordinate system is not established correctly. But I can't think of the reason for the error. Why does the transformation matrix not change with the change of the robot's position and posture?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-05-13 23:15:08 -0500

fvd gravatar image

Because you create a new robot_state from scratch in your first block of code, which is not related to what your real robot is doing. The update() function you are calling is more low-level than you think. It does not mean "update my robot with data from the real world", but "calculate the positions of the child links and bodies from the joint rotations" (unless I am mistaken).

The MoveGroupInterface maintains a current robot state by using the joint_states topic, so you don't have to worry about this.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-02 10:08:32 -0500

Seen: 97 times

Last updated: May 13 '20