I got a LED stripe connected with a RasPi3. The stripe should be installed at an automated guided vehicle as the human maschine interface. I would like to program the stripe so that there are "eyes" on it (e.g. 3 LED pixel on -- 5 LED pixel off -- 3 LED pixel on), which follow automatically a person who is standing in front of it.
Actually i have the methods:
"set_eye_position(msg)" which is able to set the LED pixel on an interval from -99 (completely left) to +99 (completely right) as input parameter (msg) and
"set_eyes_to_coord(msg)" which get two input parameters: The x and y coordinates of the person who is standing next to the vehicle. My approach is to set a coordinate system in the middle of the robot (see Picture)
The reason for my question is, if there is an opportunity to calculate the exact position of the LED pixel at given input parameters (x,y)?
I'm writing with Python and I'm quite a newbee in programming, so I would really appreciate if I get some ideas how to realize my issue.
Thanks in advance
EDIT:
Assuming the approach from bendl THIS is the new setup, right? I do not really know what to do with the variables boe_left, boe_right and boe_dist. But maybe I'm just too dumb to understand it.
Here's something to get you started off:
This works by drawing a line between an fixed point you can think of as the imaginary back of the robot's eye and the person. The point where this line intersects the LED strip is the point that the eye should be centered. This solution makes the (naive) assumption that there is one LED per unit distance, so you'll have to make some changes, but we can't do EVERYTHING for you ;)