+ All Categories
Home > Devices & Hardware > Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Date post: 15-Jul-2015
Category:
Upload: codemotion
View: 231 times
Download: 0 times
Share this document with a friend
Popular Tags:
35
David Meléndez Cano David Meléndez Cano @taiksontexas Taiksonprojects.blogspot.com
Transcript
Page 1: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

David Meléndez CanoDavid Meléndez Cano@taiksontexas

Taiksonprojects.blogspot.com

Page 2: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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!!!

Page 3: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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

Page 4: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Round one: ROV Texas Ranger

Page 5: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Round two!: Atropos Quadcopter

➔Fonera 2201

➔OpenWRT

➔Stabilization process

➔HTML5 telemetry and control

Page 6: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

A-B-C for quad drones

Page 7: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015
Page 8: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: GPIOs for I2C

Led lights are driven by SoC CPU pins

Page 9: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: GPIOs for soft I2C and serial port

GPIO---> I2C / RS232

GPIO leds

Serial port

Page 10: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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 

Page 11: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: Serial port

stty -F /dev/ttyS0 raw stty -F /dev/ttyS0 speed 115200

Page 12: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: Gyroscope

Wii Motion Plus

Triaxial gyroscope

I2C port

•Gives angular velocity on each axis

•Real angle: angular velocity * time ? → not so easy

Page 13: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: Accelerometer

Wii Nunchuck

Triaxial accelerometer

Puerto I2C

G forces in each axis.

Page 14: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: Magnetometer

- HMC5881L

-Units: Gauss

-Accelerometer only cancels gyro drif for pitch & roll

-Yaw gyro drif must be cancelled with a compass (magnetometer)

Page 15: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Router platform: Reading I2C sensors

#include <linux/i2c­dev.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

Page 16: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Imagen: “The Balance Filter” MIT

Gyroscopes

Accelerometer

Obteniendo ángulos absolutos con respecto a la Tierra

Page 17: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Mejor: Matriz de Cosenos Directores (DCM)

Page 18: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

We will work with:

➔Absolute angle: (rad) filtered value➔Angular velocity : (rad/sec) from gyroscopes➔Angullar acceleration: (rad/sec/sec) calculated from angular velocity

Page 19: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Proportional Integral Derivative Controller

Page 20: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Proportional

error=current_value-last_value

Proportional_term=Proportional_term*error

Page 21: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Integral

accumulated_error=accumulated_error+(error*time_between_samples)

Integral_term=Integral_term*accumulated_error

Page 22: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Derivativo

error_speed=error_error_speed

/time_between_samples

Derivative_term=Derivative_term*error_speed

Page 23: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Nested PID

P Controller

PID controller

Angle

AngularVelocity

Router Serial port

Page 24: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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

Page 25: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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);

Page 26: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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);

Page 27: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Actuator hardware

Electronic Speed controller (ESC)

Brushless motors “Outrunner”.

Page 28: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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[GUIÑADA]Z

Router Httpd.c is tweaked to process the query faster.

Page 29: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

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;    [...]

Page 30: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

What about Android?

Page 31: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015
Page 32: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

HEADER

AP“ATROPATROP”

COMMAND

PreambleGas

PitchRollYaw

SEQUENCENUMBER CHECKSUMINIT.

VECTOR

Forged Beacon Frame injection

Protected with AES-128

BEACON FRAME PAYLOADBEACON FRAME PAYLOADHEADER

Page 33: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Demo?Vuelo Atropos Quadrocopter

Page 34: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Acknowledges

Vicente Polo (Albalá Ingenieros)Jaime (Trescal)

Page 35: Trash Robotic Router Platform - David Melendez - Codemotion Rome 2015

Thank you!Thank you!

David Meléndez CanoDavid Meléndez Cano

@TaiksonTexas

Taiksonprojects.blogspot.com


Recommended