Merged cmake-2

This commit is contained in:
Lorenz Meier
2015-09-20 11:37:28 +02:00
5 changed files with 193 additions and 155 deletions
+52 -48
View File
@@ -53,24 +53,25 @@
#include <uORB/uORB.h>
#include <v1.0/mavlink_types.h>
#include <v1.0/common/mavlink.h>
namespace simulator {
namespace simulator
{
// FIXME - what is the endianness of these on actual device?
#pragma pack(push, 1)
struct RawAccelData {
float temperature;
float x;
float y;
float z;
float temperature;
float x;
float y;
float z;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct RawMagData {
float temperature;
float x;
float y;
float z;
float temperature;
float x;
float y;
float z;
};
#pragma pack(pop)
@@ -103,22 +104,23 @@ struct RawAirspeedData {
#pragma pack(push, 1)
struct RawGPSData {
int32_t lat;
int32_t lon;
int32_t alt;
uint16_t eph;
uint16_t epv;
uint16_t vel;
int16_t vn;
int16_t ve;
int16_t vd;
uint16_t cog;
uint8_t fix_type;
uint8_t satellites_visible;
int32_t lat;
int32_t lon;
int32_t alt;
uint16_t eph;
uint16_t epv;
uint16_t vel;
int16_t vn;
int16_t ve;
int16_t vd;
uint16_t cog;
uint8_t fix_type;
uint8_t satellites_visible;
};
#pragma pack(pop)
template <typename RType> class Report {
template <typename RType> class Report
{
public:
Report(int readers) :
_readidx(0),
@@ -135,6 +137,7 @@ public:
if (len != _report_len) {
return false;
}
read_lock();
memcpy(outbuf, &_buf[_readidx], _report_len);
read_unlock();
@@ -153,13 +156,13 @@ protected:
void read_unlock() { px4_sem_post(&_lock); }
void write_lock()
{
for (int i=0; i<_max_readers; i++) {
for (int i = 0; i < _max_readers; i++) {
px4_sem_wait(&_lock);
}
}
void write_unlock()
{
for (int i=0; i<_max_readers; i++) {
for (int i = 0; i < _max_readers; i++) {
px4_sem_post(&_lock);
}
}
@@ -173,7 +176,8 @@ protected:
};
class Simulator {
class Simulator
{
public:
static Simulator *getInstance();
@@ -211,32 +215,32 @@ public:
private:
Simulator() :
_accel(1),
_mpu(1),
_baro(1),
_mag(1),
_gps(1),
_airspeed(1),
_accel_pub(nullptr),
_baro_pub(nullptr),
_gyro_pub(nullptr),
_mag_pub(nullptr),
_initialized(false)
_accel(1),
_mpu(1),
_baro(1),
_mag(1),
_gps(1),
_airspeed(1),
_accel_pub(nullptr),
_baro_pub(nullptr),
_gyro_pub(nullptr),
_mag_pub(nullptr),
_initialized(false)
#ifndef __PX4_QURT
,
_rc_channels_pub(nullptr),
_actuator_outputs_sub(-1),
_vehicle_attitude_sub(-1),
_manual_sub(-1),
_vehicle_status_sub(-1),
_rc_input{},
_actuators{},
_attitude{},
_manual{},
_vehicle_status{}
,
_rc_channels_pub(nullptr),
_actuator_outputs_sub(-1),
_vehicle_attitude_sub(-1),
_manual_sub(-1),
_vehicle_status_sub(-1),
_rc_input{},
_actuators{},
_attitude{},
_manual{},
_vehicle_status{}
#endif
{}
~Simulator() { _instance=NULL; }
~Simulator() { _instance = NULL; }
void initializeSensorData();