zhuyeyiyi / ros-hc-sr04-node

raspberry pi c++ ROS hc-sr04 sonar node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

c++ ROS node wrapper for a set of hc-sr04 ultrasonic sonars.

hc-sr04

Publishes sensor_msgs::Range messages at 10Hz to /sonarN topics. Specifically populates range.

We include a node for a set of sonars, rather than a node per sonar, since we need to ensure only one sonar is measuring at a time (sonars can easily interfere with each other)

on rasp pi 2 uses ~2% cpu and <1% mem for 3 sonars (capping at a distance of 20cm)

REQUIRES running src/export_gpio_pins.sh to export pins otherwise need to run as root. (limitation of wiringPiSetupSys)

rostopic echo /sonar_0
---
header:
  seq: 525
  stamp:
    secs: 1462946345
    nsecs: 463606605
  frame_id: ''
radiation_type: 0
field_of_view: 0.0
min_range: 0.0
max_range: 20.0
range: 7.08620691299
---

TODOS

  • make hard coded pins in hc_sr04_node.cpp configurable
  • need some analysis on field_of_view

About

raspberry pi c++ ROS hc-sr04 sonar node

License:MIT License


Languages

Language:CMake 59.4%Language:C++ 28.3%Language:Shell 6.6%Language:Python 5.7%