Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5a6e1f1
added obstacle avoidance tutorial
Jun 3, 2018
dbfa3f7
added preprocessing the 3D data tutorial
Jun 3, 2018
bc009b0
removing files not needed for current tutorial
Jun 4, 2018
812e80f
clean up and clang formatting
Jun 4, 2018
6b74c1b
adding keep-alive option to enable fake controller planning
Jun 7, 2018
988432d
handled most changes requested by @mlautman except refactoring and re…
Jun 7, 2018
3e96e8b
changing name; fixing links; fixing heading syntax
Jun 7, 2018
417f620
adding collision object to scene; refactoring functions
Jun 8, 2018
dfcf581
updating tutorial for detection and adding cylinder collision object
Jun 8, 2018
59db088
Finishing up perception pipeline tutorial
Jun 11, 2018
47bcb6b
Merge remote-tracking branch 'upstream/kinetic-devel' into perception…
Jun 11, 2018
63e8849
formatting fixes
Jun 11, 2018
980d0bd
incorporating the requested reviews
Jun 12, 2018
50b07e5
Handling reviews
Jun 20, 2018
8fc3d80
reducing size of bag and including it
Jun 27, 2018
e5c22a8
refactor launch
Jun 27, 2018
bb6a59f
removing usage of boost_foreach
Jun 27, 2018
d5f7045
adding known issues
Jul 4, 2018
22b1015
Fixing typos, adding lisence, better naming and issue tracker for kno…
Jul 12, 2018
a346982
tutorial formatting and style rules (#179)
mlautman Jun 18, 2018
cf003cb
Added demos for collision avoidance using CHOMP planner (#173)
raghavendersahdev Jun 20, 2018
ca3466c
Add description of duration parameters (#161)
Jun 25, 2018
12d2298
Added tutorial for STOMP Motion planner (#185)
raghavendersahdev Jul 5, 2018
1e9a50b
Move collision_scene_example into correct subfolder (#191)
davetcoleman Jul 7, 2018
514912a
Corrected tutorial's Cartesian path example (#190)
nbbrooks Jul 10, 2018
9401d53
Pick plan tutorial (#182)
Ridhwanluthra Jul 13, 2018
f52457b
update fork
Aug 6, 2018
3073ad6
Handled comments:
Aug 6, 2018
fa10a7e
clang formatting
Aug 7, 2018
9f4ba07
fixed old link
Aug 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ find_package(catkin REQUIRED
moveit_ros_planning_interface
pluginlib
geometric_shapes
pcl_ros

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v4hn Is adding this dependency going to be an issue?

pcl_conversions
rosbag
)

find_package(Boost REQUIRED system filesystem date_time thread)
Expand Down Expand Up @@ -61,3 +64,5 @@ add_subdirectory(doc/move_group_python_interface)
add_subdirectory(doc/state_display)
add_subdirectory(doc/interactivity)
add_subdirectory(doc/pick_place)
add_subdirectory(doc/perception_pipeline)

2 changes: 1 addition & 1 deletion doc/chomp_planner/chomp_planner_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ To run CHOMP in an evironment with obstacles, you can run the sample python scri

:codedir:`collision_scene_example.py<collision_environments/scripts/collision_scene_example.py>`.

This scripts creates a cluttered scene with four ostacles or a simple scene with one obstacle depending on the argument given to the script. One can also change the position/size of the obstacles to change the scene.
This scripts creates a cluttered scene with four obstacles or a simple scene with one obstacle depending on the argument given to the script. One can also change the position/size of the obstacles to change the scene.

To run the CHOMP planner with obstacles, open two shells. In the first shell start RViz and wait for everything to finish loading: ::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def add_box_object(self, name, dimensions, pose):
if (len(sys.argv) != 2):
print "Correct usage:: \n\"rosrun moveit_tutorials collision_scene_example.py cluttered\" OR \n\"rosrun moveit_tutorials collision_scene_example.py sparse\""
sys.exit()

if sys.argv[1] == "cluttered":
load_scene.add_four_boxes();
elif sys.argv[1] == "sparse":
Expand Down
5 changes: 5 additions & 0 deletions doc/perception_pipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_executable(cylinder_segment src/cylinder_segment.cpp)
target_link_libraries(cylinder_segment ${catkin_LIBRARIES})

add_executable(bag_publisher_maintain_time src/bag_publisher_maintain_time.cpp)
target_link_libraries(bag_publisher_maintain_time ${catkin_LIBRARIES} ${Boost_LIBRARIES})
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems rather redundant. Is there a reason you didn't <include> demo.launch and add the additional nodes specific to this demo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I started testing that way and didnt change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor when you get a chance

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya did that

<include file="$(find moveit_tutorials)/doc/perception_pipeline/launch/obstacle_avoidance_demo.launch" />

<!-- Run the detection and adding cylinder node -->
<node pkg="moveit_tutorials" type="cylinder_segment" name="point_cloud_preprocessor" />

</launch>
11 changes: 11 additions & 0 deletions doc/perception_pipeline/launch/obstacle_avoidance_demo.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<launch>
<include file="$(find panda_moveit_config)/launch/demo.launch" />

<!-- Play the rosbag that contains the pointcloud data -->
<node pkg="moveit_tutorials" type="bag_publisher_maintain_time" name="point_clouds" />

<!-- If needed, broadcast static tf for robot root -->
<node pkg="tf" type="static_transform_publisher" name="to_temp_link" args="0 0.4 -0.6 0 0 0 temp_link panda_link0 10" />
<node pkg="tf" type="static_transform_publisher" name="to_panda_base" args="0 0 0 0 0.2 1.92 camera_rgb_optical_frame temp_link 10" />

</launch>
Binary file added doc/perception_pipeline/obstacle_avoidance.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
Perception/Configuration
=================================
Perception Pipeline Tutorial
============================

MoveIt! allows for seamless integration of 3D sensors using `Octomap <http://octomap.github.io/>`_.
Once properly configured, you should see something like this in rviz:

.. image:: perception_configuration_demo.png
:width: 700px

Getting Started
---------------
If you haven't already done so, make sure you've completed the steps in `Getting Started <../getting_started/getting_started.html>`_.

Configuration
-------------

In this section, we will walk through configuring the 3D sensors on your robot with MoveIt!. The primary component in MoveIt! that deals with 3D perception is the Occupancy Map Updater. The updater uses a plugin architecture to process different types of input. The currently available plugins in MoveIt! are:

Expand All @@ -8,13 +21,14 @@ In this section, we will walk through configuring the 3D sensors on your robot w
* The Depth Image Occupancy Map Updater: which can take as input Depth Images (``sensor_msgs/Image``)

YAML Configuration file (Point Cloud)
-------------------------------------
+++++++++++++++++++++++++++++++++++++

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ridhwanluthra are you aware of @mohmadAyman's work relating to setting up 3D sensors moveit/moveit#969

Can both of cross-review these PRs to ensure there is no duplicate or contradictory effort? Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!


We will have to generate a YAML configuration file for configuring the 3D sensors. Please see `this example file <https://github.com/ros-planning/panda_moveit_config/blob/master/config/sensors_kinect_pointcloud.yaml>`_ for processing point clouds, located in the `panda_moveit_config repository for Kinetic <https://github.com/ros-planning/panda_moveit_config>`_: ::
We will have to generate a YAML configuration file for configuring the 3D sensors. Please see `this example file <https://github.com/ros-planning/panda_moveit_config/blob/master/config/sensors_kinect_pointcloud.yaml>`_ for processing point clouds, located in the `panda_moveit_config repository for Kinetic <https://github.com/ros-planning/panda_moveit_config>`_.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer we use the examples that are almost available in the moveit setup assistant:

moveit_setup_assistant/resources/default_config/sensors_3d.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The challenge with including that would be that it won't work out of the box as we can't directly add that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a naming stand point, would sensors_3d.yaml be better? as more generalized.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to sensors_3d.yaml for the name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now it matches the files in panda_moveit_config.
depthmap
pointcloud

Also, If the name is same the user will have to delete 1 ffile and then use it. or if its all included in a single file they will have to comment out one of the plugins. Which would lead to unnecessary confusion for a newcomer.

Save this file in the config folder in the robot's moveit_config package with name "sensors_kinect_pointcloud.yaml": ::

sensors:
- sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
point_cloud_topic: /head_mount_kinect/depth_registered/points
point_cloud_topic: /camera/depth_registered/points
max_range: 5.0
point_subsample: 1
padding_offset: 0.1
Expand Down Expand Up @@ -43,13 +57,14 @@ We will have to generate a YAML configuration file for configuring the 3D sensor


YAML Configuration file (Depth Map)
-----------------------------------
+++++++++++++++++++++++++++++++++++

We will have to generate a YAML configuration file for configuring the 3D sensors. An `example file for processing depth images <https://github.com/ros-planning/panda_moveit_config/blob/master/config/sensors_kinect_depthmap.yaml>`_ can be found in the `panda_moveit_config repository <https://github.com/ros-planning/panda_moveit_config>`_ as well: ::
We will have to generate a YAML configuration file for configuring the 3D sensors. An `example file for processing depth images <https://github.com/ros-planning/panda_moveit_config/blob/master/config/sensors_kinect_depthmap.yaml>`_ can be found in the `panda_moveit_config repository <https://github.com/ros-planning/panda_moveit_config>`_ as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I want to ask about since I'm not sure, is it possible to have both plugins working at the same time?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think so but im not 100% on that

Save this file in the config folder in the robot's moveit_config package with name "sensors_kinect_depthmap.yaml": ::

sensors:
- sensor_plugin: occupancy_map_monitor/DepthImageOctomapUpdater
image_topic: /head_mount_kinect/depth_registered/image_raw
image_topic: /camera/depth_registered/image_raw
queue_size: 5
near_clipping_plane_distance: 0.3
far_clipping_plane_distance: 5.0
Expand Down Expand Up @@ -84,14 +99,15 @@ We will have to generate a YAML configuration file for configuring the 3D sensor


Update the launch file
----------------------
++++++++++++++++++++++

Add the YAML file to the launch script

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the sensors_kinect.yaml to point to the correct .yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think that sensor_manager.launch is incorrect. I think it should be <robot_name>_moveit_sensor_manager.launch.xml or but you should double check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least in panda it is sensor_manager.launch

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You will now need to update the *sensor_manager.launch* file in the "launch" directory of your panda_moveit_config directory with this sensor information (this file is auto-generated by the Setup Assistant but is empty). You will need to add the following line into that file to configure the set of sensor sources for MoveIt! to use: ::

<rosparam command="load" file="$(find panda_moveit_config)/config/sensors_kinect.yaml" />
<rosparam command="load" file="$(find panda_moveit_config)/config/sensors_kinect_pointcloud.yaml" />

If you are using depthmap change the name of the yaml file to ``sensors_kinect_depthmap.yaml``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending if the perception screen was to be merged first, adding this line would be automated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. this tutorial can be simplified by relying on the perception screen

Note that you will need to input the path to the right file you have created above.

Octomap Configuration
Expand All @@ -106,3 +122,64 @@ MoveIt! uses an octree-based framework to represent the world around it. The *Oc
* *octomap_frame*: specifies the coordinate frame in which this representation will be stored. If you are working with a mobile robot, this frame should be a fixed frame in the world.
* *octomap_resolution*: specifies the resolution at which this representation is maintained (in meters).
* *max_range*: specifies the maximum range value to be applied for any sensor input to this node.

Obstacle Avoidance
------------------

If you set the initial and the final location of the robot in a way that there is no straight path between them, then the planner will automatically avoid the octomap and plan around it.

.. image:: obstacle_avoidance.gif
:width: 700px

Running the Interface
+++++++++++++++++++++
Roslaunch the launch file to run the code directly from moveit_tutorials: ::

roslaunch moveit_tutorials obstacle_avoidance_demo.launch

you should see something like the image shown at the beginning of this tutorial.

You can test obstacle avoidance for yourself by setting the goal state manually and then planning and executing. To learn how to do that look at `MoveIt! Quickstart in RViz <../quickstart_in_rviz/quickstart_in_rviz_tutorial.html>`_

Detecting and Adding Object as Collision Object
-----------------------------------------------

In this section, we will demonstrate an example of extracting a cylinder from a pointcloud, computing relevant values and adding it as a collision object to the planning scene.
We will be working with point clouds but it can be implemented similarly with depth maps.

After running the code, you should be able to see something like this in rviz:

.. image:: cylinder_collision_object.png
:width: 700px

Running the Code
++++++++++++++++
Roslaunch the launch file to run the code directly from moveit_tutorials: ::

roslaunch moveit_tutorials detect_and_add_cylinder_collision_object_demo.launch

KNOWN ISSUE - You may see the following error when running the demo ::

ros.moveit_ros_planning.planning_scene_monitor: Transform error: Lookup would require extrapolation into the future. Requested time 1527473962.793050157 but the latest data is at time 1527473962.776993978, when looking up transform from frame [panda_link2] to frame [camera_rgb_optical_frame]
ros.moveit_ros_perception: Transform cache was not updated. Self-filtering may fail.

We are working on fixing it, it should not break the working of the demo.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a Github issue tracking the progress of this problem? Please link to it (and create it if needed)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can follow its status in the `issue tracker <https://github.com/ros-planning/moveit_tutorials/issues/192>`_

Relevant Code
+++++++++++++
The entire code can be seen :codedir:`here <perception_pipeline>` in the moveit_tutorials GitHub project. The details regarding the implementation of each of the perception pipeline function have been omitted in this tutorial as they are well documented `here. <http://wiki.ros.org/pcl/Tutorials>`_

.. |br| raw:: html

<br />

.. |code_start| raw:: html

<code>

.. |code_end| raw:: html

</code>

.. tutorial-formatter:: ./src/cylinder_segment.cpp
82 changes: 82 additions & 0 deletions doc/perception_pipeline/src/bag_publisher_maintain_time.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2018, Ridhwan Luthra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Ridhwan Luthra nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/

/* Author: Ridhwan Luthra */

#include "ros/ros.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add license

#include <ros/package.h>
#include <rosbag/bag.h>
#include <rosbag/view.h>
#include <sensor_msgs/PointCloud2.h>

int main(int argc, char** argv)
{
ros::init(argc, argv, "bag_publisher_maintain_time");
ros::NodeHandle nh;

ros::Publisher point_cloud_publisher = nh.advertise<sensor_msgs::PointCloud2>("/camera/depth_registered/points", 1);
ros::Rate loop_rate(0.1);

// Variable holding the rosbag containing point cloud data.
rosbag::Bag bagfile;
std::string path = ros::package::getPath("moveit_tutorials");
path += "/doc/perception_pipeline/bags/perception_tutorial.bag";
bagfile.open(path, rosbag::bagmode::Read);

std::vector<std::string> topics;
topics.push_back("/camera/depth_registered/points");

// Iterator for topics in bag.
rosbag::View bagtopics_iter(bagfile, rosbag::TopicQuery(topics));

for (auto const msg : bagtopics_iter)
{
sensor_msgs::PointCloud2::Ptr point_cloud_ptr = msg.instantiate<sensor_msgs::PointCloud2>();
if (point_cloud_ptr == NULL)
{
std::cout << "error" << std::endl;
break;
}

while (ros::ok())
{
point_cloud_ptr->header.stamp = ros::Time::now();
point_cloud_publisher.publish(*point_cloud_ptr);
ros::spinOnce();
loop_rate.sleep();
}
}
bagfile.close();
return 0;
}
Loading