Difference between revisions of "2019WinterTeam2"

From MAE/ECE 148 - Introduction to Autonomous Vehicles
Jump to: navigation, search
(ROS Project)
(ROS Project)
 
(25 intermediate revisions by the same user not shown)
Line 16: Line 16:
 
==RC Car details==
 
==RC Car details==
 
*RC Car hardware:
 
*RC Car hardware:
*RC Car software:
+
::The RC car is designed with a few simple modules. The total cost of the RC car is about $336.97.Here is a detailed list of parts used in the RC car:
 
 
==ROS Project==
 
*ROS [[http://wiki.ros.org/ROS/Tutorials ROS Wiki]]
 
**The ROS Wiki explains ROS in great details. Here is a sum of the content learned from this webpage for the project.
 
  
 
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"
 
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"
|+ Basic Commands in ROS
+
|+ RC Car BOM(Bill of Material)
! scope="col" style="width: 280px;" | ROS Command
+
! scope="col" style="width: 60px;" | Part Name
! scope="col" style="width: 500px;" | Description
+
! scope="col" style="width: 60px;" | Part Number
 +
! scope="col" style="width: 60px;" | Datasheet
 +
! scope="col" style="width: 60px;" | Manufacturer
 +
! scope="col" style="width: 25px;" | Qty
 +
! scope="col" style="width: 80px;" | Unit Price
 +
! scope="col" style="width: 60px;" | Purchase Link
 +
! scope="col" style="width: 500px;" | Purpose in RC Car
 +
|-
 +
| ESC||SBEC ESC 60a||[http://www.hobbywing.com/goods.php?id=358 Datasheet]||QuicRun||1||$19.99||[https://www.ebay.com/p/Hobbywing-30120201-QuicRun-1060-Waterproof-Brushed-SBEC-ESC-60a/1678055620?iid=272429528837&chn=ps Purchase Link]||Controls the DC motor using PWM controlled by Raspberry Pi
 
|-
 
|-
| rospack find <package name>||  
+
| PWM Controller||PCA9685||[https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf Datasheet]||Adafruit||1||$14.95||[https://www.adafruit.com/product/815?gclid=EAIaIQobChMIwPy46dWe4AIVlshkCh3tiQkxEAQYASABEgI6lPD_BwE Purchase Link]||Raspberry Pi doens't have many PWM GPIOs, therefore we use this module to control multiple PWM devices. Connects to RP via I2C protocol
 
|-
 
|-
| roscd <package name>||  
+
| USB Module||HW384||[https://www.amazon.com/HW384-Step-Down-Module-Portable-Supply/dp/B07KKF51TV Datasheet]||SheoIseven||1||$6.99||[https://www.amazon.com/HW384-Step-Down-Module-Portable-Supply/dp/B07KKF51TV Purchase Link]|| Connects the LiPo battery to RPi. Includes a 5V regulator
 
|-
 
|-
| rosls <package name>||  
+
| Motor||RS540||[http://www.alphalanding.com/rc-track/rs_540rhsh.pdf Datasheet]||Tamiya||1||$17.30||[https://www.amazon.com/Tamiya-RS540-Sport-Tuned-Motor/dp/B00061HB0K Purchase Link]||DC motor for the rear wheels
 
|-
 
|-
| roscore ||  
+
| Blue/Red LED||APM External||[https://hobbyking.com/en_us/kingduino-apm-external-led-module.html Datasheet]||Kingduino||1||$4.04||[https://hobbyking.com/en_us/kingduino-apm-external-led-module.html Purchase Link]||Indicates state of the relay
 
|-
 
|-
| rosnode list ||  
+
| Main Switch||T/XT60/EC3 Plug||[https://usa.banggood.com/High-Current-LiPo-Battery-Switch-With-Optional-T-PlugXT60EC3-Plug-p-1056050.html?gmcCountry=US&currency=USD&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=zouzou&utm_campaign=pla-usg-all-pc&ID=521833&cur_warehouse=CN Datasheet]|| Banggood||1||$5.60||[https://usa.banggood.com/High-Current-LiPo-Battery-Switch-With-Optional-T-PlugXT60EC3-Plug-p-1056050.html?gmcCountry=US&currency=USD&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=zouzou&utm_campaign=pla-usg-all-pc&ID=521833&cur_warehouse=CN Purchase Link]||Turns on the ESC and relay
 
|-
 
|-
| rosnode info ||  
+
| Chasis||TT01 TT01E||[https://www.amazon.com/Aluminium-Carbon-Shaft-Drive-Touring/dp/B07496B5HQ/ref=sr_1_13?ie=UTF8&qid=1546999189&sr=8-13&keywords=tamiya+tt01 Datasheet]||Radcat||1||$128.49||[https://www.amazon.com/Aluminium-Carbon-Shaft-Drive-Touring/dp/B07496B5HQ/ref=sr_1_13?ie=UTF8&qid=1546999189&sr=8-13&keywords=tamiya+tt01 Purchase Link]||Car skeleton
 
|-
 
|-
| rosrun <name of package> <name of node> ||  
+
| RGB LED||N/A||[https://www.makerlab-electronics.com/product/rgb-led-module/ Datasheet]||MakerLab||1||$34.75||[https://www.makerlab-electronics.com/product/rgb-led-module/ Purchase Link]||Indicates drive mode
 
|-
 
|-
| rosnode ping <name of the node> ||  
+
| Relay||KR1201A-4||[https://www.aliexpress.com/item/433Mhz-Universal-Wireless-Remote-Control-Switch-DC12V-10A-1CH-relay-Receiver-Module-with-RF-Remote-433/32654946482.html Datasheet]||QIACHIP||1||$7.69||[https://www.aliexpress.com/item/433Mhz-Universal-Wireless-Remote-Control-Switch-DC12V-10A-1CH-relay-Receiver-Module-with-RF-Remote-433/32654946482.html Purchase Link]||Enables ESC. In the system for safty. Controlled by a remote controller
 
|-
 
|-
| rostopic list ||  
+
|Raspberry Pi||Model 3 b+||[https://www.terraelectronica.ru/pdf/show?pdf_file=%252Fds%252Fpdf%252FT%252FTechicRP3.pdf Datasheet]||Raspberry Pi||1||$38.30||[https://www.amazon.com/ELEMENT-Element14-Raspberry-Pi-Motherboard/dp/B07BDR5PDW/ref=sr_1_3?s=pc&ie=UTF8&qid=1549172590&sr=1-3&keywords=raspberry+pi+3+b%2B Purchase Link]||Computer controlling all components
 
|-
 
|-
| rostopic pub ||
+
| RP Camera||913-2664||[https://cdn.sparkfun.com/datasheets/Dev/RaspberryPi/RPiCamMod2.pdf Datasheet]||Raspberry Pi||1||$23.90||[https://www.amazon.com/Raspberry-Pi-Camera-Module-Megapixel/dp/B01ER2SKFS Purchase Link]||Camera compatible with RPi
 
|-
 
|-
| rosservice list ||  
+
| "11.1 V 3 cell LiPo"||XT-60||[https://hobbyking.com/en_us/turnigy-battery-3000mah-3s-20c-lipo-pack-xt-60.html Datasheet]||Turnigy||1||$16.37||[https://hobbyking.com/en_us/turnigy-battery-3000mah-3s-20c-lipo-pack-xt-60.html Purchase Link]||Battery powering the system
 
|-
 
|-
| rosservice call ||  
+
| Voltage Reader||EC||NA||BX100||1||$13.39||[https://www.amazon.com/Ec-voltage-Meter-Battery-Voltage/dp/B073ZKFMGQ Purchase Link]|| Reads LiPo voltages for each cell.
 
|-
 
|-
 +
| Servo Motor||MG995||[https://usa.banggood.com/MG995-High-Torgue-Mental-Gear-Analog-Servo-p-73885.html?gmcCountry=US&currency=USD&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=zouzou&utm_campaign=pla-usg-all-pc&cur_warehouse=CN Datasheet]||N/A||1||$5.21||[https://usa.banggood.com/MG995-High-Torgue-Mental-Gear-Analog-Servo-p-73885.html?gmcCountry=US&currency=USD&createTmp=1&utm_source=googleshopping&utm_medium=cpc_bgcs&utm_content=zouzou&utm_campaign=pla-usg-all-pc&cur_warehouse=CN Purchase Link]||Used to control steering
 
|}
 
|}
  
 +
*RC Car ELectrical Connections
 +
 +
*Base plate and Camera mount
 +
:: In order to hold the components on chassis a build plate was designed in Inkscape and laser cut: <br>
 +
::In addition to the base plate a camera mount was designed and 3D printed. Based on multiple trials, it was determined a taller camera mount would yield better results since it would capture a wider range of the track. The captured pictures can be cropped for before training in the config.py file in the d2t donkey car.
 +
 +
<gallery class="center" heights="350px">
 +
File:Camera mount team2.PNG|Camera Mount
 +
File:Buildplate.png | Baseplate
 +
</gallery>
 +
 +
*RC Car Software
 +
The software used in the project is open source.
 +
 +
==ROS Project==
 
*RPLidar
 
*RPLidar
**'''''What is an RPLidar?''''' Lidar is a device that measures the distance to a target by sending pulsed laser beams and receiving the reflected beams with a sensor. The accuracy of lidar is higher than other sensors of similar nature, such as an IR sensor or an ultrasonic sensor. An RPLidar is a 360-degree 2D lidar. The RPLidar used in our project is the A1M8 12M range model. A1M8 is based on laser triangulation ranging principle and uses high-speed version acquisition and processing hardware. This system measures distance data more than 8000 times per second.
+
::'''''What is an RPLiDAR?''''' Lidar is a device that measures the distance to a target by sending pulsed laser beams and receiving the reflected beams with a sensor. The accuracy of lidar is higher than other sensors of similar nature, such as an IR sensor or an ultrasonic sensor. An RPLidar is a 360-degree 2D lidar. Here is a scheamtic of a RPLiDAR in action:<br>
 +
[[File:Rplidar_sch.png|center]]
 +
::'''''What are the different types of RPLiDAR?'''''
 +
::*RPLiDAR A1: The RPLidar used in our project is the A1M8 12M range model. A1M8 is based on laser triangulation ranging principle and uses high-speed version acquisition and processing hardware. This system measures distance data more than 8000 times per second.This LiDAR is supported by ROS Melodic.
 +
::*RPLiDAR A2: The next generation of low cost RPLiDARs. Has higher sampling rates.It is compatible with ROS Melodic.
 +
::*RPLiDAR A3: Latest genertation of low cost RPLiDARs. It is compatible with ROS Melodic.
 +
 
 +
*RPLiDAR and Raspberry Pi
 +
 
 +
 
 +
 
 +
 
  
 
*ROS and RPLidar
 
*ROS and RPLidar
 +
::Upon every connection to a USB port, sudo permission to access the serial port for the lidar must be granted. In the Linux operating system, the command to list the responsible port and granting permission would be the following:
 +
:::<code>ls -l /dev |grep ttyUSB0</code><span style="color:blue">#lists the port connected to the LiDAR</span>
 +
:::<code>sudo chmod 666 /dev/ttyUSB0</code><span style="color:blue">#grants permission to write to USB0</span>
 +
 +
::To test the RPLiDAR within ROS, we can run the rplidar node and view the realtime readings and mappings:
 +
:::<code>roslaunch rplidar_ros view_rplidar.launch</code><span style="color:blue">#running the RPLiDAR live feed
 +
[[File:RPLidar_room.png|thumb|center|alt=Alt|upright=2|An example of an RPLiDAR scanning the room]]
 +
:::<code>rosrun rplidar_ros rplidarNodeClient</code><span style="color:blue">#read values from LiDAR</span>
 +
The lidar scan values can be read by subscribing to rplidar_node topic:<br>
 +
[[File:rplidar_live_read.png|thumb|center|alt=Alt|upright=2.5| A live read of the RPLiDAR Scans and relevent topics]]
 +
Viewing graphs of ongoing scans on the roscore primary node can be viewed using a ros rqt graph generator:<br>
 +
[[File:rqt_graph.png|thumb|center|alt=Alt|upright=1| A rqt graph of RPLiDAR subscriber and publisher to the scan topic]]
 +
 +
==Helpful resources==

Latest revision as of 21:03, 25 March 2019

Team 2 attempted to achieve object avoidance by incoorporating a 360° RPLIdar along with the camera, and controlling their operation using ROS (Robot Operating System).

2019team2car.jpeg

Introduction

Welcome to team2 ECE148 Wiki page. In this class, we build and utilized a remote-controlled car. In this page, we will cover the details behind the design of the RC car and demonstrate results. The goal in this class was to perform the following tasks:

  • Autonomously drive on an indoor track
  • Autonomously drive on an outdoor track
  • Obstacle avoidance using RPLidar and ROS

Team Members

  • Chen Du (ECE grad)
  • Jingying Chen (MAE undergrad)
  • Marshall Garcia (MAE undergrad)
  • Tina Kafel (ECE undergrad)

RC Car details

  • RC Car hardware:
The RC car is designed with a few simple modules. The total cost of the RC car is about $336.97.Here is a detailed list of parts used in the RC car:
RC Car BOM(Bill of Material)
Part Name Part Number Datasheet Manufacturer Qty Unit Price Purchase Link Purpose in RC Car
ESC SBEC ESC 60a Datasheet QuicRun 1 $19.99 Purchase Link Controls the DC motor using PWM controlled by Raspberry Pi
PWM Controller PCA9685 Datasheet Adafruit 1 $14.95 Purchase Link Raspberry Pi doens't have many PWM GPIOs, therefore we use this module to control multiple PWM devices. Connects to RP via I2C protocol
USB Module HW384 Datasheet SheoIseven 1 $6.99 Purchase Link Connects the LiPo battery to RPi. Includes a 5V regulator
Motor RS540 Datasheet Tamiya 1 $17.30 Purchase Link DC motor for the rear wheels
Blue/Red LED APM External Datasheet Kingduino 1 $4.04 Purchase Link Indicates state of the relay
Main Switch T/XT60/EC3 Plug Datasheet Banggood 1 $5.60 Purchase Link Turns on the ESC and relay
Chasis TT01 TT01E Datasheet Radcat 1 $128.49 Purchase Link Car skeleton
RGB LED N/A Datasheet MakerLab 1 $34.75 Purchase Link Indicates drive mode
Relay KR1201A-4 Datasheet QIACHIP 1 $7.69 Purchase Link Enables ESC. In the system for safty. Controlled by a remote controller
Raspberry Pi Model 3 b+ Datasheet Raspberry Pi 1 $38.30 Purchase Link Computer controlling all components
RP Camera 913-2664 Datasheet Raspberry Pi 1 $23.90 Purchase Link Camera compatible with RPi
"11.1 V 3 cell LiPo" XT-60 Datasheet Turnigy 1 $16.37 Purchase Link Battery powering the system
Voltage Reader EC NA BX100 1 $13.39 Purchase Link Reads LiPo voltages for each cell.
Servo Motor MG995 Datasheet N/A 1 $5.21 Purchase Link Used to control steering
  • RC Car ELectrical Connections
  • Base plate and Camera mount
In order to hold the components on chassis a build plate was designed in Inkscape and laser cut:
In addition to the base plate a camera mount was designed and 3D printed. Based on multiple trials, it was determined a taller camera mount would yield better results since it would capture a wider range of the track. The captured pictures can be cropped for before training in the config.py file in the d2t donkey car.
  • RC Car Software

The software used in the project is open source.

ROS Project

  • RPLidar
What is an RPLiDAR? Lidar is a device that measures the distance to a target by sending pulsed laser beams and receiving the reflected beams with a sensor. The accuracy of lidar is higher than other sensors of similar nature, such as an IR sensor or an ultrasonic sensor. An RPLidar is a 360-degree 2D lidar. Here is a scheamtic of a RPLiDAR in action:
Error creating thumbnail: Unable to save thumbnail to destination
What are the different types of RPLiDAR?
  • RPLiDAR A1: The RPLidar used in our project is the A1M8 12M range model. A1M8 is based on laser triangulation ranging principle and uses high-speed version acquisition and processing hardware. This system measures distance data more than 8000 times per second.This LiDAR is supported by ROS Melodic.
  • RPLiDAR A2: The next generation of low cost RPLiDARs. Has higher sampling rates.It is compatible with ROS Melodic.
  • RPLiDAR A3: Latest genertation of low cost RPLiDARs. It is compatible with ROS Melodic.
  • RPLiDAR and Raspberry Pi



  • ROS and RPLidar
Upon every connection to a USB port, sudo permission to access the serial port for the lidar must be granted. In the Linux operating system, the command to list the responsible port and granting permission would be the following:
ls -l /dev |grep ttyUSB0#lists the port connected to the LiDAR
sudo chmod 666 /dev/ttyUSB0#grants permission to write to USB0
To test the RPLiDAR within ROS, we can run the rplidar node and view the realtime readings and mappings:
roslaunch rplidar_ros view_rplidar.launch#running the RPLiDAR live feed
Alt
An example of an RPLiDAR scanning the room
rosrun rplidar_ros rplidarNodeClient#read values from LiDAR

The lidar scan values can be read by subscribing to rplidar_node topic:

Alt
A live read of the RPLiDAR Scans and relevent topics

Viewing graphs of ongoing scans on the roscore primary node can be viewed using a ros rqt graph generator:

Alt
A rqt graph of RPLiDAR subscriber and publisher to the scan topic

==Helpful resources==