GithubHelp home page GithubHelp logo

sichitong / lightsensor_gazebo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jimfinnis/lightsensor_gazebo

0.0 2.0 0.0 17 KB

A trivial "light sensor" for Gazebo+ROS, which traverses the world calculating angles to specially marked models.

CMake 30.15% Python 7.40% C++ 62.45%

lightsensor_gazebo's Introduction

lightsensor_gazebo

A trivial "light sensor" for Gazebo under ROS, which traverses the world calculating angles to specially marked models and producing an array of pixel values from the extents of those models.

Lacking an omnidirectional camera sim, and realising any sim would be far too slow for my purposes, I realised my application just needs to head toward or away from different coloured lights.

This plugin provides that functionality. It traverses the models in the world, looking for those with names of the form "lightrgbXXX" where XXX is a hexadecimal RGB colour. The relative angle and distance of the "light" is taken into account, and a buffer of RGB pixels - a virtual omnidirectional planar camera - is built up. This is then broadcast on a ROS topic. The simulation is entirely 2D (in the XY plane) and there is no occlusion. If multiple lights overlap a sensor, they are added together (with each colour channel clamped at 255).

Output

The output is published on the light topic by default, is of type LightSensor, which is an array of Pixel, which is 3 uint8 values (r,g,b). The middle value is the front sensor, with the first half of the values covering the left side and the second half covering the right side of the robot.

watch.py

This script, which requires pygame, displays the light topic as a circle of coloured squares. It's a useful example of working with the output.

watch_node

This is a C++ program which monitors both the lightsensor and the sonars using the wheelyPioneer rendering code.

Elements

  • robotNamespace - the namespace for the broadcast topic (default none)
  • interval - the update interval in seconds (default 0.1)
  • bodyName - the name of the link to which the sensor is attached (required)
  • topic - the broadcast topic (default light)
  • pixels - the resolution of the sensor, as the number of pixels (default 10)

Example URDF

This attaches a light sensor to a robot which has a link called base_link:

  <gazebo>
    <plugin name="lightsensor" filename="liblightsensor_gazebo.so">
      <link name="base_link"/>
      <interval>0.1</interval>
      <pixels>100</pixels>
    </plugin>
  </gazebo>

lightsensor_gazebo's People

Contributors

jimfinnis avatar

Watchers

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