===== P3 - Asymptotically optimal randomized sampling-based path planning ====== The main task is to implement ROS modules for asymptotically optimal randomized sampling-based path planning using the OMPL library. |**Deadline** | January 5th, 23:59 PST | |**Points** | 5 | |**Label in BRUTE** | P3 | |**Evaluation** | Solution is evaluated by a demonstration to an instructor | |**Resources** | {{:courses:b4m36uir:projects:uir-p3-ompl.zip | P3-ompl resource package}} | \\ ===Assignment=== Implement ROS nodes to solve the asymptotically optimal randomized sampling-based path planning. The provided resource pack supports deployment using the STDR simulator. Moreover, an R-VIZ setup file is provided to visualize the robot knowledge of the environment using the messages published by the individual ROS nodes. \\ ==Simulator== The simulator provides and processes the following inputs and outputs, respectively | | Message type | ROS Topic | Description | | Outputs| Robot pose ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Odometry.html|nav_msgs/Odometry]]) | /robot0/odom | Robot pose provided by a simulator | | | Robot goal ([[http://docs.ros.org/melodic/api/geometry_msgs/html/msg/Point.html|geometry_msgs/Point]]) | /robot0/goal | Robot goal provided by an interactive marker | | Inputs | Velocity command ([[https://docs.ros.org/api/geometry_msgs/html/msg/Twist.html|geometry_msgs/Twist]] ) | /robot0/cmd_vel | Velocities to drive the robot | To run the STDR simulator - launch the ROS node roslaunch uir_ompl_tools uir_backend_stdr.launch \\ ==RVIZ== The provided RVIZ setup file may be used to visualize the following topics | Message type | Topic | Description | | Robot odometry ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Odometry.html|nav_msgs/Odometry]]) | /robot0/odom | Robot position and orientation provided by a simulator | | Path ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Path.html|nav_msgs/Path]]) | /robot0/path | Path to be followed by the robot | Moreover, an interactive marker is setup in RVIZ to place the robot goal on the map. \\ == Expected Behavior == {{:courses:b4m36uir:projects:p3.gif?300|}} \\ === Evaluation === A demonstration in STDR is evaluated by an instructor during the labs. \\ ===Suggested architecture=== \\ ==Path following module== The path following module drives the robot along a given path by publishing velocity commands. | | Message type | Topic | Description | Inputs | Path ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Path.html|nav_msgs/Path]]) | /robot0/path | Path to be followed by the robot | | | Robot odometry ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Odometry.html|nav_msgs/Odometry]]) | /robot0/odom | Robot position and orientation provided by a simulator | | Outputs | Velocity command ([[https://docs.ros.org/api/geometry_msgs/html/msg/Twist.html|geometry_msgs/Twist]] ) | /robot0/cmd_vel | Velocities to drive the robot | \\ ==Path planning module== The path planning module plans a safe path to the published goal. | | Message type | Topic | Description | Inputs | Robot pose ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Odometry.html|nav_msgs/Odometry]]) | /robot0/odom | Robot pose provided by a simulator | | | Robot goal ([[http://docs.ros.org/melodic/api/geometry_msgs/html/msg/Point.html|geometry_msgs/Point]]) | /robot0/goal | Robot goal provided by an interactive marker | | Outputs | Path ([[http://docs.ros.org/melodic/api/nav_msgs/html/msg/Path.html|nav_msgs/Path]]) | /robot0/path | Path followed by the robot | The path should be computed using a single-query asymptotically optimal randomized sampling-based planner. This may be achieved using the OMPL library with a variant of the RRT* planner. The Rapid library may used to check for collision in a similar manner to the tasks [[courses:b4m36uir:hw:t3a-sampl|T3a-sampl]] and [[courses:b4m36uir:hw:t3b-rrt|T3b-rrt]]. \\ ===Appendix=== \\ ==Setup and ROS Basics== To run the ROS nodes, it is strongly recommended to use either Ubuntu 16 with ROS Kinetic or Ubuntu 18 with ROS Melodic. Detailed installation instructions may be found on ROS web pages [[http://wiki.ros.org/kinetic/Installation/Ubuntu|ROS Kinetic]], [[http://wiki.ros.org/melodic/Installation/Ubuntu|ROS Melodic]]. On the lab computers, ROS Kinetic is already preinstalled but two more libraries need to be installed before using it. pip install rospkg pip install netifaces Moreover, it is necessary to source the main ROS setup script, which has to be done in each new terminal instance. Thus, it is recommended to add the following source command in your ''~/.bashrc'' file echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc or alternatively when running ROS Meloding echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc Finally, on Ubuntu 16 the STDR simulator is installed using sudo apt-get install ros-kinetic-stdr-* On Ubuntu 18, STDR has to be compiled from source, which can be found at [[https://github.com/stdr-simulator-ros-pkg/stdr_simulator]]. \\ ==OMPL Setup== The [[https://ompl.kavrakilab.org/|Open Motion Planning Library (OMPL)]] implements many state-of-the-art sampling-based motion planning algorithms. The OMPL library may be downloaded at [[https://ompl.kavrakilab.org/download.html|this link]]. To install OMPL and generate its Python bindings, cd into the downloaded folder and run sudo -s ./install-ompl-ubuntu.sh --python Note, this may take several hours.\\ Moreover, when installing on Ubuntu 17.10 and above, where the default version of Python 3, it may be necessary to modify the lines 130-133 of the installation script # the default version of Python in 17.10 and above is version 3 if [[ $ubuntu_version > 1704 ]]; then PYTHONV=3 fi as follows # the default version of Python in 17.10 and above is version 3 if [[ $ubuntu_version > 1704 ]]; then PYTHONV=2 fi since the OMPL bindings should be generated for Python 2, which is used by ROS. \\ Alternatively, it is possible to get OMPL working on Ubuntu 16.04 by installing using the {{:courses:b4m36uir:tutorials:ompl_install.zip|minimum install script}}.\\ The script copies the necessary libraries into the ''/usr/local/lib'' directory and bindings to the ''/usr/local/lib/python2.7''. \\ ==ROS Basics== On Ubuntu 16 and 18 the ROS workspace is created as follows cd ~/ mkdir rds_ws mkdir rds_ws/src cd rds_ws catkin_make # source the workspace cd devel devel_path=$(pwd) echo "source $devel_path/setup.bash" >> ~/.bashrc source setup.bash # Add new (custom) package to the workspace cd ~/rds_ws/src # Go to src folder in your workspace. ln -s [path to your package] # Create symlink to your package (or place the whole package directly to src). cd ~/rds_ws catkin_make # Compile the workspace. rospack list # Make sure that your pack is known. (Sometimes this is necessary to refresh ROS. ) # Now, you should be able to use the package within ROS (rosrun or roslaunch). # useful commands rostopic list # all current topics in the ROS system rostopic info [topic name] # show info about topic - publishers, subscribers rostopic echo [topic name] # writes msgs data on certain topic to stdout rostopic hz [topic name] # prints frequency of msgs on a certain topic rosnode list # all currently running nodes rosnode info [node name] # info about the node: published topics, subscribed topics # useful tools rqt_graph # visualize connection between the nodes (might not be 100% accurate) rviz # spatial visualization of the msgs rosrun tf view_frames # creates pdf with a visualization of the whole transformation tree (all the /tf msgs in the system) rosbag record # capture ROS msgs on selected topics (data can be played with selected speed afterwards) rosbag play [bagfile] # play data saved in bagfile The main study material for ROS is [[http://wiki.ros.org/ROS/Tutorials]]. A special attention should be given to ROS message-based communication presented in [[http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29]].