dino updates: initial tests w/ datalogging, current control, and etc [updates]
So today! We wanted to do some initial tests with the Dyno and essential we want to start by knowing if the control on all the motors works properly. That means getting the Dyno and the python script communicating and getting logging working and things like that. So we just start with getting everything all setup and things.
Note that nothing is tuned at all so we want to drop the Kp to a very low value so things don't overcurrent and etc. We're setting the PID values to Kp=0.05 and basically nothing else. We're starting by running simple position hold with this and moving the output shaft of the motor. We get the following graph:
These graphs are pretty much as expected right, as we move one motor, the other motor's position should be the opposite which it is. The current commanded doesn't make too much sense though as the current is always positive even when we move the system in two directions. We want to try to command a negative and positive current and see if the motor spins in both directions. Note we're doing all of this with the system running @18V.
So commanding a +/- current does give different turning directions. But for some reason, the current logging above is only (+), let's check our code first because that's honestly the best place to start w/ these things.
The above graphs are the current output from the +/- 0.5A runs... now let's see the position output because that'll be the most important to see if logging is actually working.
So clearly something is working... it seems like in this run we started at a position of like 6 revolutions (left over from a previous run and ramped down). But the current doesn't seem accurate.
Ok here's a hunch, these motor drivers aren't really built for torque control or accurate current sensing and things which means the current reporting is likely only (+) back through the CAN because it isn't really needed other than to set current limits and things. Maybe we're doing something wrong or it's honestly just BAD. We might need to think of a better control strategy. Current control may not be a super reliable way to do torque control on these motors. We might need to relate the voltage control to the torque. This is a jank solution but let's see how much progress we make with it. We're going to try commanding a various number of random voltages and measure the torque we get.
The problem with straight voltage control here is that voltage control we have no way of knowing of the voltage is directly going to a torque or a speed or etc. If the voltage directly commands a current even if we are in position hold or not then this may work, but if not then this will not work. Let's try that next... let it go to whatever speed it wants and see the current on the supply (command 1.4V).
Yea no... setting the voltage to 1.4V drew exactly 0.5A total from the power supply but there's also no way to know if the 7.5A we were reading was from the motor holding position or the motor we were commanding a voltage to. We'll need a separate current sensor on each motor and we can't trust the one on there. Will probably need a DC amp meter or something.
It's possible that this dyno will not give us too much information and a better strategy is to move to the hoppy leg and abstract impedance and force control into the motion magic the sparkmaxs have.
It's good we built this dyno as a learning experience but it also showed us how terrible the SparkMAX current controller system and everything is *honestly really disappointed thought it would be better*
Not going to completely give up of course but I think a new strategy may be in order
We may want to use the dyno to tune the controllers. Command a certain voltage as a resistance to motion (we can measure the amount of resistance with the torque sensor) and then tune the PID controllers for position and velocity to achieve the desired response.
We can also try smart-motion and the logging will show us a good profile for velocity as well as position which is pretty nice (especially position).
The whole impedance controller isn't looking too good
We may need to replace impedance control with varying the Kp value to essentially mitigate impact forces --> we'll only figure out how well that works on hoppy-leg and probably not on the dyno (which was never the point of the Dyno).
We need a power supply bigger than 10A to really do anything...
What we want to do next, is a few things. First, we want to find a larger power supply that can supply more than 10A (or a battery that can do this as we likely won't have current draw issues with the battery). Then we want to work on tuning the controllers while applying some sort of voltage-based counter torque from the other motor. We'll apply a voltage to one of the motors and run position control on the other one of the motors. We'll then move to tuning the position and the velocity controller and trying smart motion and graphing the profiles.
CONCLUSION: the motor controllers aren't as great as we think...