Go to Post One wouldn't want to keep the red herring in hand, that gets kind of stinky. - GaryVoshol [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 21-02-2004, 09:35
Matthew_H's Avatar
Matthew_H Matthew_H is offline
Ubergeek
#1028 (Ubergeeks)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2001
Location: Huntsville,AL
Posts: 105
Matthew_H will become famous soon enough
Send a message via AIM to Matthew_H Send a message via MSN to Matthew_H
Software Speed Fix

Where in the default code do we slow the full speed of the robot. I know this is simple but I just can not seem to find it. Thanks
__________________
Matthew

  #2   Spotlight this post!  
Unread 21-02-2004, 10:12
bstempi bstempi is offline
Captain
#0708 (Hardwired Hatters)
Team Role: Student
 
Join Date: Feb 2004
Location: Horsham, Pa
Posts: 23
bstempi is an unknown quantity at this point
Send a message via AIM to bstempi
Re: Software Speed Fix

You have to create your own code. You either have to add some code to defaultroutine() (in userroutines.c) or from Processdatafrommasterup() (in the same file). Basically, you can do a few things. You can get creative with your code and kind of scale it so that it ignores the first 10 'ticks' of the joystick feedback, but you scale it so that you don't lose range of motion. If you're really in a crunch, you can just flat out ignore some of the feedback. [code]if (pwm15 < 145 && pwm15 > 100) {pwm15 = 127;}[code] Something like this would just ignore whatever values in the joystick output you want. There's a lot of room for creativity. That depends on how creative/timley your coders are. Best of luck to you.
~BStem
  #3   Spotlight this post!  
Unread 21-02-2004, 10:30
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: Software Speed Fix

Quote:
Originally Posted by Matthew_H
Where in the default code do we slow the full speed of the robot. I know this is simple but I just can not seem to find it. Thanks
I'm not exactly sure what you mean by 'slow down' but I'll take a stab.

For as far as I know our team has been scaling back the speed of the robot by 50% unless the 'turbo' button is pressed on the drive stick. This makes the robot more controlable, but still allows the driver to go full speed.

So here's how we do it, and generally how you'd scale any motor down:

<beginner mistake>
If I want to scale the motor speed down by 50% all I have to do is divide the speed by 2
</beginner mistake>

This won't work because the 'zero' point where the motor doesn't move is 127, not 0. So if you divide 127 (motor not moving) by 2 you get 63 which means your motor is moving half speed backwards. In order for your motor to stop running you must add back 64.

Now my equation is motor_speed / 2 + 64. Seems to work fine.

If you want to scale by 1/3 you divide your motor speed by 3 and add 85.

The general formula is:
(motor_speed * (1 / scaling_factor)) + (127 * (1 - (1 / scaling factor)))

Or you could approach it another way. Instead of fooling around with adding the (1 - 1/scaling) factor, you can re-center your math around 0:

First thing you do is subtract 127 from your motor speed, then divide by your scaling factor, then add 127 again to get back to pwm values. Quite simple, but remember to cast the calculation to an integer because an unsigned char can't handle negative numbers.

((motor_speed - 127) / scaling_factor) + 127

Both work. One is probably more efficient than the other. It's a matter of personal preference. I hope this helps.

Someone please check what I wrote for typos, I've been known to make them.
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
Joining 2 dif. motors K.Shaw Motors 32 14-10-2004 19:40
SCRRF Design Classes Redhead Jokes Southern California Regional Robotics Forum 0 10-07-2003 17:29
which software Ryan Foley 3D Animation and Competition 5 01-03-2003 23:39
Power, speed, and torque... AGH Gui Cavalcanti Technical Discussion 5 10-11-2002 19:02
software software software archiver 2001 5 24-06-2002 00:21


All times are GMT -5. The time now is 04:23.

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