Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015
-
Upload
codemotion -
Category
Devices & Hardware
-
view
230 -
download
0
Transcript of Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015
David Meléndez CanoDavid Meléndez Cano@taiksontexas
Taiksonprojects.blogspot.com
2
¿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/59i2cgpio
echo "i2cgpiocustom bus0=0,4,7 bus1=1,3,1" >/etc/modules.d/59i2cgpiocustom
echo "i2cgpio" >/etc/modules.d/60i2cgpio
[reboot]
i2cdetect /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 <linux/i2cdev.h>
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
•Petición 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
Derivativo
error_speed=error_error_speed
/time_between_samples
Derivative_term=Derivative_term*error_speed
Nested PID
P Controller
PID controller
Angle
AngularVelocity
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/ttyS0 PIC16f876A
ESCMotores
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 <sched.h>
schedule.sched_priority=sched_get_priority_max(SCHED_FIFO);schedule.sched_priority=sched_get_priority_max(SCHED_FIFO);sched_setscheduler(pthread_self(), SCHED_FIFO,&schedule);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, "cgibin/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/cgibin/ajaxinput?QQZ[GAS]Z[ALABEO]Z[CABECEO]Z[GUIÑADA]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?
HEADER
AP“ATROPATROP”
COMMAND
PreambleGas
PitchRollYaw
SEQUENCENUMBER CHECKSUMINIT.
VECTOR
Forged Beacon Frame injection
Protected with AES-128
BEACON FRAME PAYLOADBEACON FRAME PAYLOADHEADER
Demo?Vuelo Atropos Quadrocopter
Acknowledges
Vicente Polo (Albalá Ingenieros)Jaime (Trescal)
Thank you!Thank you!
David Meléndez CanoDavid Meléndez Cano
@TaiksonTexas
Taiksonprojects.blogspot.com