philip-huang / single_beam_sonar

ROS Driver of The Ping Sonar Altimeter and Echosounder from BlueRobotics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ROS Driver of The Single Beam Sonar from BlueRobotics

We need access permission of the ttyUSB port to communicate with the sensor. To check whether we have the access, run the following command

groups | grep tty

If we can see tty in red, we can proceed to the next step. Otherwise, add the current user to the tty group.

sudo usermod -a -G tty $USER

Log out and log back in to verify whether we are in the tty group now.

bluerobotics-ping requires Python3. We create the ROS Noetic virtual environment in Conda so that this package can be used on Ubuntu 16.04/18.04 as well.

  1. Install Miniconda: https://docs.conda.io/en/latest/miniconda.html
  2. Follow https://github.com/RoboStack/ros-noetic to create a ROS Noetic virtual environment called ros
  3. Create a catkin workspace if necessary
mkdir -p ~/sonar_ws/src
  1. Clone this repo
cd ~/sonar_ws/src
git clone https://github.com/Weizhe-Chen/single_beam_sonar.git
  1. Install ping-python to read the sonar data
conda activate ros
pip install bluerobotics-ping
  1. Build the package
cd ~/sonar_ws/
catkin build
. devel/setup.bash
  1. Launch the driver
roslaunch single_beam_sonar driver.launch
  1. Check the published data
rqt_console

  1. Alternatively, we can run the node directly rather than doing step 5 and 6
# In another terminal
roscore
# In the terminal with conda virtualenv and ~/sonar_ws/devel/setup.sh sourced
rosrun single_beam_sonar driver.py

  1. Check rostopic

    rostopic info /sonar
    rostopic echo /sonar

  2. (Optional) I've added the following lines in the ~/.bashrc file of the on-board computer to activate the Noetic virtual environment and catkin workspace whenever we open a terminal

    # vim ~/.bashrc
    conda activate ros
    source ~/sonar_ws/devel/setup.bash

About

ROS Driver of The Ping Sonar Altimeter and Echosounder from BlueRobotics

License:MIT License


Languages

Language:Python 75.5%Language:CMake 24.5%