stronnag / mwptools

ground station, mission planner and tools for inav and multiwii-nav
http://stronnag.github.io/mwptools/
GNU General Public License v3.0
190 stars 35 forks source link

MWP Not showing / detecting Radar tracked Crafts from ESP32 Radar #154

Closed b14ckyy closed 8 months ago

b14ckyy commented 8 months ago

Description

MWP is not showing any Radar tracked crafts when a TTGO LoRa V1.0 Module is connected to the GCS Hardware. Neither in Primary connect mode nor in Telemetry Tracking mode.

Used Hardware and Software

Issue 1

image

issue 2

LOGS: Logs.zip (You can Ignore USB0 Logs, this is the TTGO own USB Serial port that's inactive, USB1 is the UART Conenction.

stronnag commented 8 months ago

Thanks. It looks like Telem Tracker breaks --radar-device. may take a little while to get to the bottom of this ...

No, I just have to use the correct device nodes

# back to back /dev/ttyUSB0 and /dev/rfcomm4 (ttl-usb and BT)
# In one terminal
mwp --radar-device=/dev/ttyUSB0  --centre "54.353972 -4.523611"
# In another terminal
./mwp-inav-radar-sim -d /dev/rfcomm4 -v

And simulated INAV-Radar tracks appear.

So --radar-device works OK with Telem Tracker, that's good.

stronnag commented 8 months ago

Confirmed --radar-device is not recognised from cmdopts Fixed locally, not yet pushed.

stronnag commented 8 months ago

@b14ckyy Can you please do a simple test for me:

i.e. I'd like to see the unambiguous effect of one radar device.

# /dev/ttyUSBx represents the USB device connected to the RADAR 
mwp --radar-device=/dev/ttyUSBx --debug-flags=20 --raw-log

If it's working, as well as RADAR tracks, there will be log entries like:

13:07:11.801660 RDR-msg: MSP_CMDS_NAME
13:07:11.832943 RDR-msg: MSP_CMDS_FC_VARIANT
13:07:11.862969 RDR-msg: MSP_CMDS_FC_VERSION
13:07:11.870482 RDR-msg: MSP_CMDS_RAW_GPS
13:07:11.870540 RDR-rgps: Lat, Lon 54.353972 -4.523611
13:07:11.870560 RDR-rgps: 02 2a 08 c2 65 20 73 c0 4d fd 00 00 00 00 00 00 63 00
13:07:12.083557 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
13:07:12.084574 RDR-recv 0: Lat, Lon 54.354010 -4.523533
13:07:12.084649 RDR-recv: 00 01 85 c3 65 20 7b c3 4d fd a6 13 00 00 31 00 21 05 01
13:07:12.207116 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
13:07:12.207398 RDR-recv 1: Lat, Lon 54.353916 -4.523525
13:07:12.207411 RDR-recv: 01 01 dc bf 65 20 c9 c3 4d fd 6a 13 00 00 8a 00 7b 06 01

If it's working, we can look at generating udev rules to disambiguate the radar devices, if it doesn't work, please let me have the mwp_stderr and raw logs.

If you wish, repeat from the top for the other radar device (especially if the doesn't work).

b14ckyy commented 8 months ago

@stronnag For clarification: I just used the same radar device all the time. Just switched it between Node-Operation and GS-Operation modes.

I assume you want me to test both operation modes then? No problem will do in a bit.

stronnag commented 8 months ago

@stronnag For clarification: I just used the same radar device all the time. Just switched it between Node-Operation and GS-Operation modes.

OK.

I assume you want me to test both operation modes then? No problem will do in a bit.

That would be useful to test both in the simplest usage case.

Thanks

b14ckyy commented 8 months ago

My order of steps:

So when I put the radar device into the command line for launch it detects the radar module in NODE mode and sets it into GS mode automatically. Also tested it in forced GS mode and that also works. But adding the radar device into cmdopts it seems not to work at all.

image

Also the USB device does not list anymore in the Telemetry Tracker Window but I can see the INAV node now when I power it on. Not sure if that's supposed to be.

One thing I notice now is, that if the Module is booted before MWP is up then it won't connect. I have to reset the module once MWP is started. Not sure if its possible for MWP to reset it over UART though, I guess its a Radar firmware limitation.

Update: I just realize that the radar view does not get updated. I get an initial position and can see that on the map but no further updates afterwards. I attach the logs here in a sec. New Logs with serial raw: mwp_stderr_2023-10-20.txt.zip

stronnag commented 8 months ago

Thanks, that looks good.

From the logs, the location is never changed. The status is "undefined" (a value that comes from the radar module), ["Undefined", "Armed", "Hidden", "Stale"]. TheLast` and fields to the right are only updated if the status is not "Undefined".

From your stderr log:

2023-10-20T15:59:17+0200 RDR-msg: MSP_CMDS_FC_VARIANT
2023-10-20T15:59:17+0200 RDR-msg: MSP_CMDS_FC_VERSION
2023-10-20T15:59:17+0200 RDR-msg: MSP_CMDS_NAME
2023-10-20T15:59:23+0200 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
2023-10-20T15:59:23+0200 RDR-recv 0: Lat, Lon 51.488640 11.977810
2023-10-20T15:59:23+0200 RDR-recv: 00 00 00 8b b0 1e 34 ab 23 07 28 3c 00 00 69 00 00 00 00
2023-10-20T15:59:23+0200 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
2023-10-20T15:59:23+0200 RDR-recv 0: Lat, Lon 51.488640 11.977810
2023-10-20T15:59:23+0200 RDR-recv: 00 00 00 8b b0 1e 34 ab 23 07 28 3c 00 00 69 00 00 00 00
2023-10-20T15:59:23+0200 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
2023-10-20T15:59:23+0200 RDR-recv 0: Lat, Lon 51.488640 11.977810
2023-10-20T15:59:23+0200 RDR-recv: 00 00 00 8b b0 1e 34 ab 23 07 28 3c 00 00 69 00 00 00 00
2023-10-20T15:59:23+0200 RDR-msg: MSP_CMDS_COMMON_SET_RADAR_POS
2023-10-20T15:59:23+0200 RDR-recv 0: Lat, Lon 51.488640 11.977810
2023-10-20T15:59:23+0200 RDR-recv: 00 00 00 8b b0 1e 34 ab 23 07 28 3c 00 00 69 00 00 00 00

Note: I've replayed this as:

One terminal

mwp --radar-device udp://:30001 --debug-flags 20

Second terminal

mwp-log-replay -d udp://localhost:30001 mwp._dev_ttyUSB0.2023-10-20T155826.raw

I'm fixing the failure to read the predefined --radar-device from the cmdopts --- I'll let you when that's done (properly, I have an ugly workaround).

b14ckyy commented 8 months ago

Maybe undefined is because its not armed. I will play around a bit to see how it behaves. At least one issue is solved and I am not crazy or utterly stupid :P The internal UART of the Pi should then also not be a problem anymore. I will also doublecheck if MAYBE the USB works as well instead as I prefer USB connection to keep the UART for the ERLS Airport.

stronnag commented 8 months ago

The parsing of cmdopts --radar-device is fixed by e0ae7b3a. As I think that was the only real (code) issue, I'll close this later unless you have anything else to add on radar.

b14ckyy commented 8 months ago

Not more on the MWP side then. I think there is a issue with the Radar Firmware probably. So I will test other versions now. Even when armed the status does not change and no updates coming in but as you said, the module does not send more image

it seems like very rarely I get an update in. Maybe the planes have to actually move I will see.

Just one question: When I set the "Enabled" box for a radar device, it will switch into radar tracking on demand. But when I launch MWP with the radar device cli option this port is completely blocked for telemetry radar and cannot be disabled afterwards in the gui, right? Just for my understanding.

b14ckyy commented 8 months ago

@stronnag I think the pasing is still not working. It works when I use command line but not with cmdopts image

stronnag commented 8 months ago

Just one question: When I set the "Enabled" box for a radar device, it will switch into radar tracking on demand. But when I launch MWP with the radar device cli option this port is completely blocked for telemetry radar and cannot be disabled afterwards in the gui, right? Just for my understanding.

In order to define a radar service you must use --radar-device, either in cmdopts (how about a system wide one?) or on the command line.

The devices listed in the "Telemetry Tracker" are not radar devices, they are for telemetry tracking. So another pilot (without the radar module) could forward telemtry from her transmitter (CRSF, S.Port, IBus), for example in ETX/OTX "Telemetry Mirror" and a BT dongle and it would appear in mwp, both on the map and in the "Radar View" list.

https://www.daria.co.uk/mwptools/mwp-Radar-View/

https://www.daria.co.uk/mwptools/mwp-telemetry-tracker/

@stronnag I think the pasing is still not working. It works when I use command line but not with cmdopts

Damn it. When I removed the debug messages, I must have borken it. Let me try again.

b14ckyy commented 8 months ago

Doing another test right now. And yes it seems like clearly the GS mode is broken on Radar. When I define a GCS Location in MWP so it fakes itself as an INAV FC and radar is in normal Node-Operation I get perfect updates once a second while flying in the X-Plane simulator. This clearly works. but in GS mode it seems to output a new position just once every few minutes if at all.

EDIT same with the old 2.2 version

stronnag commented 8 months ago

Damn it. When I removed the debug messages, I must have borken it. Let me try again.

Just failed to appreciate that --radar-device 35:53:17:04:14:BA (worked) and --radar-device=35:53:17:04:14:BA (broken) needed to be handled specifically / separately. Should be fixed by a0cd8aa3

This clearly works. but in GS mode it seems to output a new position just once every few minutes if at all.

This is indeed down to the firmware; once the initial conversation has happened, the radar device just pushes location updates to a passive mwp.

b14ckyy commented 8 months ago

OK all working good now. In this case I will need to find a workaround to keep the module in Node-Operation without the need to manually set a GS location everytime. I hope this woll work better then with FormationFlight when its ready. Thanks a lot for the fix