top

To install sonars,

sudo apt update
sudo apt upgrade
sudo apt install ros-kinetic-pi-sonar

Then, to enable the sensors, edit the file as root using

`sudo nano etc/ubiquity/robot.yaml`  

or some other editor of your choice, so that

sonars: 'pi_sonar_v1' is uncommented and sonars: None is commented.

Like so:

# Robot Configuration
#sonars: None
sonars: 'pi_sonar_v1'

Operation

The sonar node publishes a sensor_msgs/Range message for each sonar reading. Rviz can visualize these messages as cones. There are launch files to do this in:
https://github.com/UbiquityRobotics/magni_robot (the source package, not the binary packages)

The move_basic node uses the messages published by the sonar node to determine proximity to obstacles.

   
Topic Direction
/pi_sonar/sonar_0 Far right
/pi_sonar/sonar_1 45 degrees to the left
/pi_sonar/sonar_2 45 degrees to the right
/pi_sonar/sonar_3 Front
/pi_sonar/sonar_4 Far left

back- - - - - - - - - - up