Go to Post Best. Team. Update. Ever. - Billfred [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 21-02-2005, 13:19
Moloch's Avatar
Moloch Moloch is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Michigan
Posts: 39
Moloch can only hope to improve
Robot turning Erratically in auton...

During auton mode, when given a turn command in the commands.h, all it does is spin around in circles...please help! We ship out tonight!
  #2   Spotlight this post!  
Unread 21-02-2005, 17:04
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: Robot turning Erratically in auton...

Quote:
Originally Posted by Moloch
During auton mode, when given a turn command in the commands.h, all it does is spin around in circles...please help! We ship out tonight!

Did you get it running with the original scripting code? I haven't been able to do that....

Jon
  #3   Spotlight this post!  
Unread 21-02-2005, 22:13
neilsonster's Avatar
neilsonster neilsonster is offline
Registered User
AKA: Andrew Neilson
FRC #0772 (Sabre Bytes)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 188
neilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to allneilsonster is a name known to all
Send a message via MSN to neilsonster
Re: Robot turning Erratically in auton...

Your motors are either turning in the wrong direction or your gyro isn't calculating the bias properly. For us we had to give the gyro a second to get bias or else it would spit out an angle like 20 000 milliradians to turn (it spins in circles). Try adding in some extra wait time before calculating bias. If it works then decrease it as much as you can. Hope that helps
  #4   Spotlight this post!  
Unread 22-02-2005, 11:33
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Robot turning Erratically in auton...

the PWM's are mixed up. swap them and it will solve your problems.
  #5   Spotlight this post!  
Unread 23-02-2005, 13:49
Moloch's Avatar
Moloch Moloch is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Michigan
Posts: 39
Moloch can only hope to improve
Re: Robot turning Erratically in auton...

Incorrect.
  #6   Spotlight this post!  
Unread 23-02-2005, 14:20
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Robot turning Erratically in auton...

Quote:
Originally Posted by Moloch
Incorrect.
I'm not sure who you're saying was incorrect, but turning one of the cables around would definetly solve your problem, but it's most likely not the solution you want. (Because you, I assume, have it working correctly under normal driver control.)

What I would do is go into pid.c and and find the function called pid(). Down at the bottom of that function, find these lines:
Code:
switch (motor)
  {
  case LEFT:
    {
    wheel_l = (unsigned char)(PWM_ZERO + LEFT_DIR * motor_info[left].pwm);
	break;
    }
  case RIGHT:
    {
    wheel_r = (unsigned char)(PWM_ZERO + RIGHT_DIR * motor_info[right].pwm);
	break;
    }
  default:
	{
	printf("Unknown motor");
	break;
	}
  }
For which ever motor is running the wrong way, take the value they are currently assigning to it and subtract it from 255. IE, if you're left motor is the one running backward:
Code:
switch (motor)
  {
  case LEFT:
    {
    wheel_l = 255 - (unsigned char)(PWM_ZERO + LEFT_DIR * motor_info[left].pwm);
	break;
    }
  case RIGHT:
    {
    wheel_r = (unsigned char)(PWM_ZERO + RIGHT_DIR * motor_info[right].pwm);
	break;
    }
  default:
	{
	printf("Unknown motor");
	break;
	}
  }
Yep... and I just read your post and discovered that it spins in circles when you tell it to turn. So I'll leave that because it may help someone else, but now for my new answer:

You're probably going so fast that your encoders are missing clicks. If you're not using interrupts, you have a fairly limited ability to see state changes...
__________________

  #7   Spotlight this post!  
Unread 23-02-2005, 16:07
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Robot turning Erratically in auton...

I would assume that your encoders are working, since you didn't mention any problems with going straight. Is your gyro working is the first question.

Even with a working gyro, we had trouble with the turning code, I think it was because our encoders didn't give enough resolution to give good velocity control. With a few modifications we were able to get the code to turn with encoders working well enough. We're still working on turning with the gyro.
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
Winning Robot or Quality Robot? Eric Bareiss General Forum 30 09-02-2006 13:19
Is allowing a practice robot good for FIRST? Matt Adams General Forum 38 19-01-2005 11:35
[moderated] You write <G34> and <G35> Aidan F. Browne General Forum 109 21-04-2004 17:00
Robot Collaboration Karthik General Forum 153 18-02-2004 03:40
about how Drive Train push the robot... shouldn't the force accelerate the robot? Ken Leung Technical Discussion 12 26-11-2001 09:39


All times are GMT -5. The time now is 00:19.

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