mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-08 18:30:36 +08:00
Add gz model for quadtailsitter (#23943)
* Add gazebo airspeed plugin and add a tailsitter model --------- Co-authored-by: Claudio Chies <61051109+Claudio-Chies@users.noreply.github.com>
This commit is contained in:
@@ -226,17 +226,15 @@ int GZBridge::init()
|
||||
PX4_WARN("failed to subscribe to %s", lidar_sensor.c_str());
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Airspeed: /world/$WORLD/model/$MODEL/link/airspeed_link/sensor/air_speed/air_speed
|
||||
std::string airpressure_topic = "/world/" + _world_name + "/model/" + _model_name +
|
||||
"/link/airspeed_link/sensor/air_speed/air_speed";
|
||||
std::string airspeed_topic = "/world/" + _world_name + "/model/" + _model_name +
|
||||
"/link/airspeed_link/sensor/air_speed/air_speed";
|
||||
|
||||
if (!_node.Subscribe(airpressure_topic, &GZBridge::airspeedCallback, this)) {
|
||||
PX4_ERR("failed to subscribe to %s", airpressure_topic.c_str());
|
||||
if (!_node.Subscribe(airspeed_topic, &GZBridge::airspeedCallback, this)) {
|
||||
PX4_ERR("failed to subscribe to %s", airspeed_topic.c_str());
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
// Air pressure: /world/$WORLD/model/$MODEL/link/base_link/sensor/air_pressure_sensor/air_pressure
|
||||
std::string air_pressure_topic = "/world/" + _world_name + "/model/" + _model_name +
|
||||
"/link/base_link/sensor/air_pressure_sensor/air_pressure";
|
||||
@@ -449,8 +447,8 @@ void GZBridge::barometerCallback(const gz::msgs::FluidPressure &air_pressure)
|
||||
pthread_mutex_unlock(&_node_mutex);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void GZBridge::airspeedCallback(const gz::msgs::AirSpeedSensor &air_speed)
|
||||
|
||||
void GZBridge::airspeedCallback(const gz::msgs::AirSpeed &air_speed)
|
||||
{
|
||||
if (hrt_absolute_time() == 0) {
|
||||
return;
|
||||
@@ -475,7 +473,6 @@ void GZBridge::airspeedCallback(const gz::msgs::AirSpeedSensor &air_speed)
|
||||
|
||||
pthread_mutex_unlock(&_node_mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
void GZBridge::imuCallback(const gz::msgs::IMU &imu)
|
||||
{
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
|
||||
#include <gz/msgs/imu.pb.h>
|
||||
#include <gz/msgs/fluid_pressure.pb.h>
|
||||
#include <gz/msgs/air_speed.pb.h>
|
||||
#include <gz/msgs/model.pb.h>
|
||||
#include <gz/msgs/odometry_with_covariance.pb.h>
|
||||
#include <gz/msgs/laserscan.pb.h>
|
||||
@@ -106,7 +107,7 @@ private:
|
||||
|
||||
void clockCallback(const gz::msgs::Clock &clock);
|
||||
|
||||
// void airspeedCallback(const gz::msgs::AirSpeedSensor &air_pressure);
|
||||
void airspeedCallback(const gz::msgs::AirSpeed &air_speed);
|
||||
void barometerCallback(const gz::msgs::FluidPressure &air_pressure);
|
||||
void imuCallback(const gz::msgs::IMU &imu);
|
||||
void poseInfoCallback(const gz::msgs::Pose_V &pose);
|
||||
@@ -167,8 +168,8 @@ private:
|
||||
// Subscriptions
|
||||
uORB::SubscriptionInterval _parameter_update_sub{ORB_ID(parameter_update), 1_s};
|
||||
|
||||
//uORB::Publication<differential_pressure_s> _differential_pressure_pub{ORB_ID(differential_pressure)};
|
||||
uORB::Publication<distance_sensor_s> _distance_sensor_pub{ORB_ID(distance_sensor)};
|
||||
uORB::Publication<differential_pressure_s> _differential_pressure_pub{ORB_ID(differential_pressure)};
|
||||
uORB::Publication<obstacle_distance_s> _obstacle_distance_pub{ORB_ID(obstacle_distance)};
|
||||
uORB::Publication<vehicle_angular_velocity_s> _angular_velocity_ground_truth_pub{ORB_ID(vehicle_angular_velocity_groundtruth)};
|
||||
uORB::Publication<vehicle_attitude_s> _attitude_ground_truth_pub{ORB_ID(vehicle_attitude_groundtruth)};
|
||||
|
||||
Reference in New Issue
Block a user