panda_simulation
This package was written for ROS melodic running under Ubuntu 18.04. Run the following commands to make sure that all additional packages are installed:
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/erdalpekel/panda_simulation.git
git clone https://github.com/erdalpekel/panda_moveit_config.git
git clone --branch simulation https://github.com/erdalpekel/franka_ros.git
cd ..
sudo apt-get install libboost-filesystem-dev
rosdep install --from-paths src --ignore-src -y --skip-keys libfranka
cd ..
It is also important that you build the libfranka library from source and pass its directory to catkin_make when building this ROS package as described in this tutorial.
Currently it includes a controller parameter config file and a launch file to launch the Gazebo simulation environment and the Panda robot from FRANKA EMIKA in it with the necessary controllers.
Build the catkin workspace and run the simulation:
catkin_make -j4 -DCMAKE_BUILD_TYPE=Release -DFranka_DIR:PATH=/path/to/libfranka/build
source devel/setup.bash
roslaunch panda_simulation simulation.launch
Depending on your operating systems language you might need to export the numeric type so that rviz can read the floating point numbers in the robot model correctly:
export LC_NUMERIC="en_US.UTF-8"
Otherwise, the robot will appear in rviz in a collapsed state.
You can see the full explanation in my blog post.
Installing Eclipse Paho MQTT-Client for C++
The build process currently supports a number of Unix and Linux flavors. The build process requires the following tools:
- CMake v3.5 or newer
- GCC v4.8 or newer or Clang v3.9 or newer
- GNU Make
On Debian based systems this would mean that the following packages have to be installed:
$ sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
$ sudo apt-get install libssl-dev
$ sudo apt-get install doxygen graphviz
$ sudo apt-get install libcppunit-dev
Before building the C++ library, first, build and install the Paho C library:
$ git clone https://github.com/eclipse/paho.mqtt.c.git
$ cd paho.mqtt.c
$ git checkout v1.3.1
$ cmake -Bbuild -H. -DPAHO_WITH_SSL=ON -DPAHO_ENABLE_TESTING=OFF
$ sudo cmake --build build/ --target install
$ sudo ldconfig
Build and install the C++ library:
$ git clone https://github.com/eclipse/paho.mqtt.cpp
$ cd paho.mqtt.cpp
$ cmake -Bbuild -H. -DPAHO_BUILD_DOCUMENTATION=TRUE -DPAHO_BUILD_SAMPLES=TRUE
$ sudo cmake --build build/ --target install
$ sudo ldconfig
(source: https://github.com/eclipse/paho.mqtt.cpp/blob/master/README.md)
- see gitlab-CI for more details
Provided MQTT-Interfaces
Configuration of the data-stream (ROS -> RAG)
General
- Channel: dataconfig
- Protobuff-message format defined in https://git-st.inf.tu-dresden.de/ceti/ros/panda_simulation/-/blob/development/morse/proto/dataconfig.proto
- Changes submitted data starting from the next data-package retreived from gazebo
Parameter
- Parameter "data_publish_rate" means in which intervals messages are pulled out of gazebo's data stream
- data_enable_position, true -> send joint positions
- data_enable_orientation, true -> send joint orientations
- data_enable_twist_linear, true -> sent linear twists of joints
- data_enable_twist_angular, true -> sent angular twists of joints
Configuration of the simulated robot
General
- Channel: robotconfig
- Protobuff-message format defined in https://git-st.inf.tu-dresden.de/ceti/ros/panda_simulation/-/blob/development/morse/proto/robotconfig.proto
Parameter
- robot_speed_factor, defines how fast the robot moves starting from the next trajectory-point
- is a factor multiplied to the speed computed by the trajectory-planning algorithm
- Range: 0,1 to 1,0 (recommed are values > 0.3)
Datastream format
General
- Data for every link has its own mqtt-channel (defined in section bellow)
- Protobuff-message format defined in https://git-st.inf.tu-dresden.de/ceti/ros/panda_simulation/-/blob/development/morse/proto/linkstate.proto
Channels
- panda_ground: ground-plate
- panda_link_0: link_0 of the panda
- panda_link_1: link_1 of the panda
- panda_link_2: link_2 of the panda
- panda_link_3: link_3 of the panda
- panda_link_4: link_4 of the panda
- panda_link_5: link_5 of the panda
- panda_link_6: link_6 of the panda
- panda_link_7: link_7 of the panda (end effector)
- panda_link_8: link_8 of the panda (left finger)
- panda_link_9: link_9 of the panda (right finger)
Changelog
Safetyzones
Integrates safetyzones via the SafetyAwarePlanner. start-command: ... roslaunch panda_simulation simulation.launch ...
To see through the boxes one have to set the alpha of the planning an environment (see picture).
MoveIt! constraint-aware planning
An example of one can add constraints to the planning and simulate it. start-command: start-command: ... roslaunch panda_simulation simulation_constraint.launch ...
This repository was extended with a ROS node that communicates with the MoveIt! Planning Scene API. It makes sure that the motion planning pipeline avoids collision objects in the environment specified by the user in a separate directory (~/.panda_simulation
) as json files.
Publishing a box at Panda's hand in Gazebo
This repository was extended with a node that publishes a simple box object in the Gazebo simulation at the hand of the robot. The position of this box will get updated as soon as the robot moves.
Visual Studio Code Remote Docker
I have added configuration files and additional setup scripts for developing and using this ROS package within a Docker container. Currently user interfaces for Gazebo and RViz are not supported.
Position based trajectory execution
The joint specifications in Gazebo were changed from an effort interface to position based interface. Furthermore, the PID controller was substituted with the simple gazebo internal position based control mechanism for a more stable movement profile of the robot. A custom joint position based controller was implemented in order to set the initial joint states of the robot to a valid configuration.
Automatic robot state initialization
A separate ROS node was implemented that starts a custom joint position controller and initializes the robot with a specific configuration. It switches back to the default controllers after the robot reaches the desired state.