Skip to content

Computer vision

anti002 edited this page Oct 9, 2019 · 11 revisions

Wiki page for computer vision development. Document here continuously during the duration of the course

Unexpected changes and errors

  • Too much noise picked up by the LIDAR.
  • Not enough memory on the Raspberry Pi.
  • Not calculating vectors fast enough.
  • Package loss.

ROS on raspberryPI

Install ROS

Begin with installing ROS on your platform, raspberryPI in this case. The melodic version will be used in this project.

Setup your computer to accept software from packages.ros.org. $ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Setup key and keyserver.

$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

First, make sure your Debian package index is up-to-date:

$ sudo apt update

Install the desktop version of ROS since we don't need the additional packages this version will suffice.

$ sudo apt install ros-melodic-desktop

To find available packages, use:

$ apt search ros-melodic

Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.

$ sudo rosdep init

$ rosdep update

It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

$ source ~/.bashrc

To install the 'rosinstall' tool and other dependencies for building ROS packages, run:

$ sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

Setup ROS workspace

Now that we've installed ROS we need to setup our workspace. This is important because the packages need to be saved in specific locations for us to be able to use them properly.

Firstly we can check our environment variables to verify the installation was successful.

$ printenv | grep ROS

If you just installed ROS from apt on Ubuntu then you will have setup.*sh files in '/opt/ros//', and you could source them like so:

$ source /opt/ros/melodic/setup.bash

Lets create the catkin workspace.

$ mkdir -p ~/catkin_ws/src

$ cd ~/catkin_ws/

$ catkin_make

source your new setup.*sh file:

$ source devel/setup.bash

Install drivers for LIDAR and visualizing the output

install drivers for ros melodic

$ sudo apt-get install ros-melodic-hls-lfcd-lds-driver

Set permission for LDS-01

$ sudo chmod a+rw /dev/ttyUSB0

Download the driver for LDS-01 from github

$ git clone https://github.com/ROBOTIS-GIT/hls_lfcd_lds_driver.git

Build and make

$ cd hls_lfcd_lds_driver/applications/lds_driver/

$ make

Run script to generate raw data from LIDAR

$ ./lds_driver

For local visualization of the continuous raw data

$ export ROS_MASTER_URI=http://127.0.0.1:11311

$ export ROS_HOSTNAME=localhost

Launching the visualization software

$ roslaunch hls_lfcd_lds_driver view_hlds_laser.launch

Cartographer on RaspberryPI

Install packages

Too install Cartographer on raspberry pi, run:

$ sudo apt-get install ros-melodic-cartographer

Then for installing rviz for visualization, run:

$ sudo apt-get install ros-melodic-cartographer-rviz

Then for installing additional useful packages, run:

$ sudo apt-get install ros-melodic-cartographer-ros

$ sudo apt-get install ros-melodic-cartographer-ros-msgs

Build and Install Cartographer ROS

Using Ninja for faster builds:

$ sudo apt-get install -y python-wstool python-rosdep ninja-build

If there is no catkin workspace on the device:

$ wstool init src

$ cd catkin_ws

Then simply do:

$ wstool init src

$ wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall

$ wstool update -t src

Install Cartographer dependencies, if it is already installed an error will occur. This can be ignored.

$ src/cartographer/scripts/install_proto3.sh

$ sudo rosdep init

$ rosdep update

$ rosdep install --from-paths src --ignore-src --rosdistro=melodic -y -r

Build and install:

$ catkin_make_isolated --install --use-ninja

Build and Install Cartographer ROS for Turtlebot

Be in your catkin workspace while executing these commands:

$ wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_turtlebot/master/cartographer_turtlebot.rosinstall

$ wstool update -t src

$ sudo rosdep init

$ rosdep update

$ rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y -r

$ catkin_make_isolated --install --use-ninja

$ source install_isolated/setup.bash

Clone this wiki locally