Dynamically configure ultrasonic range sensors on an Arduino running the sensor_hub firmware
The sensor_hub firmware implements ROS Service Calls that configure the various sensors and other parameters for the publication of data.
The sensor_hub_node acts as a driver, initializing and configuring the sensors by calling the services exposed by the counterpart firmware.
- Open the
sensor_hub.ino
sketch in the Arduino IDE - Install the required dependencies:
- Rosserial
- Ultrasonic <- Modified!
- Select the platform and amend the
SENSOR_MAX
variable - Upload the firmware
- Change directory your catkin workspace
cd ~/catkin_ws/src
- Clone the sensor_hub repository into your catkin workspace
git clone https://github.com/eliotlim/sensor_hub
- Build the package from source by performing
catkin_make
- rosserial_client
- rosserial_python
Add a <sensorName>/device
key to each sensor_hub
sensor, and specify the
- type:
- SRF05 # For SRF05/HY-SRF05/Ping)))
- SRF10 # For SRF08/10
- connection point:
- pin: 14 # For SRF05 use a pin number
- addr: 0xE0 # For SRF08/10 use an 8-bit I2C address (as per datasheet)
- timeout:
- timeout: 60000 # Wait 60 ms for ping return
sensor0:
topic: ultrasound/range
device:
type: SRF05
pin: 14
timeout: 60000
transform:
frame: sensor0
...
sensor1:
topic: sensor_hub/range
device:
type: SRF10
addr: 0xE2
timeout: 60000
transform:
frame: sensor1
See the sensorConfig.yaml guide for more details
- Run the
sensor_hub/sensor_hub.launch
file after loading the sensorConfig.yaml into node namespace using rosparam or sensor_pointcloud
roslaunch sensor_hub sensor_hub.launch device:=/dev/ttyACM0
- Connect the device and run:
rosrun rosserial_python serial_node.py <device>
For Example:
rosrun rosserial_python serial_node.py /dev/ttyACM0
- Run the sensor_hub_node
rosrun sensor_hub sensor_hub_node
to load the sensor configuration onto the Arduino
When sensor_hub is not connected by rosserial, the service call cannot be resolved and will fail. By default, sensor_hub_node will block and wait for the SetupSensorHub
service to become available. Check the power, data cable, serial port, and any collision with other sensor_hub_node / Arduino IDE instances.
If the sensor_hub has run out of slots (exceeding SENSOR_MAX
), any sensor attachment service call will fail.
The sensor_hub_node will monitor initialized sensors and highlight signs of sensor errors:
- Measured value exceeds defined range
- Timeout resulting in no reading
This library is licensed under the MIT License.