This is my first post here and I’m really hoping someone can help me out.
We are developing some guidance routines on an external Linux computer that feeds commands to the autopilot (a Pixhawk 2.0) via the USB serial interface. We are doing this in Python, using Pymavlink.
While I am generally happy with our setup and the Mavlink interface (we can send RC commands to manipulate movement, and receive back attitude information) we now need to use position and velocity set point control, and the Mavlink messages needed for this seem non-existent or unreliable.
What works reliably now:
Sending RC values using RC_CHANNELS_OVERRIDE
Receiving RC values RC_CHANNELS
Receiving attitude from ATTITUDE
Receiving GPS position and fix type using GPS_RAW_INT
Working inconsistently now with Pymavlink and Mission Planner:
Not working at all:
What’s interesting about this problem, is that LOCAL_POSITION_NED has vanished from my T-Logs also in Mission Planner, despite resetting all parameters in the Full Parameter Tree view to default, which sets up the datastreams such that this message should be transmitted (at 2 Hz). This problem is present even with the quad on my desk, and communicating directly from my PC to the micro USB port on the autopilot (it’s not a telemetry drop-out issue). This is without the Lunix computer connected (i.e. Pymavlink not in use at the same time). Pymavlink can be used to set data stream rates of course, but I have overridden these settings with Mission Planner.
This is is the case even while having a valid GPS Fix: ‘3D Fix’ (note that this is in the office, but enough satellites are visible for a fix, and the real-time position shown on the map in Mission Planner is good to within 20m of where I’m sitting).
My simple test is to connect with Mission Planner (directly to autopilot on Serial 0), wait for 3D Fix (in the office), let it sit for 10 seconds, disconnect and check the T-Log for LOCAL_POSITION_NED data.
I have tried multiple settings, and two Copter firmware versions (3.5.4 and 3.5.5).
Right now I’m using:
Mission Planner: 1.3.52 build 126.96.36.199
See screenshot of SR0 datastream settings:
So I’m hoping that by understanding how to get LOCAL_POSITION_NED to be reliably reported to Mission Planner, I will understand how to get this working properly with Pymavlink. It worked great for a time, then I must have altered a setting somewhere and I can’t get it back.
As for the POSITION_TARGET_LOCAL_NED message, this is not in the list of data streams in Mission Planner. Does this message really exist yet? Same goes for CONTROL_SYSTEM_STATE (this contains lots of useful information for this application!).
The plan would be to set position or velocity set points using the message SET_POSITION_TARGET_LOCAL_NED, and verify this using the above two messages. Currently I have no way of telling if this command has got through.
Any thoughts, questions, advice would be much appreciated!!
Some observations / ideas from me:
- GLOBAL_POSITION_INT is received, but this is supposed to be in the same data stream as LOCAL_POSITION_NED.
- Does it take some time / accuracy convergence before LOCAL_POSITION_NED is reported?
Thanks in advance!