Go to Post However, I think the laws of physics indicate that doing so is going to be very difficult at best. - EricH [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 09-02-2016, 21:23
axiomofdarkness's Avatar
axiomofdarkness axiomofdarkness is offline
Registered User
FRC #1403 (Cougar Robotics)
Team Role: Alumni
 
Join Date: Mar 2015
Rookie Year: 2013
Location: United States
Posts: 21
axiomofdarkness has a spectacular aura aboutaxiomofdarkness has a spectacular aura aboutaxiomofdarkness has a spectacular aura about
Update rate of commands

How often is the "Execute" method run on commands in command-based? We are trying to do something which relies on sensor and motor controller values being updated at a constant rate. I am worried that these methods will be called at irregular intervals. So if there is a set rate at which they are called, what is it? And if they are called irregularly, how might I go about ensuring that this information is updated at a regular rate? We are using C++, if it matters.

Last edited by axiomofdarkness : 09-02-2016 at 21:23. Reason: Fixed words
Reply With Quote
  #2   Spotlight this post!  
Unread 09-02-2016, 21:50
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is online now
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,048
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Update rate of commands

Quote:
Originally Posted by axiomofdarkness View Post
How often is the "Execute" method run on commands in command-based? We are trying to do something which relies on sensor and motor controller values being updated at a constant rate. I am worried that these methods will be called at irregular intervals. So if there is a set rate at which they are called, what is it? And if they are called irregularly, how might I go about ensuring that this information is updated at a regular rate? We are using C++, if it matters.
Each execute method should be called approximately every 20ms. This can vary a few ms in either direction though.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-02-2016, 22:03
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,622
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Update rate of commands

In fact, if you're following standard structuring of your command-based code, Teleop/Autonomous/DisabledPeriodic in Robot.cpp is called once per data packet received from the driver station. Which can be irregular if you drop packets.

You could use the Notifier class to set up a periodic event that will call a function at regular intervals. If you're trying to do this for PID control, the PIDController class is already set up for regular timing to run the PID algorithm and set motor outputs.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
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 13:20.

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