AccelerationConsortium / ac-training-lab

Codebase for controlling and managing the Acceleration Consortium (AC) Training Lab.
https://ac-training-lab.readthedocs.io/
MIT License
8 stars 2 forks source link

Add MWE for MyCobot 280 python control to `src` directory, connect to MQTT, and set up streamlit #36

Open sgbaird opened 1 month ago

sgbaird commented 1 month ago

We can wait on the accelerated discovery post until we hear back from Yang.

The intent is to expose XYZ control, joint angle control, gripper control, and camera snapshots. It may make sense to expose states (e.g., joint states), but this is lower priority.

gursi26 commented 1 month ago

just a few questions before i start working on this;

  1. How should the camera snapshots be streamed back? Periodically or each time the user sends a command (similar to the Pico W onboard temperature in the color matching SDL)?
  2. Should there be any restrictions on what angles/coordinates are valid to prevent damage to the cobot? I guess this would depend on where the cobot is placed and maybe implemented later down the line, but just making sure.
  3. Are there any example streamlit apps I can look at for reference?
sgbaird commented 1 month ago
  1. For now, just point and shoot (streaming or similar could come later). We will likely have a camera pointing at the arm and livestreaming to YouTube or similar.
  2. For now, I would say just restrict it so it doesn't go below the plane of the bottom of the base, with some safety factor. This is an error/warning you can send back to the user if they request something out of bounds. This can be done either on the orchestrator (web app) or device (Pi) side. Since this is a bit of a safety restriction (keep the robot from tipping itself over/breaking), perhaps best on the Pi side.
  3. Glad you asked. I suggest starting with a hugging face spaces starter tutorial, then exploring the code (see "files" tab) in the following: https://huggingface.co/collections/AccelerationConsortium/hardware-control-66a4506f9876e9781c8a0808. The web app you write will live next to these in this same list.
sgbaird commented 1 month ago

EDIT: moved to #56 to keep this one focused on the software implementation rather than firmware issues

gursi26 commented 1 month ago

Had a slight issue with some messages being dropped, likely because streamlit reruns the script everytime and it's possible the client was not ready in time to recieve the message.

Fixed by adding client, response queue and credentials to the session state. This allows for the client to only be refreshed when the credentials change and for the queue to persist in the entire session.

sgbaird commented 1 month ago

I think the stands arrived

gursi26 commented 1 month ago

Perfect, I can come in on Thursday to set it up

sgbaird commented 4 weeks ago

The stands as well as a bunch of cable management pieces arrived.

PXL_20241010_154915622.jpg

PXL_20241010_154921682.jpg

sgbaird commented 1 week ago

Maybe mentioned in another post, but the stands - not so great. Doesn't really function as a steady pedestal to give that extra access.

sgbaird commented 1 week ago

@gursi26 thoughts on status of this issue?

gursi26 commented 1 week ago

Not sure about the pedestal stuff, since I havent tried it out yet.

As for the code, it is mostly complete bar a few small bug fixes and refactoring for cleanliness. Ill be updating the PR soon and will let you know when it is good to merge (probably after i finish migrating the HF space to gradio and testing everything together). Ill also add an explanation to the PR for how user authentication works the way I've currently implemented it.