Skip to content

A tentative C++ wrapper for the Python based Digit tactile sensor simulation

Notifications You must be signed in to change notification settings

hsp-iit/gazebo-yarp-digit-plugin

Repository files navigation

gazebo-yarp-digit-plugin (WIP)

A tentative C++-based Gazebo-YARP plugin for the python-based DIGIT tactile sensor simulator.

This is a work in progress and very likely to change often:

  • No connections to a physical environment are considered
  • The interaction between the sensor and a single object is considered

Dependencies

can be installed, e.g. on Ubuntu, using apt install pybind11-dev

it is not required to download it as the provided CMakeLists.txt take care of it

To install it, refer to this quick start guide

How to build

We strongly advise to create a Python virtual environment before proceeding.

git clone https://github.com/robotology-playground/gazebo-yarp-digit-plugin.git
cd gazebo-yarp-digit-plugin
mkdir build
cd build
cmake ../

At this point, please wait for the TACTO repository to be cloned.

pip install -r _deps/tacto-src/requirements/requirements.txt
make -j

Then, put the following lines of code in the ~/.bashrc:

export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/path/to/the/repo/gazebo-yarp-digit-plugin/build/lib
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/path/to/the/repo/gazebo-yarp-digit-plugin/models

(Remember to source the .bashrc)

How to attach a DIGIT to your model

The following snippet code is an example on how to add the DIGIT link to your robot

<link name = "your_link_name">
    <pose>"your_pose"</pose>
    <inertial>
        <pose>0 0 0.015  0 0 0</pose>
        <mass>.1</mass>
        <inertia>
            <ixx>1</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>1</iyy>
            <iyz>0</iyz>
            <izz>1</izz>
        </inertia>
    </inertial>
    <collision name= "your_collision_name">
        <pose>0 0 0 0 0 0</pose>
        <geometry>
            <mesh><uri> "path to the digit.STL file into the models/digit directory"</uri></mesh>
        </geometry>
     </collision>
     <visual name="your_visual_name">
        <geometry>
            <mesh><uri>"path to the digit.STL file into the models directory "</uri></mesh>
        </geometry>
    </visual>
    <sensor name='your_sensor_name' type='contact'>
        <contact>
            <collision> "your_collision_name" </collision>
        </contact>
        <update_rate> 30 </update_rate>
    </sensor>
</link>

The following snippet shows how to declare the RendererDigitPlugin

<plugin name="RendererDigitPlugin" filename="libRendererDigitPlugin.so">
    <ObjectName>your_object</ObjectName>
    <ObjectMeshAbsolutePath>the relative path of your object mesh</ObjectMeshAbsolutePath>
    <NumberOfSensors>N(number of sensors used)</NumberOfSensors>
    <LinkName1>base</LinkName1>
    <SensorName1>contact_digit</SensorName1>
    ...
    <LinkNameN>base</LinkNameN>
    <SensorNameN>contact_digit</SensorNameN>
    <UpdatePeriod>s</UpdatePeriod>
</plugin>

The ObjectName parameter is the name of the object the sensors are sensitive to. The ObjectMeshAbsolutePath parameter is the path of the mesh of the object. The NumberOfSensors parameter indicates the number of sensors in the model. The LinkName and SensorName parameters indicate the name of the links and sensors attached to them. The UpdatePeriod parameters indicates the sleep time of the rendering thread in seconds.

The following snippet shows how to declare the ControlDigitPlugin

<plugin name="ControlDigitPlugin" filename="libControlDigitPlugin.so">
    <Gain>10</Gain>
</plugin>

The following snippet shows how to declare the ControlPlugin

<plugin name="ControlPlugin" filename="libControlPlugin.so">
    <Gain>10</Gain>
    <Link>link_name</Link>
    <PortOutputPoseName>/name/of/the/output/port</PortOutputPoseName>
    <PortRpcName>/name/of/the/rpc/port</PortRpcName>
</plugin>

The Link parameter indicates the name of the link that is controlled. The PortOutputPoseName and PortRpcName indicates the names of the port which outputs the real time pose of the link and the name of the rpc port to send command to.

At the moment, the urdf snippet code is not available.

How to run the examples

DIGIT and ball

The code simulates the contact between the sensor and a small ball which touches the sensor periodically.

  1. Run the yarpserver

  2. Run the executable

gazebo ../world/digit_and_ball.world
  1. Open a terminals and write yarpview --name /in:i

  2. In another terminal, connect ports

yarp connect /gazebo-yarp-digit-plugin/output:o /in:i

Left hand mk3 with one sensor

  1. Run the yarpserver

  2. Run the executable

gazebo world/hand_one_sensor.world
  1. Open a terminals and write yarpview --name /medium:i

  2. In another terminal, connect ports

yarp connect /gazebo-yarp-digit-plugin-sensor_link_medium"/output:o /medium:i
  1. Launch the binary ./build/bin/grasp-example

  2. In another terminal, launch the script GraspExample/script.sh

Left hand mk3 with 3 sensors

  1. Run the yarpserver

  2. Run the executable

gazebo world/hand_three_sensors.world
  1. Open 3 terminals and write yarpview --name /thumb:i yarpview --name /index:i yarpview --name /medium:i
  2. In another terminal, connect ports
yarp connect /gazebo-yarp-digit-plugin-sensor_link_thumb/output:o /in1:i
yarp connect /gazebo-yarp-digit-plugin-sensor_link_index/output:o /in2:i
yarp connect /gazebo-yarp-digit-plugin-sensor_link_medium/output:o /in3:i

About

A tentative C++ wrapper for the Python based Digit tactile sensor simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages