Skip to content

Commit

Permalink
Added Comments in almost each file of the project for more
Browse files Browse the repository at this point in the history
clarity
  • Loading branch information
vjaunet committed Jan 14, 2014
1 parent a3b03f7 commit d844b0f
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 28 deletions.
12 changes: 8 additions & 4 deletions PILOT/cli.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include <string.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>

/*
* cli.cpp
* created 01-2014
* author : Vincent Jaunet
*
* Makes possible to give PID constant values
* through command line options
*/
#include "cli.h"

CLI cli;
Expand Down
3 changes: 3 additions & 0 deletions PILOT/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include <string.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>


class CLI {

Expand Down
21 changes: 21 additions & 0 deletions PILOT/dmp.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
DMP class
author : vincent jaunet
date : 10-01-2013
Description :
The DMP class is mainly a wrapper to the MPU6050
one from github/PiBits and Jeff Rowberg <[email protected]>
It defines the main functions to :
-set up the I2C communication through I2Cdev
-Initialize the measurements and retrieve Offset values
-Get the attitude of the drone
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down Expand Up @@ -80,6 +97,10 @@ void DMP::set_com() {
}

void DMP::initialize(){

//This routine waits for the yaw angle to stop
//drifting

if (!dmpReady) return;

printf("Initializing IMU...\n");
Expand Down
16 changes: 16 additions & 0 deletions PILOT/net.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Socekt class
author : vincent jaunet
date : 10-01-2013
Description :
The Socket class contains all the necessary routine to set
up and use a UDP network serve on the drone waiting for
the remote client to send request.
The output should be parsed in order to retrieve
the desired attitude from the remote (see parse.*)
*/


#include "net.h"

Socket remote;
Expand Down
12 changes: 10 additions & 2 deletions PILOT/pid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
PID Controller
author : vincent JAUNET
mail : [email protected]
mail : [email protected]
date : 10-01-2013
Description:
the PID class is a collection of routine necessary
to perform a PID control based on setpoints (remote control),
inputs (measured attitude).
Can be used for any type of system and features :
- Derivative on measurement
- Windsup of integral errors
*/

Expand Down
Binary file modified PILOT/quad_pilot
Binary file not shown.
26 changes: 23 additions & 3 deletions PILOT/servo.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#include <iostream>
#include <stdlib.h>
#include <fstream>
/*
Servo Class
author : vincent JAUNET
mail : [email protected]
date : 10-01-2013
Description:
the Servo class is a collection of routine used to control
the motors through the electronic speed controllers.
ESC and Servo use the same communication protocole: PWM. That is
the reason why the servoblaster module is being used here. This allows
to get rid of an external PIC controller to generate such PWM signal.
The routines in the Serco class do the follwing:
- open the /dev/servoblaster file in order to write in it
- initlaize the ESC by sending a PWM of 1ms (~ throttle = 0)
- write the desired PWM values
*/


#include "servo.h"

Servo ESC;
Expand Down
3 changes: 3 additions & 0 deletions PILOT/servo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef SERVOS
#define SERVOS

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>

class Servo {
Expand Down
1 change: 0 additions & 1 deletion PILOT/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ void TimerClass::sig_handler_(int signum)

//Timer dt
Timer.calcdt_();
printf("%f \n",Timer.dt);

// PID on attitude
float PIDout[3];
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ The quadcopter is remotely controlled via wifi and an Android App.


The Raspberry PI hosts:
- PID controller
- PID controller
- ESC signal generator (ServoBlaster)
- UDP server to get command from an android device
- Communication with the MPU6050 through I2C.

The repository has several folders, that I initially made to code and test
the different functions of the controller. The entire controller is in the
The repository has several folders, that I initially made to code and test
the different functions of the controller. The entire controller is in the
PILOT folder.

This project is greatly inspired and using source code from :
- https://github.com/richardghirst/PiBits
for ServoBlaster and the MPU6050 usage
- https://github.com/richardghirst/PiBits
for ServoBlaster that I use to control the ESCs and the MPU6050 Digital motion processing.

- https://github.com/big5824/Picopter
for the Timing and the code structure
Expand All @@ -38,7 +38,7 @@ Many thanks to these people.
Hardware
--------

This projects includes :
This projects includes :
- 4 brushless motors (TURNIGY 2204-14T 19g Outrunner)
- 4 Electronic Speed Controllers (Turnigy Multistar 10 Amp)
- 1 LiPo 3s 3700 mAh battery
Expand All @@ -50,21 +50,21 @@ Wiring
------

MPU6050 :
VDD -> 3.3V
GND -> GND
SDA -> SDA
SCL -> SCL
VIO -> 3.3V
-VDD -> 3.3V
-GND -> GND
-SDA -> SDA
-SCL -> SCL
-VIO -> 3.3V


ESCs:
GND -> GND
Signal Servo 0 -> pin 4
Signal Servo 1 -> pin 23
Signal Servo 2 -> pin 24
Signal Servo 3 -> pin 25
-GND -> GND
-Signal Servo 0 -> pin 4
-Signal Servo 1 -> pin 23
-Signal Servo 2 -> pin 24
-Signal Servo 3 -> pin 25

Note that the use of this code requires some modofication of the Servoblaster configuration.
Note that the use of this code requires some modifications of the Servoblaster configuration.



Expand Down
2 changes: 1 addition & 1 deletion SERVOS/servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void Servo::init(Servo servo)

servo.set(servoval);

sleep(5);
sleep(2);
}

void Servo::set(int* ServoPosition)
Expand Down
Binary file modified SERVOS/test
Binary file not shown.

0 comments on commit d844b0f

Please sign in to comment.