alireza787b / mavsdk_drone_show

All in one Drone Show and Smart Swarm Solutin for PX4
86 stars 22 forks source link

Error with set_position_velocity_acceleration_ned #4

Closed dbaldwin closed 10 months ago

dbaldwin commented 11 months ago

Hi, first off great job with this project. We have been doing a lot with PX4 over the years and more recently with Crazyflie swarming. I'm interested in learning more about PX4 swarming and stumbled across this repo. Unfortunately I'm running into a problem with some of the examples and errors with set_position_velocity_acceleration_ned:

Waiting for drone to connect...
-- Connected to drone!
Waiting for drone to have a global position estimate...
-- Global position estimate OK
-- Arming
-- Setting initial setpoint
-- Starting offboard
-- Performing trajectory
 Mode number: 10, Description: Initial climbing state
Traceback (most recent call last):
  File "D:\_repos\mavsdk_drone_show\offboard_from_csv.py", line 204, in <module>
    asyncio.run(main())
  File "C:\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "D:\_repos\mavsdk_drone_show\offboard_from_csv.py", line 196, in main
    await asyncio.gather(*tasks)
  File "D:\_repos\mavsdk_drone_show\offboard_from_csv.py", line 153, in run
    await drone.offboard.set_position_velocity_acceleration_ned(
  File "D:\_repos\mavsdk_drone_show\mavsdk\offboard.py", line 1482, in set_position_velocity_acceleration_ned
    response = await self._stub.SetPositionVelocityAccelerationNed(request)
  File "D:\_repos\mavsdk_drone_show\venv\lib\site-packages\aiogrpc\channel.py", line 40, in __call__
    return await fut
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.UNIMPLEMENTED
        details = ""
        debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"", grpc_status:12, created_time:"2023-08-18T19:31:42.3218676+00:00"}"
>
Exception ignored in: <function System.__del__ at 0x000001F7AC62B520>
Traceback (most recent call last):
  File "D:\_repos\mavsdk_drone_show\mavsdk\system.py", line 86, in __del__
  File "D:\_repos\mavsdk_drone_show\mavsdk\system.py", line 122, in _stop_mavsdk_server
ImportError: sys.meta_path is None, Python is likely shutting down

I'm also seeing the same when running the offboard_position_velocity_ned.py script. My MAVSDK version is 1.4.8. Any guidance would be appreciated. Thank you.

alireza787b commented 11 months ago

Hi

Thank you there are what comes to my mind:

MAVSDK Server Version: Firstly, can you check which mavsdk_server version you're currently using? It's crucial to ensure its compatibility with the other components.

Building MAVSDK Server: Did you build mavsdk_server yourself? It's possible that the version of mavsdk_server you're using might not be in sync with the new commands added to mavsdk_python.

Position & Velocity Setpoint: You mentioned trying the position and velocity setpoint in isolation. If you encountered the same error in this scenario, it would be helpful to know if you made any changes to the inputs. For troubleshooting, I recommend modifying all offboard setpoint commands to only position and velocity. Do remember to adjust the input parameters accordingly, specifically to exclude acceleration values.

Check for Old Versions: It's also possible that the versions of mavsdk_python and mavsdk_server installed via pip might still be the older ones. These versions might not have integrated the new functions yet.

dbaldwin commented 10 months ago

@alireza787b thanks for the assistance. Your feedback helped point me in the right direction. It turns out that my server version doesn't support acceleration setpoints, but I can work around it for now. I've modified the api calls to use only position and velocity for now. Everything works very well. You've done a great job with this repo and I'll share a video of some testing that I've done soon.