Skip to content

Commit

Permalink
SITL: unify names in ILabs sim
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Bugrov authored and peterbarker committed Sep 16, 2024
1 parent 2b3ee0e commit 167dd7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions libraries/SITL/SIM_InertialLabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void InertialLabs::send_packet(void)
const auto gps_tow = GPS_Backend::gps_time();

// 0x01 GPS INS Time (round)
pkt.gps_ins_time_ms = gps_tow.ms;
pkt.gnss_ins_time_ms = gps_tow.ms;

// 0x23 Accelerometer data HR
pkt.accel_data_hr.x = (fdm.yAccel / GRAVITY_MSS) * 1.0e6; // g*1.0e6
Expand Down Expand Up @@ -119,9 +119,9 @@ void InertialLabs::send_packet(void)
pkt.ins_sol_status = 0; // INS solution is good

pkt.gnss_new_data = 0;
if (packets_sent % gps_frequency == 0) {
if (packets_sent % gnss_frequency == 0) {
// 0x3C GPS week
pkt.gps_week = gps_tow.week;
pkt.gnss_week = gps_tow.week;

// 0x4A GNSS extended info
pkt.gnss_extended_info.fix_type = 2; // 3D fix
Expand All @@ -131,9 +131,9 @@ void InertialLabs::send_packet(void)
pkt.num_sats = 32;

// 0x30 GNSS Position
pkt.gps_position.lat = fdm.latitude * 1e7; // deg*1.0e7
pkt.gps_position.lon = fdm.longitude * 1e7; // deg*1.0e7
pkt.gps_position.alt = fdm.altitude * 1e2; // m*100
pkt.gnss_position.lat = fdm.latitude * 1e7; // deg*1.0e7
pkt.gnss_position.lon = fdm.longitude * 1e7; // deg*1.0e7
pkt.gnss_position.alt = fdm.altitude * 1e2; // m*100

// 0x32 GNSS Velocity, Track over ground
Vector2d track{fdm.speedN,fdm.speedE};
Expand Down
10 changes: 5 additions & 5 deletions libraries/SITL/SIM_InertialLabs.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class InertialLabs : public SerialDevice
0x3b, 0x30, 0x32, 0x3e, 0x36, 0x41, 0xc0, 0x28, 0x86, 0x8a, 0x8d, 0x50, 0x52,
0x5a, 0x33, 0x3a, 0x40, 0x42, 0x54
};
uint32_t gps_ins_time_ms; // ms since start of GPS week for IMU data
uint16_t gps_week;
uint32_t gnss_ins_time_ms; // ms since start of GPS week for IMU data
uint16_t gnss_week;
vec3_32_t accel_data_hr; // g * 1e6
vec3_32_t gyro_data_hr; // deg/s * 1e5
struct PACKED {
Expand Down Expand Up @@ -92,7 +92,7 @@ class InertialLabs : public SerialDevice
int32_t lat; // deg*1e7
int32_t lon; // deg*1e7
int32_t alt; // m*100, AMSL
} gps_position;
} gnss_position;
struct PACKED {
int32_t hor_speed; // m/s*100
uint16_t track_over_ground; // deg*100
Expand Down Expand Up @@ -128,8 +128,8 @@ class InertialLabs : public SerialDevice

uint32_t last_pkt_us;
const uint16_t pkt_rate_hz = 200;
const uint16_t gps_rate_hz = 10;
const uint16_t gps_frequency = pkt_rate_hz / gps_rate_hz;
const uint16_t gnss_rate_hz = 10;
const uint16_t gnss_frequency = pkt_rate_hz / gnss_rate_hz;
uint32_t packets_sent;
};

Expand Down

0 comments on commit 167dd7f

Please sign in to comment.