• aditya mehrotra.

chip updates: starting the PID tuning and starting to inverse kinematics on the robot [chip updates]

So today we finally are doing robolab again after a while of not being able to because everyone is busy. Ronak, Me, Hannah, and Fischer are here! What we're attempting to do is program in the inverse kinematics of the robot and tune the gains to see if we can get the gains to go to a set point in position. After some deliberation, we're going to start with the 2D simplification.


In the meantime that I'm developing that, Ronak is working on some functions he's calling "Setup_Actions." He's writing functions that allow us to ZERO the leg, and changing PID constants without re-starting the robot. We're going to run them using the FRC autonomous mode (so we're abusing the FRC autonomous mode in this case but who cares).


Here's the math from the simplified model:

So we're going to program this in first. We're going to basically just try it and see what happens you know. The HOME position of this leg isn't (0,0), it's actually (l1-l2, 0). At the moment, we're just trying to get the legs to zero when we want them to so we don't have to hold all four of them into position when trying to enable the robot.


So the other thing we need to come up with is the translation from our THETA frame to the motor's position command. The motor's position command seems to be in fractions of a rotation, so the math is simple here.



How'd we get the above formula? Well theta/2*pi (or 360) gives us the fraction of a full rotation of the output shaft we need to make. Then since there's a100:1 gear ratio we multiple by 100 to get the fraction the motor must turn.


Now the only other thing we are going to do before we actually start coding in the inverse kinematics and testing things is the direction of the motors in the + is the same as the direction of + thetas. Some aren't, we are reversing the direction of the one's that are not. Should be a simple fix.


Okay so - Ronak (and I) are very very tired so we're going to go to bed and do this tomorrow. Hopefully we'll have some updates then.


But the code will look something like this:


setLegPos(x, y) { //x y are in meters

//calculate r

//calculate phi

//calculate alpha


//calculate theta_1

//calculate theta_2


//calculate pos1 from theta_1 and deal with any necessary inversion

//calculate pos2 from theta_2 and deal with any necessary inversion


//setpos1

//setpos2

}


Honestly if this works really well, we might just NOT change the model we are using. There's no reason for rotation matrices and Jacobins if we don't need them. Simple is best!


#robolab #tenb #robotics #omgrobots #chip #updates #sleep_more_kids

8 views0 comments