Rename differential drive setpoint topics

This commit is contained in:
Matthias Grob 2024-01-22 11:24:50 +01:00 committed by PerFrivik
parent d50fef0aa3
commit 9d44b58af0
5 changed files with 15 additions and 15 deletions

View File

@ -3,4 +3,4 @@ uint64 timestamp # time since system start (microseconds)
float32 speed # [m/s] collective roll-off speed in body x-axis
float32 yaw_rate # [rad/s] yaw rate
# TOPICS feed_forward_differential_drive_setpoint closed_loop_differential_drive_setpoint
# TOPICS differential_drive_setpoint differential_drive_control_output

View File

@ -142,7 +142,7 @@ void DifferentialDriveControl::Run()
_differential_drive_setpoint.speed = manual_control_setpoint.throttle * _param_rdd_speed_scale.get() * _max_speed;
_differential_drive_setpoint.yaw_rate = manual_control_setpoint.roll * _param_rdd_ang_velocity_scale.get() *
_max_angular_velocity;
_feed_forward_differential_drive_setpoint_pub.publish(_differential_drive_setpoint);
_differential_drive_control_output_pub.publish(_differential_drive_setpoint);
}
}
@ -159,19 +159,19 @@ void DifferentialDriveControl::Run()
_differential_drive_setpoint.timestamp = now;
_differential_drive_setpoint.speed = guidance_output(0);
_differential_drive_setpoint.yaw_rate = guidance_output(1);
_closed_loop_differential_drive_setpoint_pub.publish(_differential_drive_setpoint);
_differential_drive_setpoint_pub.publish(_differential_drive_setpoint);
}
// check if the topic is updated and update the setpoint
if (_feed_forward_differential_drive_setpoint_sub.updated()) {
_feed_forward_differential_drive_setpoint_sub.copy(&_differential_drive_setpoint);
if (_differential_drive_control_output_sub.updated()) {
_differential_drive_control_output_sub.copy(&_differential_drive_setpoint);
_speed_pid_output = 0;
_angular_velocity_pid_output = 0;
}
if (_closed_loop_differential_drive_setpoint_sub.updated()) {
_closed_loop_differential_drive_setpoint_sub.copy(&_differential_drive_setpoint);
if (_differential_drive_setpoint_sub.updated()) {
_differential_drive_setpoint_sub.copy(&_differential_drive_setpoint);
_speed_pid_output = pid_calculate(&_speed_pid, _differential_drive_setpoint.speed, _velocity_in_body_frame(0), 0, dt);
_angular_velocity_pid_output = pid_calculate(&_angular_velocity_pid, _differential_drive_setpoint.yaw_rate,

View File

@ -99,8 +99,8 @@ protected:
private:
void Run() override;
uORB::Subscription _feed_forward_differential_drive_setpoint_sub{ORB_ID(feed_forward_differential_drive_setpoint)};
uORB::Subscription _closed_loop_differential_drive_setpoint_sub{ORB_ID(closed_loop_differential_drive_setpoint)};
uORB::Subscription _differential_drive_control_output_sub{ORB_ID(differential_drive_control_output)};
uORB::Subscription _differential_drive_setpoint_sub{ORB_ID(differential_drive_setpoint)};
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
@ -110,8 +110,8 @@ private:
uORB::Subscription _vehicle_local_position_sub{ORB_ID(vehicle_local_position)};
uORB::PublicationMulti<actuator_motors_s> _actuator_motors_pub{ORB_ID(actuator_motors)};
uORB::Publication<differential_drive_setpoint_s> _feed_forward_differential_drive_setpoint_pub{ORB_ID(feed_forward_differential_drive_setpoint)};
uORB::Publication<differential_drive_setpoint_s> _closed_loop_differential_drive_setpoint_pub{ORB_ID(closed_loop_differential_drive_setpoint)};
uORB::Publication<differential_drive_setpoint_s> _differential_drive_control_output_pub{ORB_ID(differential_drive_control_output)};
uORB::Publication<differential_drive_setpoint_s> _differential_drive_setpoint_pub{ORB_ID(differential_drive_setpoint)};
differential_drive_setpoint_s _differential_drive_setpoint{};
vehicle_angular_velocity_s _vehicle_angular_velocity{};

View File

@ -57,8 +57,8 @@ void LoggedTopics::add_default_topics()
add_topic("commander_state");
add_topic("config_overrides");
add_topic("cpuload");
add_optional_topic("feed_forward_differential_drive_setpoint", 100);
add_optional_topic("closed_loop_differential_drive_setpoint", 100);
add_optional_topic("differential_drive_control_output", 100);
add_optional_topic("differential_drive_setpoint", 100);
add_optional_topic("external_ins_attitude");
add_optional_topic("external_ins_global_position");
add_optional_topic("external_ins_local_position");

View File

@ -127,10 +127,10 @@ subscriptions:
- topic: /fmu/in/vehicle_rates_setpoint
type: px4_msgs::msg::VehicleRatesSetpoint
- topic: /fmu/in/feed_forward_differential_drive_setpoint
- topic: /fmu/in/differential_drive_control_output
type: px4_msgs::msg::DifferentialDriveSetpoint
- topic: /fmu/in/closed_loop_differential_drive_setpoint
- topic: /fmu/in/differential_drive_setpoint
type: px4_msgs::msg::DifferentialDriveSetpoint
- topic: /fmu/in/vehicle_visual_odometry