Tuesday, August 28, 2018

Neato Lidar XV11 + ROS


Introduction:

Hello once again, we are quite a bit focus on finishing  tutorials about  lidars. These  kinds of sensors are  important because SLAM in R.O.S rely much about the use of it. As much as possible we are trying to choose, reverse engineer , economize the build of  our rotating laser sensors. Our  purpose is to craft and replicate  lidars into a more affordable and efficient distant ranging sensors. Otherwise, though robotic is interesting, not everybody will be doing industrial robots  because of cost and that is not practical for a mass patronage.

For a few days we had already tackle introduction and hands on tutorial as motivational guide for a hobbyists to start using R.O.S. After familiarizing the usefulness , we will proceed to interfacing encoders and motors to relate the actuation ,speed,revolution of motors when running,this time all are test and first. Next step is to put wheels on the chassis and see for our selves how our code able to simulate movement of the robots from the visualized GUI to what we are able to observe it in a real world action.

One of the cheapest and known lidar was the Neato XV11 lidar, this was because a vacuum cleaner robot was deployed world wide so old machine produce stocks of 2nd hand lidars. We choose this surplus or second hand lidar because of course it is cheaper and its hacks had complete documentations on the internet , so not a bad choice for us Filipino.

I have just bought Neato XV11 lidar recently and saw a lot of tutorials on the internet and am glad about it. One I have observed was that it needs to power source 5V and 3.3V other hobbyist tried to isolate the source so they needed two modules (DC-DC step down and USB-to Serial), but its obvious that USB-t Serial module has 5V/3.3V so it is perfect for the Lidar power requirements.The rest are instruction to be discussed below. Hope we can get more units as stocks online :)


Requirements:
Neato XVII Lidar
ROS Kinetic
Ubuntu 16.04
USB to Serial module with 5V and 3.3V

Objectives:




Methodology:


Image result for Neato Lidar






















































































































Summary:
Trouble:
Shooting:


Conclusions:

It is ideal cost effective LIDAR for hobbyist.

Sunday, August 26, 2018

LaserScan ROS + Arduino



Introductions:
Yes, a happy weekend plus a holiday on Monday, so with  choco and cookies placed on the table ah what  a little  time to spare   ticking keyboards here. Anyway, we will be continuing our R.O.S tutorials , and its all about understanding how LIDARs works in R.O.S. We knew that the scattered lines served as the perception of a robot using this kind of sensors. These lines forming figures creates a dimensions of area used to be navigated by robots.The rays of line were formed as a collection of distances measured or sensed by LIDAR/LEDDAR).Thus infra red lights emitted by transmitter are then feedback to the receiver usually the photo diode. An array of these measured distances  will be included  in the parameters' value of   scanning angle,time,and the number of points how wide is the coverage of scanning.All these parameters are wrapped in the "Sensor Messages/LaserScan" in a R.O.S string packet format.

This time, the deal is using rosserial library, "ros_lib  and ROS Sensors Messages:: LaserScan. The Arduino DUE will  process the  publishing of  "LaserScan" messages and its topic. Using "ros_lib" an Arduino Due  communicate  with the host R.O.S installed in the computer (Laptop/Desktop) both of which are  connected physically via serial serial interface . In the  near future  of these tutorials, using Arduino/microcomputer will not be ideal anymore in  integrating multiple  sensors to R.O.S. This is because processing and computing will be at risk and not a practical design of  R.O.S application. In short, the use of microcontroller is only to interface sensor modules yet most  of single board computers  have IO ports to their advantage.

Thus , what we will be doing  is to get a common measuring modules such as  SAMSUNG infrared or Ultrasonic SRF04 considered as poor man's LIDAR. SG90 servo motor will carry and rotate the sensor with the speed relative to the frequency of its data acquisition. The angle of rotation is as wide as  180 degrees angle, a back and forth or  a clock and  counter clockwise directions. It is possible to rotate 360 degrees wide  but it requires a slip ring and that is an additional cost. The  interval of time,angle, and number frequency of measuring   distances can be set or adjusted depending the type of sensor or  modules being used. To accurately dump data in  R.O.S Laser scan messages , is to configure its   parameter settings, for example a 180  degrees maximum angle if   divided  by desired 90 points then the angular interval of scanning is 2 degrees.

The simple steps to code ROS Laser Scanning,first  is to initialize  Sensor messages,its laser scan function ,and  to  check topic that publish messages. The finale, use the  R.O.S visualization "rviz" to simulate the functionality of  DIY LIDAR. Okay? So let's get this done :) 

Requirements:
Software: Ubunto 16.04, ROS (kinetic)
Hardware: Arduino DUE, SBC or Laptop,SG90 Servo
                Optional : sensors (ultrasonic or infra red)

Objectives:
1)  To be able to publish a ranging(distance measurement sensor) messages from a DIY LIDAR to ROS .
2) To be able to study algorithm or program to  collect array of measurements and  feed(publish)  it into a R.O.S messages format.
3) To create a program using  rosserial library "ros_lib"  from Arduino to ROS

Methodology:
Testing Arduino Due sample code to fake laser array of data(ranges)












Arduino Due code for Laser scan






















Please copy and paste the program

A simple setup of our DIY Lidar (photo credit to the photographer)












Open four CLI terminals:
 Run the ros core "roscore"
robook# roscore













Communicate between ROS and Arduino  using rosserial
library
robook # rosrun rosserial_python serial_node.py /dev/ttyUSB0
robook# rosrun rosserial_arduino serial_node.py _port:=/dev/ttyUSB0













Make sure that the "/laserScan" topic is being echoed or broadcasted to ROS.
robook# rostopic list
robook# rostopic echo /LaserScan
If  Arduino DUE is able to bombard those collected ranges in ROS , scrolling
stream of string may appear in the screen











Set the transformation of the frame required to accurately map the laser data
robook# rosrun tf tf_publisher_transform 0.0 0.0 0.0 0.0 0.0 0.0  /base_frame /Lidar_frame











Displaying or visualizing  the laser data, we can use RVIZ to plot
it in its grid map.
robook# rosrun rviz rviz 











By setting the ROS Visualizer "rivz": fixed frame "Lidar_frame" and LaserScan
"LaserScan". The display would eventually appear same as the screen below.












Making sure that RVIZ is properly configured , LaserScan
topic is receiving messages coming from Arduino Due,also
transformation is set properly.












Summary:
Trouble:    Arduino is not syncing to rosserial
Shooting:  Place "#define USE_USBCON" before the include "ros.h"
Trouble: No display of laser data in RVIZ
Shooting : Check if there is a laser scan topic
                 Use  #rostopic echo /LaserScan -> if this is the topic

Conclusion:
A simple code of a possible integrations of different ranging sensor to ROS