47 #include <px4_platform_common/defines.h> 58 #define BOARD_TEMP_OFFSET_DEG 5 94 memset(&msg, 0, *size);
99 memcpy(buffer, &msg, *size);
106 size_t size =
sizeof(
msg);
107 memset(&msg, 0, size);
108 memcpy(&msg, buffer, size);
110 memset(&esc, 0,
sizeof(esc));
140 memset(&battery, 0,
sizeof(battery));
145 memset(&msg, 0, *size);
162 memset(&airspeed, 0,
sizeof(airspeed));
166 msg.
speed_L = (uint8_t)speed & 0xff;
167 msg.
speed_H = (uint8_t)(speed >> 8) & 0xff;
170 memcpy(buffer, &msg, *size);
178 memset(&esc, 0,
sizeof(esc));
183 memset(&msg, 0, *size);
192 const uint16_t voltage = (uint16_t)(esc.
esc[0].
esc_voltage * 10.0F);
196 const uint16_t current = (uint16_t)(esc.
esc[0].
esc_current * 10.0F);
198 msg.
current_H = (uint8_t)(current >> 8) & 0xff;
200 const uint16_t rpm = (uint16_t)(esc.
esc[0].
esc_rpm * 0.1f);
201 msg.
rpm_L = (uint8_t)rpm & 0xff;
202 msg.
rpm_H = (uint8_t)(rpm >> 8) & 0xff;
205 memcpy(buffer, &msg, *size);
213 memset(&gps, 0,
sizeof(gps));
218 memset(&msg, 0, *size);
236 uint16_t speed = (uint16_t)(gps.
vel_m_s * 3.6f);
241 double lat = ((double)(gps.
lat)) * 1e-7d;
256 uint16_t lat_min = (uint16_t)(deg * 100 + min);
259 uint16_t lat_sec = (uint16_t)(sec);
264 double lon = ((double)(gps.
lon)) * 1e-7d;
276 uint16_t lon_min = (uint16_t)(deg * 100 + min);
279 uint16_t lon_sec = (uint16_t)(sec);
284 uint16_t alt = (uint16_t)(gps.
alt * 1e-3
f + 500.0f);
295 memset(&home, 0,
sizeof(home));
317 memcpy(buffer, &msg, *size);
325 double delta = val - *deg;
326 const double min_d = delta * 60.0d;
328 delta = min_d - *
min;
329 *sec = (int)(delta * 10000.0d);
struct esc_report_s esc[8]
int orb_copy(const struct orb_metadata *meta, int handle, void *buffer)
uint8_t latitude_min_L
231 0xE7 = 0x12E7 = 4839
uint8_t longitude_min_L
150 157 = 0x9D = 0x039D = 0925
uint8_t main_voltage_L
Main power voltage using 0.1V steps.
Definition of geo / math functions to perform geodesic calculations.
float get_distance_to_next_waypoint(double lat_now, double lon_now, double lat_next, double lon_next)
Returns the distance to the next waypoint in meters.
uint8_t distance_H
036 35 = /distance high byte
#define BINARY_MODE_REQUEST_ID
uint8_t esc_connectiontype
void build_gam_response(uint8_t *buffer, size_t *size)
uint8_t home_direction
HomeDirection (direction from starting point to Model position) (1 byte)
orb_advert_t orb_advertise(const struct orb_metadata *meta, const void *data)
uint8_t gps_speed_H
0 = /GPS speed high byte
High-resolution timer with callouts and timekeeping.
uint8_t temperature1
Temperature sensor 1.
uint8_t latitude_sec_H
016 3 = 0x03
void convert_to_degrees_minutes_seconds(double val, int *deg, int *min, int *sec)
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
#define GPS_SENSOR_TEXT_ID
int orb_subscribe(const struct orb_metadata *meta)
void build_gam_request(uint8_t *buffer, size_t *size)
uint8_t gam_sensor_id
GAM sensor id.
void init_sub_messages(void)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
uint8_t gps_fix
00 ASCII Free Character [6], we use it for GPS FIX
uint8_t altitude_L
Attitude (meters) lower 8-bits.
#define EAM_SENSOR_TEXT_ID
#define BOARD_TEMP_OFFSET_DEG
#define GAM_SENSOR_TEXT_ID
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
void init_pub_messages(void)
uint8_t temperature1
Temperature 1.
uint8_t latitude_ns
000 = N = 48°39’988
float indicated_airspeed_m_s
uint8_t latitude_sec_L
171 220 = 0xDC = 0x03DC =0988
uint8_t gps_num_sat
GPS.Satellites (number of satellites) (1 byte)
float get_bearing_to_next_waypoint(double lat_now, double lon_now, double lat_next, double lon_next)
Returns the bearing to the next waypoint in radians.
uint8_t latitude_min_H
018 18 = 0x12
uint8_t temperature2
Temperature 2.
uint8_t main_voltage_L
Main power voltage lower 8-bits in steps of 0.1V.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
uint8_t altitude_L
243 244 = /Altitude low byte 500 = 0m
uint8_t altitude_H
001 1 = /Altitude high byte
constexpr _Tp min(_Tp a, _Tp b)
void build_eam_response(uint8_t *buffer, size_t *size)
uint8_t distance_L
027 123 = /distance low byte 6 = 6 m
uint8_t longitude_ew
000 = E= 9° 25’9360
static bool _home_position_set
uint8_t longitude_min_H
003 3 = 0x03
int orb_check(int handle, bool *updated)
uint8_t sensor_text_id
GPS Sensor text mode ID.
uint8_t flight_direction
119 = Flightdir.
uint8_t longitude_sec_L
056 144 = 0x90 0x2490 = 9360
uint8_t eam_sensor_id
EAM sensor.
uint8_t rpm_L
RPM in 10 RPM steps.
uint8_t gps_speed_L
8 = /GPS speed low byte 8km/h
The GPS sensor message Struct based on: https://code.google.com/p/diy-hott-gps/downloads.
uint8_t current_L
Current in 0.1A steps.
Dual< Scalar, N > abs(const Dual< Scalar, N > &a)
void build_gps_response(uint8_t *buffer, size_t *size)
uint8_t sensor_id
GPS sensor ID.
uint8_t speed_L
Airspeed in km/h in steps of 1 km/h.
void publish_gam_message(const uint8_t *buffer)
uint8_t longitude_sec_H
004 36 = 0x24
uint8_t gps_fix_char
GPS.FixChar.
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
static orb_advert_t _esc_pub