50 gazebo::physics::ModelPtr model,
ros::NodeHandle* nh, std::string mav_type)
59 std::string bind_host = nh->
param<std::string>(
"gazebo_host",
"localhost");
61 std::string remote_host = nh->
param<std::string>(
"ROS_host",
"localhost");
62 int remote_port = nh->
param<
int>(
"ROS_port", 14520);
64 set_ports(bind_host, bind_port, remote_host, remote_port);
95 double inclination =
nh_->
param<
double>(
"inclination", 1.14316156541);
96 double declination =
nh_->
param<
double>(
"declination", 0.198584539676);
165 double inclination_ = 1.14316156541;
166 double declination_ = 0.198584539676;
199 y_acc = q_I_NWU.RotateVectorReverse(-
gravity_);
251 (*temperature) = 27.0;
258 ROS_ERROR(
"[gazebo_rosflight_sil] imu not responding");
302 double y_baro = 101325.0f*(float)pow((1-2.25694e-5 * alt), 5.2553);
313 (*pressure) = (float)y_baro;
314 (*temperature) = 27.0f;
327 static double rho_ = 1.225;
334 double y_as = rho_*Va*Va/2.0;
341 *diff_pressure = y_as;
378 for (
size_t i = 0;
i < 14;
i++)
388 return static_cast<float>(
latestRC_.values[channel]-1000)/1000.0;
404 for(
int i=0;
i<14;
i++)
421 std::ifstream memory_file;
422 memory_file.open(directory +
"/mem.bin", std::ios::binary);
424 if(!memory_file.is_open())
426 ROS_ERROR(
"Unable to load rosflight memory file %s/mem.bin", directory.c_str());
430 memory_file.read((
char*) dest, len);
438 std::string mkdir_command =
"mkdir -p " + directory;
439 const int dir_err = system(mkdir_command.c_str());
443 ROS_ERROR(
"Unable to write rosflight memory file %s/mem.bin", directory.c_str());
447 std::ofstream memory_file;
448 memory_file.open(directory +
"/mem.bin", std::ios::binary);
449 memory_file.write((
char*) src, len);
#define GZ_COMPAT_SET_X(VECTOR, VALUE)
#define GZ_COMPAT_GET_GRAVITY(WORLD_PTR)
#define GZ_COMPAT_SET_Z(VECTOR, VALUE)
gazebo::common::Time last_time_
gazebo::physics::WorldPtr world_
void baro_read(float *pressure, float *temperature) override
#define GZ_COMPAT_GET_Z(VECTOR)
double gyro_bias_walk_stdev_
std::uniform_real_distribution< double > uniform_distribution_
void clock_delay(uint32_t milliseconds) override
bool memory_write(const void *src, size_t len) override
double airspeed_bias_range_
void memory_init(void) override
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool diff_pressure_present(void) override
gazebo::math::Vector3 GazeboVector
bool sonar_present(void) override
void led1_off(void) override
void mag_read(float mag[3]) override
bool rc_lost(void) override
#define GZ_COMPAT_GET_X(VECTOR)
void sensors_init() override
rosflight_firmware::BackupData get_backup_data(void) override
double mag_bias_walk_stdev_
#define GZ_COMPAT_GET_RELATIVE_ANGULAR_VEL(LINK_PTR)
uint64_t next_imu_update_time_us_
void gazebo_setup(gazebo::physics::LinkPtr link, gazebo::physics::WorldPtr world, gazebo::physics::ModelPtr model, ros::NodeHandle *nh, std::string mav_type)
float sonar_read(void) override
void led1_on(void) override
void diff_pressure_read(float *diff_pressure, float *temperature) override
void pwm_init(uint32_t refresh_rate, uint16_t idle_pwm) override
void led0_on(void) override
std::normal_distribution< double > normal_distribution_
double acc_bias_walk_stdev_
uint32_t clock_millis() override
bool imu_read(float accel[3], float *temperature, float gyro[3], uint64_t *time_us) override
rosflight_msgs::RCRaw latestRC_
#define GZ_COMPAT_GET_WORLD_POSE(LINK_PTR)
void board_reset(bool bootloader) override
gazebo::math::Pose GazeboPose
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
gazebo::physics::LinkPtr link_
void imu_not_responding_error() override
bool new_imu_data() override
double airspeed_bias_walk_stdev_
uint32_t getNumPublishers() const
const std::string & getNamespace() const
#define GZ_COMPAT_GET_ROT(POSE)
void led1_toggle(void) override
void RCCallback(const rosflight_msgs::RCRaw &msg)
#define GZ_COMPAT_GET_WORLD_LINEAR_ACCEL(LINK_PTR)
void pwm_disable(void) override
uint64_t clock_micros() override
void set_ports(std::string bind_host, uint16_t bind_port, std::string remote_host, uint16_t remote_port)
uint16_t num_sensor_errors(void) override
double baro_bias_walk_stdev_
#define GZ_COMPAT_GET_LENGTH(VECTOR)
bool has_backup_data(void) override
bool baro_present(void) override
float rc_read(uint8_t channel) override
GazeboVector inertial_magnetic_field_
#define GZ_COMPAT_GET_POS(POSE)
double time_since_epoch()
bool mag_present(void) override
std::default_random_engine random_generator_
void init_board(void) override
gazebo::physics::ModelPtr model_
uint64_t imu_update_period_us_
void rc_init(rc_type_t rc_type) override
void led0_off(void) override
void led0_toggle(void) override
#define GZ_COMPAT_GET_SIM_TIME(WORLD_PTR)
void pwm_write(uint8_t channel, float value) override
#define GZ_COMPAT_GET_Y(VECTOR)
#define GZ_COMPAT_GET_RELATIVE_LINEAR_VEL(LINK_PTR)
bool memory_read(void *dest, size_t len) override
#define GZ_COMPAT_SET_Y(VECTOR, VALUE)
gazebo::math::Quaternion GazeboQuaternion