Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "Commands/Scheduler.h"
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
#include <algorithm>
|
|
|
|
|
#include <set>
|
2016-09-25 16:50:13 -07:00
|
|
|
|
2018-07-08 15:41:31 -07:00
|
|
|
#include <HAL/HAL.h>
|
|
|
|
|
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
#include "Buttons/ButtonScheduler.h"
|
|
|
|
|
#include "Commands/Subsystem.h"
|
2017-12-04 23:28:33 -08:00
|
|
|
#include "SmartDashboard/SendableBuilder.h"
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
#include "WPIErrors.h"
|
|
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
Scheduler* Scheduler::GetInstance() {
|
2015-06-24 04:25:10 -07:00
|
|
|
static Scheduler instance;
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
return &instance;
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void Scheduler::AddCommand(Command* command) {
|
2017-11-22 17:10:21 -08:00
|
|
|
std::lock_guard<wpi::mutex> lock(m_additionsMutex);
|
2015-06-25 15:07:55 -04:00
|
|
|
if (std::find(m_additions.begin(), m_additions.end(), command) !=
|
|
|
|
|
m_additions.end())
|
|
|
|
|
return;
|
|
|
|
|
m_additions.push_back(command);
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void Scheduler::AddButton(ButtonScheduler* button) {
|
2017-11-22 17:10:21 -08:00
|
|
|
std::lock_guard<wpi::mutex> lock(m_buttonsMutex);
|
2018-06-23 19:41:45 -05:00
|
|
|
m_buttons.emplace_back(button);
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-31 20:47:15 -07:00
|
|
|
void Scheduler::RegisterSubsystem(Subsystem* subsystem) {
|
|
|
|
|
if (subsystem == nullptr) {
|
|
|
|
|
wpi_setWPIErrorWithContext(NullParameter, "subsystem");
|
2015-06-25 15:07:55 -04:00
|
|
|
return;
|
|
|
|
|
}
|
2018-05-31 20:47:15 -07:00
|
|
|
m_subsystems.insert(subsystem);
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scheduler::Run() {
|
2015-06-25 15:07:55 -04:00
|
|
|
// Get button input (going backwards preserves button priority)
|
|
|
|
|
{
|
|
|
|
|
if (!m_enabled) return;
|
|
|
|
|
|
2017-11-22 17:10:21 -08:00
|
|
|
std::lock_guard<wpi::mutex> lock(m_buttonsMutex);
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& button : m_buttons) {
|
|
|
|
|
button->Execute();
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-02 23:02:41 -07:00
|
|
|
// Call every subsystem's periodic method
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& subsystem : m_subsystems) {
|
2017-07-02 23:02:41 -07:00
|
|
|
subsystem->Periodic();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
m_runningCommandsChanged = false;
|
|
|
|
|
|
|
|
|
|
// Loop through the commands
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto cmdIter = m_commands.begin(); cmdIter != m_commands.end();) {
|
|
|
|
|
Command* command = *cmdIter;
|
2015-06-25 15:07:55 -04:00
|
|
|
// Increment before potentially removing to keep the iterator valid
|
2018-06-23 19:41:45 -05:00
|
|
|
++cmdIter;
|
2015-06-25 15:07:55 -04:00
|
|
|
if (!command->Run()) {
|
|
|
|
|
Remove(command);
|
|
|
|
|
m_runningCommandsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add the new things
|
|
|
|
|
{
|
2017-11-22 17:10:21 -08:00
|
|
|
std::lock_guard<wpi::mutex> lock(m_additionsMutex);
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& addition : m_additions) {
|
|
|
|
|
ProcessCommandAddition(addition);
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
|
|
|
|
m_additions.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add in the defaults
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& subsystem : m_subsystems) {
|
|
|
|
|
if (subsystem->GetCurrentCommand() == nullptr) {
|
|
|
|
|
ProcessCommandAddition(subsystem->GetDefaultCommand());
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
2018-06-23 19:41:45 -05:00
|
|
|
subsystem->ConfirmCommand();
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void Scheduler::Remove(Command* command) {
|
2015-06-23 04:49:51 -07:00
|
|
|
if (command == nullptr) {
|
2015-06-25 15:07:55 -04:00
|
|
|
wpi_setWPIErrorWithContext(NullParameter, "command");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_commands.erase(command)) return;
|
|
|
|
|
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& requirement : command->GetRequirements()) {
|
|
|
|
|
requirement->SetCurrentCommand(nullptr);
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command->Removed();
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scheduler::RemoveAll() {
|
2015-06-25 15:07:55 -04:00
|
|
|
while (m_commands.size() > 0) {
|
|
|
|
|
Remove(*m_commands.begin());
|
|
|
|
|
}
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void Scheduler::ResetAll() {
|
|
|
|
|
RemoveAll();
|
|
|
|
|
m_subsystems.clear();
|
|
|
|
|
m_buttons.clear();
|
|
|
|
|
m_additions.clear();
|
|
|
|
|
m_commands.clear();
|
2017-09-02 00:17:43 -07:00
|
|
|
m_namesEntry = nt::NetworkTableEntry();
|
|
|
|
|
m_idsEntry = nt::NetworkTableEntry();
|
|
|
|
|
m_cancelEntry = nt::NetworkTableEntry();
|
2014-09-20 23:08:44 -04:00
|
|
|
}
|
|
|
|
|
|
2018-05-31 20:47:15 -07:00
|
|
|
void Scheduler::SetEnabled(bool enabled) { m_enabled = enabled; }
|
|
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
void Scheduler::InitSendable(SendableBuilder& builder) {
|
|
|
|
|
builder.SetSmartDashboardType("Scheduler");
|
|
|
|
|
m_namesEntry = builder.GetEntry("Names");
|
|
|
|
|
m_idsEntry = builder.GetEntry("Ids");
|
|
|
|
|
m_cancelEntry = builder.GetEntry("Cancel");
|
|
|
|
|
builder.SetUpdateTable([=]() {
|
2015-06-25 15:07:55 -04:00
|
|
|
// Get the list of possible commands to cancel
|
2017-09-02 00:17:43 -07:00
|
|
|
auto new_toCancel = m_cancelEntry.GetValue();
|
2015-08-13 23:17:19 -07:00
|
|
|
if (new_toCancel)
|
|
|
|
|
toCancel = new_toCancel->GetDoubleArray();
|
|
|
|
|
else
|
|
|
|
|
toCancel.resize(0);
|
2015-06-25 15:07:55 -04:00
|
|
|
|
2017-11-16 00:33:51 -08:00
|
|
|
// Cancel commands whose cancel buttons were pressed on the SmartDashboard
|
2015-08-13 23:17:19 -07:00
|
|
|
if (!toCancel.empty()) {
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& command : m_commands) {
|
|
|
|
|
for (const auto& cancelled : toCancel) {
|
|
|
|
|
if (command->GetID() == cancelled) {
|
|
|
|
|
command->Cancel();
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-13 23:17:19 -07:00
|
|
|
toCancel.resize(0);
|
2017-09-02 00:17:43 -07:00
|
|
|
m_cancelEntry.SetDoubleArray(toCancel);
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the running commands
|
|
|
|
|
if (m_runningCommandsChanged) {
|
2015-08-13 23:17:19 -07:00
|
|
|
commands.resize(0);
|
|
|
|
|
ids.resize(0);
|
2018-06-23 19:41:45 -05:00
|
|
|
for (const auto& command : m_commands) {
|
|
|
|
|
commands.emplace_back(command->GetName());
|
|
|
|
|
ids.emplace_back(command->GetID());
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
2017-09-02 00:17:43 -07:00
|
|
|
m_namesEntry.SetStringArray(commands);
|
|
|
|
|
m_idsEntry.SetDoubleArray(ids);
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
2017-12-04 23:28:33 -08:00
|
|
|
});
|
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Added Omar's changes to the compressor interface
Fixes to make C++ plugin compile on linux.
Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.
Fixed wpilibJavaSim artifactId to mirror the new convention.
Modified the build of the java plugin to pull in the simulation dependencies.
Added stacktrace printing.
Fixed support for creating projects.
Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.
Added support for a "WPILib Simulate" button.
Added GearsBot to the built in examples.
Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.
Removed unused import.
Added file browser for world files.
Added support for debugging in simulation.
Change simulate icon to be a Gazebo icon.
Switched over to the gazebo messaging system.
Updated location of default world file.
Reverted cmake change.
Fixed bug in WPILibJSim, added better logging and cleaned up code.
Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.
Added installation to frc_gazebo_plugin Makefile.
Fixed running of simulation to actually use frcsim.
Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.
Added notes for generating protobuf messages.
Import of the debuild process into the main repository.
Moved frc_gazebo_plugin under simulation and removed the gazebo folder.
Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].
Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.
Reduced delay between starting frcsim and the users program to 1 second.
Updated GearsBot example.
Fixed a few minor issues for demoable state.
Added simulator support for Victors, Jaguars and Talons.
Added NetworkTables, SmartDashboard and LiveWindow to the simulator.
Added AnalogPotentiometer for simulation.
Added support for simulating encoders.
Added simulation support for Gyro.
Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.
Added RobotDrive support to simulation.
Separated out JavaGazebo so that SimDS will be able to reuse it.
Separated out SimDS into its own application..
Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.
Added DriverStation support to WPILibCSim
Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.
Cleanup of includes for WPILibCSim
Added AnalogPotentiometer to the real WPILibC.
Added AnalogPotentiometer to the real WPILibC.
Added GearsBot example to C++ eclipse plugin.
WPILibCSim fixes to work with launching from the plugin.
Package libwpilibsim in a deb file.
Added includes to plugin distribution.
Added support for external-limit-switches to Gazebo, Java and C++.
Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.
Added support for internal limit switches.
Updated GearsBot programs to use limit switches + range finders.
Added disabling of motors when robot is disabled to more closely mimic the real robot.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.
Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-12 11:02:26 -07:00
|
|
|
}
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
Scheduler::Scheduler() {
|
2018-07-08 15:41:31 -07:00
|
|
|
HAL_Report(HALUsageReporting::kResourceType_Command,
|
|
|
|
|
HALUsageReporting::kCommand_Scheduler);
|
2018-05-31 20:47:15 -07:00
|
|
|
SetName("Scheduler");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scheduler::ProcessCommandAddition(Command* command) {
|
|
|
|
|
if (command == nullptr) return;
|
|
|
|
|
|
|
|
|
|
// Check to make sure no adding during adding
|
|
|
|
|
if (m_adding) {
|
|
|
|
|
wpi_setWPIErrorWithContext(IncompatibleState,
|
|
|
|
|
"Can not start command from cancel method");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Only add if not already in
|
|
|
|
|
auto found = m_commands.find(command);
|
|
|
|
|
if (found == m_commands.end()) {
|
|
|
|
|
// Check that the requirements can be had
|
|
|
|
|
Command::SubsystemSet requirements = command->GetRequirements();
|
2018-06-23 19:41:45 -05:00
|
|
|
for (const auto& requirement : requirements) {
|
|
|
|
|
if (requirement->GetCurrentCommand() != nullptr &&
|
|
|
|
|
!requirement->GetCurrentCommand()->IsInterruptible())
|
2018-05-31 20:47:15 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Give it the requirements
|
|
|
|
|
m_adding = true;
|
2018-06-23 19:41:45 -05:00
|
|
|
for (auto& requirement : requirements) {
|
|
|
|
|
if (requirement->GetCurrentCommand() != nullptr) {
|
|
|
|
|
requirement->GetCurrentCommand()->Cancel();
|
|
|
|
|
Remove(requirement->GetCurrentCommand());
|
2018-05-31 20:47:15 -07:00
|
|
|
}
|
2018-06-23 19:41:45 -05:00
|
|
|
requirement->SetCurrentCommand(command);
|
2018-05-31 20:47:15 -07:00
|
|
|
}
|
|
|
|
|
m_adding = false;
|
|
|
|
|
|
|
|
|
|
m_commands.insert(command);
|
|
|
|
|
|
|
|
|
|
command->StartRunning();
|
|
|
|
|
m_runningCommandsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
}
|