Hi,
I’m trying to compile a code on sitl using the Offboard’s plugin and the set_position_global class, because i wanna stabilize the drone. I takeoff the vehicle using the AttitudeRate and it begins to fly fordward having all the attributes on 0, I’m only changing the thrust value, so I assigned some attribute values to GlobalPsitionYaw looking for correct the position using the gps, but I got an error with the AltitudeType.
AltitudeType altitude_type {} - altitude type for this position
AttributeError: ‘int’ object has no attribute ‘translate_to_rpc’
I have tryed to use the recomend values on the code
but it doesn’t work.
Thank you for any advice.
Could you paste the code that doesn’t work?
Julian, I am getting similar errors with the code line:
await drone.offboard.set_actuator_control(ActuatorControl([0.5, 0, 0, 0, 0, 0, 0, 0]))
File “/home/diar/MAVSDK-Python/examples/telemetry_circle.py”, line 99, in run
await drone.offboard.set_actuator_control(ActuatorControl([0.5, 0, 0, 0, 0, 0, 0, 0])) # Roll to the right
File “/home/diar/.local/lib/python3.10/site-packages/mavsdk/offboard.py”, line 1255, in set_actuator_control
actuator_control.translate_to_rpc(request.actuator_control)
File “/home/diar/.local/lib/python3.10/site-packages/mavsdk/offboard.py”, line 245, in translate_to_rpc
elem.translate_to_rpc(rpc_elem)
AttributeError: ‘float’ object has no attribute ‘translate_to_rpc’
@Swimmer by the way, I don’t think this API is supported with PX4 v1.14 and later.
For your error, it looks like set_actuator_control() wants an array of groups and not just one group.
See: Offboard — MAVSDK-Python 2.8.1 documentation
Thanks for the response. When you say this API isn’t supported by PX4 v1.14 and later do you mean Offboard isn’t supported? MAVSDK isn’t’ supported? Or set actuator control isn’t supported?
If offboard isn’t supported, what do you suggest we use for SITL testing for PX4 v1.14?
set_actuator_control is not supported. It was removed and the recommendation is to use the ROS 2 bridge instead for direct actuator control.
Offboard otherwise is still supported.
What sort of SITL testing do you have in mind?
Julian,
We have a quadcopter tailsitter. We are adding ailerons (for roll) and are looking to use an offboard command streamer and subject the model to repeatable inputs in stabilized and position flight modes. The thought was to fly a test pattern with no control surfaces enabled to get a stable flight, then explore the differential thrust and control surface effect on roll. Once we are happy with the tuning, we’d start injecting failure modes to make sure the aircraft can handle emergencies appropriately.
What API / approach do you recommend?
For test commands (and not continuous control) set_actuator should work.