IEEERobotics / bot

Robot code for 2014.
BSD 2-Clause "Simplified" License
17 stars 10 forks source link

Drive motor upgrades #62

Closed dfarrell07 closed 10 years ago

dfarrell07 commented 10 years ago

This is a meta-issue used to track our progress towards the Base Functionally milestone. We've ordered our new new and 5x faster motors. Once they get in, we need to install them, hook up their encoders to the capes and convert all code to use the DMCC PID-controlled methods.

dfarrell07 commented 10 years ago

While posting about how encoders for localization in #8, I thought about how slippage of the mecanum wheels (especially when driving sideways) would likely cause invalid encoder counts. How would that effect the drive motor PID, @jasteve4 and @R00ney?

R00ney commented 10 years ago

Short answer, it won't. PIDs can only help ensure that the wheel is turning at the rate you want it to turn, not that the wheels properly grip the ground.

Forward/backwards should hopefully have negiglble slippage.

Sideways kinda forces thinks to slip at a constant rate, right? So sideways speed won't actually be the speed you tell the wheels to turn, but some proportional amount of said speed. Thus, I don't think this form of slippage is harmful PID either.

napratin commented 10 years ago

MecDriver needs to be updated to use DMCCMotor instances, configure velocity PID on startup and set signed velocity values (instead of separate speed and direction).

napratin commented 10 years ago

The DMCC Python library doesn't seem to be fast enough for our needs (#81) - each motor command is taking a considerable amount of time to get executed, hence 4 separate commands to start/stop/change velocities are putting the motors out of sync. This also makes it impossible to make tiny corrective movements. An alternate Python wrapper is required that can keep the DMCC session alive, or some additional methods need to be written in the existing wrapper that can at least handle changing all 4 motor velocities at the same time.

dfarrell07 commented 10 years ago

The DMCC Python library doesn't seem to be fast enough for our needs (#81) - each motor command is taking a considerable amount of time to get executed, hence 4 separate commands to start/stop/change velocities are putting the motors out of sync.

I've started work on a native Python implementation of the DMCC library to solve this problem, remove the complication of C-in-Python and hopefully document and test things a bit more clearly.

dfarrell07 commented 10 years ago

...or some additional methods need to be written in the existing wrapper that can at least handle changing all 4 motor velocities at the same time.

The DMCC C code does support setting the velocities of all motors to a single value with one call, but it's not exported to the Python API.

// setAllTargetVel - Sets the target velocity for all motors
// Parameters: fd - connection to the board (value returned from DMCCstart)
//             velocity - motor velocity
void setAllTargetVel(int fd, int vel)
{
    short int vel16 = (short int) vel;

    // Write the new target velocity for the first motor
    putByte(fd, 0x28, ((unsigned char)(vel16 & 0xff)));
    putByte(fd, 0x29, ((unsigned char)((vel16 >> 8) & 0xff)));

    // Write the new target velocity for the second motor
    putByte(fd, 0x2A, ((unsigned char)(vel16 & 0xff)));
    putByte(fd, 0x2B, ((unsigned char)((vel16 >> 8) & 0xff)));

    // Send the command to start the PID mode
    putByte(fd, 0xff, 0x23);

}
dfarrell07 commented 10 years ago

This is an update regarding the new physical motors (I'll call them HP, for "high powered"). With the DMCC delay described above, combined with the lower torque of these 9.7:1 gearboxes, we see one motor start and stall, the next start and stall, and so on for all four. We're solving the delay with a native Python DMCC API as described above. I'm also planning on swapping the 34:1 gearboxes onto the HP motors at tonight's meeting, to see how well that combo works. If they are still too slow, we can consider buying the 20.4:1 gearboxes and using those on our HP motors. The problem with that solution is that Pololu doesn't sell that combo and has no plans for doing so (I debated this via email for quite some time with them). We would have to buy HP or regular motors without encoders and with the 20.4:1 gearboxes, basically scrap those motors and install the gearboxes on our HP motors with encoders.

dfarrell07 commented 10 years ago

We did a quick test and saw the new HP motors run (last week). They seemed to be spinning at a reasonable speed, using the 9.7:1 gearboxes, but we were not about to actually drive the bot around (due to #90).

dfarrell07 commented 10 years ago

We drove the bot with the new motors during tonight's major integration test. They did quite well! Closing this issue.