Go to Post Continuous improvement turns good to great. Continuous tinkering can lead to inconsistent behavior and headaches. - IKE [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
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 09-05-2013, 00:54
jacob9706 jacob9706 is offline
Registered User
AKA: Jacob Ebey
FRC #3574 (High Tekerz)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Seattle
Posts: 101
jacob9706 is on a distinguished road
Need some feedback

I am going to come straight out and say that I have yet to actually test any of this code on a robot. The point of this is not to have anyone look over it and see if it will run or look for syntax errors or anything like that but to see if people would be interested in the concept behind the potential framework.

I am here to see the interest in my concept. I will continue developing for anyone who want's it but any feedback/suggestions for the system would be awesome.

Code: link

The idea is that you create individual modules (files) with classes in them that represent a system. In the like there is a drive module (drive.py) that represents a drive system. There is a method for teleop driving and one for autonomous driving for X amount of time at Y speed. The required objects to run the drive (Joysticks and Motors) are imported from the robotmap module at the top of the file along with a nifty Kalman filter I whipped up (have not documented yet). At the bottom of the drive.py there are 3 important lines. These lines import the scheduler instance, create a instance of the above class and register the DriveTeleop method to the scheduler as a task to be executed over and over during teleop. The DriveTeleop returns False always which means that it will never be removed from the scheduler.

In the robot.py on line 91 there is a method that is called RegisterAutonomous. This method registers our DriveForTime method from the instance of the Drive class called drive located in the drive module. It is registered as a sequential task then the time, and speed are specified. We then call this method on line 51 before we get into our autonomous loop. Once in the loop we execute the autonomous commands by calling scheduler.Autonomous() inside of the loop. After the loop is over we clear all the autonomous tasks incase they did not finish that way we may run autonomous again without rebooting the robot.

Running the teleop scheduler is as easy as calling scheduler.OperatorControl() inside of the teleop loop. We do not clear the teleop tasks after the loop though because the tasks have been registered in their individual modules.

There is another method called RegisterOperatorControlTaskIfNotAlready that will only register if there is not already a registered instance of that task. This is by name of the method not by the name you specify when you register it. This could be used for things like shooting. You have a button push run the method RegisterOperatorControlTaskIfNotAlready and try to schedual the kicker.kick method for example. This would then just "ignore" the push and continue with the kick until it resolves then if the button is still pushed it would register a new kicker.kick task.
__________________
/*
* Team 3574 Alumni
*
* 2011 - Highest Seeded Rookie
* 2011 - Rookie All-Star
* 2012 - Engineering Inspiration
* 2012 - Olympic Deans List Winner
* 2013 - Engineering Inspiration
* 2013 - Judges Award (For unique circular robot and the way the team works together.)
*/
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 06:22.

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