Skip to content

Conversation

@SamCarlberg
Copy link
Member

@SamCarlberg SamCarlberg commented Mar 23, 2016

How to use the publishing operations

Use them in the UI just like a NetworkTable publish operation

Getting the data

All data published will be at http://localhost:8080/GRIP/data (or whatever port you set in the settings) in json format. To get specific data, put their names as parameters in the URL -- e.g. if you want myContoursReport and myBlobsReport, go to http://localhost:8080/GRIP/data?myContoursReport&myBlobsReport

HTTP image source

GRIP-side

Just use it like a normal image source. The URL is configurable under /GRIP/upload/image/ -- e.g. /GRIP/upload/image/my-image. Note that this path must be under /GRIP/upload/image/

Supplier-side

Perform an HTTP POST operation to /GRIP/upload/image/your-image with the raw image bytes as binary data. It will be reconstructed server-side and trigger the pipeline to run if the image is different form the last one POSTed to that path.

compile gradleApi()
compile localGroovy()
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why that's there; I had pulled from WPIRoboticsProjects/master so this may have gotten changed.

Edit: Reverted in 438cf2f

@codecov-io
Copy link

codecov-io commented Mar 24, 2016

Current coverage is 53.72%

Merging #551 into master will increase coverage by +<.01%

@@           master       #551   diff @@
========================================
  Files         158        176    +18   
  Lines        4699       4993   +294   
  Methods         0          0          
  Branches      500        521    +21   
========================================
+ Hits         2522       2682   +160   
- Misses       2037       2164   +127   
- Partials      140        147     +7   
  1. File ...StoppableButton.java (not in diff) was modified. more
    • Misses 0
    • Partials +1
    • Hits -1
  2. File ...ables/NTManager.java (not in diff) was modified. more
    • Misses -3
    • Partials 0
    • Hits +3

Sunburst

Powered by Codecov. Last updated by ac76ce5

private final HttpServerFactory serverFactory;
private HttpServer server;
private final Map<String, GetHandler> getHandlers;
private final Map<String, List<PostHandler>> postHandlers;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

It would replace one stream operation and nothing else. Not much point.

GripServer returns a 423 error if a data request is sent while the
pipeline is running
This breaks compatibility with previous save files that use HTTP sources
…is running

Use library-defined HTTP codes instead of redefining them
404 error when going to a URI such as /GRIP/data/foo or /GRIP/data* (now it has to be on a path that has a handler specifically assigned to it)
Update tests to stop codacy bot from complaining so much
Remove GripProperties
Tests are broken. Will be fixed in next commit.
It works on my Travis instance, so hopefully it's not borked on the main Travis instance
HTTP sources can only supply images POSTed to URLs under '/GRIP/upload/image', e.g. '/GRIP/upload/image/foo'
Also added logging to PedanticHandler when handling a request
- Remove unused imports and redundant asserts
- Undid some Intellij autoformatting
- Remove PipelineLoaded / PIpelineUnloaded events
@SamCarlberg SamCarlberg changed the title Added HTTP publishing and image source operations Add HTTP publishing and image source operations Jun 30, 2016
this.server.setHandler(handlers);
handlers.addHandler(new NoContextHandler(contextStore));

Runtime.getRuntime().addShutdownHook(new Thread(this::stop));
Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be made a daemon thread.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's not how the shutdown hook API works. This is the proper way to do it

@JLLeitschuh JLLeitschuh merged commit 1fa3a84 into WPIRoboticsProjects:master Jun 30, 2016
@AustinShalit AustinShalit added this to the v2.0.0 milestone Jul 29, 2016
@SamCarlberg SamCarlberg deleted the feat/http branch October 3, 2016 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants