Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Resolved Resolved by DJ Sures!

Is It Possible To Read The RGB Values From JD Eyes

Is it possible to read the RGB values from JD Humanoid's eyes.    For example if all the eyes are bright RED then play a WAVE file.
I understand you can use the RGB Animator to set the eyes.
What would be the javascript or EZ-Script syntax to set one eye to bright red.
I2C.write(0xA0, ??)  or I2CWrite(0,0xA0, 0xFF, 0x00, 0x00).   Also How do you specify which of the 18 eyes?  Or do you just assume 3 bytes times 18.
What would the javascript or EZ-Script syntax be to read the eye LEDs assuming you can read the values as well?
eg: I2C.read(0xA0, ??) Also when I try and print that it just says System.object[].
or I2CReadBinary( 0, 0xA0, 18, $RGBValues ) and print($RGBValues[0])

Related Hardware JD Humanoid
Related Control RGB Animator


Upgrade to ARC Pro

ARC Early Access will give you immediate updates and new features needed to unleash your robot's potential!

#1   — Edited
You can’t read from the rgb eyes. It wouldn’t be an efficient way of going about what you want to do - because it would be unnecessarily taxing on the bandwidth of the communication. 

it would be easiest to simply get the name of the action by looking at the variable. You can find that I’m the settings tab of the rgb animator control.  

There isn’t a published protocol definition for the eyes. However, you can piece it together from the source code: https://github.com/synthiam/E-64_RGB_Eyes


I wouldn't recommend using EZ-Script for anything, specifically i2c. Additionally, even if you were to you'd have to use the Binary versions of the commands because you'd be writing binary data. Use the JavaScript of ARC, because it's 100 times faster (no joke).... and the i2c commands are much easier implemented.
#2   — Edited
Reviewing the code from github - it looks like the first byte contains the index you want to change, and the r value (0-7). The next byte contains both the g and b values.

Here's the protocol definition from https://github.com/synthiam/E-64_RGB_Eyes/blob/master/E-64%20Firmware/Src/4685%20-%20i2c%20Biped%20Eyes%20x%2018/main.c


7 6 5 4 3 2 1 0
~~~~~~~~~ ~~~~~~
Index R
7 6 5 4 3 2 1 0
~~~~~~~ ~~~~~~~

However, be careful not to write to address 30, because that changes the i2c address in eeprom and possibly brick the unit.
Hi DJ, thanks for answering the question.  I did see that if I look at $RGBAnimatorAction and I can see the script name and $RGBAnimationStatus to see if it is running.  Is there a way to read each frame action from the script file and interpret it?   Then I could determine if the eyes met a criteria and do an action.
Say if someone else wrote an RGB Annimation script and you want to act on it when it runs.
Perhaps as a future feature in the RGB Animator when writing each frame you could allow the option to save the RGB Eyes as an array eg: $RGBAnimatorEyes.  Then someone could just reference that to get the values of each RGB LED of JD's eyes.
I also tried setting a variable name for the Current Frame in the RGB Animator but it does not seem to save the variable name.  
User-inserted image

After saving when I come back in it is blank again.  Perhaps that is a bug.  I am running ARC 2020.04.03.00.
I think I will avoid writing to I2C directly until I fully understand how it works.   I assume if I always use 0xA0 as the address I can never write to 30 (0x1E) by mistake.     Also thanks for the link to the c source code.  So the index uses the first 5 bits and the each RGB uses 3 bits.   G and B would always start with 0.
I also now notice in the RGB Animator there are only 8 intensity settings from 0 to 7 for each colour. 
This has helped me to better understand how the LED Eyes work.
Hi DJ and team thanks for fixing the Current Frame bug.     Keeping my fingers crossed that you add a future feature to save the eye LED values to  $RGBAnimatorEyes array in a future release.