Go to Post I actually see no issue about the sentence, but then im still in college and only half way edumacated, i am only eduma right now. - Alex Cormier [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 14-02-2004, 15:37
great_one411 great_one411 is offline
Registered User
#1210 (NYACK)
 
Join Date: Jan 2003
Location: St. Louis
Posts: 18
great_one411 is an unknown quantity at this point
Question Modifying Default code

How do you modify the Default Code from one joystick to two joysticks
  #2   Spotlight this post!  
Unread 14-02-2004, 15:55
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Modifying Default code

Quote:
Originally Posted by great_one411
How do you modify the Default Code from one joystick to two joysticks
[edit] Forgot the rest of the story. This goes in Default_Routine() in the user_routines.c file. Comment out the 1-Joystick lines:
Code:
//pwm13 = pwm14 = Limit_Mix(2000...
//pwm15 = pwm16 = Limit_Mix(2000...
and add in
Code:
/*------------ 2 Joystick -----------------*/
pwm13 = pwm15 = p1_y;
pwm14 = pwm16 = 254 - p2_y; // Assumes your motors are reversed, just p2_y if not
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 15-02-2004 at 12:46.
  #3   Spotlight this post!  
Unread 15-02-2004, 08:58
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Modifying Default code

Basically what he said, just simplified. To map two joysticks, you would do something like this:

Code:
// This code assumes the joystick are on ports 1 and 2 and pwm01 and 02 are the drive motors.
// These can be easily changed
pwm01 = p1_y;
pwm02 = p2_y;
That code just makes the Y axis of the joysticks on ports 1 and 2 run the left and right drive motors.
__________________

  #4   Spotlight this post!  
Unread 15-02-2004, 09:44
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Modifying Default code

The default code already has two joystick drive on pwm01 and pwm02. You just need to change pwms. No code changes necessary.
  #5   Spotlight this post!  
Unread 15-02-2004, 12:44
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Modifying Default code

Quote:
Originally Posted by Joe Ross
The default code already has two joystick drive on pwm01 and pwm02. You just need to change pwms. No code changes necessary.
Depends on which copy of the default code you're working with.
IFI dropped the 2-joystick code from later versions.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #6   Spotlight this post!  
Unread 15-02-2004, 13:00
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Modifying Default code

Quote:
Originally Posted by Mark McLeod
Depends on which copy of the default code you're working with.
IFI dropped the 2-joystick code from later versions.
I know it was in the first version posted, and its also in the current version (2-10-2004). I haven't used any intermediate versions, but I find it hard to beleive that Innovation FIRST would have dropped it.

Lines 211 and 212 (in Default_Routine)
Code:
  pwm01 = p1_y;   
  pwm02 = p2_y;
  #7   Spotlight this post!  
Unread 15-02-2004, 13:02
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Modifying Default code

Quote:
Originally Posted by Joe Ross
The default code already has two joystick drive on pwm01 and pwm02. You just need to change pwms. No code changes necessary.
I just thought the example without all the extra stuff would be helpful.
__________________

  #8   Spotlight this post!  
Unread 16-02-2004, 10:32
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Modifying Default code

Quote:
Originally Posted by Joe Ross
I know it was in the first version posted, and its also in the current version (2-10-2004). I haven't used any intermediate versions, but I find it hard to beleive that Innovation FIRST would have dropped it.

Lines 211 and 212 (in Default_Routine)
Code:
 pwm01 = p1_y; 
pwm02 = p2_y;
I looked right past the obvious!
I believe at one time (maybe EDU code) they had the line:
Code:
/*---------- 2 Joystick Drive ----------------------------------------------

*-------------------------------------------------------------------------
*/


and that's what I was missing.

Thanks!
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
default code and the actual robot tml240 Programming 15 24-01-2004 11:31
How long does it take you to load the default code? vegasmcse Robotics Education and Curriculum 10 03-11-2003 21:41
2003 PBasic default code from Innovation First ttedrow Programming 0 06-01-2003 11:18
default code archiver 2001 2 23-06-2002 22:53
Rookie Programmer has question about the default code DanL Programming 3 26-01-2002 19:59


All times are GMT -5. The time now is 00:01.

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