Go to Post Sometimes an aggravating season is the most educational. - Al Skierkiewicz [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 31-01-2007, 22:51
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
limiting voltage to the speed controller

Is there a location (file) in EasyC that we can change the ratio between the tellioperated input signal into the robot controller, and the pwm output signal to the speed controllers For ex. when i push a joystick 50% of its motion forward, can i have the controller only send out 10% of the pwm output signal. (to say it more simply the voltage to the speed controller)
  #2   Spotlight this post!  
Unread 31-01-2007, 22:57
Stuart's Avatar
Stuart Stuart is offline
#include coffee.h
FRC #1745 (P51- Mustangs)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Dallas, TX
Posts: 414
Stuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond repute
Send a message via AIM to Stuart
Re: limiting voltage to the speed controller

you can set up a look up table.
ie: an array with 256 elements where each element has a value from 0-255

so if it were 50% push on a joy stick that would look like array[192] = 147ish

you can also run the joystick value through a math function to get your answer
left = ((left -127) /2 ) + 127

btw thats our "half the displacement" algorithm
__________________
Proud mentor of Team #1745 the P-51 Mustangs

If at first it doesn't work, use a hammer.
If that doesn't work, use a bigger hammer.
  #3   Spotlight this post!  
Unread 31-01-2007, 23:42
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 98
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: limiting voltage to the speed controller

The enclosed zip file is a Graphing Calculator file that demonstrates how you can have a linear translation from the joystick to the motor.

Graphing Calculator including a viewer is available from Pacific Tech at http://www.pacifict.com/Products.html
Attached Files
File Type: zip Joystick Scale.gcf.zip (673 Bytes, 26 views)
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #4   Spotlight this post!  
Unread 01-02-2007, 10:50
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
Re: limiting voltage to the speed controller

When you say left = .... are you using a variable for that?? Because i'm not quite sure on how to do that. And also do you add a user function block to put that task in or is it under assignment that you put that in or what. it's all quite confusing to me...Could you explain more simply how do you run the joystick value through a math function??? This if my first year working on this program and i am still becoming familiar with the software and help would be greatly appreciated

Last edited by team877 : 01-02-2007 at 11:05.
  #5   Spotlight this post!  
Unread 06-02-2007, 08:11
WGRAY WGRAY is offline
Registered User
FRC #2027
 
Join Date: Jan 2007
Location: westbury
Posts: 22
WGRAY is an unknown quantity at this point
Re: limiting voltage to the speed controller

Can you explain how to ": array with 256 elements where each element has a value from 0-255" in easycpro for us newbies. Maybe a quick step by step. Thanks
  #6   Spotlight this post!  
Unread 06-02-2007, 09:16
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: limiting voltage to the speed controller

If it was me, I don't think I'd use a lookup table. I have no idea how to set that up in easyC (which is part of why I don't use it all the time). In any case, here's my solution.

If you take the joystick input and subtract 127, you get a -127 to 127 value. Divide that by 127 to get a -1 to 1 value. Then, you multiply that by the range you want the output to be--if you want it to be half what it is, the range would be 127 / 2 = 64ish. So you'd multiply by 64. That will give you a -64 to 64 value. Then, add 127 to center it around 127 again, for the PWM output, and output it.

I've attached a screen shot of the code I use. I multiplied the value first, then divided, but that shouldn't change the answer.

JBot
Attached Thumbnails
Click image for larger version

Name:	easyC scaled output.JPG
Views:	45
Size:	29.3 KB
ID:	5020  
__________________
Aren't signatures a bit outdated?
  #7   Spotlight this post!  
Unread 06-02-2007, 11:11
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: limiting voltage to the speed controller

I'm pretty sure you cannot use lookup tables with easyC. The solutions posted will work.

You could even do something like a cubic regression. If you do it right, it will let you move the motor very slowly, but you will still be able to use the full range if you need to.
  #8   Spotlight this post!  
Unread 06-02-2007, 16:28
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: limiting voltage to the speed controller

Quote:
you can also run the joystick value through a math function to get your answer
left = ((left -127) /2 ) + 127
Dont forget to typecast or else you will overflow.

left = (( (int)left - 127) /2 ) + 127

you can replace 2 with any value that you want to in order to further dampen the speed.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
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
Battery Voltage variable on EDU controller bear24rw Programming 2 02-07-2006 23:05
speed controller max speed Team 668 Programming 15 13-02-2005 14:05
voltage regulators vs. speed controlers Greg Needel Electrical 8 06-08-2004 23:31
Speed limiting code from last year in C? Josh Siegel Programming 6 01-04-2004 22:27
How do you connect the speed controller fans? Iain Electrical 7 31-01-2003 07:05


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

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