Hello, I am trying to set each rotor thrust for research objective, but something wrong with my PX4 6x settings.
I already set THR_MDL_FAC
to 0.7 in QGroundControl.
Firstly, I call publish_vehicle_command()
and arm()
like this.
this->publish_vehicle_command(VehicleCommand::VEHICLE_CMD_DO_SET_MODE, 1, 6);
this->arm();
After this setup, I call publish_offboard_control_mode()
and publish_actuator_motors()
in every control period, as follows:
void publish_offboard_control_mode()
{
OffboardControlMode msg{};
msg.position = false;
msg.velocity = false;
msg.acceleration = false;
msg.attitude = false;
msg.body_rate = false;
msg.body_rate = false;
msg.thrust_and_torque = false;
msg.direct_actuator = true;
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
offboard_control_mode_pub->publish(msg);
}
void publish_actuator_motors()
{
ActuatorMotors msg{};
msg.control[0] = 0.1; // example
msg.control[1] = 0.2;
msg.control[2] = 0.3;
msg.control[3] = 0.4;
msg.control[4] = 0.5;
msg.control[5] = 0.6;
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
actuator_motors_pub->publish(msg);
}
Is this correct method?