add control modes h file

This commit is contained in:
Sem van der Hoeven
2023-05-12 12:42:13 +02:00
parent 10191e122b
commit 6bc357b6f8
4 changed files with 23 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -10,16 +10,9 @@
#include <drone_services/srv/set_vehicle_control.hpp>
#include <drone_services/msg/drone_control_mode.hpp>
#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;

View File

@@ -20,6 +20,8 @@
#include <std_srvs/srv/empty.hpp>
#include "drone_control_modes.h"
#define D_SPEED(x) -x - 9.81
using namespace std::chrono_literals;