Skip to content

Commit

Permalink
Moved gps crates locally because they were broken. Correct gps stream…
Browse files Browse the repository at this point in the history
… to the navigation module. Calibrated accelerometer and magenetometer with ellipsoid fitting. Got a correct bearing reading from callibrated magnetometer so we have yaw.
  • Loading branch information
martindeegan committed Sep 1, 2017
2 parents edb3614 + 67958bf commit 3151a4c
Show file tree
Hide file tree
Showing 29 changed files with 3,740 additions and 433 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ rs,toml
.vscode/
node_modules/
out.txt


*.key
166 changes: 166 additions & 0 deletions copter/Cargo.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions copter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ authors = ["Thomas Deegan <tadeegan@gmail.com>", "Martin Deegan <mddeegan@gmail.
rust-pigpio = "0.2.0"
time = "0.1"
debug_server = {path = "./debug", version = "0.1.0"}
protos = {path = "./protos"}
config = {path = "./config"}
protos = { path = "./protos" }
config = { path = "./config" }
protobuf = "1.2.2"
ansi_term = "0.9.0"
i2csensors = "0.1.*"
Expand All @@ -18,8 +18,10 @@ i2cdev-l3gd20 = "0.1.*"
i2cdev-lsm303d = "0.1.*"
i2cdev-lsm9ds0 = "0.1.*"
i2cdev = "0.3.1"
unbounded-gpsd = "0.4.1"
unbounded-gpsd = { path = "./unbounded-gpsd" }
wifilocation = { path = "./wifilocation" }
nalgebra = "0.13"
typenum = "1.7.0"

[[bin]]
name = "drone"
Expand Down
17 changes: 9 additions & 8 deletions copter/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"roll_kp": 3.1,
"roll_ki": 0.08,
"roll_kd": 0.85,
"pitch_kp": 3.0,
"pitch_ki": 0.08,
"pitch_kd": 0.8,
"roll_kp": 3.7,
"roll_ki": 1.6,
"roll_kd": 0.6,
"pitch_kp": 3.7,
"pitch_ki": 1.6,
"pitch_kd": 0.6,
"yaw_kp": 0.0,
"yaw_ki": 0.0,
"yaw_kd": 0.0,
Expand All @@ -18,8 +18,9 @@
"integral_decay_time": 0.8,
"integral_bandwidth": 10.0,
"server_address": "10.0.0.209:7070",
"hover_power": 1290,
"max_motor_speed": 1465,
"hover_power": 1280,
"max_motor_speed": 1395,
"take_off_time": 3.0,
"debug_websocket_port": 27070,
"sea_level_pressure": 1.01325,
"derivative_sampling": 0.001,
Expand Down
47 changes: 42 additions & 5 deletions copter/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ pub struct SensorCalibrations {
pub gyro_z: f32,
pub accel_x: f32,
pub accel_y: f32,
pub accel_z: f32
pub accel_z: f32,
pub mag_ofs_x: f32,
pub mag_ofs_y: f32,
pub mag_ofs_z: f32,
pub mag_rot_11: f32,
pub mag_rot_12: f32,
pub mag_rot_13: f32,
pub mag_rot_21: f32,
pub mag_rot_22: f32,
pub mag_rot_23: f32,
pub mag_rot_31: f32,
pub mag_rot_32: f32,
pub mag_rot_33: f32,
}

impl SensorCalibrations {
Expand All @@ -31,7 +43,19 @@ impl SensorCalibrations {
gyro_z: 0.0,
accel_x: 0.0,
accel_y: 0.0,
accel_z: 0.0
accel_z: 0.0,
mag_ofs_x: 0.0,
mag_ofs_y: 0.0,
mag_ofs_z: 0.0,
mag_rot_11: 0.0,
mag_rot_12: 0.0,
mag_rot_13: 0.0,
mag_rot_21: 0.0,
mag_rot_22: 0.0,
mag_rot_23: 0.0,
mag_rot_31: 0.0,
mag_rot_32: 0.0,
mag_rot_33: 0.0,
}
}
let mut contents = String::new();
Expand All @@ -42,7 +66,19 @@ impl SensorCalibrations {
gyro_z: 0.0,
accel_x: 0.0,
accel_y: 0.0,
accel_z: 0.0
accel_z: 0.0,
mag_ofs_x: 0.0,
mag_ofs_y: 0.0,
mag_ofs_z: 0.0,
mag_rot_11: 0.0,
mag_rot_12: 0.0,
mag_rot_13: 0.0,
mag_rot_21: 0.0,
mag_rot_22: 0.0,
mag_rot_23: 0.0,
mag_rot_31: 0.0,
mag_rot_32: 0.0,
mag_rot_33: 0.0,
}
}
toml::from_str(contents.as_ref()).unwrap()
Expand Down Expand Up @@ -86,8 +122,9 @@ pub struct Config {
pub integral_decay_time: f32,
pub integral_bandwidth: f32,
pub server_address: String,
pub hover_power: u32,
pub max_motor_speed: u32,
pub hover_power: f32,
pub max_motor_speed: f32,
pub take_off_time: f32,
pub debug_websocket_port: i32,
pub sea_level_pressure: f32,
pub derivative_sampling: f32,
Expand Down
1 change: 1 addition & 0 deletions copter/debug/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn start_port(server: &mut Server<NoTlsAcceptor>) -> Result<Client<TcpStream>,()
pub struct Logger {}

impl Logger {
//Return PID channel, Motor_channel, IMU channel, time channel
pub fn new(on: bool) -> Sender<Signal> {
let (tx,rx): (Sender<Signal>,Receiver<Signal>) = channel();
if on {
Expand Down
Loading

0 comments on commit 3151a4c

Please sign in to comment.