Servers by jDrones

Getting values for MAVlink-NMEA converter from a PX

Hi everyone, I’m building Raspberry Pi based MAVlink - NMEA Python converter, to make it possible to use NMEA devices on Pixhawk/ArduRover boat.
And maybe it’s a rookie question, but I am struggling to find a way to get the values of the parameters I need from Pixhawk to Raspberry - I’ve never before been using Pixhawk, and even in this project I’m only doing this converter separately.
What the converter is doing, it getting some info from Pixhawk (i.e. heading, throttle, rudder angle, bow thruster throttle and so on) and creates NMEA sentences based on them.
And here is the question - let’s take throttle (or RPM, as NMEA calls it) - what is the best way of getting info about it from Pixhawk? I found somewhere in the documentation info about separating throttle and steering, by setting:
SERVO1_FUNCTION = 26 (GroundSteering)
SERVO3_FUNCTION = 70 (Throttle)
But how can I get to the actual value of throttle? Which parameter is it save in? SERVO3_VALUE (I know there is no such parameter, just trying to explain my way of thinking)?
I have a feeling that I’m just missing something really obvious, but what makes it even more difficult is that I have only plain PX for testing, without and motors, compass etc, so I cannot even test it properly
So I’d be extremely grateful if someone will explain to me how to get simple boat parameters from PX
Cheers
Fil

PS: One more think, I am not able to change PX mode, neither in Mission Planner nor via Mavproxy, it’s set for Manual and every try to change it ends up with an error. Why is that?

Is this question so stupid, no-one knows the answer, or what’s wrong with it? :stuck_out_tongue: :stuck_out_tongue:

you could use pymavlink, or you could use scripting to output the required NMEA sentences directly from the flight controller.

https://ardupilot.org/rover/docs/common-lua-scripts.html

Thanks, but I think it’s not exactly what I’m looking for - I’m using Dronekit on Raspberry anyway, so I have easy access to Pixhawk parameters.
But what I’m looking for are data that are being sent from Mission Planner to Pixhawk, like throttle value or ground steering value.
What I mean is: When I set any waypoint in Mission Planner it’s sending some order to Pixhawk, something like ‘turn 20 deg right’, or ‘change throttle to 45%’ or something like that I believe (or am I wrong?)
And I’m wondering if it’s possible to somehow access those data on a companion computer? I don’t need Pixhawk’s heading, I need info how much I need this heading to change to arrive to next waypoint, to convert it to NMEA and send it to steering device.
I hope it’s somehow understandable, what I’d like to achieve

If you’re using dronekit, does your code have something like this?

vehicle = connect("/dev/ttyS0",baud=57600,wait_ready=False) # telemetry usb

If so, then the vehicle object has stuff you might be looking for.
For example: vehicle.channels['6'] shows the PWM value of RC input 6.
vehicle.battery.voltage, vehicle.heading, etc, the dronekit examples list more of these.

If you can’t get out of manual my guess is there is some arming safety check preventing you from arming, is the vehicle armed?

Hi, yes, that’s exactly connect I have
Thank you for that, didn’t know how to read RC channel input, that’ll help a lot!
I know before about ie. vehicle.heading, but not about vehicle.channel!
But one last question, do you know, if there is any way to read Mission Planner input some similar way? Something like, I don’t know, vehicle heading not from this very moment, but the one which vehicle is suppose to follow to get to the waypoint?
Or is Mission Planner just sending waypoint coordinates to Pixhawk and PX is calculating whether it needs to turn left or right to get to the waypoint at some very low level code? But how about speed then?
Yes it’s armed (because I don’t have any device connected I set arming_check for 0, just for testing purposes), but I still can’t change flight mode - when I change Initial-mode it starts with Hold mode, regardless of what is set except Manual, which is working

Servers by jDrones