mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
SITL: Airsim: Add support for rangefinder sensor data
Also increase RC channels to 12
This commit is contained in:
parent
6085614364
commit
0f66936353
@ -323,11 +323,18 @@ void AirSim::recv_fdm(const sitl_input& input)
|
||||
|
||||
scanner.points = state.lidar.points;
|
||||
|
||||
rcin_chan_count = state.rc.rc_channels.length < 8 ? state.rc.rc_channels.length : 8;
|
||||
// Update RC input, max 12 channels
|
||||
rcin_chan_count = MIN(state.rc.rc_channels.length, 12);
|
||||
for (uint8_t i=0; i < rcin_chan_count; i++) {
|
||||
rcin[i] = state.rc.rc_channels.data[i];
|
||||
}
|
||||
|
||||
// Update Rangefinder data, max sensors limit as defined
|
||||
uint8_t rng_sensor_count = MIN(state.rng.rng_distances.length, RANGEFINDER_MAX_INSTANCES);
|
||||
for (uint8_t i=0; i<rng_sensor_count; i++) {
|
||||
rangefinder_m[i] = state.rng.rng_distances.data[i];
|
||||
}
|
||||
|
||||
#if 0
|
||||
// @LoggerMessage: ASM1
|
||||
// @Description: AirSim simulation data
|
||||
|
@ -121,6 +121,9 @@ private:
|
||||
struct {
|
||||
struct float_array rc_channels;
|
||||
} rc;
|
||||
struct {
|
||||
struct float_array rng_distances;
|
||||
} rng;
|
||||
} state;
|
||||
|
||||
// table to aid parsing of JSON sensor data
|
||||
@ -129,7 +132,7 @@ private:
|
||||
const char *key;
|
||||
void *ptr;
|
||||
enum data_type type;
|
||||
} keytable[12] = {
|
||||
} keytable[13] = {
|
||||
{ "", "timestamp", &state.timestamp, DATA_UINT64 },
|
||||
{ "imu", "angular_velocity", &state.imu.angular_velocity, DATA_VECTOR3F },
|
||||
{ "imu", "linear_acceleration", &state.imu.linear_acceleration, DATA_VECTOR3F },
|
||||
@ -142,6 +145,7 @@ private:
|
||||
{ "velocity", "world_linear_velocity", &state.velocity.world_linear_velocity, DATA_VECTOR3F },
|
||||
{ "lidar", "point_cloud", &state.lidar.points, DATA_VECTOR3F_ARRAY },
|
||||
{ "rc", "channels", &state.rc.rc_channels, DATA_FLOAT_ARRAY },
|
||||
{ "rng", "distances", &state.rng.rng_distances, DATA_FLOAT_ARRAY },
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user