Skip to content

Commit ea0c9c4

Browse files
authored
Merge pull request #450 from rosflight/jacob/remove-gnss-full
Jacob/remove gnss full
2 parents d8cd695 + 4e45354 commit ea0c9c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3932
-7400
lines changed

COLCON_IGNORE

Whitespace-only changes.

boards/varmint_h7/common/Varmint.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ bool Varmint::gnss_read(rosflight_firmware::GnssStruct * gnss)
248248
if (gps_.rxFifoReadMostRecent((uint8_t *) &p, sizeof(p))) {
249249
gnss->header = p.header;
250250
gnss->pps = p.pps;
251-
// struct tm tm;
252-
// tm.tm_sec = p.pvt.sec;
253-
// tm.tm_min = p.pvt.min;
254-
// tm.tm_hour = p.pvt.hour;
255-
// tm.tm_mday = p.pvt.day;
256-
// tm.tm_mon = p.pvt.month - 1;
257-
// tm.tm_year = p.pvt.year - 1900;
258-
//gnss->time = mktime(&tm);
259251
gnss->unix_seconds = p.unix_seconds; // Unix time
260252
gnss->t_acc = p.pvt.tAcc;
261253
gnss->time_of_week = p.pvt.iTOW;

comms/mavlink/mavlink.cpp

Lines changed: 12 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -143,67 +143,25 @@ void Mavlink::send_imu(uint8_t system_id, uint64_t timestamp_us, const turbomath
143143
send_message(msg, 0);
144144
}
145145

146-
#ifdef MAVLINK_MESSAGE_INFO_ROSFLIGHT2_GNSS
147-
void Mavlink::send_gnss(uint8_t system_id, const GNSSData & data)
146+
void Mavlink::send_gnss(uint8_t system_id, const GnssStruct & data)
148147
{
149148
mavlink_message_t msg;
150-
mavlink_msg_rosflight2_gnss_pack(
149+
mavlink_msg_rosflight_gnss_pack(
151150
system_id, compid_, &msg,
152151
data.unix_seconds, // Unix time in seconds
153152
data.nano, // nanoseconds
154153
data.fix_type,
155154
data.num_sat,
156-
data.lat, data.lon, data.height_ellipsoid,
157-
data.vel_n, data.vel_e, data.vel_d,
158-
data.h_acc, data.v_acc, data.speed_accy,
159-
data.header.timestamp);
160-
send_message(msg);
161-
}
162-
#else
163-
void Mavlink::send_gnss(uint8_t system_id, const GNSSData & data)
164-
{
165-
mavlink_message_t msg;
166-
mavlink_msg_rosflight_gnss_pack(
167-
system_id, compid_, &msg, data.time_of_week, data.fix_type, data.unix_seconds, data.nano, data.lat,
168-
data.lon, data.height_ellipsoid, data.vel_n, data.vel_e, data.vel_d, data.h_acc, data.v_acc, data.ecef.x,
169-
data.ecef.y, data.ecef.z, data.ecef.p_acc, data.ecef.vx, data.ecef.vy, data.ecef.vz,
170-
data.ecef.s_acc, data.header.timestamp);
171-
send_message(msg);
172-
}
173-
#endif
174-
175-
void Mavlink::send_gnss_full(uint8_t system_id, const GNSSFull & full)
176-
{
177-
mavlink_message_t msg;
178-
mavlink_rosflight_gnss_full_t data = {};
179-
data.time_of_week = full.time_of_week;
180-
data.year = full.year;
181-
data.month = full.month;
182-
data.day = full.day;
183-
data.hour = full.hour;
184-
data.min = full.min;
185-
data.sec = full.sec;
186-
data.valid = full.valid;
187-
data.t_acc = full.t_acc;
188-
data.nano = full.nano;
189-
data.fix_type = full.fix_type;
190-
data.num_sat = full.num_sat;
191-
data.lon = full.lon;
192-
data.lat = full.lat;
193-
data.height = full.height_ellipsoid;
194-
data.height_msl = full.height_msl;
195-
data.h_acc = full.h_acc;
196-
data.v_acc = full.v_acc;
197-
data.vel_n = full.vel_n;
198-
data.vel_e = full.vel_e;
199-
data.vel_d = full.vel_d;
200-
data.g_speed = full.ground_speed;
201-
data.head_mot = full.course;
202-
data.s_acc = full.speed_accy;
203-
data.head_acc = full.course_accy;
204-
data.p_dop = full.dop;
205-
data.rosflight_timestamp = full.header.timestamp;
206-
mavlink_msg_rosflight_gnss_full_encode(system_id, compid_, &msg, &data);
155+
(double)data.lat * 1e-7, // Convert 100's of nanodegs into deg (DDS format)
156+
(double)data.lon * 1e-7, // Convert 100's of nanodegs into deg (DDS format)
157+
(float)data.height_msl * 1e-3, // mm to m
158+
(float)data.vel_n * 1e-3, // mm/s to m/s
159+
(float)data.vel_e * 1e-3, // mm/s to m/s
160+
(float)data.vel_d * 1e-3, // mm/s to m/s
161+
(float)data.h_acc * 1e-3, // mm/s to m/s
162+
(float)data.v_acc * 1e-3, // mm/s to m/s
163+
(float)data.speed_accy * 1e-3, // mm/s to m/s
164+
(float)data.header.timestamp);
207165
send_message(msg);
208166
}
209167

comms/mavlink/mavlink.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ class Mavlink : public CommLinkInterface
8888
int16_t loop_time_us) override;
8989
void send_timesync(uint8_t system_id, int64_t tc1, int64_t ts1) override;
9090
void send_version(uint8_t system_id, const char * const version) override;
91-
void send_gnss(uint8_t system_id, const GNSSData & data) override;
92-
void send_gnss_full(uint8_t system_id, const GNSSFull & full) override;
91+
void send_gnss(uint8_t system_id, const GnssStruct & data) override;
9392
void send_error_data(uint8_t system_id, const StateManager::BackupData & error_data) override;
9493
void send_battery_status(uint8_t system_id, float voltage, float current) override;
9594

comms/mavlink/rosflight.xml

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,15 @@ python3 -m pymavlink.tools.mavgen --lang=C --wire-protocol=1.0 --output=generate
322322
<field type="uint32_t" name="reset_count"/>
323323
<field type="uint32_t" name="doRearm"/>
324324
</message>
325-
<!--
326-
<message id="197" name="ROSFLIGHT2_GNSS">
327-
<description>Rosflight2 GNSS message</description>
325+
<message id="197" name="ROSFLIGHT_GNSS">
326+
<description>Rosflight GNSS message</description>
328327
<field type="int64_t" name="seconds">Unix time, in seconds</field>
329328
<field type="int32_t" name="nanos">Fractional Unix time</field>
330329
<field type="uint8_t" name="fix_type" enum="GNSS_FIX_TYPE">GNSS fix type</field>
331330
<field type="uint8_t" name="num_sat">Number of satellites seen</field>
332331
<field type="double" name="lat">In deg DDS format</field>
333332
<field type="double" name="lon">In deg DDs format</field>
334-
<field type="float" name="height">meters</field>
333+
<field type="float" name="height">meters, MSL</field>
335334
<field type="float" name="vel_n">meters per second</field>
336335
<field type="float" name="vel_e">meters per second</field>
337336
<field type="float" name="vel_d">meters per second</field>
@@ -340,65 +339,6 @@ python3 -m pymavlink.tools.mavgen --lang=C --wire-protocol=1.0 --output=generate
340339
<field type="float" name="s_acc">meters</field>
341340
<field type="uint64_t" name="rosflight_timestamp">microseconds, estimated firmware timestamp for the time of validity of the gnss data</field>
342341
</message>
343-
-->
344-
<message id="197" name="ROSFLIGHT_GNSS">
345-
<description>Rosflight ECEF GPS Message</description>
346-
<!-- time_of_week is only for determining which packets where calculated at the same time.
347-
Use the time and nanos field to get GPS time. -->
348-
<field type="uint32_t" name="time_of_week"/>
349-
<field type="uint8_t" name="fix_type" enum="GNSS_FIX_TYPE"/>
350-
<field type="uint64_t" name="time"/> <!--unix time, in seconds -->
351-
<field type="uint64_t" name="nanos"/>
352-
<field type="int32_t" name="lat"/> <!-- deg*10^-7 -->
353-
<field type="int32_t" name="lon"/> <!-- deg*10^-7 -->
354-
<field type="int32_t" name="height"/> <!-- mm -->
355-
<field type="int32_t" name="vel_n"/> <!-- mm/s -->
356-
<field type="int32_t" name="vel_e"/> <!-- mm/s -->
357-
<field type="int32_t" name="vel_d"/> <!-- mm/s -->
358-
<field type="uint32_t" name="h_acc"/> <!-- mm -->
359-
<field type="uint32_t" name="v_acc"/> <!-- mm -->
360-
<field type="int32_t" name="ecef_x"/> <!-- cm -->
361-
<field type="int32_t" name="ecef_y"/> <!-- cm -->
362-
<field type="int32_t" name="ecef_z"/> <!-- cm -->
363-
<field type="uint32_t" name="p_acc"/> <!-- cm -->
364-
<field type="int32_t" name="ecef_v_x"/> <!-- cm/s -->
365-
<field type="int32_t" name="ecef_v_y"/> <!-- cm/s -->
366-
<field type="int32_t" name="ecef_v_z"/> <!-- cm/s -->
367-
<field type="uint32_t" name="s_acc"/> <!-- cm/s -->
368-
<field type="uint64_t" name="rosflight_timestamp"/> <!-- microseconds -->
369-
</message>
370-
<message id="198" name="ROSFLIGHT_GNSS_FULL">
371-
<description>Rosflight Full GPS Message</description>
372-
<!-- time_of_week is only for determining which packets where calculated at the same time.
373-
Use the various time and date fields to get GPS time. -->
374-
<field type="uint32_t" name="time_of_week"/>
375-
<field type="uint16_t" name="year"/>
376-
<field type="uint8_t" name="month"/>
377-
<field type="uint8_t" name="day"/>
378-
<field type="uint8_t" name="hour"/>
379-
<field type="uint8_t" name="min"/>
380-
<field type="uint8_t" name="sec"/>
381-
<field type="uint8_t" name="valid"/>
382-
<field type="uint32_t" name="t_acc"/> <!-- ns -->
383-
<field type="int32_t" name="nano"/> <!-- ns -->
384-
<field type="uint8_t" name="fix_type" enum="GNSS_FIX_TYPE"/>
385-
<field type="uint8_t" name="num_sat"/>
386-
<field type="int32_t" name="lon"/> <!-- deg *10^-7 -->
387-
<field type="int32_t" name="lat"/> <!-- deg *10^-7 -->
388-
<field type="int32_t" name="height"/> <!-- mm above elipsoid -->
389-
<field type="int32_t" name="height_msl"/> <!-- mm above mean sea level -->
390-
<field type="uint32_t" name="h_acc"/> <!-- mm -->
391-
<field type="uint32_t" name="v_acc"/> <!-- mm -->
392-
<field type="int32_t" name="vel_n"/> <!-- mm/s -->
393-
<field type="int32_t" name="vel_e"/> <!-- mm/s -->
394-
<field type="int32_t" name="vel_d"/> <!-- mm/s -->
395-
<field type="int32_t" name="g_speed"/> <!-- mm/s -->
396-
<field type="int32_t" name="head_mot"/> <!--deg *10^-5 -->
397-
<field type="uint32_t" name="s_acc"/> <!--mm/s-->
398-
<field type="uint32_t" name="head_acc"/> <!-- deg * 10^-5 -->
399-
<field type="uint16_t" name="p_dop"/> <!-- *.01 -->
400-
<field type="uint64_t" name="rosflight_timestamp"/> <!-- microseconds -->
401-
</message>
402342
<message id="199" name="ROSFLIGHT_BATTERY_STATUS">
403343
<description>Battery data</description>
404344
<field type="float" name="battery_voltage"/> <!-- V -->

comms/mavlink/v1.0/checksum.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C" {
2323

2424
#ifndef HAVE_CRC_ACCUMULATE
2525
/**
26-
* @brief Accumulate the MCRF4XX CRC16 by adding one char at a time.
26+
* @brief Accumulate the X.25 CRC by adding one char at a time.
2727
*
2828
* The checksum function adds the hash of one char at a time to the
2929
* 16 bit checksum (uint16_t).
@@ -44,9 +44,9 @@ static inline void crc_accumulate(uint8_t data, uint16_t *crcAccum)
4444

4545

4646
/**
47-
* @brief Initialize the buffer for the MCRF4XX CRC16
47+
* @brief Initiliaze the buffer for the X.25 CRC
4848
*
49-
* @param crcAccum the 16 bit MCRF4XX CRC16
49+
* @param crcAccum the 16 bit X.25 CRC
5050
*/
5151
static inline void crc_init(uint16_t* crcAccum)
5252
{
@@ -55,7 +55,7 @@ static inline void crc_init(uint16_t* crcAccum)
5555

5656

5757
/**
58-
* @brief Calculates the MCRF4XX CRC16 checksum on a byte buffer
58+
* @brief Calculates the X.25 checksum on a byte buffer
5959
*
6060
* @param pBuffer buffer containing the byte array to hash
6161
* @param length length of the byte array
@@ -73,7 +73,7 @@ static inline uint16_t crc_calculate(const uint8_t* pBuffer, uint16_t length)
7373

7474

7575
/**
76-
* @brief Accumulate the MCRF4XX CRC16 CRC by adding an array of bytes
76+
* @brief Accumulate the X.25 CRC by adding an array of bytes
7777
*
7878
* The checksum function adds the hash of one char at a time to the
7979
* 16 bit checksum (uint16_t).

comms/mavlink/v1.0/mavlink_conversions.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef _MAVLINK_CONVERSIONS_H_
22
#define _MAVLINK_CONVERSIONS_H_
33

4-
#ifndef MAVLINK_NO_CONVERSION_HELPERS
5-
64
/* enable math defines on Windows */
75
#ifdef _MSC_VER
86
#ifndef _USE_MATH_DEFINES
@@ -210,7 +208,4 @@ MAVLINK_HELPER void mavlink_euler_to_dcm(float roll, float pitch, float yaw, flo
210208
dcm[2][2] = cosPhi * cosThe;
211209
}
212210

213-
#endif // MAVLINK_NO_CONVERSION_HELPERS
214-
215-
#endif // _MAVLINK_CONVERSIONS_H_
216-
211+
#endif

0 commit comments

Comments
 (0)