diff options
author | Sebastian Reichel <sre@ring0.de> | 2012-10-12 19:45:47 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2012-10-12 19:45:47 +0200 |
commit | 46a3dea3b9daa5be5be2e56a9d76d22c8386670d (patch) | |
tree | b2bd9706d5856e5c91870895420f9f61d9934565 | |
parent | c696cb9b0daf0a27ca79fb645efcc66bda2fe6c2 (diff) | |
download | microcopterd-46a3dea3b9daa5be5be2e56a9d76d22c8386670d.tar.bz2 |
run kinematics update with sensor data
-rw-r--r-- | main.vala | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -26,11 +26,18 @@ Kinematics kinematics; bool loop() { try { - /* TODO: get sensor values */ - /* TODO: get remote control values */ - /* TODO: update kinematics */ + /* get sensor data */ + int16 gx, gy, gz; + uint16 ax, ay, az, mx, my, mz; + gyroscope.get_data(out gx, out gy, out gz); + accelerometer.get_data(out ax, out ay, out az); + compass.get_data(out mx, out my, out mz); - //flightCtrl.process(); + /* calculate kinematics (TODO: calculate time diff) */ + kinematics.update(gx, gy, gz, ax, ay, az, mx, my, mz, 0.1); + + /* update motors */ + flightCtrl.process(); } catch(Error e) { stderr.printf("%s\n", e.message); } |