justagist / panda_simulator

A Gazebo simulator for the Franka Emika Panda robot with ROS interface, supporting sim-to-real code transfer (Python). Exposes customisable controllers and state feedback from robot in simulation.
Apache License 2.0
188 stars 58 forks source link
franka-emika franka-gazebo franka-ros franka-simulation franka-simulator gazebo-robot panda-gazebo panda-simulation panda-simulator sim-to-real

Panda Simulator Release ROS Version Python 3.6+ Build Status

franka_ros_version franka_ros_interface_version

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.

Features

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.

Control and Monitor robot using Python API

Python API: Franka ROS Interface, PandaRobot

vid Watch video here

vid Watch video here

Control using MoveIt

vid Watch video here

Installation

ROS Melodic (noetic-devel branch): Build Status

ROS Melodic (melodic-devel branch): Build Status

ROS Kinetic (kinetic-devel branch; not maintained): Build Status

Dependencies

The following dependencies can be installed using the .rosinstall file (instructions in next section: Building the Package).

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.

Building the Package

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

Docker Build (experimental!)

Requires nvidia-docker. Gazebo and RViz may not work without nvidia-docker.

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.

Usage

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.

Demos

To run these demos, launch the simulator first: roslaunch panda_gazebo panda_world.launch. The following demos can then be tested:

Task-space Impedance Control Demo

vid Watch video here

Some useful ROS topics

Published Topics
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
Subscribed Topics
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.

ROS Services

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).

Known Issues

  1. [ERROR] Exception while loading planning adapter plugin 'default_planner_request_adapters/ResolveConstraintFrames in melodic. This can be safely ignored.

  2. Error in REST request error message when starting Gazebo. This also can be safely ignored, or fixed by following the instructions here.

  3. ~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.

  4. 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).

Version Update

Check versionLog.md.

Related Packages

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.

License

License

Copyright (c) 2019-2021, Saif Sidhik

If you use this software, please cite it using DOI.