mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 07:41:36 +08:00
Log airflow topics
This commit is contained in:
@@ -155,6 +155,7 @@ void LoggedTopics::add_default_topics()
|
|||||||
add_topic("fixed_wing_longitudinal_setpoint");
|
add_topic("fixed_wing_longitudinal_setpoint");
|
||||||
add_topic("longitudinal_control_configuration");
|
add_topic("longitudinal_control_configuration");
|
||||||
add_topic("lateral_control_configuration");
|
add_topic("lateral_control_configuration");
|
||||||
|
add_topic("airflow");
|
||||||
add_optional_topic("fixed_wing_lateral_guidance_status", 100);
|
add_optional_topic("fixed_wing_lateral_guidance_status", 100);
|
||||||
add_optional_topic("fixed_wing_lateral_status", 100);
|
add_optional_topic("fixed_wing_lateral_status", 100);
|
||||||
add_optional_topic("fixed_wing_runway_control", 100);
|
add_optional_topic("fixed_wing_runway_control", 100);
|
||||||
@@ -222,6 +223,7 @@ void LoggedTopics::add_default_topics()
|
|||||||
param_get(param_find("SYS_HITL"), &sys_hitl);
|
param_get(param_find("SYS_HITL"), &sys_hitl);
|
||||||
|
|
||||||
if (sys_hitl >= 1) {
|
if (sys_hitl >= 1) {
|
||||||
|
add_topic("airflow_groundtruth", 10);
|
||||||
add_topic("vehicle_angular_velocity_groundtruth", 10);
|
add_topic("vehicle_angular_velocity_groundtruth", 10);
|
||||||
add_topic("vehicle_attitude_groundtruth", 10);
|
add_topic("vehicle_attitude_groundtruth", 10);
|
||||||
add_topic("vehicle_global_position_groundtruth", 100);
|
add_topic("vehicle_global_position_groundtruth", 100);
|
||||||
|
|||||||
@@ -582,6 +582,22 @@ void GZBridge::poseInfoCallback(const gz::msgs::Pose_V &msg)
|
|||||||
|
|
||||||
local_position_groundtruth.timestamp = timestamp;
|
local_position_groundtruth.timestamp = timestamp;
|
||||||
_lpos_ground_truth_pub.publish(local_position_groundtruth);
|
_lpos_ground_truth_pub.publish(local_position_groundtruth);
|
||||||
|
|
||||||
|
|
||||||
|
airflow_s airflow_groundtruth;
|
||||||
|
airflow_groundtruth.timestamp = timestamp;
|
||||||
|
// Body-relateive air velocity
|
||||||
|
matrix::Dcmf Rib(matrix::Quatf{(float)q_nb.W(), (float)q_nb.X(), (float)q_nb.Y(), (float)q_nb.Z()});
|
||||||
|
matrix::Vector3f velocity_f = matrix::Vector3f{(float)velocity(0), (float)velocity(1), (float)velocity(2)};
|
||||||
|
matrix::Vector3f body_velocity = Rib.transpose() * velocity_f;
|
||||||
|
airflow_groundtruth.u = body_velocity(0);
|
||||||
|
airflow_groundtruth.v = body_velocity(1);
|
||||||
|
airflow_groundtruth.w = body_velocity(2);
|
||||||
|
///TODO: Include wind
|
||||||
|
airflow_groundtruth.windspeed_north = 0.0;
|
||||||
|
airflow_groundtruth.windspeed_east = 0.0;
|
||||||
|
airflow_groundtruth.windspeed_down = 0.0;
|
||||||
|
_airflow_groundtruth_pub.publish(airflow_groundtruth);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
#include <uORB/topics/vehicle_global_position.h>
|
#include <uORB/topics/vehicle_global_position.h>
|
||||||
#include <uORB/topics/vehicle_local_position.h>
|
#include <uORB/topics/vehicle_local_position.h>
|
||||||
#include <uORB/topics/vehicle_odometry.h>
|
#include <uORB/topics/vehicle_odometry.h>
|
||||||
|
#include <uORB/topics/airflow.h>
|
||||||
|
|
||||||
#include <gz/math.hh>
|
#include <gz/math.hh>
|
||||||
#include <gz/msgs.hh>
|
#include <gz/msgs.hh>
|
||||||
@@ -144,6 +145,7 @@ private:
|
|||||||
uORB::Publication<distance_sensor_s> _distance_sensor_pub{ORB_ID(distance_sensor)};
|
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<differential_pressure_s> _differential_pressure_pub{ORB_ID(differential_pressure)};
|
||||||
uORB::Publication<obstacle_distance_s> _obstacle_distance_pub{ORB_ID(obstacle_distance)};
|
uORB::Publication<obstacle_distance_s> _obstacle_distance_pub{ORB_ID(obstacle_distance)};
|
||||||
|
uORB::Publication<airflow_s> _airflow_groundtruth_pub{ORB_ID(airflow)};
|
||||||
uORB::Publication<vehicle_angular_velocity_s> _angular_velocity_ground_truth_pub{ORB_ID(vehicle_angular_velocity_groundtruth)};
|
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)};
|
uORB::Publication<vehicle_attitude_s> _attitude_ground_truth_pub{ORB_ID(vehicle_attitude_groundtruth)};
|
||||||
uORB::Publication<vehicle_global_position_s> _gpos_ground_truth_pub{ORB_ID(vehicle_global_position_groundtruth)};
|
uORB::Publication<vehicle_global_position_s> _gpos_ground_truth_pub{ORB_ID(vehicle_global_position_groundtruth)};
|
||||||
|
|||||||
Reference in New Issue
Block a user