Dec-14-2017, 01:23 AM
Hi everyone.
Need a little help interpreting the following bit of code. Keep in mind this is all brand new to me but am keen to lean.
I am working on a previously created project as I like to learn by doing and seeing the effects of what I do directly.
The following is a bit of code is a small section that is designed to output the signal from a xbox style controller to move steppers on a robotic arm. (think I have the right section anyway)
The issue I am having is that the motor output (0) on the driver likes to interpret the signal from the controller and tell the motor to keep moving in one direction perpetually.
It is like the neutral point of the stick on the controller is somehow offset.
all I need to know is if I am reading this correctly.....
Are the " -1500" and "5000" sections the areas that define the thresholds for the stick movement on the controller? or the central point offset?
Or is it the (1, 35) and (0, 35)
if event.code == 'ABS_X':
value = event.state
if value < -1500:
if not joints[0].isBusy(): joints[0].run(1, 35)
elif value > 5000:
if not joints[0].isBusy(): joints[0].run(0, 35)
else:
if not joints[0].isBusy(): joints[0].softStop()
Or am I reading this wrong?
links to the github section of this project here - https://github.com/Roboteurs/rbx1-softwa...r/robot.py