A Gazebo simulator for the Franka Emika Panda robot with ROS interface, providing exposed controllers and real-time robot state feedback similar to the real robot when using the Franka ROS Interface package.
- Customisable low-level controllers (joint position, velocity, torque) available that can be controlled through ROS topics (including position control for gripper) or Python API.
- Real-time robot state (end-effector state, joint state, controller state, etc.) available through ROS topics.
- The Franka ROS Interface package (which is a ROS interface for controlling the real Panda robot) can also be used with the panda_simulator, providing direct sim-to-real code transfer. The PandaRobot package which provides simplified python API for the robot can also be used for direct sim-to-real code transfer, as well as for performing real-time kinematics and dynamics computation.
- Supports MoveIt planning and control for Franka Panda Emika robot arm and Franka Gripper, as well as smooth motion control using customisable ROS JointTrajectoryAction service.
For a simple bare-bone Gazebo simulator created using inbuilt Gazebo ROS controllers and transmission interfaces, see Gazebo Panda.
See version log for details about new feature updates.
Python API: Franka ROS Interface, PandaRobot
Watch video here
Watch video here
Watch video here
ROS Melodic (noetic-devel branch):
ROS Melodic (melodic-devel branch):
ROS Kinetic (kinetic-devel branch; not maintained):
pip install -r requirements.txt #(to install numpy and numpy-quaternion)
(orpip3 install -r requirements.txt
)- libfranka (
apt install ros-${ROS_DISTRO}-libfranka
or install from source). - Most of the other basic dependencies can be met by running the following
apt-get
command:apt install ros-$ROS_DISTRO-gazebo-ros-control ros-${ROS_DISTRO}-rospy-message-converter ros-${ROS_DISTRO}-effort-controllers ros-${ROS_DISTRO}-joint-state-controller ros-${ROS_DISTRO}-moveit ros-${ROS_DISTRO}-moveit-commander ros-${ROS_DISTRO}-moveit-visual-tools
.
The following dependencies can be installed using the .rosinstall
file (instructions in next section: Building the Package).
- franka-ros
- panda_moveit_config
- Franka ROS Interface (branch
v0.7.1-dev
branch) - franka_panda_description (urdf and model files from panda_description package modified to work in Gazebo, with the custom controllers, and more realistic dynamics parameters)
- orocos-kinematics-dynamics (requires a specific commit; see instructions below)
NOTE: The franka_panda_description package above has to be independently updated regularly (using git pull
) to get the latest robot description, visual and dynamics parameters.
1.Clone the repo:
cd <catkin_ws>/src
git clone -b noetic-devel https://github.com/justagist/panda_simulator
Steps 2 and 3 can be automated by running ./build_ws.sh
from <catkin_ws>/src/panda_simulator
.
2.Update dependency packages:
wstool init
wstool merge panda_simulator/dependencies.rosinstall
wstool up
# use old ros-compatible version of kdl
cd orocos_kinematics_dynamics && rm -rf * && git checkout b35c424e && git reset --hard
cd ../.. && rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO --skip-keys python-sip
3.Once the dependencies are met, the package can be installed using catkin_make:
source /opt/ros/$ROS_DISTRO/setup.bash
catkin build # if catkin not found, install catkin tools (apt install python-catkin-tools)
source devel/setup.bash
Requires nvidia-docker. Gazebo and RViz may not work without nvidia-docker.
- To build the docker image of the package, run
docker build docker/ -t ps_${ROS_DISTRO}:v1.0.0
, or pull built image from github (docker pull docker.pkg.github.com/justagist/panda_simulator/ps_${ROS_DISTRO}:v1.0.0
). Note: Even when using the docker image, this repository has to be cloned on to the host machine. - To run the built image interactively, run the script
./run_docker.sh
from the cloned repository. The container starts in a catkin workspace (directory location in host machine:$HOME/.panda_sim_${ROS_DISTRO}_ws
). The host's home directory is also mounted in the container for access to.ros/
and for making the catkin workspace writable. To see and modify other mounted volumes, go through therun_docker.sh
file. - When running for the first time, the catkin workspace has to be built (
cd src/panda_simulator && ./build_ws.sh
). - If everything was successfully built in the previous step, you should be able to run the simulator (see Usage section below).
Any edits made to the host directory will be reflected in the docker container (and vice-versa). You can also run and build other ROS nodes and packages without having any ROS installation on the host machine.
The simulator can be started by running:
roslaunch panda_gazebo panda_world.launch # (use argument load_gripper:=false for starting without gripper; see other available arguments in launch file)
This exposes a variety of ROS topics and services for communicating with and controlling the robot in simulation. The robot can also be controlled using the Franka ROS Interface package and/or PandaRobot APIs.
Update: The above roslaunch command does not start the moveit server automatically anymore. If using Panda Simulator in ROS Melodic environment, the moveit server now has to be started manually by running the following command in a new terminal:
roslaunch panda_sim_moveit sim_move_group.launch # (use argument load_gripper:=false for starting without gripper
For known errors and issues, please see Issues section below.
To run these demos, launch the simulator first: roslaunch panda_gazebo panda_world.launch
. The following demos can then be tested:
-
Moveit Demo: The moveit server must be running (see usage). Run
roslaunch panda_simulator_examples demo_moveit.launch
to run a demo for testing the moveit planner interface with the simulated robot. This script starts a moveit RViz GUI for motion planning and terminal interface for modifying planning scene. -
Task-space control using Franka ROS Interface (or PandaRobot) API: Run
roslaunch panda_simulator_examples demo_task_space_control.launch
to run a demo showing the task-space control. By default, the demo uses the (Franka ROS Interface) API to retrieve state information, and to control it using torque control (see script). -
Task-space control using ROS topics directly: Another script demonstrating the same functionality without using the Franka ROS Interface API, and only the ROS topics from the simulation is also provided. This can be run interactively by running
roslaunch panda_simulator_examples demo_task_space_control.launch use_fri:=False
. -
API usage demo: Another (much simpler) demo 'move_robot.py' is provided demonstrating (i) controlling the robot in the joint space, (ii) retrieving state information of the robot.
Watch video here
ROS Topic | Data |
---|---|
/panda_simulator/custom_franka_state_controller/robot_state | gravity, coriolis, jacobian, cartesian velocity, etc. |
/panda_simulator/custom_franka_state_controller/tip_state | end-effector pose, wrench, etc. |
/panda_simulator/joint_states | joint positions, velocities, efforts |
ROS Topic | Data |
---|---|
/panda_simulator/motion_controller/arm/joint_commands | command the robot using the currently active controller |
/panda_simulator/franka_gripper/move | (action msg) command the joints of the gripper |
Other topics for changing the controller gains (also dynamically configurable), command timeout, etc. are also available.
Controller manager service can be used to switch between all available controllers (joint position, velocity, effort). Gripper joints can be controlled using the ROS ActionClient (via the same topics as the real robot and franka_ros).
-
[ERROR] Exception while loading planning adapter plugin 'default_planner_request_adapters/ResolveConstraintFrames
in melodic. This can be safely ignored. -
Error in REST request
error message when starting Gazebo. This also can be safely ignored, or fixed by following the instructions here. -
Gripper control and model definition is not completely developed, and gripper control may not produce the required performance.Update: robot and gripper model definitions have now been improved in the franka_panda_description package. -
Gravity compensation when using velocity or torque controller with gripper is not very good. This is bypassed by deactivating simulator gravity by default (see
panda.world
).
Check versionLog.md.
- Franka ROS Interface : A ROS API for controlling and managing the Franka Emika Panda robot (real and simulated). Contains controllers for the robot (joint position, velocity, torque), interfaces for the gripper, controller manager, coordinate frames interface, etc.. Provides almost complete sim-to-real transfer of code.
- PandaRobot : Python interface providing higher-level control of the robot integrated with its gripper, controller manager, coordinate frames manager, etc. It also provides access to the kinematics and dynamics of the robot using the KDL library.
- Gazebo Panda: A simple bare-bone gazebo simulator using in-built gazebo controllers and transmissions. No custom controllers or interfaces.
The Franka ROS Interface package provides Python API and interface tools to control and communicate with the robot using the ROS topics and services exposed by the simulator. Since the simulator exposes similar information and controllers as the robot_state_controller_node of the Franka ROS Interface, the API can be used to control both the real robot, and the simulated robot in this package, with minimum change in code.
Copyright (c) 2019-2021, Saif Sidhik