Go to Post The object of the team is not to design, build and compete a robot, it is to design, build and compete students. If after four years we have opened a student's eyes to the infinite possibilities they have in their life, it is worth all the effort. - adunakin [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
  #2   Spotlight this post!  
Unread 26-04-2016, 14:04
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,031
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Initial release of MagicBot framework

Magicbot has had a lot of upgrades this season, and hopefully in the offseason I'll be able to add some more things and document them.

Two particular new features in today's release that I wanted to highlight:
  1. There is a 'tunable' property that you can add to automatically add variables to networktables (sorta like ntproperty, but less verbose)
  2. Do you like the autonomous state machine builder? Of course you do! Well, you can create magicbot components using the same style of declarative state machine helpers!

As an example, here's a theoretical shooter component:

Code:
class ShooterAutomation:

    # Some other component
    shooter = Shooter
    ball_pusher = BallPusher
    
    def fire(self):
        """This is called from the main loop"""
        self.engage()
        
    @state(first=True)
    def begin_firing(self):
        self.shooter.enable()
        if self.shooter.ready():
            self.next_state('firing')
        
    @timed_state(duration=1.0, must_finish=True)
    def firing(self):
        """This state will continue executing even if engage isn't called"""
        self.shooter.enable()
        self.ball_pusher.push()

...
    
class MyRobot(magicbot.MagicRobot):

    ...
    
    def teleopPeriodic(self):
    
        if self.joystick.getTrigger():
            self.shooter_automation.fire()


If you're competing at the Championship, you probably won't want to upgrade. But for the rest of you, download it and give it a shot.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff

Last edited by virtuald : 26-04-2016 at 14:06.
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 02:41.

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