22 changed files with 206 additions and 13 deletions
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
#include <AP_HAL/AP_HAL.h> |
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL && defined(HAL_BUILD_AP_PERIPH) |
||||
|
||||
#include "AP_HAL_SITL.h" |
||||
#include "AP_HAL_SITL_Namespace.h" |
||||
#include "HAL_SITL_Class.h" |
||||
#include "UARTDriver.h" |
||||
#include "Scheduler.h" |
||||
|
||||
#include <stdio.h> |
||||
#include <signal.h> |
||||
#include <unistd.h> |
||||
#include <stdlib.h> |
||||
#include <errno.h> |
||||
#include <sys/select.h> |
||||
|
||||
#include <AP_Param/AP_Param.h> |
||||
#include <SITL/SIM_JSBSim.h> |
||||
#include <AP_HAL/utility/Socket.h> |
||||
|
||||
extern const AP_HAL::HAL& hal; |
||||
|
||||
using namespace HALSITL; |
||||
|
||||
void SITL_State::init(int argc, char * const argv[]) { |
||||
|
||||
} |
||||
|
||||
void SITL_State::wait_clock(uint64_t wait_time_usec) { |
||||
while (AP_HAL::native_micros64() < wait_time_usec) { |
||||
usleep(1000); |
||||
} |
||||
} |
||||
|
||||
|
||||
int SITL_State::gps_pipe(uint8_t index) { |
||||
return 0; |
||||
} |
||||
|
||||
int SITL_State::sim_fd(const char *name, const char *arg) { |
||||
return 0; |
||||
} |
||||
|
||||
int SITL_State::sim_fd_write(const char *name) { |
||||
return 0; |
||||
} |
||||
|
||||
|
||||
#endif //CONFIG_HAL_BOARD == HAL_BOARD_SITL && defined(HAL_BUILD_AP_PERIPH)
|
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
#pragma once |
||||
|
||||
#include <AP_HAL/AP_HAL.h> |
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL && defined(HAL_BUILD_AP_PERIPH) |
||||
|
||||
#include "AP_HAL_SITL.h" |
||||
#include "AP_HAL_SITL_Namespace.h" |
||||
#include "HAL_SITL_Class.h" |
||||
#include "RCInput.h" |
||||
|
||||
#include <sys/types.h> |
||||
#include <sys/socket.h> |
||||
#include <netinet/in.h> |
||||
#include <netinet/udp.h> |
||||
#include <arpa/inet.h> |
||||
|
||||
#include <AP_Baro/AP_Baro.h> |
||||
#include <AP_InertialSensor/AP_InertialSensor.h> |
||||
#include <AP_Compass/AP_Compass.h> |
||||
#include <AP_Terrain/AP_Terrain.h> |
||||
#include <AP_HAL/utility/Socket.h> |
||||
|
||||
class HAL_SITL; |
||||
|
||||
class HALSITL::SITL_State { |
||||
friend class HALSITL::Scheduler; |
||||
friend class HALSITL::Util; |
||||
friend class HALSITL::GPIO; |
||||
public: |
||||
void init(int argc, char * const argv[]); |
||||
int gps_pipe(uint8_t index); |
||||
|
||||
// create a file descriptor attached to a virtual device; type of
|
||||
// device is given by name parameter
|
||||
int sim_fd(const char *name, const char *arg); |
||||
// returns a write file descriptor for a created virtual device
|
||||
int sim_fd_write(const char *name); |
||||
|
||||
bool use_rtscts(void) const { |
||||
return _use_rtscts; |
||||
} |
||||
|
||||
uint16_t base_port(void) const { |
||||
return _base_port; |
||||
} |
||||
|
||||
// simulated airspeed, sonar and battery monitor
|
||||
uint16_t sonar_pin_value; // pin 0
|
||||
uint16_t airspeed_pin_value; // pin 1
|
||||
uint16_t airspeed_2_pin_value; // pin 2
|
||||
uint16_t voltage_pin_value; // pin 13
|
||||
uint16_t current_pin_value; // pin 12
|
||||
uint16_t voltage2_pin_value; // pin 15
|
||||
uint16_t current2_pin_value; // pin 14
|
||||
// paths for UART devices
|
||||
const char *_uart_path[7] { |
||||
"tcp:5860", |
||||
"fifo:/tmp/ap_gps0", |
||||
"tcp:5861", |
||||
"tcp:5862", |
||||
"fifo:/tmp/ap_gps0", |
||||
"tcp:5863", |
||||
"tcp:5864", |
||||
}; |
||||
private: |
||||
|
||||
void wait_clock(uint64_t wait_time_usec); |
||||
bool _use_rtscts; |
||||
uint16_t _base_port; |
||||
|
||||
const char *defaults_path = HAL_PARAM_DEFAULTS_PATH; |
||||
}; |
||||
|
||||
#endif |
Loading…
Reference in new issue