Goodmorning,
I am trying to achieve velocity control using ROS2. I have been trying to modify the offboard control example (this one: ROS 2 Offboard Control Example | PX4 User Guide, provided in px4_ros_com/src/examples/offboard/offboard_control.cpp), obtaining poor results.
As I have understood, it is possible to control velocity only while reaching the specified position. I don’t have problems in controlling the position.
I tried different approaches, as:
set only msg.velocity to true
void OffboardControl::publish_offboard_control_mode() const {
OffboardControlMode msg{};
msg.timestamp = timestamp_.load();
msg.position = false;
msg.velocity = true;
msg.acceleration = false;
msg.attitude = false;
msg.body_rate = false;
offboard_control_mode_publisher_->publish(msg);
}
and then setting
void OffboardControl::publish_trajectory_setpoint() const {
TrajectorySetpoint msg{};
msg.timestamp = timestamp_.load();
msg.vz = -5.0;
trajectory_setpoint_publisher_->publish(msg);
}
However the quadcopter stops rising at a certain altitude, and I don’t understand why. Can someone help me? Thanks in advance.