The MobileTrunk's robot prefab for SoftRobots.
- Requirement
- Compile sofa
- Install Required dependencies
- Download and set up working space
- Install ROS and set up working space
- Launch test
- Connecting the digital twin to the physical robot
- License
This prefab was developed as part of the SOMOROB project. The goal is to integrate a deformable robotic trunk (softrobot) on a 4-wheeled mobile robot base equipped with a LIDAR and to develop its digital twin equivalent. The deformable trunk is a project Echelon 3 developed by the Defrost team at INRIA. The mobile base is developed by the company Robotnik automation
The softwares are use with the following version :
- Python 3
The following Sofa plugins are required. version V21.12 is needed.
- SofaPython3
- BeamAdapter
- SoftRobots
The following python module are required :
- time
- threading
- math
- numpy
- dataclasses
- sys
For that follow these instructions (We will install the linux one)
Now that you have install SOFA binairy we can clone prefab.MobileTrunk repository.
-
Create a directory where you will put it
-
Move into it and clone the last working version
foo@bar:~$ git clone https://github.com/CRIStAL-PADR/prefab.MobileTrunk
Open your bashrc and add the following lines in order to setup your working space
-
Add to the PATH the path to the folder where the binary files are located
export PATH="/path to binary folder/bin:$PATH"
-
Tell to SOFA_ROOT the path where to find the path to the buid folder of SOFA
export SOFA_ROOT=/path to binary folder
-
Make an alias in order to be able to launch Sofa easily by doing a runSofa
runSofa="/path to binary folder/bin/runSofa"
-
Add to the PYTHONPATH the path to SofaPython3, STLIB , SofaROS , Python3
export PYTHONPATH=$PYTHONPATH:"/path to binary folder/plugin/SofaPython3/lib/python3/site-packages":"/path to binary folder/plugin/STLIB/lib/python3/site-packages":"/usr/local/lib/python3.8/dist-packages":"/path to binary folder/plugin/SoftRobots/share/sofa/examples/SoftRobots/sofaros"
-
Now you can source your .bashrc file with the command
source ~/.bashrc
-
And run the command:
runSofa
If everything went well, you should see the Sofa GUI appear.
Now, click on the Edit button and go to Plugin Manager. Then click on Add. A window will appear. You need to navigate to the directory where the binary files are located. Go to the plugins directory, then to ArticulatedSystemPlugin, and then to lib. There, you will find a file named libArticulatedSystemPlugin.so. Click on Open.
Repeat the same procedure to add the .so files for the SofaPython3 plugin.
The digital twin has a ros2 interface while the mobile platform (summit_xl) has a ros1 interface. It is possible to be able to link the digital twin to the real robot using rosbridge.
Install the noetic version for ros1 in order to be able to use rosbridge
Install the foxy version for ros2.
If you are new to ros you can follow the tutorials before continuing
Install rosbridge
foo@bar:~$ sudo apt-get install -y ros-foxy-ros1-bridge
Open your bashrc and add the following lines in order to setup your working space for ros
-
Create an alias for noetic(ros1) and foxy(ros2) in order to be able to source your terminal more easily
alias foxy="source /opt/ros/foxy/setup.bash" alias noetic="source /opt/ros/noetic/setup.bash"
-
Open sofaros.py file located in plugings/SoftRobots/share/sofa/examples/SoftRobots folder. Then replace in the callback method of RosReceiver class the line
self.data = data.data by self.data = data
To confirm all the previous steps and verify that the prefab is working properly you can :
- Launch the scene.py SOFA scene situated in prefab.MobileTrunk/mobile_trunk_sim by doing:
foo@bar:~$ runSofa scene.py --argv KeyboardController
-
If everything went well you should see the GUI Sofa with the digital twin of
-
Then with your keyboard send velocity and orientation command to the Sofa scene in order to see the robot move.
-
source your terminal using :
foo@bar:~$ foxy
-
Go to the directory where the prefab.MobleTrunk/mobile_trunk_sim folder is located and run the following command:
foo@bar:~$ runSofa scene.py --argv RobotToSim
-
Open a new terminal then source it as before then execute the commands to the following command:
foo@bar:~$ colcon build && . install/setup.bash && foxy
-
You can now launch the keyboard controller to interact with the robot in the simulation
foo@bar:~$ ros2 run summitxl summitxl_teleop_key
-
If everything went well you should see this appear in the terminal
- ctl + i : To select the cable i (from 1 to 9) you want to actuate
- ctl + plus : if you want to pull the cable
- ctl + minus : if you want to release the cable
You can found the Echelon3 folder with the reference simulation there : https://gitlab.inria.fr/defrost/Robots/Echelon3.git with the branch Centrale_Dynamixel. The reference simulation is in the folder simulation.
There is also the ros2 package : https://gitlab.inria.fr/defrost/Robots/sim_echelon3_ros.git with the branch ros2.
You can find all the details and the explanation in this two repository.
Creative Commons Zero v1.0 Universal see LICENSE