LibrePilot Forum

General Category => General Discussion => Topic started by: treemark on January 30, 2019, 08:34:57 pm

Title: uavobjgenerator -java output
Post by: treemark on January 30, 2019, 08:34:57 pm
I am working on a non-android java implementation of UavTalk and have successfully generated the UAVObjects for java, but those templates have dependencies on the following classes:

import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObjectField;

Does anyone know where I can get the source for these classes? Or any non-android java implementation of UavTalk for that matter?

Mark
Title: Re: uavobjgenerator -java output
Post by: f5soh on January 31, 2019, 12:18:02 am
Hi,

You may find some java files here :

Code: [Select]
./ground/gcs/src/libs/juavtalk
├── build.xml
└── src
    └── org
        └── openpilot
            └── uavtalk
                ├── CRC8.java
                ├── UAVObjectFieldDescription.java
                ├── UAVObject.java
                ├── UAVObjectMetaData.java
                ├── UAVObjectsInterface.java
                ├── UAVTalkDefinitions.java
                ├── UAVTalkHelper.java
                └── ValueParser.java
Title: Re: uavobjgenerator -java output
Post by: treemark on January 31, 2019, 12:49:25 am
Thank you for the quick reply, Unfortunately there are several classes referenced by the templates that aren't there. The best I've been able to find is this old repo.

https://github.com/cberner/openpilot.git

That has the correct class names, but they must be from a previous branch as they are missing a few fields and methods referenced in the templates. I'm guessing  the -java target of uavobjgenerator hasn't been maintained for some time.

I'll kick the classes I have around a little bit and see if I can get it to deserialize some packets.

Is the original open pilot repo available somewhere?
Title: Re: uavobjgenerator -java output
Post by: f5soh on January 31, 2019, 08:07:32 am
Original openpilot repo is here : https://github.com/openpilot/OpenPilot

Maybe should consider update current code and made a PR (https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/84672528/Git+Workflow#GitWorkflow-Createapullrequest).
Title: Re: uavobjgenerator -java output
Post by: treemark on February 02, 2019, 06:47:07 pm
I've got things working reasonably well.  I've successfully deserialized and re-serialized the GCSTelemetryStats object sent by the GCS in UDP mode. I'm now attempting to send those exact bytes to a CC3D via a HID usb serial connection expecting to get some sort of response, but nothing is coming back. Any idea what I'm doing wrong?

I've also looked into the librepilot2go project, looks like they took an entirely different approach by reading the various uavobject XML files at runtime. It's also horribly entangled with the android API, so not ideal for my purposes.

Strangely enough, neither librepilots or the legacy openpilot repos have any references to the missing java imports.

I'd be glad to contribute my implementation back via PR if I can get it working.
Title: Re: uavobjgenerator -java output
Post by: treemark on February 03, 2019, 08:26:54 pm
I think there is a serial/usb connectivity issue going on here, as I can access the pilot's serial telemetry via the main port. Not sure why I can't read anything from the USB interface. The GCS has no problem getting data from the FC, but I get nothing.
Title: Re: uavobjgenerator -java output
Post by: f5soh on February 03, 2019, 10:51:21 pm
Default GCS connexion uses HID, you may need to configure the USB VCP (Virtual Com Port) with USBTelemetry.
(https://forum.librepilot.org/index.php?action=dlattach;topic=4561.0;attach=8072)
Title: Re: uavobjgenerator -java output
Post by: treemark on February 03, 2019, 11:02:10 pm
I'll try that again. Last time I did, I couldn't connect via GCS anymore and ended up having to perform the rescue procedure. Can you have it both ways?

Thank you.

Mark
Title: Re: uavobjgenerator -java output
Post by: f5soh on February 03, 2019, 11:14:01 pm
If you use the VCP you should disable de automatic connexion in Options and connect manually GCS to the Com port.
Title: Re: uavobjgenerator -java output
Post by: treemark on February 04, 2019, 04:34:16 am
That was it, thank you again.