42 #include <px4_platform_common/log.h> 43 #include <px4_platform_common/tasks.h> 44 #include <px4_platform_common/time.h> 52 #include <sys/types.h> 70 return _gps.copyData(buf, len);
81 if (_parameter_update_sub.updated() || force) {
84 _parameter_update_sub.copy(&pupdate);
98 if (argc == 4 && strcmp(argv[2],
"-u") == 0) {
99 _instance->set_ip(InternetProtocol::UDP);
100 _instance->set_port(atoi(argv[3]));
103 if (argc == 4 && strcmp(argv[2],
"-c") == 0) {
104 _instance->set_ip(InternetProtocol::TCP);
105 _instance->set_port(atoi(argv[3]));
110 _instance->poll_for_MAVLink_messages();
116 PX4_WARN(
"Simulator creation failed");
133 PX4_WARN(
"Usage: simulator {start -[spt] [-u udp_port / -c tcp_port] |stop}");
134 PX4_WARN(
"Start simulator: simulator start");
135 PX4_WARN(
"Connect using UDP: simulator start -u udp_port");
136 PX4_WARN(
"Connect using TCP: simulator start -c tcp_port");
147 if (argc > 1 && strcmp(argv[1],
"start") == 0) {
150 PX4_WARN(
"Simulator already started");
156 SCHED_PRIORITY_DEFAULT,
170 }
else if (argc == 2 && strcmp(argv[1],
"stop") == 0) {
172 PX4_WARN(
"Simulator not running");
static int start(int argc, char *argv[])
__BEGIN_DECLS int simulator_main(int argc, char *argv[])
LED driver API to control the onboard LED(s) via ioctl() interface.
This module interfaces via MAVLink to a software in the loop simulator (SITL) such as jMAVSim or Gaze...
void write_gps_data(void *buf)
void set_ip(InternetProtocol ip)
static Simulator * _instance
bool getGPSSample(uint8_t *buf, int len)
void set_port(unsigned port)
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
static Simulator * getInstance()
static px4_task_t g_sim_task
__BEGIN_DECLS __EXPORT void drv_led_start(void)
void parameters_update(bool force)