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

How to create colored objects in moveit or Rviz in robot's frame

asked 2019-06-20 16:49:50 -0500

Tawfiq Chowdhury gravatar image

updated 2019-06-20 16:56:17 -0500

I have been making collision objects just to use them as regular grasping object in moveit, I keep a distance between the robot's gripper and the object so that I can plan the gripper. This is the code that I have been using so far:

  p = PoseStamped()
  p.header.frame_id = robot.get_planning_frame()
  p.pose.position.x = 0.82
  p.pose.position.y = 0.30
  p.pose.position.z = 1.20
  p.pose.orientation.x = 0.0
  p.pose.orientation.y = 0.0
  p.pose.orientation.z = 0.0
  p.pose.orientation.w = 1.0
  scene.add_box("object1", p, (0.1, 0.5, 0.1))

What I need now, is to create objects of various types and set pose for them, or I may also create regular objects as I created before and set different colors for different endpoints of the objects to distinguish them. I need to know if I can do that and how to do that.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-06-21 03:36:47 -0500

The colors of objects shown in the moveit visualisations are defined by the RVIZ plugin. You cannot define specific colors for individual objects.

You could use a visualisations marker topic to achieve what you want though. If you add a marker that uses the frame of the robots end effector and set it's frame_locked parameter to true then it will move as the robot moves. However this object will not be visible in the planning preview.

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-06-20 16:49:50 -0500

Seen: 1,126 times

Last updated: Jun 21 '19