diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-31 09:14:59 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-31 09:14:59 +0100 |
commit | bc5fe30270d450ae6e22f69b2fd6b7ff252e8bb1 (patch) | |
tree | 9d487e5afe4c2f206294d67132cee12f52eaabd5 /src/platforms/ros/nodes | |
parent | 255ba24288d1b284bd2200a83b4c5ffe5292929d (diff) | |
download | px4-firmware-bc5fe30270d450ae6e22f69b2fd6b7ff252e8bb1.tar.gz px4-firmware-bc5fe30270d450ae6e22f69b2fd6b7ff252e8bb1.tar.bz2 px4-firmware-bc5fe30270d450ae6e22f69b2fd6b7ff252e8bb1.zip |
make mixer to radps scaling a param and raise default
Diffstat (limited to 'src/platforms/ros/nodes')
-rw-r--r-- | src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp b/src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp index 69d69dcf8..61ee13ecd 100644 --- a/src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp +++ b/src/platforms/ros/nodes/mc_mixer/mc_mixer.cpp @@ -74,7 +74,6 @@ private: }outputs; void mix(); - }; const MultirotorMixer::Rotor _config_x[] = { @@ -88,11 +87,15 @@ const MultirotorMixer::Rotor _config_x[] = { }; MultirotorMixer::MultirotorMixer(): + _n(), _rotor_count(4), _rotors(_config_index) { _sub = _n.subscribe("actuator_controls_0", 1000, &MultirotorMixer::actuatorControlsCallback,this); _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() { @@ -168,8 +171,10 @@ void MultirotorMixer::mix() { // publish message mav_msgs::MotorSpeed rotor_vel_msg; + double scaling; + _n.getParamCached("motor_scaling_radps", scaling); 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); } |