summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-10-12 19:45:47 +0200
committerSebastian Reichel <sre@ring0.de>2012-10-12 19:45:47 +0200
commit46a3dea3b9daa5be5be2e56a9d76d22c8386670d (patch)
treeb2bd9706d5856e5c91870895420f9f61d9934565
parentc696cb9b0daf0a27ca79fb645efcc66bda2fe6c2 (diff)
downloadmicrocopterd-46a3dea3b9daa5be5be2e56a9d76d22c8386670d.tar.bz2
run kinematics update with sensor data
-rw-r--r--main.vala15
1 files changed, 11 insertions, 4 deletions
diff --git a/main.vala b/main.vala
index 790e0fc..8dce275 100644
--- a/main.vala
+++ b/main.vala
@@ -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);
}