====== Wireless programming ======
The technical solution description and a user manual for wireless programming of Distance Lab.
===== Quick Guide =====
**The Robot**
* Load Wireless_bootloader with a program called HapyJTAG2
* Check FuseBits –if Boot vector is enabled
* Fusebits: 90 F7
* Check configuration of the XBee\\
**Distancelab Server **
\\
\\
Loading the code:
./robocop -r [robot’s number] -f [the hex file name]
./robocop -r 3 -f atmega2561_demo.hex
\\
Creating reset\\
./robocop -r [robot’s number] -R
./robocop -r 3 -R
\\
Reading the ADC inputs:
./robocop -r [robot’s number] -a -i [interval (1/10 s)] -n [numbers of readings]
./robocop -r 2 -a -i 1 -n 10
\\
**In webserver**
===== Detailed manual =====
RoboCop is Linux based client program for Distancelab robots, it uses if necessary RobotLoader and RobotCharger. The RobotLoader contains bootloader, as the RobotLoader contains a charging program.\\
{{:et:distancelab:robotite_haldamine.png?330|}}\\
\\
Some of the opportunities offered by RoboCop
* Loading the new .hex file to the robot
* XBee pin configuration
* Displaying ADC values on console and saving them on User harddrive in .txt format
* Robot’s wireless module configuration check, check is done wireless
* Configuration of the robot’s wireless module, check is done wireless
* Monitoring the state of the robot and sending it to charge
* Refreshing the info about robots in the Distancelab webpage \\
\\
RoboLoader or wireless bootloader
* Takes into account possible errors arising from the radio communication
* Sends the data by blocks
* Checks the data blocks accuracy with checksum
* In case of error, sends the data again
* Has a reasonabe delays \\
\\
RoboCharger also wireless charging program
* Contains algorithm for finding the charger
* Identifies the beginning of the charging cycle
* Identifies the end of the charging cycle
* Releases the charging station\\
{{:et:distancelab:skeem.jpg?330|}}
**Robocopi oleku kontroll**
*Pärib baasist robotite loetelu, olekud, seadistused ...
*Kontrollib iga roboti aku pinget, temperatuuri
*Vajadusel muudab roboti olekut (DIO4) active -> charge
*Saadab roboti laadima, laeb robotisse RoboCharger programmi
*Muudab roboti olekut Kauglabori veebikeskkonnas
*Salvestab (ADC) parameetrid, analüüsi (graafikute) tarbeks.
**RoboCharger**
*Contains algorithm for seeking the charging station
*Detects the beginning of charging *
*Takse charging time in consideration just in case if chargind doesn't end
*Checks the tempriture of the batteries, it’s also done by RoboCop
*Detects the end of charging cycle, free’s the charging station in a program
*Changes the robot status charge -> active
==== Use of RoboCop====
Usage: robocop [options]
General options:\\
* -r remote 16 bit address\\
* -f flash robot\\
* -R reset robot\\
* -m maintenance (check batteries)\\
GPIO options\\
* -g gpio num\\
* -v gpio value (0|1)\\
ADC options\\
* -a read adc0 value\\
* -n read number of samples\\
* -i interval between samples\\
* -A all ADC's\\
Diagnostics options\\
* -c check remote XBee configuration\\
* -F fix remote XBee configuration\\
* -m test MySQL connectivity\\
** Uploading the code**
-r3 = robot’s 16 bit address
./robocop -r [robot’s number] -f [hex fail name]
./robocop -r 3 -f atmega2561_demo.hex
\\
**Using the ADC **
\\
Reading the ADC inputs:
./robocop -r [robot’s number] -a
./robocop -r 3 -f -a
\\
Monitoring battery level
./robocop -r [robot’s number] -a -n [numbers of readings] -i [interval (1/10 s)]
./robocop -r 3 -a -n 100 -i 1
There will be 100 readings, taken in every 0.1 second, in a console
\\
All input ADC readings
./robocop -r [robot’s number] -a -n [numbers of readings] -i [interval (1/10 s)] -A
./robocop -r 3 -a -n 100 -i 1 -A
\\
**Other operations**\\
\\
XBee configuration control
./robocop -r [robot’s number] -c
./robocop -r 3 -c
\\
Improving the XBee configuration
./robocop -r [robot’s number] -F
./robocop -r 3 -F
\\
Creating reset
./robocop -r [robot’s number] -R
./robocop -r 3 -R
\\
GIPO pin configuration
./robocop -r [robot’s number] -g [pin number] -v [1|0]
./robocop -r 3 -g 4 -v 1
g4 is XBee pin DIO4 and v1 means this pin is set to high\\
\\
**Locking**\\
Using multiple RoboCop program is not a problem. User will wait in gueue until robot is free or time run’s out.