Go to Post Even in the worst times, I get a reminder of just how wonderful my big FIRST family is. - 216Robochick288 [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 13-03-2013, 04:47
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Question SmartDashboard with CommandBasedRobot Template

Since all of the tweaking of our robot code with regards to its proper operation are done, I've been working on customizing the dashboard using SmartDashboard. However, as I'm using the CommandBasedRobot template, I've run into a puzzling issue. I have no idea where to put all of my SmartDashboard:utNumber... commands.

I've come up with three ideas, and reasons why each of them may not work properly.

1) Place the SmartDashboard output commands in the Subsystem functions that access the required objects.
Problem: I end up with SmartDashboard code everywhere and that seems a bit messy.

2) Create a SmartDashboardOutput Command. (This is what I was doing before posting this topic.)
Problem: It 'Requires' every Subsystem that I want output from and I'm worried that those requirements (and the interrupts that they will cause) will stop the robot from functioning correctly.

3) Put copies of all the SmartDashboard commands in the appropriate functions (DisabledPeriodic, AutonomousPeriodic, and TeleopPeriodic) of the CommandBasedRobot.cpp file.
Problem: This seems to make the most sense but I'm not sure that this is where these things should go. Also, I'd end up with three copies of each output line.

I've read the SmartDashboard guide but all of its code examples seem to use the SimpleRobot template so I haven't been able to use that as a reference for this purpose.

Normally, if I couldn't figure something like this out, I'd just write it all three ways and test by trial-and-error but, we only have so many 'Robot Access Period' hours before this weekend and I'd rather not waste any driver practice time with unnecessary flashing.

Thanks for any help you can provide ^_^
__________________

Reply With Quote
  #2   Spotlight this post!  
Unread 13-03-2013, 09:34
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: SmartDashboard with CommandBasedRobot Template

We created a function to hold all the SmartDashboard calls in the robot class. It is hooked to a GetRawButton on the joystick inside each of the appropriate functions. That way we aren't sending all the data when we don't have to have it.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-03-2013, 15:45
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: SmartDashboard with CommandBasedRobot Template

We just have it in our TeleopPeriodic() loop running at whatever interval we set it to from the Dashboard. Personally, I would just make a function and put it in a vxWorks task instead of thinking about it too hard. But then again, that would defeat the purpose of Command-based robot, which is to eliminate any reason why you would worry about relatively complex things like threading.

Alex Brinister
Reply With Quote
  #4   Spotlight this post!  
Unread 13-03-2013, 16:33
BigJ BigJ is online now
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 945
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: SmartDashboard with CommandBasedRobot Template

Quote:
Originally Posted by CardcaptorRLH85 View Post
2) Create a SmartDashboardOutput Command. (This is what I was doing before posting this topic.)
Problem: It 'Requires' every Subsystem that I want output from and I'm worried that those requirements (and the interrupts that they will cause) will stop the robot from functioning correctly.
You don't have to "require" the subsystems. If all you are doing is reading from them, it is fine. Because the Command extends CommandBase, you have access to the subsystem. the only thing that requires() does is stop other commands that require the subsystem because you are ostensibly going to affect the subsystems outputs.

TL;DR: If you are using a subsystem as read-only it is probably safe not to require it, AFAIK.
Reply With Quote
  #5   Spotlight this post!  
Unread 13-03-2013, 16:37
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: SmartDashboard with CommandBasedRobot Template

Quote:
Originally Posted by BigJ View Post
You don't have to "require" the subsystems. If all you are doing is reading from them, it is fine. Because the Command extends CommandBase, you have access to the subsystem. the only thing that requires() does is stop other commands that require the subsystem because you are ostensibly going to affect the subsystems outputs.

TL;DR: If you are using a subsystem as read-only it is probably safe not to require it, AFAIK.
Really? If that's true then I should be good. Thanks ^_^
__________________

Reply With Quote
  #6   Spotlight this post!  
Unread 13-03-2013, 20:53
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: SmartDashboard with CommandBasedRobot Template

I have not been able to get commands to run in disabled. If you are able to, I'd like to know how.
Reply With Quote
  #7   Spotlight this post!  
Unread 13-03-2013, 21:27
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: SmartDashboard with CommandBasedRobot Template

Quote:
Originally Posted by Jefferson View Post
I have not been able to get commands to run in disabled. If you are able to, I'd like to know how.
In Java, there is a setRunWhileDisabled method, that you can call in the constructor of the command. You also need to call the scheduler in the disabledPeriodic. I assume it's similar in C++.
Reply With Quote
  #8   Spotlight this post!  
Unread 13-03-2013, 21:40
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: SmartDashboard with CommandBasedRobot Template

Quote:
Originally Posted by Joe Ross View Post
In Java, there is a setRunWhileDisabled method, that you can call in the constructor of the command. You also need to call the scheduler in the disabledPeriodic. I assume it's similar in C++.
Ah. Probably. I was running the scheduler, but didnt know about the setRunWhileDisabled option. I'll check it out tonight.

Thanks
Reply With Quote
  #9   Spotlight this post!  
Unread 13-03-2013, 21:42
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: SmartDashboard with CommandBasedRobot Template

Quote:
Originally Posted by Jefferson View Post
I have not been able to get commands to run in disabled. If you are able to, I'd like to know how.
Quote:
Originally Posted by Joe Ross View Post
In Java, there is a setRunWhileDisabled method, that you can call in the constructor of the command. You also need to call the scheduler in the disabledPeriodic. I assume it's similar in C++.
Yup, in C++ it works like this:

Code:
	virtual void RobotInit() {
		CommandBase::init();
		lw = LiveWindow::GetInstance();
		
                RandomCommand->SetRunWhenDisabled(true);
	}
        .
        .
        .
	virtual void DisabledPeriodic() {
		RandomCommand->Run();
		Scheduler::GetInstance()->Run();
	}
__________________

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 12:49.

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