OCCRA
Go to Post I saw Dave Lavery on the Webcast. And he winked at me! - Tetraman [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-26-2012, 09:30 PM
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Motors stop running in autonomous

We ran into a little issue with running motors in autonomous at the Palmetto regional. We know about the watchdog for the robot and the motor safetly timers. We disabled the watchdog and set the expiration timeout for the motors, but still sometimes the motors would shut off before the time was up. It seems to happen more on the fields than in the pits, but it did happen in the pit when tethered as well. Our code is similiar to this. I don't have access to it, the laptop is locked up at the school.

My question is if we set the expiration, can't the code delay that long before updating the drive setting? That is before the "drive isn't updated often enough" message?

This didn't always run the full 2 seconds:
Code:
myRobot.SetExpiration(6); // set MotorSafety expiration
myRobot.Drive(0.6, 0.0); 
Wait(2.0); // wait 2 seconds while driving
myRobot.Drive(0.0, 0.0);
To get around this we implemented a loop that keept calling myRobot.Drive() for the time required. Something like:
Quote:
Timer timer;
timer.Reset();
timer.Start();
while (timer.Get() < 2.0)
{
myRobot.Drive(0.6, 0.0);
}
myRobot.Drive(0.0, 0.0);
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #2   Spotlight this post!  
Unread 03-27-2012, 06:46 PM
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 195
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Motors stop running in autonomous

Yea - you may be getting bit by the automatic expiration.

Your re-vamp code looks better, but I'd suggest during your 'while()' that you also put a "Wait(0.1)" so that you're not in a total tight-loop situation which might cause other issues with other tasks on the cRio. I don't know of any such issues, but a tight loop isn't a good thing either.

Code:
Timer timer;
timer.Reset();
timer.Start();

while (timer.Get() < 2.0)
{
  myRobot.Drive(0.6, 0.0);
  Wait(0.1);
}
 
myRobot.Drive(0.0, 0.0);
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
  #3   Spotlight this post!  
Unread 03-27-2012, 11:25 PM
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: Motors stop running in autonomous

Thanks, we did have the Wait() in the while loop, I just didn't remember to type it in when I was making the post.
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
Reply


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


All times are GMT -5. The time now is 08:52 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