OCCRA
Go to Post "Drink Mountain Dew. Eat Pizza. Make Robot. This is life." - onecoolc [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 01-30-2006, 06:39 PM
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 104
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Acceleration Curve

We used an acceleration curve to overcome the sensitivity of the low range of the joystick. The code looks exactly like this:

Code:
tempRight = pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
tempLeft = pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
  
  if(p1_y >= 127){
    tempRight = (tempRight - 127)(tempRight - 127)/127 + 127;
    tempLeft = (tempLeft - 127)(tempLeft - 127)/127 + 127;
  }
  if(p1_y < 127){
    tempRight = (tempRight - 127)(tempRight - 127)/-127 + 127;
    tempLeft = (tempLeft - 127)(tempLeft - 127)/-127 + 127;
  }

  pwm13 = pwm14 = tempRight;
  pwm15 = pwm16 = tempLeft;
When building, the compiler gives error 1202: Call of non-function, on the 4 lines inside the if statements.

I'm completely stumped, any help would be greatly appreciated.
  #2   Spotlight this post!  
Unread 01-30-2006, 06:44 PM
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 854
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Re: Acceleration Curve

I'm not entirely sure what the error is in your code i will take a look at it again but if u want here is the method i used for doind the same thing u are doing:

try adding brackets for order of operations:
tempRight = (((tempRight - 127) * (tempRight - 127))/127) + 127;


Quote:
Originally Posted by code
#include "ifi_aliases.h"
#include "ifi_default.h"
#include "ifi_utilities.h"
#include "user_routines.h"
#include "cuog_cam.h"
#include "cuog_util.h"
#include "math.h"

void Exp_Joy_Mapping()
{
char raw = 0;
switch(MAP_NUMBER)
{
//maps joystick and PWM #8
case 8:
raw = (MAP_JOYSTICK08 - 128) / 11.3;
if(MAP_JOYSTICK08 < 127)
{
MAP_PWM08 = (raw * raw) - 128;
}
else
{
MAP_PWM08 = (raw * raw) + 128;
}
//maps joystick and PWM #7
case 7:
raw = (MAP_JOYSTICK07 - 128) / 11.3;
if(MAP_JOYSTICK07 < 127)
{
MAP_PWM07 = (raw * raw) - 128;
}
else
{
MAP_PWM07 = (raw * raw) + 128;
}
//maps joystick and PWM #6
case 6:
raw = (MAP_JOYSTICK06 - 128) / 11.3;
if(MAP_JOYSTICK06 < 127)
{
MAP_PWM06 = (raw * raw) - 128;
}
else
{
MAP_PWM06 = (raw * raw) + 128;
}
//maps joystick and PWM #5
case 5:
raw = (MAP_JOYSTICK05 - 128) / 11.3;
if(MAP_JOYSTICK05 < 127)
{
MAP_PWM05 = (raw * raw) - 128;
}
else
{
MAP_PWM05 = (raw * raw) + 128;
}
//maps joystick and PWM #4
case 4:
raw = (MAP_JOYSTICK04 - 128) / 11.3;
if(MAP_JOYSTICK04 < 127)
{
MAP_PWM04 = (raw * raw) - 128;
}
else
{
MAP_PWM04 = (raw * raw) + 128;
}
//maps joystick and PWM #3
case 3:
raw = (MAP_JOYSTICK03 - 128) / 11.3;
if(MAP_JOYSTICK03 < 127)
{
MAP_PWM03 = (raw * raw) - 128;
}
else
{
MAP_PWM03 = (raw * raw) + 128;
}
//maps joystick and PWM #2
case 2:
raw = (MAP_JOYSTICK02 - 128) / 11.3;
if(MAP_JOYSTICK02 < 127)
{
MAP_PWM02 = (raw * raw) - 128;
}
else
{
MAP_PWM02 = (raw * raw) + 128;
}
//maps joystick and PWM #1
case 1:
raw = (MAP_JOYSTICK01 - 128) / 11.3;
if(MAP_JOYSTICK01 < 127)
{
MAP_PWM01 = (raw * raw) - 128;
}
else
{
MAP_PWM01 = (raw * raw) + 128;
}

break;
}
}
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.

Last edited by Cuog : 01-30-2006 at 06:50 PM.
  #3   Spotlight this post!  
Unread 01-30-2006, 06:46 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Acceleration Curve

You need an asterisk (*) to multiply.
  #4   Spotlight this post!  
Unread 01-30-2006, 06:51 PM
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Re: Acceleration Curve

Quote:
Originally Posted by Astronouth7303
You need an asterisk (*) to multiply.
Thats the one!
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
  #5   Spotlight this post!  
Unread 01-30-2006, 06:52 PM
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 104
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Re: Acceleration Curve

Quote:
Originally Posted by Astronouth7303
You need an asterisk (*) to multiply.

'Doh! Man, 3 years programming C and I still make these stupid mistakes. Yesterday I forgot to end a quotation on a string and the compiler decided to give a syntax error on a comment 20 lines down


Thanks alot for the help guys, it's always nice to have the outside party take a look at your code because one of two things can happen:

1. They write it better.
2. They find your stupid mistake.
  #6   Spotlight this post!  
Unread 02-01-2006, 03:27 PM
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,186
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Acceleration Curve

Quote:
Originally Posted by Ewilliams2006
'Doh! Man, 3 years programming C and I still make these stupid mistakes. Yesterday I forgot to end a quotation on a string and the compiler decided to give a syntax error on a comment 20 lines down


Thanks alot for the help guys, it's always nice to have the outside party take a look at your code because one of two things can happen:

1. They write it better.
2. They find your stupid mistake.
3. You can help them find their stupid mistakes. Stupid if statements ;-)
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
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
(SolidWorks) Create Sketch Points Around Curve Yan Wang Inventor 6 08-04-2005 08:20 PM
Acceleration Sensor Connected, but values are odd.... Leav Electrical 7 02-04-2005 02:28 PM
van door torque curve DLyons Motors 1 01-13-2003 08:54 PM
Drill motor torque curve thedillybar Motors 1 03-10-2002 04:19 AM
The Learning Curve Was Steep! Mike McIntyre OCCRA 0 11-11-2001 11:23 PM


All times are GMT -5. The time now is 03:22 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi