This project aims at hacking a remote controlled car by replacing the tx/rx and navigation systems. This project implements the car side.
Dependencies: mbed-rtos mbed ssWi
This project consists of a remote controller which pilots a car holding a video camera onboard. It is divided in two main parts:
- user side: the microcontroller reads the user input from the joystick (four potentiometers), elaborates them and then sends those commands through the wireless connection (using a XBee module);
- car side: the microcontroller receives the sent commands (using a XBee module), elaborates them and adjusts the main engine, the steering servomotor and the two servos which move the X-Y axis of the onboard video camera.
Here are a image of the hardware and a video I recorderd and edited.
Concerning the part related to the user side, the project is the following.
Import programrover_pc
This project aims at hacking a remote controlled car by replacing the tx/rx and navigation systems. This project implements the pc side.
The communication protocol I exploited to make the two parts communicate each other is ssWi.
Import libraryssWi
A simple wireless protocol to let my examples communicate each other. ssWi stands for Shared Slotted Wireless protocol
carDrivers/Servo/servo.cpp@0:97d3a2b0ff58, 2013-03-12 (annotated)
- Committer:
- mariob
- Date:
- Tue Mar 12 07:35:28 2013 +0000
- Revision:
- 0:97d3a2b0ff58
rover project - car side; MB
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mariob | 0:97d3a2b0ff58 | 1 | #include "servo.hpp" |
mariob | 0:97d3a2b0ff58 | 2 | |
mariob | 0:97d3a2b0ff58 | 3 | |
mariob | 0:97d3a2b0ff58 | 4 | Servo::Servo (PinName pwm, float min, float max, float center): _pwm(pwm) |
mariob | 0:97d3a2b0ff58 | 5 | { |
mariob | 0:97d3a2b0ff58 | 6 | _pwm.period(0.02); |
mariob | 0:97d3a2b0ff58 | 7 | _min = min; |
mariob | 0:97d3a2b0ff58 | 8 | _max = max; |
mariob | 0:97d3a2b0ff58 | 9 | _center = center; |
mariob | 0:97d3a2b0ff58 | 10 | *this = 0.5; |
mariob | 0:97d3a2b0ff58 | 11 | } |
mariob | 0:97d3a2b0ff58 | 12 | |
mariob | 0:97d3a2b0ff58 | 13 | Servo &Servo::operator= (float angle) |
mariob | 0:97d3a2b0ff58 | 14 | { |
mariob | 0:97d3a2b0ff58 | 15 | if (angle>1.0) |
mariob | 0:97d3a2b0ff58 | 16 | angle = 1.0; |
mariob | 0:97d3a2b0ff58 | 17 | else |
mariob | 0:97d3a2b0ff58 | 18 | if (angle<-1.0) |
mariob | 0:97d3a2b0ff58 | 19 | angle = -1.0; |
mariob | 0:97d3a2b0ff58 | 20 | _pwm.pulsewidth(_center+((_max-_min)*(angle/2.0))); |
mariob | 0:97d3a2b0ff58 | 21 | return *this; |
mariob | 0:97d3a2b0ff58 | 22 | } |
mariob | 0:97d3a2b0ff58 | 23 | |
mariob | 0:97d3a2b0ff58 | 24 | Servo::operator float() |
mariob | 0:97d3a2b0ff58 | 25 | { |
mariob | 0:97d3a2b0ff58 | 26 | return _pwm.read(); |
mariob | 0:97d3a2b0ff58 | 27 | } |