Go to Post I have trouble believing that there's really a regional that isn't fun... - psquared89 [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
  #2   Spotlight this post!  
Unread 30-01-2006, 19:44
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: 852
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
Send a message via AIM to Cuog
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 : 30-01-2006 at 19:50.
 


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 04-08-2005 21:20
Acceleration Sensor Connected, but values are odd.... Leav Electrical 7 04-02-2005 15:28
van door torque curve DLyons Motors 1 13-01-2003 21:54
Drill motor torque curve thedillybar Motors 1 10-03-2002 05:19
The Learning Curve Was Steep! Mike McIntyre OCCRA 0 12-11-2001 00:23


All times are GMT -5. The time now is 11:27.

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