chip updates: puppy's code is sad - or we weren't paying attention [updates]
So yesterday, we did a little playing with the code to see if when a button was pressed we could add three points to the trajectory and have it do a three-step standup procedure. The problem is there must be something wrong with how we're using trajectory or how we're adding points or something because the robot isn't going to one of the points.
Okay wait, I think I found out what's wrong.
So what we've been doing in trajectory is feeding in the current position of the robot's motors to the tick() method so at all times the trajectory object knows where the robot is. But the position we're feeding in is the RAW position of the motors and the position we should be feeding in is the ADJUSTED position because otherwise "0" doesn't mean what we think it does. So when we tick, we need to go re-adjust for the zero offsets we didn't re-adjust for, and that should solve that problem.
Oops, had to sleep on that problem to solve it. Need to pay a little more attention!
So there's two options here, the first, is that we convert the command to RAW before we add it to trajectory not when we're pulling it from trajectory, and that's hard because that's what the publish_CMD method does.
Or what we do is we create another method in the main class that when it pulls the position it accounts for the offsets. We should do this in the POS callback because EVERYTHING IN THE MAIN CLASS SHOULD BE WITH REFERENCE TO THE OFFSET COORDINATE FRAME NOT THE RAW FRAME.
Okay, let's do that one. Woot!
So what this means is the platform has two coordinate frames/origins. The RAW_FRAME which is anything that rostopic can echo and gets actually bounced over the network/sent to the motors. And there's the USER_FRAME which is the shifted frame that the master uses. Later we'll get to actually making this thing stand and sit, for now let's test this and see if it solves our problem, and then we'll let it go. We're going to make EPSILON 0.25 because we're putting CMDS in it not XYZ foot positions now. So that means our accuracy is +/- 0.25 rotations on the motor which is 0.25/100=0.0025 rotations on the output shaft which is OK because the slop is definitely higher than that. Let's try it.
First thing's first, we should get into the habit of shutting down chip properly instead of just un-plugging the power, idk how happy the jetson is with that kind of treatment. Second, it worked!
Ta-da! Two-steps in the standing sequence, we'll program in the rest later when we're out on the patio - that's important so we can test it in the conditions it'll be working in. See we'll program it assuming a lot of grip (outdoors) and then when we bring it inside, we'll fix the lack of grip with "indoor shoes" for the robot.
Ah you thought shoes were for the outdoors, nono, now with chip they're for the indoors.