Thread: encoder help
View Single Post
  #4   Spotlight this post!  
Unread 01-04-2009, 15:04
Nikhil Bajaj Nikhil Bajaj is offline
MATLAB Fan
FRC #0461 (Westside Boiler Invasion)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2002
Location: West Lafayette, Indiana
Posts: 101
Nikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond reputeNikhil Bajaj has a reputation beyond repute
Send a message via AIM to Nikhil Bajaj
Re: encoder help

We can't just give you a code to do it. I think you need to think carefully about the situation, decided on a programming strategy, and see if it accomplishes what you want. The reason I say this is that it is not necessarily straightforward to write wheel slip control code, especially with the sensor arrangement you have.

To help you get started, let's go through a hypothetical code design process.

1.) What do you want to accomplish?
--We came up with the idea to control the wheel slip in software, in order to help reduce the amount of wheel slip we have during matches so we can control the robot better.

Okay, great. That's where we are now, right?

2.) Brainstorming solutions.
--In a physical system like a robot that we have to program, we have to closely consider the physical behavior of the system and what information we have about it before just diving in to programming--we wouldn't know what to do! Unfortunately, Labview, C, C++, etc. don't really have "traction control" blocks or libraries and even if they were available we would want to know what they did for sure before using them on our machines.
--So in order to come up with a solution, lets think about what is happening when the wheels are slipping. We have a wheel, on the ground. How do we get the robot to drive forward? We have a motor, which turns some gears in a gearbox, which turns the output shaft a bit slower based on our gear ratio, which may go through some sprockets and chain to go slower (or faster) which turn our wheel. Our encoder is measuring the speed somewhere in the gearbox, so we'll have to adjust for the gear ratio...but we can effectively find the wheel speed using the encoder, just by multiplying. So let's say we know the wheel speed. But if I know the wheel speed, do I know if the wheel is slipping or not?
--The answer is...no, not really. We need more information. If the robot is rolling really fast on the ground without slipping, the wheel speed can still be high. So an encoder on the gearbox isn't strictly enough to let you do wheel slip control.
--A hint--you can still (and certainly should) use the information from those gearbox encoders to control your slipping, but you need other information in addition to that to accomplish the task. For example, there are many teams who use un-driven wheels (that aren't powered by the drivetrain, so they won't slip as much, they just roll on the ground) and have encoders on those, and so they try to match the speeds, so that the driven wheels don't slip as much. There are other methods you could use, like using an accelerometer to estimate your actual speed and comparing that to the wheel speed so that you could make those match. That way you wouldn't have to add more wheels. But it might not work as well and may be more difficult to do, because you'd have to learn how to use an additional kind of sensor.

I hope this helps--but don't be alarmed if this raises more questions than it answers--that was the point.