mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 00:03:34 +08:00
make mixer to radps scaling a param and raise default
This commit is contained in:
@@ -74,7 +74,6 @@ private:
|
|||||||
}outputs;
|
}outputs;
|
||||||
|
|
||||||
void mix();
|
void mix();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const MultirotorMixer::Rotor _config_x[] = {
|
const MultirotorMixer::Rotor _config_x[] = {
|
||||||
@@ -88,11 +87,15 @@ const MultirotorMixer::Rotor _config_x[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultirotorMixer::MultirotorMixer():
|
MultirotorMixer::MultirotorMixer():
|
||||||
|
_n(),
|
||||||
_rotor_count(4),
|
_rotor_count(4),
|
||||||
_rotors(_config_index)
|
_rotors(_config_index)
|
||||||
{
|
{
|
||||||
_sub = _n.subscribe("actuator_controls_0", 1000, &MultirotorMixer::actuatorControlsCallback,this);
|
_sub = _n.subscribe("actuator_controls_0", 1000, &MultirotorMixer::actuatorControlsCallback,this);
|
||||||
_pub = _n.advertise<mav_msgs::MotorSpeed>("/mixed_motor_commands",10);
|
_pub = _n.advertise<mav_msgs::MotorSpeed>("/mixed_motor_commands",10);
|
||||||
|
if (!_n.hasParam("motor_scaling_radps")) {
|
||||||
|
_n.setParam("motor_scaling_radps", 2000.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultirotorMixer::mix() {
|
void MultirotorMixer::mix() {
|
||||||
@@ -168,8 +171,10 @@ void MultirotorMixer::mix() {
|
|||||||
|
|
||||||
// publish message
|
// publish message
|
||||||
mav_msgs::MotorSpeed rotor_vel_msg;
|
mav_msgs::MotorSpeed rotor_vel_msg;
|
||||||
|
double scaling;
|
||||||
|
_n.getParamCached("motor_scaling_radps", scaling);
|
||||||
for (int i = 0; i < _rotor_count; i++) {
|
for (int i = 0; i < _rotor_count; i++) {
|
||||||
rotor_vel_msg.motor_speed.push_back(outputs.control[i] * 1000);
|
rotor_vel_msg.motor_speed.push_back(outputs.control[i] * scaling);
|
||||||
}
|
}
|
||||||
_pub.publish(rotor_vel_msg);
|
_pub.publish(rotor_vel_msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user