ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to add a ground plane to MoveIt scene?

asked 2020-01-18 15:51:11 -0600

lubiluk gravatar image

updated 2020-01-18 15:51:26 -0600

I want to add an XY plane to the PlanningScene so the arm of my robot doesn't hit the ground. Unfortunately I can't work out if I'm doing it right. I don't see anything in RViz. Also, I'm not sure how to instantiate Plane coefficients correctly. Please have a look on this code:

void insertGroundPlane()
  moveit_msgs::CollisionObject object;
  object.header.frame_id = "base_footprint";

  shape_msgs::Plane plane;
  plane.coef = {{0, 0, 1, 0}};

  geometry_msgs::Pose pose;
  pose.orientation.w = 1.0;


  moveit_msgs::PlanningScene planning_scene;;
  planning_scene.is_diff = true;

  moveit_msgs::ApplyPlanningScene srv;
  srv.request.scene = planning_scene;;
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-28 01:38:13 -0600

fvd gravatar image

updated 2021-05-20 06:42:44 -0600

The easiest way would be to add a box underneath the robot in the URDF that your moveit config is based on, as described in this tutorial. You could add something like this to your URDF:

<link name="ground_plane_box">
        <origin xyz="0 0 0" rpy="0 0 0"/>
            <box size="1.0 1.0 0.5"/> 
        <material name="Grey">
            <color rgba="0.7 0.7 0.7 1.0"/>
        <origin xyz="0 0 0" rpy="0 0 0"/>
            <box size="1.0 1.0 0.5"/> 

<joint name="ground_plane_box" type="fixed">
    <parent link="world" />
    <child link="ground_plane_box" />
    <origin xyz="0 0 -0.25" rpy="0 0 0" />


I didn't finish reading your post. You want to specifically add the plane, not a box as a workaround (although an advantage of using a box as a robot base is that it will be there immediately when you start the robot, and does not have to be initialized in code).

Anyway, your code looks good to me. Have you tried running it? There may be no visualization of the plane in Rviz, but if you drag a robot via an interactive marker into the ground, you could see if collisions are detected.

edit flag offensive delete link more


Thank you, but you described how to add a box in Gazebo simulator. My question was about MoveIt planning scene and about plane specifically as its API is undocumented.

lubiluk gravatar image lubiluk  ( 2020-03-01 13:45:05 -0600 )edit

My bad for reading too quickly. I edited the answer. For completeness: This is just a box in URDF, which defines the MoveIt robot model, not only objects in Gazebo.

fvd gravatar image fvd  ( 2020-03-01 16:03:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-18 15:51:11 -0600

Seen: 873 times

Last updated: May 20 '21