Go to Post Oh the wonders that happen in Michigan competitions... ;) - delsaner [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 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.
  #2   Spotlight this post!  
Unread 16-01-2005, 11:30
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: Steering wheel problems

Quote:
Originally Posted by jgannon
...
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.
Well, since RoboEmu2 just came out not to long ago, there are still some bugs that are not fixed (I'm not sure how long Rob was working on it [testing, debugging, etc...] before releasing it). What does it show when you put the joystick in full forward in both RoboEmu & the Dashboard?
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #3   Spotlight this post!  
Unread 16-01-2005, 11:52
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Steering wheel problems

How often are you calling the Generate_Pwms() function?

PWMs 13-16 are special. They get generated directly from the RC's "user" processor, so they can be updated more quickly than the communication with the "master" processor occurs. If you never call Generate_Pwms(), they don't update. But if they get updated too quickly, they get squirrely.
  #4   Spotlight this post!  
Unread 16-01-2005, 14:25
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
Re: Steering wheel problems

Quote:
Originally Posted by Raven_Writer
Well, since RoboEmu2 just came out not to long ago, there are still some bugs that are not fixed (I'm not sure how long Rob was working on it [testing, debugging, etc...] before releasing it). What does it show when you put the joystick in full forward in both RoboEmu & the Dashboard?
I wondered about bugs in RoboEmu2, but I discarded the idea, since the code seems like it should work. When I move the joystick full forward in RoboEmu2, I get 254 on both PWMs, which makes sense. When I move the joystick full forward on the RC, pwm15 goes to 254. If I twist the wheel back and forth, and let it recenter, maybe only pwm16 will go to 254. It's very sporatic.
Quote:
Originally Posted by Alan Anderson
How often are you calling the Generate_Pwms() function?

PWMs 13-16 are special. They get generated directly from the RC's "user" processor, so they can be updated more quickly than the communication with the "master" processor occurs. If you never call Generate_Pwms(), they don't update. But if they get updated too quickly, they get squirrely.
I'm pretty sure that I have Generate_Pwms() at the bottom of the 26.2ms routine, but I'll check for sure on Tuesday. That is where I'm supposed to call it, no?
Quote:
Originally Posted by Mark McLeod
I suspect variable overflow.
LEFT and RIGHT are pretty restricted.
How do you mean?
__________________
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

_
  #5   Spotlight this post!  
Unread 16-01-2005, 12:00
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Steering wheel problems

I suspect variable overflow.
LEFT and RIGHT are pretty restricted.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
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 02:47.

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