Go to Post Life is not about avoiding risk, but managing it. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-10-2006, 11:31
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 684
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
EasyC-FRC - Arcade driving help

Our team is using EasyC-FRC (currently ver 2.7.0.2) this year. That's okay. Hey -- it's easy. But I need to get some starting point, and I always get hung up on something simple at the beginning. And if I don't know, how are my 20 programming kids going to know?

We have a 4-motor test robot, and we're going to use arcade (single joystick) driving. All of the examples in the Help file show the Tank mode, but no details on Arcade.

I've got the infinite While(1) loop okay; the joystick input okay using JoyX = AnalogOIInput(~~~) and JoyY = AnalogOIInput(~~~); and finally the OItoPWM(~~~) to send the info to the 4 motors. We do some magic calcs [1] with JoyX and JoyY to optimize our motors, etc, then send them to OItoPWM() -- how? Do we mix the X and Y somehow? How much goes to the left side motors and how much to the right side?

Or do we use the "Arcade - 4 motor" function block in the While loop instead, and be done with it?

Thanks for your help.

Roger.


[1] Magic calcs are currently to reduce the speed of the robot -- we have a small room to drive it.
  #2   Spotlight this post!  
Unread 11-10-2006, 12:40
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Talking Re: EasyC-FRC - Arcade driving help

First you need to be in L2 or PRO mode. On the toolbar at the top of the window you should see L1, L2, and PRO. Select the one you need.

Create a new competition project.

Open the Operator control function.

Under the RC Control section of the commands you should see a "Arcade - 4 Motor". Add this to the Operator control function.

The options for this command are fairly simple.

EDIT: "Advanced" code i attached is fairly simple.
Code:
int LeftDrive, RightDrive;
unsigned char JoyY, JoyX;

JoyX = GetOIAinput(1,1);
JoyY = GetOIAinput(1,2);

LeftDrive = Limit(JoyX - JoyY + 127);
RightDrive = Limit(JoyX + JoyY -127);

// the mixing code above  produce values out of the 0-255 range.
// we must limit the values or we will get overloads and weird things.
LeftDrive = Limit(LeftDrive,0,255);
RightDrive = Limit(RightDrive,0,255);

//Assign motor values.
//Left motors
SetPWM(1, LeftDrive);
SetPWM(2, LeftDrive);

//Right motors
SetPWM(3, RightDrive);
SetPWM(4, RightDrive);
The limit function used above.
Code:
 
int Limit (int input, int min, int max)
{
  if (input < min)
  {
    input = min;
  }
  if (input > max)
  {
    input = max;
  }
  return input;
}
I have attached a program for you to look at.
If you need more help PM or e-mail me.

EDIT: I have attached another file with custom arcade software. It may be easier to use your "Magic calcs" with this.
Attached Files
File Type: zip Arcade Simple.zip (1.1 KB, 64 views)
File Type: zip Arcade Advanced.zip (1.8 KB, 87 views)
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 11-10-2006 at 13:27.
  #3   Spotlight this post!  
Unread 11-10-2006, 14:54
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 684
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: EasyC-FRC - Arcade driving help

Thanks EHaskins -- to think it's as simple as:

LeftDrive = JoyX - JoyY + 127;
RightDrive = JoyX + JoyY - 127;

LeftDrive = Limit(LeftDrive,0,255);
RightDrive = Limit(RightDrive,0,255);

to mix the x and y axis numbers and get a motor speed.

Can't wait to get to that robot now!

Roger.
  #4   Spotlight this post!  
Unread 11-10-2006, 15:03
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: EasyC-FRC - Arcade driving help

If you have any problems PM or e-mail me.
__________________
Eric Haskins KC9JVH
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyC-Vex Rx/motor frustrations- please help! Steve0100 Programming 10 08-07-2006 02:18
help on easyC Loki1989 Programming 5 19-03-2006 08:42
Update for EasyC for FRC Available Kingofl337 Programming 0 07-03-2006 14:42
HELP!!!! EasyC Compiling Issues Wbrown0389 Programming 8 29-01-2006 09:18
Kickoff easyC workshop integrated into EasyC help file Dan Larochelle Programming 0 11-01-2006 06:12


All times are GMT -5. The time now is 09:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi