Instructions for getting started: Difference between revisions
Line 172: | Line 172: | ||
NB! controlling of servos using the REGBOT app is rather bad. | NB! controlling of servos using the REGBOT app is rather bad. | ||
==GIF of Robobot driving on tape-lines== | ==GIF of Robobot driving on tape-lines== | ||
[[File:robobot_line.gif]] | [[File:robobot_line.gif]] |
Revision as of 13:30, 12 January 2020
Back to Robobot
This part needs to be redone
Major parts are deprecated, but some are OK.
Connect to the raspberry pi
There are more possibilities to connect to the raspberry pi:
- a screen and a keyboard (nice, but not good for a mobile robot)
- a net cable from Robobot directly to your PC (better, but still a cable)
- connect both the Robobot and your PC to the same local network using cable
- connect Robobot to net using a cable and the PC to the net that has access to the same net
- connect raspberry to eduroam (one of the others needed first to configure logon)
- there are other ways too
Connecting Raspberry pi to PC using cable
Connect your PC with Robobot using a network cable.
Your PC should receive an IP from the raspberry pi and the raspberry pi on the Robobot should have IP: 192.168.17.2, so logon (from Linux, or using putty):
Linux console command:
ssh local@192.168.17.2
Putty (Windows, Apple or Linux):
use ssh, IP 192.168.17.2, port 22 username local
ask for the password
Usefull Linux commands
Here is some common commands in Linux
ls (directory file list) cd (change to home directory) cd some_directory (change to a subdirectory) exit (logout, e.g. of a ssh session) grep -n string_to_look_for_in_a_file *.cpp (find a string in a file, e.g. a variable or a function) sudo some_command (execute a command as "root" - root is a superuser with administrator rights to everything) pkill some_application_name (stop (or kill) a running process with name "some_application_name") pgrep some_application_name (see if a process is running - good to use before a kill) mv from_file to_file (rename a file) cp from_file to_file (copy a file) rm some_file (remove (delete) a file) nano some_file (simple text editor) zip, unzip (pack or unpack files - try zip --help to see how. top (see process load and memory usage) make (compile all as described in the "Makefile" in the same directory) make -j4 (compile using up to 4 CPU cores - faster if more files need to be compiled)
All commands have an on-line help if you add --help or -h after the command. If this is not enough, then try
man ls
to get the manual page for the ls command.
Connecting network
Start by plugging the Raspberry Pi either directly to your PC or to one of the routers on campus. Make sure that you are on the same local network for this.
SSH into the Raspberry Pi by opening a terminal and typing
ssh local@jasmin.local
Replace jasmin with the name of the your robot
Open network
Now open wpa_supplicant.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Comment out or add the following (as one of the usable network connections) to use
network={ ssid="device" key_mgmt=NONE }
Private network
Generate encrypted key with
wpa_passphrase mySSID secret776
if the desired SSID is "mySSID" and the password is "secret776", then copy the result into /etc/wpa_supplicant/wpa_supplicant.conf (except the line with the password in clear text).
network={ ssid="mySSID" #psk="secret776" psk=812439e952156aea9983f3df5a389cf3f9c2e9f30ae2624eaad1551612a6ef71 }
Connecting Raspberry Pi to Eduroam
When connecting to Eduroam you will eventually have to type in your username and password in the wpa_supplicant.conf-file. In order for your password not to be visible, generate a hash-code for it
echo -n password_here | iconv -t utf16le | openssl md4
Copy the hash-code and clear the terminal window
clear
Now open wpa_supplicant.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Comment out or replace whatever in this file so that the content corresponds to the following
country=DK ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev ctrl_interface_group=0 update_config=1 network={ ssid="eduroam" scan_ssid=1 key_mgmt=WPA-EAP eap=PEAP phase2="auth=MSCHAPV2" identity="username" password=hash:your_hash_code }
Replace username with your username for Eduroam, i.e. your student number and replace your_hash_code with the hash-code you generated in the previous step.
Reboot the Raspberry Pi
sudo reboot
When the Pi has rebooted, connect to it using SSH once again. Check that the Pi is connected to WiFi
ifconfig
Under wlan0 confirm that the Pi has received an IP (inet addr) and note down the first three sections of the IP - they are most likely 10.16.175.xxx
The MAC address (HWaddr) of the Pi should also be noted down - this probably starts with B8:27:EB:xx:xx:xx make sure to get all of it.
Remove the LAN-cabel and connect to the Pi using the IP
ssh local@IP
Replace IP with the actual ID of the robot.
Graphics (X)
If you want to forward the graphics from the Pi use -X when connecting
ssh -X local@IP
Find IP of robot
In case the Pi gets a new IP address after reboot, you can search for it using the MAC address and nmap. If nmap is not installed, start by installing it
sudo apt-get install nmap
To search for the Pi using the MAC address in terminal type
sudo nmap -sP 10.16.175.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB:23:A0:F5/{print ip}'
where 10.16.175 is the first three sections of the IP you noted down and B8:27:EB:23:A0:F5 is the MAC address of the Pi. This should return the IP of the Pi.
Hardware Setup
All low level hardware is controlled by the Teensy microprocessor. For the most part, you don't need to make changes here, but some tuning and setup will be necessary. The easiest way to tune parameters and debug mission-lines is through the QtGUI interface:
svn co svn://repos.gbar.dtu.dk/jcan/regbot/qtgui qtgui
The installation might require additional software as listed here under python packages. A manual to QtGUI and possible mission-lines is available here.
Regulators
The Teensy operates with several regulation loops. These can be tuned for optimal performance. The regulators are adjusted under the "Control" tab in QtGUI. Following is listed working parameters for robobot primary functionality:
Velocity
The velocity regulator ensures that the robot keeps the intended speed under different loads. A good set of starting parameters would be as following:
Controller: Kp = 15 | Integrator: Tau_i = 0.15, Limit = 4 | Output limit = 9
Heading
The heading controller should ensure that the robobot keeps the correct heading, this regulator can be setup with:
Controller: Kp = 0.9 | Pre filter: Tau_zero = 0, Tau_pole = 0.01
Follow edge
This controller helps the robobot navigate after lines marked on the floor. A good starting point is:
P-Controller: Kp = 0.075
For the edge controller to work properly, a calibration under the "Edge" tab might be necessary, especially to detect white crossing and black crossing. In this case, make sure to calibrate values to the actual tape on the floor.
Calibrating front wheel
The heading should also be adjusted by calibrating the nose wheel controlled by a servo. This is done under the "Servo" tab where servo 0 - the steering servo - should be offset so that the wheel actually points straight.
NB! controlling of servos using the REGBOT app is rather bad.