mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 01:00:34 +08:00
Auto traj - Add Trajectory logging
- move the update after the integration: a new computed jerk has an impact at the next epoch only - add jerk reduction in case of too large integration time: when a jerk of "min_jerk" during dt is too much - add jerk reduction if the integration time is larger than the predicted one and that integrating that jerk would lead to an acceleration overshoot - rename some variables
This commit is contained in:
@@ -641,6 +641,7 @@ void Logger::add_default_topics()
|
||||
add_topic("sensor_preflight", 200);
|
||||
add_topic("system_power", 500);
|
||||
add_topic("tecs_status", 200);
|
||||
add_topic("trajectory_setpoint");
|
||||
add_topic("telemetry_status");
|
||||
add_topic("vehicle_air_data", 200);
|
||||
add_topic("vehicle_attitude", 30);
|
||||
|
||||
@@ -100,6 +100,7 @@ private:
|
||||
bool _in_smooth_takeoff = false; /**<true if takeoff ramp is applied */
|
||||
|
||||
orb_advert_t _att_sp_pub{nullptr}; /**< attitude setpoint publication */
|
||||
orb_advert_t _traj_sp_pub{nullptr}; /**< trajectory setpoints publication */
|
||||
orb_advert_t _local_pos_sp_pub{nullptr}; /**< vehicle local position setpoint publication */
|
||||
orb_advert_t _traj_wp_avoidance_desired_pub{nullptr}; /**< trajectory waypoint desired publication */
|
||||
orb_advert_t _pub_vehicle_command{nullptr}; /**< vehicle command publication */
|
||||
@@ -218,6 +219,12 @@ private:
|
||||
*/
|
||||
void publish_local_pos_sp(const vehicle_local_position_setpoint_s &local_pos_sp);
|
||||
|
||||
/**
|
||||
* Publish local position setpoint.
|
||||
* This is only required for logging.
|
||||
*/
|
||||
void publish_trajectory_sp(const vehicle_local_position_setpoint_s &traj);
|
||||
|
||||
/**
|
||||
* Checks if smooth takeoff is initiated.
|
||||
* @param position_setpoint_z the position setpoint in the z-Direction
|
||||
@@ -751,6 +758,8 @@ MulticopterPositionControl::run()
|
||||
limit_thrust_during_landing(thr_sp);
|
||||
}
|
||||
|
||||
publish_trajectory_sp(setpoint);
|
||||
|
||||
// Fill local position, velocity and thrust setpoint.
|
||||
vehicle_local_position_setpoint_s local_pos_sp{};
|
||||
local_pos_sp.timestamp = hrt_absolute_time();
|
||||
@@ -1204,6 +1213,18 @@ MulticopterPositionControl::publish_attitude()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MulticopterPositionControl::publish_trajectory_sp(const vehicle_local_position_setpoint_s &traj)
|
||||
{
|
||||
// publish trajectory
|
||||
if (_traj_sp_pub != nullptr) {
|
||||
orb_publish(ORB_ID(trajectory_setpoint), _traj_sp_pub, &traj);
|
||||
|
||||
} else {
|
||||
_traj_sp_pub = orb_advertise(ORB_ID(trajectory_setpoint), &traj);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MulticopterPositionControl::publish_local_pos_sp(const vehicle_local_position_setpoint_s &local_pos_sp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user