Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc about NT4 MessagePack serialization. #2042

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

truher
Copy link

@truher truher commented Dec 14, 2022

As I mentioned in https://github.com/wpilibsuite/BetaTest/discussions/163 I wrote up an example
of NT4 + MessagePack for Java. This is my first doc contribution, I have no idea what I'm doing,
feedback welcome. @PeterJohnson

to make a little dashboard app that can be run by the Driver Station. These
snippets are simplified, eliding several parts required to make them work.
To run it yourself, check out the complete demo found
`here. <https://github.com/truher/radar>`__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not link to a full demo, we typically don't do that in the docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i felt uncomfortable with that too, but i wanted to be able to provide both the elided version and the version that actually works. one of my favorite things about wpilib is the "make example" button, it gives you something that works. is there another way to achieve that?


public class Target {
public enum Type {
TAG, ALLY, OPPONENT, SELF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be more interesting to teams if this was AprilTag oriented?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll try using the AprilTag class directly and update.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i remember why i didn't do that in the first place: (a) i didn't want to deal with pose3d since it's a 2d visualization and (b) i wanted to use the same representation for other kinds of targets, e.g. other robots, the "self" observer, etc. also i have this tickle in the back of my mind that says you should never use domain objects for IPC, i.e. better to decouple the models of apps that don't get updated or deployed as a unit.

}
}

And there you have it! POJO's passed end to end courtesy of Network Tables 4,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the term POJO anywhere in the docs at present... maybe just say Java object?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

messages can be hard to interpret when things go wrong, for example, an error
about missing dependent libraries doesn't mention **which** dependent library
is missing. See `the project <https://github.com/truher/radar>`__
for details in build.gradle and how to load native code in the application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a section on building desktop NT applications, so this section isn't needed (or should be merged there if relevant).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i started by following those instructions, but they didn't work for me. i struggled with the build for a long time, actually, so i felt like i needed to say something about it; i didn't end up with a gradle file that looked very much like the existing doc. i'm not sure what the sources of trouble really were. inclusion of dependent native libs? usage of beta artifacts? the nonfunctional static initializer loaders? i'm definitely not an expert with any of the gradle stuff, but i'm sure almost none of the wpilib users are either, so i wanted to provide something that would work unmodified. i guess this is kinda the same issue as the first one above: i'd like to be able to provide something that will "just work".

@Daltz333
Copy link
Member

Update on this?

@truher
Copy link
Author

truher commented Jan 13, 2023

sorry, i've been distracted. i'm actually still a bit concerned about being able to supply something that actually works, without including a bunch of detail about gradle. anyway i'll make the changes i know how to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants