|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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 ^_^ |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
Re: SmartDashboard with CommandBasedRobot Template
Quote:
TL;DR: If you are using a subsystem as read-only it is probably safe not to require it, AFAIK. |
|
#5
|
||||
|
||||
|
Re: SmartDashboard with CommandBasedRobot Template
Quote:
|
|
#6
|
|||
|
|||
|
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.
|
|
#7
|
||||||
|
||||||
|
Re: SmartDashboard with CommandBasedRobot Template
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++.
|
|
#8
|
|||
|
|||
|
Re: SmartDashboard with CommandBasedRobot Template
Quote:
Thanks |
|
#9
|
||||
|
||||
|
Re: SmartDashboard with CommandBasedRobot Template
Quote:
Quote:
Code:
virtual void RobotInit() {
CommandBase::init();
lw = LiveWindow::GetInstance();
RandomCommand->SetRunWhenDisabled(true);
}
.
.
.
virtual void DisabledPeriodic() {
RandomCommand->Run();
Scheduler::GetInstance()->Run();
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|