Coder Social home page Coder Social logo

matteoperotto / gazebo-yarp-digit-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hsp-iit/gazebo-yarp-digit-plugin

0.0 0.0 0.0 11.13 MB

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

Shell 0.49% C++ 84.39% Python 3.21% Thrift 2.56% CMake 9.35%

gazebo-yarp-digit-plugin's Introduction

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

gazebo-yarp-digit-plugin's People

Contributors

gabrielecaddeo avatar xenvre avatar matteoperotto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.