We are planning to swap our the Stretch gripper for a prosthetic hand that communicates using UART. For our initial testing, we have been using a UART to USB adapter that connects to the hand with TX, RX, GND. After going through the hardware guide again, it seems we could configure the expansion header for Serial UART and do without the adapter. I have checked out the wrist extension header tutorials but am still a bit lost on where to start for a UART sensor.
Any advice pointing me in the right direction would be a big help.
Establish serial comms between the Arduino UART and your gripper
Plumb the new UART device into the Wacc firmware / communication layer
Extend Stretch Body to include the gripper so it can be accessed via Python
Numbers 2 & 3 are fairly straightforward pattern matching from the I2C/SPI tutorials.
Number 1 (establishing serial comms) can be tricky depending on your device and its communication/bandwidth requirements.
To get started on that, it might be easiest for us to just create a UART tutorial comparable to the SPI/I2C one. Iâd guess we could have something to you in about 1-2 weeks. Would that work for you?
The serial sensor tutorial was very helpful! Iâm currently still testing with an Arduino emulating the wrist board until I finish the firmware changes.
One small thing, it seems the wacc_calc.py file is missing {self.valid_firmware_protocol = âpMyCalcâ} in the init method for it to work out of the box. Everything else went very smoothly.
Great, glad to hear it. Good catch on the protocol version bug. Iâve updated the documentation and code to now use âp99â.
For background, we are developing an automatic firmware updating tool that reads the protocol version. It now expects a number (eg 99) rather than a string. So to future proof the tutorial, we use âp99â. For your own custom protocols it really only matters that the protocol ID of the Arduino struct definition, and the protocol ID of the Python class, match.
Hi!
Instead of opening a new thread I was looking for information to get started with the expansion header pins on the wrist in the forum.
Unfortunately, all the embedded links in this thread are not available anymore, so are there any updated tutorials or guides? In the Data Transfer Tutorial for example the links lead to the deleted calculator scripts only.
How can I determine which port to use for flashing the expansion pins / SAMD21?
It seems like attaching an Arduino with my individual sensors on it directly into one of the USB ports is the quicker, simpler and safer option than using the extension pins. What is recommended therefore?
Hi @roboor, Thank you for bringing the missing/broken links to the Wrist Expansion example scripts to our attention. We can fix it soon and let you know.
In the meantime, you can find all the âhello_waccâ Arduino sketch files used in each Wacc header pin expansion tutorial in this directory:
Once you have modified the hello_wacc Arduino sketch to interact with your attached sensor based on the tutorials above, you will have to flash your Wacc board with your modified hello_wacc sketch to the USB port /dev/hello-wacc. We recommend you to use the Arduino IDE 1.8 to flash the modified âhello_waccâ sketch to the Wacc board using below steps:
Make sure the stretch_firmware repository is cloned to the directory ~/repos
Replace the contents of ~/repos/stretch_firmware/arduino/hello_wacc folder with your modified âhello_waccâ sketch files.
Once the Arduino IDE is installed, open the IDE and set the âSketchbook locationâ path found in Files â Preferences to /home/hello-robot/repos/stretch_firmware/arduino. Restart the Arduino IDE to make it recognize the hello_* hardware and sketches.
Open your âhello_waccâ sketch in the Arduino IDE (File â Sketchbook â hello_wacc)
Set the board to âHello Waccâ (Tools â Boards â ArduinoSAMD* (in sketchbook) â Hello Wacc )
Choose the right Wacc boardâs /dev/ttyACM* port in Tools - > Port â /dev/tty* and click upload.
You can check which ttyACM* port belongs to the Wacc board (/dev/hello-wacc) using the command: REx_firmware_updater.py --map
Attaching a standalone Arduino with external sensors via wrist USB is doable in multiple ways if you arenât comfortable modifying the official hello_wacc Arduino sketch and wiring the wrist expansion header pins to interact with your external hardware. I could imagine having a PySerial handle run in a separate thread that could transfer data from the attached Arduino via wrist USB without interfering with the Stretch Bodyâs main thread.
But the Cons of this approach are you would be missing the part of reading/interacting with the external hardware through the Stretch Body python library that involves a transport layer that uses COBS encoding to transfer data reliably and accurately.