Download - Trash Robotic Router Platform
Presentacin de PowerPoint
David Melndez Cano@taiksontexas
Taiksonprojects.blogspot.com
TRASH ROBOTIC ROUTER PLATFORM
What is TRRP?
Low (or null) cost embedded platform
Internet of things
Use whatever is liying around
Trash can be useful
DO NOT RECYCLE!!! ->>> REUSE!!!
Use your old (or fancy new) router as robotic platform
No initial investion. You already have the router!
Change the firmware-> Embedded Linux OpenWRT
Created Robots using this philosiphy
ROVER Texas Ranger: Linksys WRT54GL
Drone ATROPOS:La Fonera 2201
Round one: ROV Texas Ranger
Round two!: Atropos Quadcopter
Fonera 2201
OpenWRT
Stabilization process
HTML5 telemetry and control
A-B-C for quad drones
Router platform: GPIOs for I2C
Led lights are driven by SoC CPU pins
Router platform: GPIOs for soft I2C and serial port
GPIO---> I2C / RS232
GPIO leds Serial port
Router platform: Module load
rm /etc/modules.d/59-i2c-gpio
echo "i2c-gpio-custom bus0=0,4,7 bus1=1,3,1" >/etc/modules.d/59-i2c-gpio-custom
echo "i2c-gpio" >/etc/modules.d/60-i2c-gpio
[reboot]
i2c-detect /dev/i2c0
Router platform: Serial port
stty -F /dev/ttyS0 raw stty -F /dev/ttyS0 speed 115200
Router platform: Gyroscope
Wii Motion Plus
Triaxial gyroscope
I2C port
Gives angular velocity on each axis
Real angle: angular velocity * time ? not so easy
Router platform: Accelerometer
Wii Nunchuck
Triaxial accelerometer
Puerto I2C
G forces in each axis.
Router platform: Magnetometer
- HMC5881L
-Units: Gauss
-Accelerometer only cancels gyro drif for pitch & roll
-Yaw gyro drif must be cancelled with a compass (magnetometer)
Router platform: Reading I2C sensors
#include
f_i2c0=open(I2C0, O_RDWR);
ioctl(f_i2c0, I2C_SLAVE, 0x52); write(f_i2c0, buff_out, data_size); --- read(f_i2c0, buffer,size);
. Ej Wii Motion+: 0x52
Peticin de datos escribiendo al dispositivo
Lectura de datos en buffer
Imagen: The Balance Filter MIT
Gyroscopes
Accelerometer
Obteniendo ngulos absolutos con respecto a la Tierra
Mejor: Matriz de Cosenos Directores (DCM)
We will work with:
Absolute angle: (rad) filtered value
Angular velocity : (rad/sec) from gyroscopes
Angullar acceleration: (rad/sec/sec) calculated from angular velocity
Proportional Integral Derivative Controller
Proportional
error=current_value-last_value
Proportional_term=Proportional_term*error
Integral
accumulated_error=accumulated_error+(error*time_between_samples)
Integral_term=Integral_term*accumulated_error
Derivative
error_speed=error-last_error/time_between_samples
Derivative_term=Derivative_term*error_speed
Nested PID
P ControllerPID controllerAngleAngularVelocity
Router Serial port
Router platform: Motor signal board (PWM)
-PIC Microcontroller receives motor speeds via router serial port-It converts those values into 4 time-fixed digital signals (PWM)
Fonera/dev/ttyS0PIC16f876AESCMotores
Router Platform: IMU (Inertial measurement Unit)
Critical process that has to be executed in a time-fixed ratiosetitimer(ITIMER_REAL,&i_int,NULL);(void)signal(SIGALRM ,timeout_real);
It compites with the rest of the process for CPU time
Changing priority with nice is not sufficent:
Real Time scheduling FIFO, Round Robin
#include
schedule.sched_priority=sched_get_priority_max(SCHED_FIFO);sched_setscheduler(pthread_self(), SCHED_FIFO,&schedule);
WATCHDOG process notifies to kernel that system is not hanged
It consumes SCHED_FIFO process time
What happens if router hangs during flight->
ioctl(/dev/watchdog, WDIOC_KEEPALIVE, &dummywd);
Actuator hardware
Electronic Speed controller (ESC)
Brushless motors Outrunner.
HTTP CONTROL
Httpd.c:[...]if (strncmp(tptr, "cgi-bin/ajaxinput", 17) == 0) {[...]strcpy((char *)shmat(shmget(9998, 30, IPC_CREAT | 0666), NULL, 0),g_query);exit(-1);}[...]
Pilot commands can be transmitted via AJAX or UDP packets
-AJAX uses DOM events and sends commands accordingly-A separate
program reads USB Joypad and resends via UDP
http://atropos/cgi-bin/ajaxinput?QQZ[GAS]Z[ALABEO]Z[CABECEO]Z[GUIADA]Z
Router Httpd.c is tweaked to process the query faster.
USB Joypad control (GNU/Linux with joydev.ko)
cat /dev/input/js0
----
pad=open(/dev/input/js0,O_RDONLY);reads=read(pad,msg,MSG);
(msg[7]==2) gas=((analog+127))*GAS_FACTOR; [...] (msg[7]==4) yaw=-analog*YAW_FACTOR; [...] (msg[7]==1) pitch=-analog*PITCH_FACTOR; [...] (msg[7]==0) roll=-analog*ROLL_FACTOR; [...]
What about Android?
ZsunBully
HEADER
APATROP
COMMAND
PreambleGasPitchRollYaw
SEQUENCENUMBER
CHECKSUM
INIT.
VECTOR
Forged Beacon Frame injection
Protected with AES-128
BEACON FRAME PAYLOAD
HEADER
Demo?Vuelo Atropos Quadrocopter
Thank you!
David Melndez Cano
@TaiksonTexas
Taiksonprojects.blogspot.com
Taiksonprojects.blogspot.com
ROME 11-12 april 2014 Speaker's name