Go to Post The key is to get the WHOLE TEAM to understand that you are designing and building a robot, which is a complete system - not just a collection of mechanical assemblies stuck together. - SteveGarward [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-2002, 22:54
Amadkow's Avatar
Amadkow Amadkow is offline
Registered User
AKA: James Watts
None #0524 (Aplpha Omega)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Bakersfield
Posts: 74
Amadkow is an unknown quantity at this point
Send a message via ICQ to Amadkow Send a message via AIM to Amadkow Send a message via Yahoo to Amadkow
programming gear switing

I am trying to program the code for gear shifting. I can get it to shift the gears with the servos but I can't get it to jog the drill motors forward to make sure that they go in to gear. Could someone please help? I am attaching a copy of my teams program to this message.
Attached Files
File Type: txt 2002codev4.txt (18.5 KB, 67 views)
  #2   Spotlight this post!  
Unread 15-02-2002, 10:36
JHBurch JHBurch is offline
Registered User
#0045 (TechnoKats)
 
Join Date: Nov 2001
Location: Kokomo, IN
Posts: 10
JHBurch is an unknown quantity at this point
Below is the code the TechnoKats used last year to change gears. We used the joystick wheel as the input with a large deadband in the middle of the wheel. The code takes control of the drivetrain, stops the robot, changes gears, moves a little bit to let the gears lock in place, then returns control to the driver.

Make sure the serout command is inside the loop. Even though you're just sending the same thing over and over it keeps the robot controller from thinking it's lost the connection and resetting. Be sure to set the servo_gear_old default value at the top of the code to whichever gear you plan to start the match in. In this code, servo_gear actually contains the PWM value to send to the servo for the desired gear. Just conserving variables.

Hope this helps.
Jeff Burch
TechnoKats #45
jeffrey.h.burch@delphiauto.com

'---------- Gear Change --------------------------------------------------------

if (p1_wheel > 57) then not_low_gear
servo_gear = LowGear 'p1_wheel button setup for lo_gear

not_low_gear:

if (p1_wheel <= 200) then not_hi_gear
servo_gear = HighGear 'p1_wheel button setup for hi_gear
not_hi_gear:

if (servo_gear_old = servo_gear) then no_change:

for k = 1 to 20 'Stops main drive base
Serout USERCPU, OUTBAUD, [255, 255, 127, relayA, 127, relayB, 127, 127, 127, 127, 127, 127, servo_gear_old, servo_gear_old+GearOff, 127, 127, BSRollPWM, 127, BSArmPWM, 127]
next

for k = 1 to 50 'Changes gear with the servo drive
Serout USERCPU, OUTBAUD, [255, 255, 127, relayA, 127, relayB, 127, 127, 127, 127, 127, 127, servo_gear, servo_gear+GearOff, 127, 127, BSRollPWM, 127, BSArmPWM, 127]
next

for k = 0 to 128 'Ramp Speed up
Serout USERCPU, OUTBAUD, [255, 255, 127+(k/8), relayA, 127, relayB, 127+(k/8), 127, 127, 127, 127, 127, servo_gear, servo_gear+GearOff, 127, 127, BSRollPWM, 127, BSArmPWM, 127]
next

for k = 0 to 10 'Stop again
Serout USERCPU, OUTBAUD, [255, 255, 127, relayA, 127, relayB, 127, 127, 127, 127, 127, 127, servo_gear, servo_gear+GearOff, 127, 127, BSRollPWM, 127, BSArmPWM, 127]
next

servo_gear_old = servo_gear

no_change:
__________________
Jeff Burch
TechnoKats #45
  #3   Spotlight this post!  
Unread 16-02-2002, 01:32
Amadkow's Avatar
Amadkow Amadkow is offline
Registered User
AKA: James Watts
None #0524 (Aplpha Omega)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Bakersfield
Posts: 74
Amadkow is an unknown quantity at this point
Send a message via ICQ to Amadkow Send a message via AIM to Amadkow Send a message via Yahoo to Amadkow
Exclamation help please

ok I think I got that code modified to fit my teams robot but when I check the syntax I get the error "out of variable space" Please help I need to get the gear shifting up by tomarrow or my team might ditch it. I will attach the code. I am pretty new to programming the robot.
Attached Files
File Type: txt gearshift2.txt (20.0 KB, 47 views)
  #4   Spotlight this post!  
Unread 16-02-2002, 08:35
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
If you're out of variable space, then you're pretty much out of choices to make. Unless you can get rid of some other variables, you really can't do much. I believe the robot controller only has about 16 K of memory, although I could be wrong on that. My team currently has about no memory left, but we're lucky, cause we don't need to add anymore varables, I think...
  #5   Spotlight this post!  
Unread 16-02-2002, 12:00
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Quote:
Originally posted by Ian W.
If you're out of variable space, then you're pretty much out of choices to make.
Not exactly true.

We have run out of variable space several times, and have continued adding variables!

There are a couple of strategies we use when such a situation arises: Firstly, you may have some variables which are only used for intermediate values in calculations. For these, you may use "scratch" variables which can be reused similarly in other sections of the code.

You can also swap data to and from scratchpad RAM. For instance, you are filtering your joystick inputs, and you need to keep a "previous filtered value" from one loop iteration to the next, but that value is only needed in one small section of the code. Here's how you can use scratchpad RAM for this data:
Code:
' =====================
'ScratchPad RAM memory map:

PREV_FILTERED_X con 0
PREV_FILTERED_Y con 1

...


' =====================
'Filter the joystick inputs

get PREV_FILTERED_X, scratch1 ' Reads prev value into scratch1

... ' Calculate new filtered value

put PREV_FILTERED_X, newFilteredX

...
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #6   Spotlight this post!  
Unread 16-02-2002, 18:07
Amadkow's Avatar
Amadkow Amadkow is offline
Registered User
AKA: James Watts
None #0524 (Aplpha Omega)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Bakersfield
Posts: 74
Amadkow is an unknown quantity at this point
Send a message via ICQ to Amadkow Send a message via AIM to Amadkow Send a message via Yahoo to Amadkow
Cool

thanks for the help
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
Thunder Chicken CCT Simon G Motors 4 03-01-2003 13:18
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32
Drivetrain help thedillybar Technical Discussion 9 08-01-2002 21:54
Drivetrain Help Jordan Technical Discussion 16 02-12-2001 12:14
Drill motor gearBox question Dennis Hughes Motors 4 11-10-2001 07:11


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

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