Go to Post You miss 100% of the shots you don't take - Steven Donow [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 15-01-2005, 17:16
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Steering wheel problems

I'm working on controlling our robot with a steering wheel on port 1, and a throttle on port 2. I have the following definitions at the top of user_routines.c:
Code:
#define WHEEL p1_x-127				//Steering wheel on port 1
#define THROTTLE p2_y-127			//Throttle joystick on port 2
#define PIVOT_DISABLE p2_sw_trig	//Trigger button on port 2, disables in-place rotation
#define DEAD 7						//Dead zone where joystick input is ignored
#define LEFT pwm15					//Left drive motor
#define RIGHT pwm16					//Right drive motor
I also have these nifty functions:
Code:
int isActive(int x)
{
  if(abs(x)>DEAD)
    return 1;
  else
    return 0;
}

double turnRatio(void)
{
  return 1-abs(WHEEL)/127.1;
}
Then, in the driving routine, I have this code:
Code:
LEFT=0;
RIGHT=0;
if(!isActive(THROTTLE))
{
  if(isActive(WHEEL)&&!PIVOT_DISABLE)
  {
    LEFT=WHEEL;
    RIGHT=0-WHEEL-1;
  }
}
else
{
  LEFT=THROTTLE;
  RIGHT=THROTTLE;
  if(WHEEL>DEAD)
  {
    RIGHT*=turnRatio();
  }
  else if(WHEEL<-DEAD)
  {
    LEFT*=turnRatio();
  }
}
if((THROTTLE<-DEAD)&&(WHEEL<-DEAD))
  LEFT-=254*turnRatio();
if((THROTTLE<-DEAD)&&(WHEEL>DEAD))
  RIGHT-=254*turnRatio();
LEFT+=127;
RIGHT+=127;
I have tested this code in RobotEmu2 countless times, and it acts as intended (pivot when wheel is engaged without throttle, go straight with throttle but no wheel, arc with both), but when I actually hook up the equipment to the OI and RC, pwm15 and pwm16 show seemingly random values in Dashboard. I don't think that it's a problem with the actual controllers, because the actual values of p1_x and p2_y are as expected. I can't figure out why there's a discrepancy in operation between the emulator and the actual RC, and it's driving me nuts. Anything to help me figure out why this is happening would be appreciated.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_

Last edited by jgannon : 15-01-2005 at 17:24.
 


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
Steering wheel issues jgannon Programming 5 15-12-2004 10:14
Four Wheel, all steering, non-omniwheel, ONE power/motor source drive FizMan Technical Discussion 31 27-04-2004 12:12
how can you use a gyro in autonomous mode magical hands Programming 3 02-01-2004 13:31
need glp programing steering with a steering wheel Matchew Programming 2 10-02-2003 14:20
4 wheel steering/ Crab Huey_Da_X-cat Technical Discussion 3 11-02-2002 22:49


All times are GMT -5. The time now is 20:39.

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