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

I want to move joint in rviz

asked 2014-11-09 21:29:55 -0500

jiminlee gravatar image

Recently I use ROS for moving mobile manipulator, which has 2 wheels(2dof) 2arms(16dof) pan tilt camera(2dof) tilt laser(1dof)...

I'm newbie of ROS and have met a problem...

I use moveit! to plan arms motion and get joint value from joint_state_publisher to get joint value from rviz. after that I want to send joint value to rviz use same topic(joint_states)... Yes it works robot joint moves in rviz but very short time.... is there any solution for this?

here is my code and I use demo.launch file from moveit created project

 Joint_Pub.publish(joint_value_for_moveit_update); // publish part in intialize function
.....
void QNode::Joint_cb(sensor_msgs::JointState msg) // Callback function
{
  joint_state_moveit = msg;
for(int i=2;i<18;i++)
  _joint_state_view[i-2] = msg.position[i];
} 
......
joint_value_for_moveit_update.position.clear(); // publish part activated by pushbutton in QT
joint_value_for_moveit_update.name.clear();
for(int i=0;i<joint_state_moveit.position.size();++i)
{
joint_value_for_moveit_update.position.push_back(0.707);
 joint_value_for_moveit_update.name.push_back(joint_state_moveit.name[i]);
}

please help me

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-11-11 06:34:37 -0500

Rabe gravatar image

Hey,

I am not to sure if I understood your question correctly, but I'll give it a shot:

What I guess you are seeing is, that when you publish your own joint-state, Rviz displays this change until it gets a new message from the default JointStatePublisher. In the demo.launch from MoveIt, there is a line starting the jointstatepublisher.

  <!-- We do not have a robot connected, so publish fake joint states -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="/use_gui" value="false"/> 
    <rosparam param="/source_list">[/move_group/fake_controller_joint_states]</rosparam>
  </node>

Switch the param use_gui to true, and you'll get a little window, where you can set your joint states.

Also, it might be that you have your understanding of the MoveIt pipeline wrong. You are supposed to write your own joint_state_publisher which represents the current state of the robot. The fake one is only to show, that the moveit part works. It won't react to any plans and execution requests.

If you have further questions, just ask.

Cheers,

Rabe

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-11-09 21:29:55 -0500

Seen: 3,045 times

Last updated: Nov 11 '14