ARC Pro

Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

PRO
Canada
#57  

I made a quick cable and connected an arduino to my Meccanoid servo's using tutorial and then connected EZB to arduino via UART. I wrote a quick script from samples and worked very well (THANKS FOR WRITING THIS UP).

Has anyone written a script to read current server position. (Disable Servo, Manually move, read servo position).

Thanks.

#58  

Quote:

Has anyone written a script to read current server position. (Disable Servo, Manually move, read servo position).
@Nink Hobby servos like EZ Robot HDD type (as opposed to Dynamixel type) have no ability for feedback... aka position feedback... However you can hack a hobby servos to read the servos internal potentiometer by soldering a 4th wire to the wiper pin of the internal pot... You connect that wire to the ezb4's analog port which will give a relative servo position...

PRO
Canada
#59  

Hi @Richard_R The Meccanoid Servo's may be junk and no torque but they did one thing right, they have a potentiometer in them so they have the ability to report servo position. You can put the meccanoid in LIM mode and then record a series of movents by manually moving arms head etc. Meccanoid records the movements and plays them back. The Arduino Firmware appears to support it if you read the meccabrain.cpp file but the sample code on the arduino that interfaces with the EZB does not appear to support it.

PRO
Canada
#60  

The existing code did not support reading servo positions. It appears to be supported in the official BIOS but was not intuitive or clearly documented. I decided to use meccontrols BIOS and wrote a script to do the following with meccanoid servo's, an Arduino and EZB V4

  1. Reset all servo's and Set 2 Servo's red and 2 Servo's green
  2. If you move a red servo by hand the green servo mirrors the red servo position

This is my first ez-robot script so code is spaghetti. Error correction on reading data from the UART is complex as the data size changes dependent on if the servo is at 99 degrees or 100 degrees. There is no Start Code only end code (CR/LF) in packet. Each number for servo location is sent by the BIOS as its ASCII equivalent for the actual number. So 120 degrees is sent as 5 separate numbers to represent 1,2,0 and CR LF. You receive the servo position in 5 fields 49 50 48 13 10 (No idea why the BIOS does this). Writing to the bios is done in a string so you have to get 3 separate numbers convert each to ASCII and then reassemble them back into a string to write back to the BIOS software. Because the meccontrol firmware writes in single string but reads in 4 to 5 numeric fields of ASCII code there is lots of messy converting back and forth.

I need to clean up and create subroutines so you can have more servo without duplicating code. It is very slow as it can only read or write one servo at a time. I need to be able to read multiple servo positions at 1 time and write new positions at 1 time. I am not sure yet how to approach this, I may have to fork the BIOS. If someone who knows EZ-Script can clean up I would appreciate it.

https://synthiam.com/Community/EZCloud/RobotAppDetails.aspx?id=5184

User-inserted image