MAVSDK-Python: action.do_orbit no attribut found error message.
Hi, I am trying to achieve an auto mission with do_orbit function to move the drone in circle facing towards alawys front option. I tried using mavsdk python and it gives the following error.
`Error msg:
Waiting for drone to connect…
Drone discovered!
Waiting for drone to have a global position estimate…
– Global position estimate OK
– Arming
— Taking Off
Traceback (most recent call last):
File “/home/lalith/MAVSDK-Python/testScripts/windmillinspect.py”, line 43, in <module>
asyncio.run(run())
File “/usr/lib/python3.8/asyncio/runners.py”, line 44, in run
return loop.run_until_complete(main)
File “/usr/lib/python3.8/asyncio/base_events.py”, line 616, in run_until_complete return future.result() File “/home/lalith/MAVSDK-Python/testScripts/windmillinspect.py”, line 30, in run await drone.action.do_orbit(radius_m = 5, File “/home/lalith/MAVSDK-Python/drones/lib/python3.8/site-packages/mavsdk/action.py”, line 587, in do_orbit request.yaw_behavior = yaw_behavior.translate_to_rpc() AttributeError: ‘int’ object has no attribute ‘translate_to_rpc’`
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20 (16 by maintainers)
@arpitpara it would be great if you could add an example to https://github.com/mavlink/MAVSDK-Python/tree/main/examples once you have something that nicely works against SITL.
so…analyzing this ulg file with plotjuggler: The drone was for ~10 seconds in ORBIT mode. The navigation mode is written in the
vehicle_status
uORB topic in the fieldnav_state
. As you can see, it’s 21 for around 10 seconds and checking https://github.com/PX4/PX4-Autopilot/blob/main/msg/VehicleStatus.msg you will findNAVIGATION_STATE_ORBIT = 21
.The issue seems that the takeoff didn’t have enough time to do it’s job: the drone reached only 0.5m altitude. Then you gave him the orbit command to orbit somewhere at 2.5m AMSL, even though your flight started at ~488m AMSL.
So my tip: Use
float("nan")
for param7/altitude to use the current vehicle altitude (see https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) and give all the sleeps a little bit more time, especially the takeoff. Or consider a way of checking whether the drone finished takeoff before sending the orbit command. Eventually, the land detector detected the drone touching the earth and caused the drone to disarm.Edit: the altitude graph:
Sorry for pasting the whole code. But there was no error shown. That’s why
I think you are supposed to use the enum instead of raw integers, e.g.