DEPRECATED, checkout RoboCar_Platform and RoboCar_SDK
The main aim of this repo is to set up a low-cost remote-controlled robotic car and later on a completely autonomous driving car with a Raspberry Pi 3b+
To build this platform, two essential part have to be considered. On the one hand the used hardware components and on the other hand the wiring of the individual components
Here are listed all hardware components that were used to build this RoboCar
-
Chassis:
- 4WD RC Smart Auto Chassis: Auto Chassis
-
Motor equipment:
- Servomotor MG996R (already included in the auto chassis): Servomotor
- Gearmotor (already included in the auto chassis): Gearmotor
- Motordriver Pololu DRV8838: Motor Driver
-
Raspberry Pi 3b+: Raspberry Pi 3b+
-
Power Supply:
- Kraftmax RC accumulator : Accumulator
- Step Down Poti: Step Down XD-45
-
Sensors:
- PiCamera: PiCamera
- Ultrasonic ranging module HC-SR04 + SG90 Servomotor: Ultrasonic + Servo
- PCA9685 PWM/Servo Driver: PCA9685
- MPU6050: MPU6050
- Laser Scanner Hokuyo URG-04LX-UG01: Hokuyo URG
Alternative: - Laser Scanner RPLidar A1: RPLidar A1
- Laser Scanner RPLidar A2: RPLIdar A2
Without a Lidar sensor the cost is about ~140€ . With a Lidar the cost is about ~230€ - ???.
Datasheets for every component can be found under /hardware
The Circuit Diagram is shown below to connect the individual components.
A pdf file is under /circuit_diagram
This Software is written in C++, build with CMake and is divided in
Remote-controlled
and Autonomous driving
with different submodules:
As first step build the hokuyo_node with subsequent commands:
sudo apt-get install ros-kinetic-driver-common
Go into catkin workspace ~/catkin_ws/src
and clone hokuyo_node:
git clone https://github.com/ros-drivers/hokuyo_node.git
go back to ~/catkin_ws
and build:
catkin_make
Install hector_mapping and hector_trajectory_server:
sudo apt-get install ros-kinetic-hector-mapping ros-kinetic-hector-trajectory-server
Launch file for hector_mapping and hector_trajectory_server
launch file to start the hokuyo_node
, the hector_mapping
and the hector_trajectory_server
packages with the correct parameters can be found here
Writing drivers to convert raw sensor data to ROS compliant message data:
Data topics:
- /visual/odom -> data from an odometry sensor/source (camera odometry)
- /imu/data -> data from an inertial measurement unit (imu) sensor (mpu6050)
- /scan -> data from a Laser scanner (hokuyo)
- /camera/data -> data from a plugged in camera (picamera)
In order to obtain the most accurate position, the data sources visual odometry, lidar odometry and imu will be merged with an extended kalman filter
As operating system Ubuntu Mate was selected. Due to the reason
that currently no official raspberry pi 3b+ image is provided (25.10.2018), litte hacks are necessary to get
it running.
Problem: The Rasperry Pi 3b+ shows only a rainbow screen and will not boot
-
Download Ubuntu Mate image for Raspberry Pi 2/3 here
-
Flash Ubuntu Mate image on sd card
-
Insert sd card into a Raspberry Pi 2 or Raspberry Pi 3
-
Boot Raspberry Pi 2/3 and insert subsequent command for a kernel update
sudo CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt rpi-update
alternative:
sudo BRANCH=stable rpi-update
-
Insert sd card into Raspberry Pi 3b+, now the raspi should start booting
-
No wifi is available!
- Install a new raspbian image on sd card
- boot a raspberry pi with this sd card
- copy folder
/lib/firmware/brcm
on a usb
sudo cp -r /lib/firmware/brcm /path_to_usb
- boot Raspberry Pi 3b+ with Ubuntu Mate
- replace current
/lib/firmware/brcm
with the folder on usb stick
sudo cp -r /path_to_usb/lib/firmware/brcm /lib/firmware/brcm
-
Reboot and wifi should be available
-
Enable ssh on boot. Insert in terminal:
sudo systemctl enable ssh
Instructions to install ROS on Ubuntu Mate
- Setup sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- Setup keys
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- Update packages
sudo apt-get update
- Install ros-kinetic-desktop-full
sudo apt-get install ros-kinetic-desktop-full
- Initialize rosdep
sudo rosdep init
rosdep update
- Setting up the ROS environment variables
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
- Create a catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
source ~/catkin_ws/devel/setup.bash
- If you want access to source builded ros packages everywhere in your linux system
echo “source ~/catkin_ws/devel/setup.bash” >> ~/.bashrc
- Start roscore master
roscore
The hokuyo laser scanner needs write permission to the /dev/ttyACM0
port to get scans.
For this add your current "user_name" to the dialout
group.
sudo adduser "user_name" dialout
sudo reboot
- Create a file named
roscore.service
in/etc/systemd/system
and insert:
[Unit]
Description=start roscore master as a systemd service
[Service]
Type=simple
ExecStart=/bin/bash -c "source /opt/ros/kinetic/setup.bash; /usr/bin/python /opt/ros/kinetic/bin/roscore"
[Install]
WantedBy=multi-user.target
- Enable this service on boot
sudo systemctl enable roscore.service
- Now the roscore master should be available on boot. Check status with:
sudo systemctl status roscore.service
- Create a file named
hector.service
in/etc/systemd/system
and insert:
[Unit]
Description=start hokuyo_node and hector_mapping as a systemd service
Requires=roscore.service
After=roscore.service
After=network.target
[Service]
Type=simple
ExecStart=/bin/bash -c "source /opt/ros/kinetic/setup.bash; source /path_to_catkin_ws/devel/setup.bash; /opt/ros/kinetic/bin/roslaunch /path_to_launch_file/robo_car/software/remote_controlled/roboslam/hokuyo_hector_slam.launch"
Restart=on-failure
[Install]
WantedBy=multi-user.target
Please change the /path_to_catkin_ws
and the /path_to_launch_file
to your needs
- Enable this service on boot
sudo systemctl enable hector.service
- Now the this service should be available on boot. Check status with:
sudo systemctl status hector.service
-
Check WiringPi software with
gpio -v
-
If errors occur, remove current wiring pi version
sudo apt-get purge wiringpi
- Clone current wiring pi version from source and build
sudo apt install git
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
- Check the new version of wiring pi
gpio -v
gpio readall
/circuit_diagram
robocar_circuit_diagram.pdf
/hardware
/chassis
/motors
/power_supply
/raspberry
/sensors
README.md
/images
circuit_diagram_robocar.png
/scripts
README.md
os_settings.sh
ros_install.sh
/software
/gui
/build
/images
/include
ClientSocket.h
Socket.h
SocketException.h
mainwindow.h
/src
ClientSocket.cpp
Socket.cpp
mainwindow.cpp
mainwindow.ui
main_gui.cpp
CMakeLists.txt
/robocar
/build
/configs
/include
/car
/bus
I2C.h
/sensors
Camera.h
CameraServo.h
GearMotor.h
MPU6050.h
PCA9685.h
SteeringServo.h
Ultrasonic.h
Car.h
/server
/communication
ServerSocket.h
Socket.h
SocketException.h
Server.h
/slam
SlamMap.h
/src
/car
/bus
I2C.cpp
/sensors
Camera.cpp
CameraServo.cpp
GearMotor.cpp
MPU6050.cpp
PCA9685.cpp
SteeringServo.cpp
Ultrasonic.cpp
Car.cpp
/server
/communication
ServerSocket.cpp
Socket.cpp
Server.cpp
/slam
SlamMap.cpp
CMakeLists.txt
robocar_main.cpp
/testing
client.cpp
client.h
gearmotor.py
hokuyo_lidar.py
main_client.cpp
main_i2c.cpp
main_server.cpp
main_serversocket.cpp
picamera_stream.py
server.cpp
server.h
servomotor.py
ultrasonic.py
README.md
LICENSE
README.md