|
|
@ -56,6 +56,7 @@ |
|
|
|
#include <uORB/topics/vehicle_angular_velocity.h> // to publish groundtruth |
|
|
|
#include <uORB/topics/vehicle_angular_velocity.h> // to publish groundtruth |
|
|
|
#include <uORB/topics/vehicle_attitude.h> // to publish groundtruth |
|
|
|
#include <uORB/topics/vehicle_attitude.h> // to publish groundtruth |
|
|
|
#include <uORB/topics/vehicle_global_position.h> // to publish groundtruth |
|
|
|
#include <uORB/topics/vehicle_global_position.h> // to publish groundtruth |
|
|
|
|
|
|
|
#include <uORB/topics/distance_sensor.h> |
|
|
|
|
|
|
|
|
|
|
|
using namespace time_literals; |
|
|
|
using namespace time_literals; |
|
|
|
|
|
|
|
|
|
|
@ -96,6 +97,10 @@ private: |
|
|
|
sensor_gps_s _sensor_gps{}; |
|
|
|
sensor_gps_s _sensor_gps{}; |
|
|
|
uORB::Publication<sensor_gps_s> _sensor_gps_pub{ORB_ID(sensor_gps)}; |
|
|
|
uORB::Publication<sensor_gps_s> _sensor_gps_pub{ORB_ID(sensor_gps)}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to publish the distance sensor
|
|
|
|
|
|
|
|
distance_sensor_s _distance_snsr{}; |
|
|
|
|
|
|
|
uORB::Publication<distance_sensor_s> _distance_snsr_pub{ORB_ID(distance_sensor)}; |
|
|
|
|
|
|
|
|
|
|
|
// angular velocity groundtruth
|
|
|
|
// angular velocity groundtruth
|
|
|
|
vehicle_angular_velocity_s _vehicle_angular_velocity_gt{}; |
|
|
|
vehicle_angular_velocity_s _vehicle_angular_velocity_gt{}; |
|
|
|
uORB::Publication<vehicle_angular_velocity_s> _vehicle_angular_velocity_gt_pub{ORB_ID(vehicle_angular_velocity_groundtruth)}; |
|
|
|
uORB::Publication<vehicle_angular_velocity_s> _vehicle_angular_velocity_gt_pub{ORB_ID(vehicle_angular_velocity_groundtruth)}; |
|
|
@ -125,6 +130,7 @@ private: |
|
|
|
void equations_of_motion(); |
|
|
|
void equations_of_motion(); |
|
|
|
void reconstruct_sensors_signals(); |
|
|
|
void reconstruct_sensors_signals(); |
|
|
|
void send_gps(); |
|
|
|
void send_gps(); |
|
|
|
|
|
|
|
void send_dist_snsr(); |
|
|
|
void publish_sih(); |
|
|
|
void publish_sih(); |
|
|
|
|
|
|
|
|
|
|
|
perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")}; |
|
|
|
perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")}; |
|
|
@ -135,6 +141,7 @@ private: |
|
|
|
hrt_abstime _gps_time{0}; |
|
|
|
hrt_abstime _gps_time{0}; |
|
|
|
hrt_abstime _mag_time{0}; |
|
|
|
hrt_abstime _mag_time{0}; |
|
|
|
hrt_abstime _serial_time{0}; |
|
|
|
hrt_abstime _serial_time{0}; |
|
|
|
|
|
|
|
hrt_abstime _dist_snsr_time{0}; |
|
|
|
hrt_abstime _now{0}; |
|
|
|
hrt_abstime _now{0}; |
|
|
|
float _dt{0}; // sampling time [s]
|
|
|
|
float _dt{0}; // sampling time [s]
|
|
|
|
bool _grounded{true};// whether the vehicle is on the ground
|
|
|
|
bool _grounded{true};// whether the vehicle is on the ground
|
|
|
@ -177,6 +184,7 @@ private: |
|
|
|
|
|
|
|
|
|
|
|
int _gps_used; |
|
|
|
int _gps_used; |
|
|
|
float _baro_offset_m, _mag_offset_x, _mag_offset_y, _mag_offset_z; |
|
|
|
float _baro_offset_m, _mag_offset_x, _mag_offset_y, _mag_offset_z; |
|
|
|
|
|
|
|
float _distance_snsr_min, _distance_snsr_max; |
|
|
|
|
|
|
|
|
|
|
|
// parameters defined in sih_params.c
|
|
|
|
// parameters defined in sih_params.c
|
|
|
|
DEFINE_PARAMETERS( |
|
|
|
DEFINE_PARAMETERS( |
|
|
@ -205,6 +213,8 @@ private: |
|
|
|
(ParamFloat<px4::params::SIH_BARO_OFFSET>) _sih_baro_offset, |
|
|
|
(ParamFloat<px4::params::SIH_BARO_OFFSET>) _sih_baro_offset, |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_X>) _sih_mag_offset_x, |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_X>) _sih_mag_offset_x, |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_Y>) _sih_mag_offset_y, |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_Y>) _sih_mag_offset_y, |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_Z>) _sih_mag_offset_z |
|
|
|
(ParamFloat<px4::params::SIH_MAG_OFFSET_Z>) _sih_mag_offset_z, |
|
|
|
|
|
|
|
(ParamFloat<px4::params::SIH_DISTSNSR_MIN>) _sih_distance_snsr_min, |
|
|
|
|
|
|
|
(ParamFloat<px4::params::SIH_DISTSNSR_MAX>) _sih_distance_snsr_max |
|
|
|
) |
|
|
|
) |
|
|
|
}; |
|
|
|
}; |
|
|
|