diff --git a/boards/aerotenna/ocpoc/ubuntu.cmake b/boards/aerotenna/ocpoc/ubuntu.cmake index 0fe8e88d06..360acc4c42 100644 --- a/boards/aerotenna/ocpoc/ubuntu.cmake +++ b/boards/aerotenna/ocpoc/ubuntu.cmake @@ -79,5 +79,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/airmind/mindpx-v2/default.cmake b/boards/airmind/mindpx-v2/default.cmake index 2ed973a29e..70150a0d12 100644 --- a/boards/airmind/mindpx-v2/default.cmake +++ b/boards/airmind/mindpx-v2/default.cmake @@ -107,7 +107,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/atlflight/eagle/default.cmake b/boards/atlflight/eagle/default.cmake index bc126e8656..cf02348489 100644 --- a/boards/atlflight/eagle/default.cmake +++ b/boards/atlflight/eagle/default.cmake @@ -119,5 +119,4 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway ) diff --git a/boards/atlflight/excelsior/default.cmake b/boards/atlflight/excelsior/default.cmake index 6a0f15163b..7990f0f053 100644 --- a/boards/atlflight/excelsior/default.cmake +++ b/boards/atlflight/excelsior/default.cmake @@ -120,5 +120,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/auav/x21/default.cmake b/boards/auav/x21/default.cmake index a5c9c58695..4547939cff 100644 --- a/boards/auav/x21/default.cmake +++ b/boards/auav/x21/default.cmake @@ -112,7 +112,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/av/x-v1/default.cmake b/boards/av/x-v1/default.cmake index 26a00e1499..056ae91921 100644 --- a/boards/av/x-v1/default.cmake +++ b/boards/av/x-v1/default.cmake @@ -112,7 +112,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/beaglebone/blue/cross.cmake b/boards/beaglebone/blue/cross.cmake index 829c70993d..98b2ed4cd3 100644 --- a/boards/beaglebone/blue/cross.cmake +++ b/boards/beaglebone/blue/cross.cmake @@ -76,5 +76,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/beaglebone/blue/native.cmake b/boards/beaglebone/blue/native.cmake index 971cc47830..9a84cae6d2 100644 --- a/boards/beaglebone/blue/native.cmake +++ b/boards/beaglebone/blue/native.cmake @@ -74,5 +74,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/emlid/navio2/cross.cmake b/boards/emlid/navio2/cross.cmake index 983cbac5ce..ba51a3a381 100644 --- a/boards/emlid/navio2/cross.cmake +++ b/boards/emlid/navio2/cross.cmake @@ -84,5 +84,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/emlid/navio2/native.cmake b/boards/emlid/navio2/native.cmake index 0060fa923a..9080d8e58d 100644 --- a/boards/emlid/navio2/native.cmake +++ b/boards/emlid/navio2/native.cmake @@ -82,5 +82,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/intel/aerofc-v1/default.cmake b/boards/intel/aerofc-v1/default.cmake index bb38e3727e..5aca140c94 100644 --- a/boards/intel/aerofc-v1/default.cmake +++ b/boards/intel/aerofc-v1/default.cmake @@ -90,7 +90,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/intel/aerofc-v1/rtps.cmake b/boards/intel/aerofc-v1/rtps.cmake index b78db85143..81f618a6bd 100644 --- a/boards/intel/aerofc-v1/rtps.cmake +++ b/boards/intel/aerofc-v1/rtps.cmake @@ -94,7 +94,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/mro/ctrl-zero-f7/default.cmake b/boards/mro/ctrl-zero-f7/default.cmake index 0648dd8e86..58dcb93aad 100644 --- a/boards/mro/ctrl-zero-f7/default.cmake +++ b/boards/mro/ctrl-zero-f7/default.cmake @@ -116,7 +116,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/nxp/fmuk66-v3/default.cmake b/boards/nxp/fmuk66-v3/default.cmake index 23bb654037..6624bba36b 100644 --- a/boards/nxp/fmuk66-v3/default.cmake +++ b/boards/nxp/fmuk66-v3/default.cmake @@ -111,7 +111,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/omnibus/f4sd/default.cmake b/boards/omnibus/f4sd/default.cmake index 837a76a96e..0865106d1a 100644 --- a/boards/omnibus/f4sd/default.cmake +++ b/boards/omnibus/f4sd/default.cmake @@ -102,7 +102,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/px4/fmu-v2/default.cmake b/boards/px4/fmu-v2/default.cmake index 5b6eb57b4f..e6eb8492ed 100644 --- a/boards/px4/fmu-v2/default.cmake +++ b/boards/px4/fmu-v2/default.cmake @@ -119,6 +119,5 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/px4/fmu-v2/lpe.cmake b/boards/px4/fmu-v2/lpe.cmake index b41b284ab8..f865f0dcfa 100644 --- a/boards/px4/fmu-v2/lpe.cmake +++ b/boards/px4/fmu-v2/lpe.cmake @@ -113,5 +113,4 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway ) diff --git a/boards/px4/fmu-v2/test.cmake b/boards/px4/fmu-v2/test.cmake index 1c80959081..06938ae003 100644 --- a/boards/px4/fmu-v2/test.cmake +++ b/boards/px4/fmu-v2/test.cmake @@ -113,5 +113,4 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway ) diff --git a/boards/px4/fmu-v3/default.cmake b/boards/px4/fmu-v3/default.cmake index 271d9c2fbd..eed8e5ed58 100644 --- a/boards/px4/fmu-v3/default.cmake +++ b/boards/px4/fmu-v3/default.cmake @@ -120,7 +120,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v3/rtps.cmake b/boards/px4/fmu-v3/rtps.cmake index e991846e91..b9084f1a00 100644 --- a/boards/px4/fmu-v3/rtps.cmake +++ b/boards/px4/fmu-v3/rtps.cmake @@ -120,7 +120,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v3/stackcheck.cmake b/boards/px4/fmu-v3/stackcheck.cmake index 9b69dbbe30..51d7789a9b 100644 --- a/boards/px4/fmu-v3/stackcheck.cmake +++ b/boards/px4/fmu-v3/stackcheck.cmake @@ -119,7 +119,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/px4/fmu-v4/default.cmake b/boards/px4/fmu-v4/default.cmake index 50593ecfb7..666d55467b 100644 --- a/boards/px4/fmu-v4/default.cmake +++ b/boards/px4/fmu-v4/default.cmake @@ -106,7 +106,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v4/rtps.cmake b/boards/px4/fmu-v4/rtps.cmake index 7f93da7774..fa8a3284d1 100644 --- a/boards/px4/fmu-v4/rtps.cmake +++ b/boards/px4/fmu-v4/rtps.cmake @@ -109,7 +109,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v4/stackcheck.cmake b/boards/px4/fmu-v4/stackcheck.cmake index bc70d859c2..31516f0e9f 100644 --- a/boards/px4/fmu-v4/stackcheck.cmake +++ b/boards/px4/fmu-v4/stackcheck.cmake @@ -106,7 +106,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/px4/fmu-v4pro/default.cmake b/boards/px4/fmu-v4pro/default.cmake index 4d3425565c..da368a0df7 100644 --- a/boards/px4/fmu-v4pro/default.cmake +++ b/boards/px4/fmu-v4pro/default.cmake @@ -118,7 +118,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v4pro/rtps.cmake b/boards/px4/fmu-v4pro/rtps.cmake index 0a436d6ac8..18e179cd0f 100644 --- a/boards/px4/fmu-v4pro/rtps.cmake +++ b/boards/px4/fmu-v4pro/rtps.cmake @@ -118,7 +118,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v5/critmonitor.cmake b/boards/px4/fmu-v5/critmonitor.cmake index 4878af2903..d7c796524a 100644 --- a/boards/px4/fmu-v5/critmonitor.cmake +++ b/boards/px4/fmu-v5/critmonitor.cmake @@ -120,7 +120,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v5/default.cmake b/boards/px4/fmu-v5/default.cmake index ad20949613..9f6f4f21b1 100644 --- a/boards/px4/fmu-v5/default.cmake +++ b/boards/px4/fmu-v5/default.cmake @@ -120,7 +120,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v5/irqmonitor.cmake b/boards/px4/fmu-v5/irqmonitor.cmake index c0eeb3981f..8012a0c661 100644 --- a/boards/px4/fmu-v5/irqmonitor.cmake +++ b/boards/px4/fmu-v5/irqmonitor.cmake @@ -120,7 +120,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v5/rtps.cmake b/boards/px4/fmu-v5/rtps.cmake index f255607502..0617cbf736 100644 --- a/boards/px4/fmu-v5/rtps.cmake +++ b/boards/px4/fmu-v5/rtps.cmake @@ -118,6 +118,5 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/fmu-v5/stackcheck.cmake b/boards/px4/fmu-v5/stackcheck.cmake index 588d78af08..37c7766dae 100644 --- a/boards/px4/fmu-v5/stackcheck.cmake +++ b/boards/px4/fmu-v5/stackcheck.cmake @@ -119,6 +119,5 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/boards/px4/fmu-v5x/default.cmake b/boards/px4/fmu-v5x/default.cmake index 41bfb3b0d8..d8d6288a2a 100644 --- a/boards/px4/fmu-v5x/default.cmake +++ b/boards/px4/fmu-v5x/default.cmake @@ -120,6 +120,5 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway uuv_example_app ) diff --git a/boards/px4/raspberrypi/cross.cmake b/boards/px4/raspberrypi/cross.cmake index b999eac7fd..c603753936 100644 --- a/boards/px4/raspberrypi/cross.cmake +++ b/boards/px4/raspberrypi/cross.cmake @@ -76,5 +76,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/px4/raspberrypi/native.cmake b/boards/px4/raspberrypi/native.cmake index e21cbaa3ca..944b2cfca4 100644 --- a/boards/px4/raspberrypi/native.cmake +++ b/boards/px4/raspberrypi/native.cmake @@ -75,5 +75,4 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) diff --git a/boards/px4/sitl/default.cmake b/boards/px4/sitl/default.cmake index ed7aa3f81e..933de2eb01 100644 --- a/boards/px4/sitl/default.cmake +++ b/boards/px4/sitl/default.cmake @@ -79,7 +79,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) set(config_sitl_viewer jmavsim CACHE STRING "viewer for sitl") diff --git a/boards/px4/sitl/rtps.cmake b/boards/px4/sitl/rtps.cmake index e5437c565d..28e278a335 100644 --- a/boards/px4/sitl/rtps.cmake +++ b/boards/px4/sitl/rtps.cmake @@ -80,7 +80,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) set(config_sitl_viewer jmavsim CACHE STRING "viewer for sitl") diff --git a/boards/px4/sitl/test.cmake b/boards/px4/sitl/test.cmake index bb66117394..4c8e62c669 100644 --- a/boards/px4/sitl/test.cmake +++ b/boards/px4/sitl/test.cmake @@ -79,7 +79,6 @@ px4_add_board( px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app - segway ) set(config_sitl_viewer jmavsim CACHE STRING "viewer for sitl") diff --git a/boards/uvify/core/default.cmake b/boards/uvify/core/default.cmake index 72dd51004b..75c2fd9936 100644 --- a/boards/uvify/core/default.cmake +++ b/boards/uvify/core/default.cmake @@ -113,7 +113,6 @@ px4_add_board( #px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html #px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html #rover_steering_control # Rover example app - #segway #uuv_example_app ) diff --git a/src/examples/segway/BlockSegwayController.cpp b/src/examples/segway/BlockSegwayController.cpp deleted file mode 100644 index bacb7f7c1a..0000000000 --- a/src/examples/segway/BlockSegwayController.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "BlockSegwayController.hpp" - -using matrix::Eulerf; -using matrix::Quatf; - -void BlockSegwayController::update() -{ - // wait for a sensor update, check for exit condition every 100 ms - if (px4_poll(&_attPoll, 1, 100) < 0) { return; } // poll error - - uint64_t newTimeStamp = hrt_absolute_time(); - float dt = (newTimeStamp - _timeStamp) / 1.0e6f; - _timeStamp = newTimeStamp; - - // check for sane values of dt - // to prevent large control responses - if (dt > 1.0f || dt < 0) { return; } - - // set dt for all child blocks - setDt(dt); - - // check for new updates - if (_param_update.updated()) { updateParams(); } - - // get new information from subscriptions - updateSubscriptions(); - - actuator_controls_s &actuators = _actuators.get(); - - // default all output to zero unless handled by mode - for (unsigned i = 2; i < actuator_controls_s::NUM_ACTUATOR_CONTROLS; i++) { - actuators.control[i] = 0.0f; - } - - const uint8_t &nav_state = _status.get().nav_state; - - // only update guidance in auto mode - if (nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION) { - // update guidance - } - - Eulerf euler = Eulerf(Quatf(_att.get().q)); - - // compute speed command - float spdCmd = -th2v.update(euler.theta()) - q2v.update(_angular_velocity.get().xyz[1]); - - // handle autopilot modes - if (nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION || - nav_state == vehicle_status_s::NAVIGATION_STATE_ALTCTL || - nav_state == vehicle_status_s::NAVIGATION_STATE_POSCTL) { - - actuators.control[0] = spdCmd; - actuators.control[1] = spdCmd; - - } else if (nav_state == vehicle_status_s::NAVIGATION_STATE_STAB) { - actuators.control[0] = spdCmd; - actuators.control[1] = spdCmd; - - } else if (nav_state == vehicle_status_s::NAVIGATION_STATE_MANUAL) { - actuators.control[CH_LEFT] = _manual.get().z; - actuators.control[CH_RIGHT] = -_manual.get().x; - } - - // publish - _actuators.update(); -} diff --git a/src/examples/segway/BlockSegwayController.hpp b/src/examples/segway/BlockSegwayController.hpp deleted file mode 100644 index f0bd874ce6..0000000000 --- a/src/examples/segway/BlockSegwayController.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include -#include "blocks.hpp" - -using control::BlockPI; -using control::BlockP; - -class BlockSegwayController : public control::BlockUorbEnabledAutopilot -{ -public: - BlockSegwayController() : - BlockUorbEnabledAutopilot(nullptr, "SEG"), - th2v(this, "TH2V"), - q2v(this, "Q2V"), - _attPoll(), - _timeStamp(0) - { - _attPoll.fd = _att.getHandle(); - _attPoll.events = POLLIN; - } - - void update(); - -private: - enum {CH_LEFT, CH_RIGHT}; - - BlockPI th2v; - BlockP q2v; - - px4_pollfd_struct_t _attPoll; - uint64_t _timeStamp; -}; diff --git a/src/examples/segway/CMakeLists.txt b/src/examples/segway/CMakeLists.txt deleted file mode 100644 index 11dd8e917f..0000000000 --- a/src/examples/segway/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ -px4_add_module( - MODULE examples__segway - MAIN segway - SRCS - blocks.cpp - segway_main.cpp - BlockSegwayController.cpp - DEPENDS - ) - diff --git a/src/examples/segway/blocks.cpp b/src/examples/segway/blocks.cpp deleted file mode 100644 index a6348805e5..0000000000 --- a/src/examples/segway/blocks.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file uorb_blocks.cpp - * - * uorb block library code - */ - -#include "blocks.hpp" -#include -#include - -using matrix::wrap_2pi; - -namespace control -{ - -BlockWaypointGuidance::BlockWaypointGuidance(SuperBlock *parent, const char *name) : - SuperBlock(parent, name), - _xtYawLimit(this, "XT2YAW"), - _xt2Yaw(this, "XT2YAW"), - _psiCmd(0) -{ -} - -void BlockWaypointGuidance::update( - const vehicle_global_position_s &pos, - const vehicle_attitude_s &att, - const position_setpoint_s &missionCmd, - const position_setpoint_s &lastMissionCmd) -{ - - // heading to waypoint - float psiTrack = get_bearing_to_next_waypoint( - (double)pos.lat / (double)1e7, - (double)pos.lon / (double)1e7, - missionCmd.lat, - missionCmd.lon); - - // cross track - struct crosstrack_error_s xtrackError; - get_distance_to_line(&xtrackError, - (double)pos.lat / (double)1e7, - (double)pos.lon / (double)1e7, - lastMissionCmd.lat, - lastMissionCmd.lon, - missionCmd.lat, - missionCmd.lon); - - _psiCmd = wrap_2pi(psiTrack - - _xtYawLimit.update(_xt2Yaw.update(xtrackError.distance))); -} - -BlockUorbEnabledAutopilot::BlockUorbEnabledAutopilot(SuperBlock *parent, const char *name) : - SuperBlock(parent, name), - // subscriptions - _manual(ORB_ID(manual_control_setpoint), 20, 0, &getSubscriptions()), - _param_update(ORB_ID(parameter_update), 1000, 0, &getSubscriptions()), // limit to 1 Hz - _missionCmd(ORB_ID(position_setpoint_triplet), 20, 0, &getSubscriptions()), - _att(ORB_ID(vehicle_attitude), 20, 0, &getSubscriptions()), - _angular_velocity(ORB_ID(vehicle_angular_velocity), 20, 0, &getSubscriptions()), - _attCmd(ORB_ID(vehicle_attitude_setpoint), 20, 0, &getSubscriptions()), - _pos(ORB_ID(vehicle_global_position), 20, 0, &getSubscriptions()), - _ratesCmd(ORB_ID(vehicle_rates_setpoint), 20, 0, &getSubscriptions()), - _status(ORB_ID(vehicle_status), 20, 0, &getSubscriptions()), - - // publications - _actuators(ORB_ID(actuator_controls_0)) -{ -} - -} - diff --git a/src/examples/segway/blocks.hpp b/src/examples/segway/blocks.hpp deleted file mode 100644 index db521b9754..0000000000 --- a/src/examples/segway/blocks.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file uorb_blocks.h - * - * uorb block library code - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace control -{ - -/** - * Waypoint Guidance block - */ -class __EXPORT BlockWaypointGuidance : public SuperBlock -{ -private: - BlockLimitSym _xtYawLimit; - BlockP _xt2Yaw; - float _psiCmd; -public: - BlockWaypointGuidance(SuperBlock *parent, const char *name); - virtual ~BlockWaypointGuidance() = default; - - void update(const vehicle_global_position_s &pos, - const vehicle_attitude_s &att, - const position_setpoint_s &missionCmd, - const position_setpoint_s &lastMissionCmd); - - float getPsiCmd() { return _psiCmd; } -}; - -/** - * UorbEnabledAutopilot - */ -class __EXPORT BlockUorbEnabledAutopilot : public SuperBlock -{ -protected: - // subscriptions - uORB::SubscriptionPollable _manual; - uORB::SubscriptionPollable _param_update; - uORB::SubscriptionPollable _missionCmd; - uORB::SubscriptionPollable _att; - uORB::SubscriptionPollable _angular_velocity; - uORB::SubscriptionPollable _attCmd; - uORB::SubscriptionPollable _pos; - uORB::SubscriptionPollable _ratesCmd; - uORB::SubscriptionPollable _status; - - // publications - uORB::PublicationData _actuators{ORB_ID(actuator_controls_0)}; - -public: - BlockUorbEnabledAutopilot(SuperBlock *parent, const char *name); - virtual ~BlockUorbEnabledAutopilot() = default; -}; - -} // namespace control - diff --git a/src/examples/segway/params.c b/src/examples/segway/params.c deleted file mode 100644 index d3c4aea35f..0000000000 --- a/src/examples/segway/params.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -// 16 is max name length -PARAM_DEFINE_FLOAT(SEG_TH2V_P, 10.0f); // pitch to voltage -PARAM_DEFINE_FLOAT(SEG_TH2V_I, 0.0f); // pitch integral to voltage -PARAM_DEFINE_FLOAT(SEG_TH2V_I_MAX, 0.0f); // integral limiter -PARAM_DEFINE_FLOAT(SEG_Q2V, 1.0f); // pitch rate to voltage diff --git a/src/examples/segway/segway_main.cpp b/src/examples/segway/segway_main.cpp deleted file mode 100644 index e276caa6c0..0000000000 --- a/src/examples/segway/segway_main.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. - * Author: James Goppert - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file segway_main.cpp - * @author James Goppert - * - * Segway controller using control library - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "BlockSegwayController.hpp" - -static bool thread_should_exit = false; /**< Deamon exit flag */ -static bool thread_running = false; /**< Deamon status flag */ -static int deamon_task; /**< Handle of deamon task / thread */ - -/** - * Deamon management function. - */ -extern "C" __EXPORT int segway_main(int argc, char *argv[]); - -/** - * Mainloop of deamon. - */ -int segway_thread_main(int argc, char *argv[]); - -/** - * Print the correct usage. - */ -static void usage(const char *reason); - -static void -usage(const char *reason) -{ - if (reason) { - fprintf(stderr, "%s\n", reason); - } - - fprintf(stderr, "usage: segway {start|stop|status} [-p ]\n\n"); -} - -/** - * The deamon app only briefly exists to start - * the background job. The stack size assigned in the - * Makefile does only apply to this management task. - * - * The actual stack size should be set in the call - * to task_create(). - */ -int segway_main(int argc, char *argv[]) -{ - - if (argc < 2) { - usage("missing command"); - return -1; - } - - if (!strcmp(argv[1], "start")) { - - if (thread_running) { - warnx("already running"); - /* this is not an error */ - return 0; - } - - thread_should_exit = false; - - deamon_task = px4_task_spawn_cmd("segway", - SCHED_DEFAULT, - SCHED_PRIORITY_MAX - 10, - 5120, - segway_thread_main, - (argv) ? (char *const *)&argv[2] : (char *const *)nullptr); - return 0; - } - - if (!strcmp(argv[1], "stop")) { - thread_should_exit = true; - return 0; - } - - if (!strcmp(argv[1], "status")) { - if (thread_running) { - warnx("is running"); - - } else { - warnx("not started"); - } - - return 0; - } - - usage("unrecognized command"); - return -1; -} - -int segway_thread_main(int argc, char *argv[]) -{ - - warnx("starting"); - - using namespace control; - - BlockSegwayController autopilot; - - thread_running = true; - - while (!thread_should_exit) { - autopilot.update(); - } - - warnx("exiting."); - - thread_running = false; - - return 0; -}