Go to Post ...FIRST was created to change that world for the better. To presume that FIRST is simply here for your enjoyment is to demote it to nothing more than an expensive game... - RogerR [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
  #1   Spotlight this post!  
Unread 19-01-2009, 16:13
raptorf22 raptorf22 is offline
Registered User
no team
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Mass
Posts: 1
raptorf22 is an unknown quantity at this point
Timing in Simple Robot

How can I create timed loops using the SimpleRobot? The teleop code in SimpleRobot seems to run as fast as it can, while the IterativeRobot is throttled at 200Hz.

Right now we have tried something like this, but would rather make this work with the SimpleRobot
PHP Code:
#include "WPILib.h"

class CustomRobot : public IterativeRobot
{
    
RobotDrive drive// robot drive system
    
Joystick stick// only joystick
    
    // Local variables to count the number of periodic loops performed
    
UINT32 m_telePeriodicLoops;

public:
    
CustomRobot(void): drive(1,3,2,4), stick(1)
    {
        
GetWatchdog().SetExpiration(100);
        
        
// Initialize counters to record the number of loops completed in autonomous and teleop modes
        
m_telePeriodicLoops 0;
    }

    
void TeleopPeriodic(void){
        
GetWatchdog().Feed();
        
m_telePeriodicLoops++;
        
        
//Lets check time over a few minutes
        
if(m_telePeriodicLoops 200 == 0){
            
printf("Seconds: %d\r\n",m_telePeriodicLoops 200);
        }
        
        
//Reset Timer
        
if(stick.GetRawButton(2)){
            
m_telePeriodicLoops 0;
        }
        
        
drive.ArcadeDrive(stick);
    }
};

START_ROBOT_CLASS(CustomRobot); 
Any ideas? Best practices?
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Robot: Simple or Iterative? Abrakadabra Programming 3 14-01-2009 22:01
Robot Timing Code robotrobot2 Programming 8 19-01-2008 14:18
timing of re-contact Gary Dillard Rules/Strategy 16 19-01-2008 14:09
Demo: Simple robot arm with a PID controller mtomczak Programming 1 17-01-2008 02:17
autonomous timing seanl Programming 6 09-03-2007 09:42


All times are GMT -5. The time now is 17:27.

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