Go to Post FIRST is unlike every other organization or every other robot competition because it begs to you collaborate; it encourages you to be a better person through the help of others. - Amanda Morrison [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 13-02-2003, 18:45
EvilDeathCrab EvilDeathCrab is offline
Registered User
#0620
 
Join Date: Feb 2003
Location: Virginia
Posts: 1
EvilDeathCrab is an unknown quantity at this point
Send a message via ICQ to EvilDeathCrab Send a message via AIM to EvilDeathCrab
Drive Programming

We're trying to implement three things. I think I've got a handle on one of them, and the two others I'm going to ask for input on.
All of this code is considering tank drive on one joystick, with PBASIC 2.5.

1) We have the wheel controlling a speed multiplier that gets added in to the calculation for the motor outputs.

2) We want to implement a "Regular drive" mode where the robot does not turn on a dime. This would involve one of the motors moving more slowly than the other.

3) We want to implement a gradual slowdown in the motor so that the robot does not come to a dead halt whenever the joystick is moved to the neutral position.

This is our current code, with #1 above enabled.

leftdrive=((p1_wheel/255)*(2000 + p1_y - p1_x + 127) Min 2000 Max 2254)-2000
rightdrive=((p1_wheel)/255)*(2000 + p1_y + p1_x - 127) Min 2000 Max 2254)-2000

For #2 I'm thinking something like this:
Wait a minute. I just had a stroke of genius... I think. Wouldn't it just be
if p1_x < 127 then
leftdrive = p1_x
rightdrive = p1_y
else
leftdrive = p1_y
rightdrive = p1_x
endif

as for #3, I'm drawing a blank. I cannot think of an easy way to code this. It would involve getting the difference between the drive (left? right? both?) and the joystick position. Maybe just a lot of IF statements.


Any input on any of the above three would be much appreciated. Thanks again!
__________________
This code works... in theory.
 


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
1 stick drive to 2 stick drive wayne 05 Programming 18 01-04-2004 16:41
how does crab drive work? Soukup Technical Discussion 13 25-04-2003 11:31
Direct drive or Chain? Suneet Technical Discussion 32 27-03-2003 23:00
programming JasonWestHigh Technical Discussion 1 13-01-2003 20:54
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32


All times are GMT -5. The time now is 10:50.

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