View Single Post
  #2   Spotlight this post!  
Unread 25-01-2008, 00:16
The Lucas's Avatar
Happy Birthday! The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: using easyC to give more control to the joysticks

I apologize in advance because my knowledge of EasyC functions is limited. In both cases I think you should use the FourWheelDrive() or TwoWheelDrive() functions (depending on what you are using). The you can use the Drive(int speed, int direction) function to control the robot. Keep in mind that Drive how drive works

Quote:
Originally Posted by WPILIB documentation
// Drive functions that are based on motor and direction values ranging from:
// -127 - +127 for full backwards to full forwards
// -127 - +127 for full right to full left turns (see Drive function)
Quote:
Originally Posted by Neurovirus View Post
1. make the input and output relationship a cubic function - no clue how to do that tho i would prefer a look up table to save processing power...
one way to create a lookup table is to declare the table:
Code:
rom const char lookup[256] = { 0th char, ..., 255th char};
then in your Drive function:
Code:
Drive(lookup[y-axis of joystick], lookup[x-axis of joystick]);
Quote:
Originally Posted by Neurovirus View Post
2. use a divide function when a button is held down to give control - i am confused since 127 would not be 127 and things could go wrong...i don't know how to spread out the limited output over the whole joystick axis with 127 still being 127...
Normal C is centered around 127, so you would have to calculate an offset to bring it back to 127 center. For example: 127/2 = 63, 127 -63 = 64, so: (new joy axis)= (old joy axis)/2 +64;

However since EasyC's Drive is centered around 0, you can just:
Code:
Drive((y-axis of joystick-127)/(factor), (x-axis of joystick-127)/(factor));
And enclose it in a if (button pressed) statement.

I hope this helps. There may be a few minor difficulties with EasyC. I am trying to learn EasyC this year for Team 1495, but I don't have my own license. I'll PM you an email address.
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"

Last edited by The Lucas : 25-01-2008 at 00:19.