ArneB
Hi EZ-B community,
I need your experience, help & advice...
I have built a robot with two modified servos for movement. One servo is located on the left side, the other on the right side, attached to the servos are the wheels.
Now I need a mapping function from my analog joystick input on my computer (don't ask... ) to the robot servos for movement. For the four basic directions it is quite simple:
joystick up -> both servos full speed ahead (L: 99, R: 99) joystick down -> both servos full speed reverse (L: 1, R: 1) joystick left -> left servo reverse, right servo forward (L: 1, R: 99) joystick right -> left servo forward, right servo reverse (L: 99, R: 1)
Now I have a problem to define a function for the intermediate values. As an example: If I move my joystick to the top left corner, I want that my robot drives a fast curve to the left (forward + left, translates to servo settings of L: 75 and R: 99). Or slower, if I don't move the joystick to the outer edge. Currently I am struggling to define a math formula (something like Servo_value(x_pos_joystick, y_pos_joystick) = ...), which covers all cases...
Do you have any hints, links or recommendations ? I think, this should be a quite common problem...
Interesting request. Ill need to think about that one. Ill get back to you. Fortenatly I have a long flight ahead today to think about it.