Hello, everyone.
I have encountered an issue during OffboardControlMode. The key point is as follows:
- The drone takes off without any apparent anomalies.
- Subsequently, shortly after reaching its target altitude, the throttle of motors 1 and 3 abruptly drops to zero, causing the drone to fall.
I have attached a screenshot from PlotJuggler, summarizing this incident.
As you can see, _lactuator_motors/control.00
and _lactuator_motors/control.02
suddenly drop to zero when the trajectory setpoint is entered into the FCU.
This behavior has never exhibited during position control mode with RC. Therefore, I assume there is no problem with sensors or parameter settings but rather with OffboardControlMode.
The attached screenshot is a PX4 log message. The drone appears to have fallen around Timestamp 95.00. Subsequently, a Preflight Error is detected at 95.86.
The following function, referred to as the “trajectory setpoint” function, is utilized within the experiment, where hovering position is {0, 0, -1.5}
, initial position is {-4, -4, -1.5}
.
Upon publishing the message “RCLCPP_INFO(this->get_logger(), “’%s’ reached to hovering position!”, namespace_.c_str());”, the drone falls down.
void OffboardControl::publish_trajectory_setpoint()
{
std::string namespace_ = this->get_namespace();
if (!reached_hovering_position_)
{
geometry_msgs::msg::PoseStamped hovering_position_;
hovering_position_.header.frame_id = namespace_;
hovering_position_.pose.position.x = 0;
hovering_position_.pose.position.y = 0;
hovering_position_.pose.position.z = -hover_height_ + ref_alt_; // END
TrajectorySetpoint msg{};
msg.position = {
static_cast<float>(hovering_position_.pose.position.x),
static_cast<float>(hovering_position_.pose.position.y),
static_cast<float>(hovering_position_.pose.position.z) // END
};
// msg.yaw = M_PI / 2; // [-PI:PI]
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
trajectory_setpoint_publisher_->publish(msg);
if (distance(local_position_, hovering_position_) < 0.1)
{
RCLCPP_INFO(this->get_logger(), "'%s' reached to hovering position!", namespace_.c_str());
reached_hovering_position_ = true;
}
}
else
{
// RCLCPP_INFO(this->get_logger(), "'%s' recieve initial position, '%s'", namespace_.c_str(), recieve_initial_position_ ?"true":"false");
if (recieve_initial_position_)
{
TrajectorySetpoint msg{};
msg.position = {
static_cast<float>(initial_position_.pose.position.x),
static_cast<float>(initial_position_.pose.position.y),
static_cast<float>(initial_position_.pose.position.z) // END
};
msg.yaw = 0;
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
trajectory_setpoint_publisher_->publish(msg);
if (distance(local_position_, initial_position_) < 0.1)
{
reached_initial_position_ = true;
custom_files::msg::BoolStamped msg;
msg.header.frame_id = namespace_;
msg.data = reached_initial_position_;
reached_initial_position_publisher_->publish(msg);
if (count < 1)
{
RCLCPP_INFO(this->get_logger(), "'%s' reached to initial position!", namespace_.c_str());
count++;
}
}
}
}
}
I thick it is similar to case 1 of similar issue.
Lastly, the video captures this incident. Please pay attention to the around 18-second that illustrates this “failure.”
Motor throttle 1 & 3 suddenly dropped to zero, completely losing its control.