Go to Post The problem was too many penalties with too much room for judgment. - dbSparx [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Spotlight this post!  
Unread 02-24-2011, 04:35 PM
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Possessed robot

The reason the robot is possessed is that you are calling Wait inside if Elevator_get_the_heigh and Carriage_get_the_height. The tasking thread is told to wait for some time and cannot return back to get the next teleop packet containing new joystick values. The packets where the drivers let go of the joystick are being sent to the robot, but they are ignored because of the Wait().

There are many ways to fix this, but it is very easy to introduce. First make sure the explanation makes sense to you and any other programmers working on the robot.

Assuming time can be driven by the ~20ms arrival rate of new teleop packets, what you want to do is record the time that you started the carriage or elevator motor in a static variables, or perhaps if you do want to use objects, create a static object that holds the pending movements of the motors, the time movement started, and any other info that is helpful.

Each time you enter into teleop, do a quick check to see if a motor has been on long enough and should be turned off. This is also when you'd turn on the elevator motor.

Pay special attention to the initial values and any overrides that the drivers may need that turn the motors off before they reach their target.

Once you get rid of the waits, the exorcism should be complete, and perhaps you can even turn the watchdog back on. It will help identify any other placed in your code which wait or loop and block communications.

Greg McKaskle
Reply With Quote
 


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 09:29 AM.

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