diff --git a/src/drone_services/srv/SetVehicleControl.srv b/src/drone_services/srv/SetVehicleControl.srv index c0dd2411..d96ce97a 100644 --- a/src/drone_services/srv/SetVehicleControl.srv +++ b/src/drone_services/srv/SetVehicleControl.srv @@ -6,6 +6,10 @@ # bit 4: velocity # bit 5: position +# used control modes: +# 4: attitude and thrust +# 16: velocity +# 32: position int32 control # control bitmask --- int8 status # status of operation \ No newline at end of file diff --git a/src/px4_connection/include/drone_control_modes.h b/src/px4_connection/include/drone_control_modes.h new file mode 100644 index 00000000..d1324b90 --- /dev/null +++ b/src/px4_connection/include/drone_control_modes.h @@ -0,0 +1,15 @@ +#ifndef DRONE_CONTROL_MODES_H +#define DRONE_CONTROL_MODES_H + +#define CONTROL_MODE_ATTITUDE 1 +#define CONTROL_MODE_VELOCITY 2 +#define CONTROL_MODE_POSITION 3 + +#define CONTROL_ACTUATOR_POS 0 +#define CONTROL_BODY_RATE_POS 1 +#define CONTROL_ATTITUDE_POS 2 +#define CONTROL_ACCELERATION_POS 3 +#define CONTROL_VELOCITY_POS 4 +#define CONTROL_POSITION_POS 5 + +#endif \ No newline at end of file diff --git a/src/px4_connection/src/heartbeat.cpp b/src/px4_connection/src/heartbeat.cpp index 0ed09f55..9c4bdd04 100644 --- a/src/px4_connection/src/heartbeat.cpp +++ b/src/px4_connection/src/heartbeat.cpp @@ -10,16 +10,9 @@ #include #include -#define CONTROL_MODE_ATTITUDE 1 -#define CONTROL_MODE_VELOCITY 2 -#define CONTROL_MODE_POSITION 3 +#include "drone_control_modes.h" + -#define CONTROL_ACTUATOR_POS 0 -#define CONTROL_BODY_RATE_POS 1 -#define CONTROL_ATTITUDE_POS 2 -#define CONTROL_ACCELERATION_POS 3 -#define CONTROL_VELOCITY_POS 4 -#define CONTROL_POSITION_POS 5 using namespace std::chrono_literals; diff --git a/src/px4_connection/src/px4_controller.cpp b/src/px4_connection/src/px4_controller.cpp index 9f28763c..250c0f60 100644 --- a/src/px4_connection/src/px4_controller.cpp +++ b/src/px4_connection/src/px4_controller.cpp @@ -20,6 +20,8 @@ #include +#include "drone_control_modes.h" + #define D_SPEED(x) -x - 9.81 using namespace std::chrono_literals;