PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <simulator.h>
Classes | |
struct | _hil_local_proj_ref |
Public Types | |
enum | InternetProtocol { InternetProtocol::TCP, InternetProtocol::UDP } |
Public Member Functions | |
bool | getGPSSample (uint8_t *buf, int len) |
void | write_gps_data (void *buf) |
void | set_ip (InternetProtocol ip) |
void | set_port (unsigned port) |
Static Public Member Functions | |
static Simulator * | getInstance () |
static int | start (int argc, char *argv[]) |
Private Member Functions | |
Simulator () | |
~Simulator () | |
int | publish_flow_topic (const mavlink_hil_optical_flow_t *flow) |
int | publish_odometry_topic (const mavlink_message_t *odom_mavlink) |
int | publish_distance_topic (const mavlink_distance_sensor_t *dist) |
mavlink_hil_actuator_controls_t | actuator_controls_from_outputs (const actuator_outputs_s &actuators) |
void | handle_message (const mavlink_message_t *msg) |
void | handle_message_distance_sensor (const mavlink_message_t *msg) |
void | handle_message_hil_gps (const mavlink_message_t *msg) |
void | handle_message_hil_sensor (const mavlink_message_t *msg) |
void | handle_message_hil_state_quaternion (const mavlink_message_t *msg) |
void | handle_message_landing_target (const mavlink_message_t *msg) |
void | handle_message_odometry (const mavlink_message_t *msg) |
void | handle_message_optical_flow (const mavlink_message_t *msg) |
void | handle_message_rc_channels (const mavlink_message_t *msg) |
void | handle_message_vision_position_estimate (const mavlink_message_t *msg) |
void | parameters_update (bool force) |
void | poll_topics () |
void | poll_for_MAVLink_messages () |
void | request_hil_state_quaternion () |
void | send () |
void | send_controls () |
void | send_heartbeat () |
void | send_mavlink_message (const mavlink_message_t &aMsg) |
void | update_sensors (const hrt_abstime &time, const mavlink_hil_sensor_t &imu) |
void | update_gps (const mavlink_hil_gps_t *gps_sim) |
Static Private Member Functions | |
static void * | sending_trampoline (void *) |
Static Private Attributes | |
static Simulator * | _instance = nullptr |
Definition at line 156 of file simulator.h.
|
strong |
Enumerator | |
---|---|
TCP | |
UDP |
Definition at line 161 of file simulator.h.
|
inlineprivate |
Definition at line 176 of file simulator.h.
References simulator::RawGPSData::eph, and hrt_absolute_time().
|
inlineprivate |
Definition at line 191 of file simulator.h.
References perf_free().
|
private |
Definition at line 77 of file simulator_mavlink.cpp.
References armed, hrt_absolute_time(), mode_flag_armed, mode_flag_custom, msg, actuator_outputs_s::output, PWM_DEFAULT_MAX, and PWM_DEFAULT_MIN.
bool Simulator::getGPSSample | ( | uint8_t * | buf, |
int | len | ||
) |
Definition at line 68 of file simulator.cpp.
Referenced by GPSSIM::receive().
|
static |
Definition at line 63 of file simulator.cpp.
Referenced by GPSSIM::receive(), and simulator_main().
|
private |
Definition at line 291 of file simulator_mavlink.cpp.
|
private |
Definition at line 332 of file simulator_mavlink.cpp.
|
private |
Definition at line 339 of file simulator_mavlink.cpp.
|
private |
Definition at line 347 of file simulator_mavlink.cpp.
References abstime_to_ts(), armed, f(), math::gradual(), hrt_absolute_time(), hrt_abstime, hrt_elapsed_time(), math::max(), ORB_ID, ORB_PRIO_HIGH, and orb_publish_auto().
|
private |
Definition at line 410 of file simulator_mavlink.cpp.
References matrix::Matrix< Type, M, N >::copyTo(), vehicle_local_position_s::hagl_max, vehicle_local_position_s::hagl_min, hrt_absolute_time(), map_projection_init(), map_projection_project(), ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), matrix::Euler< Type >::psi(), vehicle_local_position_s::ref_alt, vehicle_local_position_s::ref_lat, vehicle_local_position_s::ref_lon, vehicle_local_position_s::ref_timestamp, vehicle_global_position_s::timestamp, vehicle_angular_velocity_s::timestamp, vehicle_local_position_s::timestamp, vehicle_attitude_s::timestamp, vehicle_local_position_s::v_xy_valid, vehicle_local_position_s::v_z_valid, vehicle_local_position_s::vx, vehicle_local_position_s::vxy_max, vehicle_local_position_s::vy, vehicle_local_position_s::vz, vehicle_local_position_s::vz_max, vehicle_local_position_s::x, vehicle_local_position_s::xy_global, vehicle_local_position_s::xy_valid, vehicle_local_position_s::y, vehicle_local_position_s::yaw, vehicle_local_position_s::z, vehicle_local_position_s::z_global, and vehicle_local_position_s::z_valid.
|
private |
Definition at line 513 of file simulator_mavlink.cpp.
References hrt_absolute_time(), ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), irlock_report_s::pos_x, irlock_report_s::pos_y, irlock_report_s::signature, irlock_report_s::size_x, irlock_report_s::size_y, and irlock_report_s::timestamp.
|
private |
Definition at line 531 of file simulator_mavlink.cpp.
|
private |
Definition at line 536 of file simulator_mavlink.cpp.
|
private |
Definition at line 543 of file simulator_mavlink.cpp.
References fill_rc_input_msg(), ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), and rc_channels.
|
private |
Definition at line 554 of file simulator_mavlink.cpp.
|
private |
Definition at line 78 of file simulator.cpp.
|
private |
Definition at line 660 of file simulator_mavlink.cpp.
References _addrlen, _buf, _fd, _srcaddr, B460800, B921600, msg, ORB_ID, orb_subscribe(), orb_subscribe_multi(), orb_unsubscribe(), read(), sending_trampoline(), and system_sleep.
|
private |
Definition at line 580 of file simulator_mavlink.cpp.
References orb_check(), orb_copy(), and ORB_ID.
|
private |
Definition at line 1095 of file simulator_mavlink.cpp.
References distance_sensor_s::current_distance, f(), distance_sensor_s::h_fov, hrt_absolute_time(), distance_sensor_s::id, distance_sensor_s::max_distance, distance_sensor_s::min_distance, OK, ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), distance_sensor_s::orientation, distance_sensor_s::q, distance_sensor_s::signal_quality, vehicle_odometry_s::timestamp, distance_sensor_s::timestamp, distance_sensor_s::type, distance_sensor_s::v_fov, and distance_sensor_s::variance.
|
private |
Definition at line 940 of file simulator_mavlink.cpp.
References optical_flow_s::frame_count_since_last_readout, optical_flow_s::ground_distance_m, optical_flow_s::gyro_temperature, optical_flow_s::gyro_x_rate_integral, optical_flow_s::gyro_y_rate_integral, optical_flow_s::gyro_z_rate_integral, hrt_absolute_time(), optical_flow_s::integration_timespan, optical_flow_s::max_flow_rate, optical_flow_s::max_ground_distance, optical_flow_s::min_ground_distance, OK, ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), param_find(), param_get(), optical_flow_s::pixel_flow_x_integral, optical_flow_s::pixel_flow_y_integral, optical_flow_s::quality, rotate_3f(), optical_flow_s::sensor_id, optical_flow_s::time_since_last_sonar_update, and optical_flow_s::timestamp.
|
private |
Definition at line 988 of file simulator_mavlink.cpp.
References matrix::Matrix< Type, M, N >::copyTo(), hrt_absolute_time(), vehicle_odometry_s::local_frame, OK, ORB_ID, ORB_PRIO_HIGH, orb_publish_auto(), vehicle_odometry_s::pitchspeed, vehicle_odometry_s::pose_covariance, vehicle_odometry_s::q, vehicle_odometry_s::rollspeed, optical_flow_s::timestamp, vehicle_odometry_s::timestamp, vehicle_odometry_s::velocity_covariance, vehicle_odometry_s::vx, vehicle_odometry_s::vy, vehicle_odometry_s::vz, vehicle_odometry_s::x, vehicle_odometry_s::y, vehicle_odometry_s::yawspeed, and vehicle_odometry_s::z.
|
private |
Definition at line 639 of file simulator_mavlink.cpp.
|
private |
Definition at line 598 of file simulator_mavlink.cpp.
References mpu9x50::parameters_update(), and px4_poll().
|
private |
Definition at line 172 of file simulator_mavlink.cpp.
References orb_check(), orb_copy(), and ORB_ID.
|
private |
Definition at line 650 of file simulator_mavlink.cpp.
|
private |
Definition at line 559 of file simulator_mavlink.cpp.
References _fd, _srcaddr, and send().
|
staticprivate |
Definition at line 592 of file simulator_mavlink.cpp.
Referenced by poll_for_MAVLink_messages().
void Simulator::set_ip | ( | InternetProtocol | ip | ) |
Definition at line 121 of file simulator.cpp.
void Simulator::set_port | ( | unsigned | port | ) |
Definition at line 126 of file simulator.cpp.
|
static |
Definition at line 91 of file simulator.cpp.
References drv_led_start().
Referenced by simulator_main().
|
private |
Definition at line 271 of file simulator_mavlink.cpp.
References simulator::RawGPSData::alt, simulator::RawGPSData::cog, simulator::RawGPSData::eph, simulator::RawGPSData::epv, simulator::RawGPSData::fix_type, gps, hrt_absolute_time(), simulator::RawGPSData::lat, simulator::RawGPSData::lon, simulator::RawGPSData::satellites_visible, simulator::RawGPSData::timestamp, simulator::RawGPSData::vd, simulator::RawGPSData::ve, simulator::RawGPSData::vel, and simulator::RawGPSData::vn.
|
private |
Definition at line 222 of file simulator_mavlink.cpp.
References ll40ls::instance, ORB_ID, ORB_PRIO_DEFAULT, orb_publish_auto(), and differential_pressure_s::timestamp.
void Simulator::write_gps_data | ( | void * | buf | ) |
Definition at line 73 of file simulator.cpp.
|
private |
Definition at line 280 of file simulator.h.
|
private |
Definition at line 296 of file simulator.h.
|
private |
Definition at line 274 of file simulator.h.
|
private |
Definition at line 241 of file simulator.h.
|
private |
Definition at line 222 of file simulator.h.
|
private |
Definition at line 242 of file simulator.h.
|
private |
Definition at line 223 of file simulator.h.
|
private |
Definition at line 224 of file simulator.h.
|
private |
Definition at line 225 of file simulator.h.
|
private |
Definition at line 275 of file simulator.h.
|
private |
Definition at line 215 of file simulator.h.
|
private |
Definition at line 286 of file simulator.h.
|
private |
Definition at line 290 of file simulator.h.
|
private |
Definition at line 288 of file simulator.h.
|
private |
Definition at line 289 of file simulator.h.
|
private |
Definition at line 291 of file simulator.h.
|
staticprivate |
Definition at line 207 of file simulator.h.
|
private |
Definition at line 233 of file simulator.h.
|
private |
Definition at line 226 of file simulator.h.
|
private |
Definition at line 237 of file simulator.h.
|
private |
Definition at line 238 of file simulator.h.
|
private |
Definition at line 276 of file simulator.h.
|
private |
Definition at line 295 of file simulator.h.
|
private |
Definition at line 229 of file simulator.h.
|
private |
Definition at line 217 of file simulator.h.
|
private |
Definition at line 218 of file simulator.h.
|
private |
Definition at line 219 of file simulator.h.
|
private |
Definition at line 231 of file simulator.h.
|
private |
Definition at line 210 of file simulator.h.
|
private |
Definition at line 213 of file simulator.h.
|
private |
Definition at line 211 of file simulator.h.
|
private |
Definition at line 212 of file simulator.h.
|
private |
Definition at line 277 of file simulator.h.
|
private |
Definition at line 294 of file simulator.h.
|
private |
How fast the simulation runs in comparison to real system time.
Definition at line 235 of file simulator.h.
|
private |
Definition at line 273 of file simulator.h.
|
private |
Definition at line 297 of file simulator.h.
|
private |
Definition at line 281 of file simulator.h.
|
private |
Definition at line 227 of file simulator.h.