Closed TSC21 closed 10 years ago
Thrust ignore bit already set (it's a bit confusing that bit enumeration starts from 1).
I am very confused! Shouldn't we give desired roll, pitch, yaw angle and throttle at the same time? In twist_cb
throttle is set to be 0, it sounds to me that the UAV will just drop down.
In twist_cb
all fields except RPY ignored, so it doesn't change throttle.
I see. Then why don't you add another cb that handels both RPY and throttle at the same time? Now you have to send RPY and throttle one after the other. If they both change frequently, wouldn't it be a burden for the serial port?
@ziyangli Hi, ROS doesn't allow overloading callbacks. The only other way here would be to implement a new message type, which we would rather prefer not to.
@mhkabir , thank you for your promt response! I understand that geometry/Twist is not able to contain the throttle field, but I also think it is normal to implement a new message type in this case, because this is MAVROS, a ros package designed for UAV.
Anyway, if you seperate RPY and throttle into two callbacks only due to the reason you have mentioned, then I can add another callback in my fork, without worrying about making something wrong. Thank you for your answer!
@ziyangli Introducing a new message wouldn't be bad as-such. You can implement a new message with all the fields. Remember to encode the proper bit such that the autopilot uses all the RPYT value. ( I'm not sure if PX4 actually checks it though )
Now the bit 7 allows to ignore the input thrust value. (https://pixhawk.ethz.ch/mavlink/#SET_ATTITUDE_TARGET), which is needed in case of attitude only control.
Bit mapping should be changed in https://github.com/vooon/mavros/blob/master/mavros/src/plugins/setpoint_attitude.cpp#L140 and https://github.com/vooon/mavros/blob/master/mavros/src/plugins/setpoint_attitude.cpp#L164.
A thrust callback can now be added in: https://github.com/vooon/mavros/blob/master/mavros/src/plugins/setpoint_attitude.cpp#L175. The read values can be normalized between 0 and 1 (with the possibility of adding a parameter which sets normalization from -1 to 1 to vehicles capable of reverse thrust). Possible subscription to a std_msgs/Float64 type of msg.