our arm will probably have two points at which it turns (see picture), and for simplicity we are looking to be able to control just the grabber part of our arm, on x and y axes.
i’m sure there is a way to do this, because CNC machines have to do a similar thing…
I’m unable, for the life of me, to develop a mathmatical formula to mix the joystick axes in a way that would allow us to control just one grabber axis at a time…
Has anyone ever done anything similar? would anyone be willing to lend me a hand here?
How do you mean? I have changed our code to assign each joystick to different components of the drivetrain, but I don’t understand your queston is entirely. Can you make a simple sketch of the arm so that I might understand it better?
Would it be easier to use the y axis of the joystick, and the joystick wheel to control the location of the tip of the arm? Like make the height of the arm equal to the value from the wheel, then make the horizontal distance to the tip of the arm be equal to the y axis of the joystick. Once you knew that you would know the lengths of all three sides of a triangle, which would allow you to use trig to find the angles at the corners, and set your arm to those angles. Something like that. You could also use the X axis to do the same thing as the wheel, but that would be weird to operate.
i made a sketch, please note the attachment in my first post:
the blue and red lines are the arm parts.
at each end of the blue line is a motor which changes the angle of the blue and red parts.
the blue line starts at the robot.
the grabber part is situated at (x,y)
@ represents the angle of the blue arm in respect to the floor represents the angle of the red arm in respect to the blue arm
@- epresents the angle of the red arm in respect to the floor
now that i think about it… i wasn’t really clear at first…
Leav, are you going to have feedback so you know @ and $? I think I know how to do this, but it’s going to be a lot harder without actually knowing those angles.
I susepct you can do it using some linear algebra. If you know any linear algebra, this would be the process. Create a transform matrx that transforms angles of the two joints to x-y coordinates. It looks you already have this part of it done in that diagram you posted. Then, you need to solve for the inverse of this matrix and that will give you the transform matrix to do the same operation in reverse.
If you don’t know linear algebra, learn it, or find someone who does. I may try this problem just because it sounds like fun. This exact problem can probably be found online somewhere, so you may not have to do anything at all.