Asked

My robot wants to communicate via JSON commands (it is controlled via JSON from a browser) but I need to use ARC to talk to it. It also sends a lot of data back over JSON to provide current servo status that would need to be fed back into ARC. Any thoughts if this can be adapted to communicate with the robot? https://github.com/mjbots/quad/blob/main/mech/web_control_assets/index.html
Related Hardware EZ-B v4
Related Controls
Custom Movement Panel
WebSocket Client
My robot wants to communicate via JSON commands (it is controlled via JSON from a browser) but I need to use ARC to talk to it. It also sends a lot of data back over JSON to provide current servo status that would need to be fed back into ARC. Any thoughts if this can be adapted to communicate with the robot. https://github.com/mjbots/quad/blob/main/mech/web_control_assets/index.html
@Nink - you sent a link to an HTML file. A JSON file looks similar to XML in that it has labelled parameter tags containing values.
i.e.
But, you can also parse the JSON in javascript right in arc..
Here's an example parsing JSON from a string...
And here's an example of getting JSON from an HTTP get request...
One last thing - you can view all of the built-in javascript classes here: https://synthiam.com/Support/javascript-api/javascript-overview
You can click on the ECMA 5.1 classes to read their manual page from developer.mozilla.org.
Thanks DJ I will try and connect with javascript. The HTML file I posted calls a javascript app.js that communicates with the bot via JSON. https://github.com/mjbots/quad/blob/main/mech/web_control_assets/js/app.js As far as I can tell this then talks to this file on the bot. https://github.com/mjbots/quad/blob/main/mech/quadruped_state.h#L32
I noticed your app.js is actually a WebSocket, so an HTTP get wouldn't work. Use this: https://synthiam.com/Support/Skills/Communication/WebSocket-Client?id=20442
The json that you would need to send is defined as a class struct in the app.js. You could edit the app.js and print the json to the console. But this is essentially the part that is creating the json - it is stored in a "command" variable and built throughout those lines by extracting data from the webpage objects and joystick.
*Moved into own thread because it is out of scope for the original thread