rcruzoliver_0-1706692914239.png

ROS2 demo example - MoveIt2! in ctrlX OS

rcruzoliver
Established Member

In this How-to I present a demo example in which MoveIt! ROS2 library, running on ctrlX CORE X7, plans a robot trajectory. 

1. Concept

Let's first understand how MoveIt2! works.

The MoveIt2! package main functionalities are included in the "move_group" ROS2 node. This node receives inputs from the user and is able to plan low-level robotic actions thanks to its knowledge of the robot configuration (loaded in the ROS Param Server). Moreover, it communicates with the robot hardware, i.e. sensors and controllers, in order to get environment information or deploy actions respectively. 

The user interface to the "move_group" can be done via C++, Python or directly from Rviz. However, this way of interacting with the planner is really low-level. For this reason, MoveIt has developed "MoveIt Task Constructor" (MTC). MTC is a higher-level layer of abstraction that allows the user to easily plan complex tasks, in which several several sub-tasks are involved. 

With this ideas in mind, the system architecture would be described as presented in the following picture.

Concept diagramConcept diagram

2. Demo description

This demo is based on the example available in the MTC documentation. It uses a Franka Emika Panda robot to execute a pick and place task. This robotic platform is widely used in the research world and loved for its well ROS2 compatibility.

In our case, we will run the robot emulation using functionalities from ros2_control and ros2_controllers, the move_group node and a "mtc_demo" node that used the MTC functionalities in ctrlX OS. 

Such components running in ctrlX OS will communicate information thanks to the ROS2 DDS middleware to a Desktop Computer running Ubuntu22, in which an Rviz visualization will be hosted.

System overviewSystem overview

3. Deployment in ctrlX OS

For this demo you need to install two snaps: ros2-base-humble and ros2-moveit-mtc. Sadly we cannot share the the instructions to compile them in this How-To. Please feel free to reach us if you are interested by leaving a comment in this post.

  • ros2-base-humble includes the basic runtime for ROS2 humble. Its resources are used by other ROS2 snaps.
  • ros2-moveit-mtc includes three main components: the Robot HW controllers, the move_group node and a specific node that uses MTC to plan a complex task.

We would need a launcher to start the Rviz simulation on your Desktop Computer. 

4. Run the example

This example assumes you have SSH connection rights with your X7.

4.1. Connect the devices

Connect your ctrlX CORE X7 and the Ubuntu Desktop Computer in the same local network.

4.2. Run the robot HW and the move_group

Open a SSH connection and run:

sudo ros2-moveit-mtc.initALL
4.3. Start the visualization

Open a terminal in your Desktop computer and run the bash that starts the simulation. It sources the ROS2 workspace that was created during the snap compilation, so it will only work if you have compiled the snap, which runs colcon build in the process, and hence the install directory is present.

cd <your_path>/moveit-mtc/

./visualization_demo.sh

You should see the robot in this specific pose.

Robot in ready poseRobot in ready poseIf it's not exactly like this, it means the initALL routine failed in the ctrlX CORE. In this case, shut it down with ctrl^C and call the command again. 

4.4. Start the MTC node

Open a SSH connection and run:

sudo ros2-moveit-mtc.task 

If everything is correct, you should see the robot moving.

Robot executing taskRobot executing task

Related Links

 

Have fun with your robots!

rcruzoliver
rcruzoliver
Enhancing ctrlX platform with solutions. Everything can be snapcrafted! Robotics specialist, ask me anything about ROS2 and ctrlX OS.
1 Comment
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist