From 013771a93e4b3e764d797be742392c9728b94a53 Mon Sep 17 00:00:00 2001 From: hmllr Date: Tue, 7 Mar 2023 11:07:08 +0100 Subject: [PATCH] Extends push demo with up/down capabilities --- examples/demos/app_push_demo/readme.md | 2 ++ examples/demos/app_push_demo/src/push.c | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/examples/demos/app_push_demo/readme.md b/examples/demos/app_push_demo/readme.md index bc1d2a2f97..f34592df54 100644 --- a/examples/demos/app_push_demo/readme.md +++ b/examples/demos/app_push_demo/readme.md @@ -14,6 +14,8 @@ When an oject (ie. an hand) has passed close to the top sensor, the Crazyflie ta If anything is detected on side sensors, the Crazyflie moves in the oposite direction. So, it is possible to push the Crazyflie around. +Per default, the Crazyflie will fly on 0.2m. If something is detected closer than 10cm on both sides it will go up, if front and back (or 30cm from the top) it will go down. It will land once it is closer than 10cm to the ground. + ## Build You must have the required tools to build the [Crazyflie firmware](https://github.com/bitcraze/crazyflie-firmware). diff --git a/examples/demos/app_push_demo/src/push.c b/examples/demos/app_push_demo/src/push.c index afa4c4c835..999a46be1c 100644 --- a/examples/demos/app_push_demo/src/push.c +++ b/examples/demos/app_push_demo/src/push.c @@ -77,8 +77,10 @@ static const uint16_t stoppedTh = 500; static const float velMax = 1.0f; static const uint16_t radius = 300; +static const uint16_t radius_up_down = 100; +static const float up_down_delta = 0.002f; -static const float height_sp = 0.2f; +static float height_sp = 0.2f; #define MAX(a,b) ((a>b)?a:b) #define MIN(a,b) ((a