Initial Commit

This commit is contained in:
Jason 2016-01-28 11:33:19 -05:00
parent 3df7e9b128
commit d265820037
821 changed files with 96702 additions and 0 deletions

283
DriveBase/.cproject Normal file
View File

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/GearsBotCPPWin"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/GearsBotCPPWin/Debug"/>
<entry flags="RESOLVED" kind="libraryFile" name="GearsBotCPPWin" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="Debug" id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.379433867" name="Cross GCC" nonInternalBuilderId="cdt.managedbuild.builder.gnu.cross" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
<option id="cdt.managedbuild.option.gnu.cross.prefix.541714056" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-frc-linux-gnueabi-" valueType="string"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1246856819" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" value="/usr/local/bin" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.864368257" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/DriveBase}/Debug" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.1308552451" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1261239456" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.680635682" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.143320011" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1793678673" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1505235107" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1204256582" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.969129918" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.394786621" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${WPILIB}/cpp/current/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.flags.1518551306" superClass="gnu.cpp.compiler.option.dialect.flags" value="-std=c++1y" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.362679811" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1895838080" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option id="gnu.cpp.link.option.libs.1363675797" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="wpi"/>
</option>
<option id="gnu.cpp.link.option.paths.1566479969" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${WPILIB}/cpp/current/lib&quot;"/>
</option>
<option id="gnu.cpp.link.option.flags.675338432" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a,-rpath,/usr/local/frc/rpath-lib" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.132949138" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.412234585" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1047448065" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1542016468" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325" moduleId="org.eclipse.cdt.core.settings" name="linux_simulate">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="linux_simulate" id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325" name="linux_simulate" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.2017904325." name="/" resourcePath="">
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.base.1184188597" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.base.1621111203" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder buildPath="${workspace_loc:/${ProjName}}/Simulate" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.target.gnu.builder.base.840272037" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.158466008" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2105416021" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option id="gnu.cpp.compiler.option.include.paths.1645322059" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/src&quot;"/>
<listOptionValue builtIn="false" value="${WPILIB}/simulation/include"/>
<listOptionValue builtIn="false" value="/usr/include"/>
<listOptionValue builtIn="false" value="/usr/include/gazebo-6.5"/>
<listOptionValue builtIn="false" value="/usr/include/ignition/math2"/>
<listOptionValue builtIn="false" value="/usr/include/sdformat-3.7"/>
</option>
<option id="gnu.cpp.compiler.option.optimization.level.1648211502" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.937474733" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.1023092361" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"/>
<option id="gnu.cpp.compiler.option.dialect.std.1098415592" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.dialect.flags.389754588" superClass="gnu.cpp.compiler.option.dialect.flags" value="-std=c++11" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1758810658" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.2039239712" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.2100353684" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.1900634657" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.1352883605" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1197133064" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.66697269" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.2094820582" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<option id="gnu.cpp.link.option.libs.1563598353" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="wpilibcSim"/>
<listOptionValue builtIn="false" value="gz_msgs"/>
<listOptionValue builtIn="false" value="ntcore"/>
<listOptionValue builtIn="false" value="gazebo_client"/>
<listOptionValue builtIn="false" value="boost_system"/>
</option>
<option id="gnu.cpp.link.option.paths.1677933356" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="/usr/lib/x86_64-linux-gnu"/>
<listOptionValue builtIn="false" value="${WPILIB}/simulation/lib"/>
</option>
<option id="gnu.cpp.link.option.other.1549699992" superClass="gnu.cpp.link.option.other" valueType="stringList">
<listOptionValue builtIn="false" value="-rpath ${WPILIB}/simulation/lib"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.152327207" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.2105089872" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.254601899" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128" moduleId="org.eclipse.cdt.core.settings" name="Windows Simulate">
<externalSettings>
<externalSetting>
<entry flags="RESOLVED" kind="includePath" name="${WPILIB}\cpp\current\include"/>
<entry flags="RESOLVED" kind="includePath" name="C:\Program Files\Gazebo\gazebo\build\install\Debug\include"/>
<entry flags="RESOLVED" kind="includePath" name="C:\Program Files\Gazebo\sdformat\build\install\Debug\include"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/GearsBotCPPWin/src"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="exe" artifactName="FRCUserProgram" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="Windows Simulate" errorParsers="org.eclipse.cdt.core.VCErrorParser" id="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128" name="Windows Simulate" parent="cdt.managedbuild.config.gnu.mingw.exe.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="setup environment variables" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128." name="/" resourcePath="">
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.cross.base.592056279" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
<option id="cdt.managedbuild.option.gnu.cross.prefix.773876502" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1970286339" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1773189260" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/GearsBotCPPWIN}/Windows Simulate" errorParsers="" id="org.eclipse.cdt.build.core.internal.builder.132963544" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="" id="cdt.managedbuild.tool.gnu.cross.c.compiler.1872033968" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.172352140" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.273333971" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.other.1387357347" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1953150292" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool command="&quot;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl&quot;" commandLinePattern="${COMMAND} ${FLAGS} /Fo${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} /wd4068 /EHsc" errorParsers="" id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.809153465" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="gnu.cpp.compiler.option.include.paths.599803694" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${WPILIB}\simulation\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Windows Kits\8.1\Include\um&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Windows Kits\8.1\Include\shared&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\gazebo\build\install\Debug\include\gazebo-6.0&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\sdformat\build\install\Debug\include\sdformat-3.0&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\ign-math\build\install\Debug\include\ignition\math2&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\FreeImage-vc12-x64-release-debug\Source&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\protobuf-2.6.0-win64-vc12\src&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\dlfcn-win32-vc12-x64-release-debug\build\install\Debug\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\tbb43_20141023oss\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\sdformat\src\win\tinyxml&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\pthread-w32\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Gazebo\boost_1_56_0&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.optimization.level.1265709272" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.1058836115" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.dialect.std.2006680120" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.warnings.allwarn.2144515316" name="All warnings (-Wall)" superClass="gnu.cpp.compiler.option.warnings.allwarn" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.other.other.1677876881" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="/c /MDd" valueType="string"/>
<option id="gnu.cpp.compiler.option.other.pic.594318292" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.1865235685" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_USE_MATH_DEFINES"/>
<listOptionValue builtIn="false" value="WIN32_LEAN_AND_MEAN"/>
<listOptionValue builtIn="false" value="NOMINMAX"/>
<listOptionValue builtIn="false" value="FRC_SIMULATOR"/>
</option>
<option id="gnu.cpp.compiler.option.debugging.other.183827657" name="Other debugging flags" superClass="gnu.cpp.compiler.option.debugging.other" useByScannerDiscovery="false" value="/Z7" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1150869869" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1090661906" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool command="&quot;C:\Program Files (x86)\Microsoft Visual Studio 12.0\vc\bin\link&quot;" commandLinePattern="${COMMAND} /ignore:4099 /LIBPATH:&quot;C:\Program Files\Gazebo\FreeImage-vc12-x64-release-debug\x64\Debug\DLL&quot; /LIBPATH:&quot;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\boost_1_56_0\lib64-msvc-12.0&quot; /LIBPATH:&quot;${WPILIB}\simulation\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\dlfcn-win32-vc12-x64-release-debug\build\install\Debug\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\pthread-w32\lib\x64&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\ign-math\build\install\Debug\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\libcurl-vc12-x64-release-debug-static-ipv6-sspi-winssl\Debug\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\sdformat\build\install\Debug\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\protobuf-2.6.0-win64-vc12\vsprojects\Debug&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\gazebo\build\install\Debug\lib&quot; /LIBPATH:&quot;C:\Program Files\Gazebo\tbb43_20141023oss\lib\intel64\vc12&quot; /LIBPATH:&quot;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64&quot; /LIBPATH:&quot;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64&quot; ${FLAGS} /OUT:${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} /DEBUG WPILibSim.lib gazebo.lib gazebo_transport.lib gazebo_msgs.lib gazebo_common.lib gazebo_util.lib gazebo_client.lib gazebo_math.lib libprotobuf.lib sdformat.lib dl.lib libcurl_a_debug.lib ignition-math2.lib pthreadVC2.lib gz_msgs.lib IPHlpApi.lib /NODEFAULTLIB:libboost_system-vc120-mt-gd-1_56.lib /NODEFAULTLIB:libboost_thread-vc120-mt-gd-1_56.lib FreeImaged.lib" errorParsers="" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.680547965" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option id="gnu.cpp.link.option.libs.231732731" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs"/>
<option id="gnu.cpp.link.option.paths.122555745" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths"/>
<option id="gnu.cpp.link.option.shared.1816604740" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" value="false" valueType="boolean"/>
<option id="gnu.cpp.link.option.flags.761367792" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/>
<option id="gnu.cpp.link.option.other.715702568" name="Other options (-Xlinker [option])" superClass="gnu.cpp.link.option.other"/>
<option id="gnu.cpp.link.option.userobjs.984105280" name="Other objects" superClass="gnu.cpp.link.option.userobjs"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1789925387" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
<outputType id="cdt.managedbuild.tool.gnu.cpp.linker.output.so.1893130812" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.cpp.linker.output.so"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.976699519" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="" id="cdt.managedbuild.tool.gnu.cross.assembler.10555843" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.219135409" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="GearsBotCPP.cdt.managedbuild.target.gnu.cross.exe.13534228" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Windows Simulate"/>
<configuration configurationName="Simulate">
<resource resourceType="PROJECT" workspacePath="/GearsBotCPP"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/GearsBotCPP"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.809153465;cdt.managedbuild.tool.gnu.cpp.compiler.input.1150869869">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;org.eclipse.cdt.msvc.cl.dll.debug.544581750;org.eclipse.cdt.msvc.cl.inputType.1806965547">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;org.eclipse.cdt.msvc.cl.c.dll.debug.748290057;org.eclipse.cdt.msvc.cl.inputType.c.690275938">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.cross.c.compiler.1872033968;cdt.managedbuild.tool.gnu.c.compiler.input.1953150292">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;org.eclipse.cdt.msvc.cl.dll.debug.880390044;org.eclipse.cdt.msvc.cl.inputType.393977355">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1297766759;cdt.managedbuild.tool.gnu.cpp.compiler.input.498113544">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.785693711;cdt.managedbuild.tool.gnu.c.compiler.input.778242069">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1647706237;cdt.managedbuild.tool.gnu.cpp.compiler.input.1338339147">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751;cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1505235107;cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1104744751;cdt.managedbuild.config.gnu.cross.exe.debug.1104744751.;cdt.managedbuild.tool.gnu.cross.c.compiler.1261239456;cdt.managedbuild.tool.gnu.c.compiler.input.1793678673">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;org.eclipse.cdt.msvc.cl.c.dll.debug.1658947706;org.eclipse.cdt.msvc.cl.inputType.c.2076377067">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128;cdt.managedbuild.config.gnu.mingw.exe.debug.912379410.387599128.;cdt.managedbuild.tool.gnu.c.compiler.mingw.base.510224028;cdt.managedbuild.tool.gnu.c.compiler.input.323654435">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

1
DriveBase/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/Debug/

28
DriveBase/.project Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DriveBase</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,13 @@
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPLUS_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPLUS_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/appendContributed=true

View File

@ -0,0 +1,11 @@
# Build information
out=FRCUserProgram
src.dir=src
build.dir=build
out.exe=Debug/${out}
# Simulation
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
# Use the current C++ library by default
cpp-version=current

28
DriveBase/build.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="FRC Deployment" default="deploy">
<!--
The following properties can be defined to override system level
settings. These should not be touched unless you know what you're
doing. The primary use is to override the wpilib version when
working with older robots that can't compile with the latest
libraries.
-->
<!-- By default the system version of WPI is used -->
<!-- <property name="version" value=""/> -->
<!-- By default the system team number is used -->
<!-- <property name="team-number" value=""/> -->
<!-- By default the target is set to 10.TE.AM.2 -->
<!-- <property name="target" value=""/> -->
<property file="${user.home}/wpilib/wpilib.properties"/>
<property file="build.properties"/>
<property file="${user.home}/wpilib/cpp/${version}/ant/build.properties"/>
<import file="${wpilib.ant.dir}/build.xml"/>
</project>

39
DriveBase/src/Robot.cpp Normal file
View File

@ -0,0 +1,39 @@
#include "WPILib.h"
#include "TankDrive.h"
/**
* This sample shows how to use the new CANTalon to just run a motor in a basic
* throttle mode, in the same manner as you might control a traditional PWM
* controlled motor.
*
*/
class Robot : public SampleRobot {
CANTalon r1_drive, r2_drive, l1_drive, l2_drive;
Joystick m_stick;
// update every 0.01 seconds/10 milliseconds.
// The talon only receives control packets every 10ms.
double kUpdatePeriod = 0.010;
public:
Robot()
: r1_drive(0), // Initialize the Talon as device 1. Use the roboRIO web
r2_drive(1)), // interface to change the device number on the talons.
l1_drive(2),
l2_drive(3),
m_stick(0)
{}
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Do Drive.
Wait(kUpdatePeriod); // Wait a bit so that the loop doesn't lock everything up.
}
}
};
START_ROBOT_CLASS(Robot)

23
DriveBase/src/TankDrive.h Normal file
View File

@ -0,0 +1,23 @@
/*
* TankDrive.h
*
* Created on: Jan 28, 2016
* Author: Jason
*/
#ifndef SRC_TANKDRIVE_H_
#define SRC_TANKDRIVE_H_
#include "WPILib.h"
class TankDrive {
public:
TankDrive(CANTalon *left, CANTalon *right) { Left = left; Right = right; }
virtual ~TankDrive() { delete Left[0]; delete Left[1]; delete Right[0]; delete Right[1]; }
private:
CANTalon *Left;
CANTalon *Right;
};
#endif /* SRC_TANKDRIVE_H_ */

Binary file not shown.

View File

@ -0,0 +1,22 @@
# Deployment information
username=lvuser
password=
deploy.dir=/home/lvuser
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
command.dir=/home/lvuser/
# Libraries to use
wpilib=${user.home}/wpilib/cpp/${cpp-version}
wpilib.lib=${wpilib}/lib
roboRIOAllowedImages=19
# Ant support
wpilib.ant.dir=${wpilib}/ant
jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar
classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar
#simulation stuff
sim.exe=linux_simulate/${out}
wpilib.sim=${wpilib}/sim
sim.tools=${wpilib.sim}/tools
sim.lib=${wpilib.sim}/lib

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="athena-project-build" default="deploy">
<!-- Load Tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${wpilib.ant.dir}/ant-contrib.jar"/>
</classpath>
</taskdef>
<taskdef resource="net/jtools/classloadertask/antlib.xml" classpath="${classloadertask.jar}"/>
<classloader loader="system" classpath="${jsch.jar}"/>
<target name="clean" description="Clean up all build and distribution artifacts.">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- Targets -->
<target name="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<assert name="team-number" exists="true" message="Team number not set. Go to Window->Preferences->WPILib Preferences to set it."/>
<property name="target" value="roboRIO-${team-number}-FRC.local" />
<echo>Trying Target: ${target}</echo>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via mDNS</echo>
</then>
<else>
<var name="target" unset="true"/>
<echo> roboRIO not found via mDNS, falling back to static USB</echo>
<property name="target" value="172.22.11.2"/>
<if>
<isreachable host="${target}" timeout="5"/>
<then>
<echo>roboRIO found via static USB</echo>
</then>
<else>
<var name="target" unset="true"/>
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
<property name="target" value="10.${ip.upper}.${ip.lower}.2"/>
<echo>roboRIO not found via USB, falling back to static address of ${target}</echo>
<assert name="roboRIOFound" message="roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse">
<bool>
<isreachable host="${target}" timeout="5"/>
</bool>
</assert>
<echo>roboRIO found via Ethernet static</echo>
</else>
</if>
</else>
</if>
</target>
<target name="deploy" depends="get-target-ip, dependencies" description="Deploy the progam and start it running.">
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
failonerror="no"
command="rm -f ${deploy.dir}/FRCUserProgram" />
<echo>[athena-deploy] Copying code over.</echo>
<scp file="${out.exe}" sftp="true" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
<!-- Suppress the exit status so that if no netconsole was running then
it doesn't show up red on the output. -->
<sshexec host="${target}"
username="admin"
password="${password}"
trust="true"
failonerror="false"
command="killall -q netconsole-host || :"/>
<scp file="${wpilib.ant.dir}/robotCommand" todir="${username}@${target}:/home/lvuser/" password="${password}" trust="true"/>
<echo>[athena-deploy] Starting program.</echo>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
failonerror="false"
command=". /etc/profile.d/natinst-path.sh; chmod a+x ${deploy.dir}/${out}; ${deploy.kill.command};"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="sync" />
</target>
<target name="kill-program" depends="get-target-ip" description="Kill the currently running FRC program">
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
failonerror="false"
command=". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t"/>
</target>
<!-- Simulation support -->
<target name="simulate">
<parallel>
<sequential>
<echo>[simulate] You may now run Gazebo and your driver station</echo>
<echo>[simulate] Running Code.</echo>
<exec executable="${sim.exe}"></exec>
</sequential>
</parallel>
</target>
<target name="dependencies" depends="get-target-ip">
<property name="ant.enable.asserts" value="true"/>
<post to="http://${target}/nisysapi/server" logfile="sysProps.xml" verbose="false" encoding="UTF-16LE" append="false">
<prop name="Function" value="GetPropertiesOfItem"/>
<prop name="Plugins" value="nisyscfg"/>
<prop name="Items" value="system"/>
</post>
<loadfile srcFile="sysProps.xml" encoding="UTF-16LE" property="roboRIOSysValues"/>
<propertyregex property="roboRIOImage" input="${roboRIOSysValues}" regexp="FRC_roboRIO_2016_v([0-9]+)" select="\1" defaultValue="ImageRegExFail"/>
<assert message="roboRIO Image does not match plugin, allowed image version: ${roboRIOAllowedImages}">
<bool>
<contains string="${roboRIOAllowedImages}" substring="${roboRIOImage}"/>
</bool>
</assert>
<echo>roboRIO image version validated</echo>
</target>
</project>

Binary file not shown.

View File

@ -0,0 +1 @@
/usr/local/frc/bin/netconsole-host /home/lvuser/FRCUserProgram

View File

@ -0,0 +1,79 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "interfaces/Accelerometer.h"
#include "I2C.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* ADXL345 Accelerometer on I2C.
*
* This class allows access to a Analog Devices ADXL345 3-axis accelerometer on
* an I2C bus.
* This class assumes the default (not alternate) sensor address of 0x1D (7-bit
* address).
*/
class ADXL345_I2C : public Accelerometer,
public I2C,
public LiveWindowSendable {
protected:
static const uint8_t kAddress = 0x1D;
static const uint8_t kPowerCtlRegister = 0x2D;
static const uint8_t kDataFormatRegister = 0x31;
static const uint8_t kDataRegister = 0x32;
static constexpr double kGsPerLSB = 0.00390625;
enum PowerCtlFields {
kPowerCtl_Link = 0x20,
kPowerCtl_AutoSleep = 0x10,
kPowerCtl_Measure = 0x08,
kPowerCtl_Sleep = 0x04
};
enum DataFormatFields {
kDataFormat_SelfTest = 0x80,
kDataFormat_SPI = 0x40,
kDataFormat_IntInvert = 0x20,
kDataFormat_FullRes = 0x08,
kDataFormat_Justify = 0x04
};
public:
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
};
public:
explicit ADXL345_I2C(Port port, Range range = kRange_2G, int deviceAddress = kAddress);
virtual ~ADXL345_I2C() = default;
ADXL345_I2C(const ADXL345_I2C&) = delete;
ADXL345_I2C& operator=(const ADXL345_I2C&) = delete;
// Accelerometer interface
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual double GetAcceleration(Axes axis);
virtual AllAxes GetAccelerations();
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(std::shared_ptr<ITable> subtable) override;
virtual void UpdateTable() override;
virtual std::shared_ptr<ITable> GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
private:
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,83 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "interfaces/Accelerometer.h"
#include "SensorBase.h"
#include "SPI.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
class DigitalInput;
class DigitalOutput;
/**
* ADXL345 Accelerometer on SPI.
*
* This class allows access to an Analog Devices ADXL345 3-axis accelerometer
* via SPI.
* This class assumes the sensor is wired in 4-wire SPI mode.
*/
class ADXL345_SPI : public Accelerometer,
protected SPI,
public LiveWindowSendable {
protected:
static const uint8_t kPowerCtlRegister = 0x2D;
static const uint8_t kDataFormatRegister = 0x31;
static const uint8_t kDataRegister = 0x32;
static constexpr double kGsPerLSB = 0.00390625;
enum SPIAddressFields { kAddress_Read = 0x80, kAddress_MultiByte = 0x40 };
enum PowerCtlFields {
kPowerCtl_Link = 0x20,
kPowerCtl_AutoSleep = 0x10,
kPowerCtl_Measure = 0x08,
kPowerCtl_Sleep = 0x04
};
enum DataFormatFields {
kDataFormat_SelfTest = 0x80,
kDataFormat_SPI = 0x40,
kDataFormat_IntInvert = 0x20,
kDataFormat_FullRes = 0x08,
kDataFormat_Justify = 0x04
};
public:
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
};
public:
ADXL345_SPI(SPI::Port port, Range range = kRange_2G);
virtual ~ADXL345_SPI() = default;
ADXL345_SPI(const ADXL345_SPI&) = delete;
ADXL345_SPI& operator=(const ADXL345_SPI&) = delete;
// Accelerometer interface
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual double GetAcceleration(Axes axis);
virtual AllAxes GetAccelerations();
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(std::shared_ptr<ITable> subtable) override;
virtual void UpdateTable() override;
virtual std::shared_ptr<ITable> GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
private:
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,63 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "interfaces/Accelerometer.h"
#include "SensorBase.h"
#include "SPI.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
class DigitalInput;
class DigitalOutput;
/**
* ADXL362 SPI Accelerometer.
*
* This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
*/
class ADXL362 : public Accelerometer, public LiveWindowSendable {
public:
enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 };
struct AllAxes {
double XAxis;
double YAxis;
double ZAxis;
};
public:
ADXL362(Range range = kRange_2G);
ADXL362(SPI::Port port, Range range = kRange_2G);
virtual ~ADXL362() = default;
ADXL362(const ADXL362&) = delete;
ADXL362& operator=(const ADXL362&) = delete;
// Accelerometer interface
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual double GetAcceleration(Axes axis);
virtual AllAxes GetAccelerations();
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(std::shared_ptr<ITable> subtable) override;
virtual void UpdateTable() override;
virtual std::shared_ptr<ITable> GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
private:
SPI m_spi;
double m_gsPerLSB = 0.001;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,43 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2015-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "GyroBase.h"
#include "Notifier.h"
#include "SPI.h"
#include "HAL/cpp/priority_mutex.h"
#include <memory>
/**
* Use a rate gyro to return the robots heading relative to a starting position.
* The Gyro class tracks the robots heading based on the starting position. As
* the robot rotates the new heading is computed by integrating the rate of
* rotation returned by the sensor. When the class is instantiated, it does a
* short calibration routine where it samples the gyro while at rest to
* determine the default offset. This is subtracted from each sample to
* determine the heading.
*
* This class is for the digital ADXRS450 gyro sensor that connects via SPI.
*/
class ADXRS450_Gyro : public GyroBase {
public:
ADXRS450_Gyro();
explicit ADXRS450_Gyro(SPI::Port port);
virtual ~ADXRS450_Gyro() = default;
float GetAngle() const override;
double GetRate() const override;
void Reset() override;
void Calibrate() override;
private:
SPI m_spi;
uint16_t ReadRegister(uint8_t reg);
};

View File

@ -0,0 +1,54 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "AnalogInput.h"
#include "SensorBase.h"
#include "PIDSource.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* Handle operation of an analog accelerometer.
* The accelerometer reads acceleration directly through the sensor. Many
* sensors have
* multiple axis and can be treated as multiple devices. Each is calibrated by
* finding
* the center value over a period of time.
*/
class AnalogAccelerometer : public SensorBase,
public PIDSource,
public LiveWindowSendable {
public:
explicit AnalogAccelerometer(int32_t channel);
explicit AnalogAccelerometer(AnalogInput *channel);
explicit AnalogAccelerometer(std::shared_ptr<AnalogInput> channel);
virtual ~AnalogAccelerometer() = default;
float GetAcceleration() const;
void SetSensitivity(float sensitivity);
void SetZero(float zero);
double PIDGet() override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
private:
void InitAccelerometer();
std::shared_ptr<AnalogInput> m_analogInput;
float m_voltsPerG = 1.0;
float m_zeroGVoltage = 2.5;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,64 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "GyroBase.h"
class AnalogInput;
/**
* Use a rate gyro to return the robots heading relative to a starting position.
* The Gyro class tracks the robots heading based on the starting position. As
* the robot
* rotates the new heading is computed by integrating the rate of rotation
* returned
* by the sensor. When the class is instantiated, it does a short calibration
* routine
* where it samples the gyro while at rest to determine the default offset. This
* is
* subtracted from each sample to determine the heading. This gyro class must be
* used
* with a channel that is assigned one of the Analog accumulators from the FPGA.
* See
* AnalogInput for the current accumulator assignments.
*
* This class is for gyro sensors that connect to an analog input.
*/
class AnalogGyro : public GyroBase {
public:
static const uint32_t kOversampleBits = 10;
static const uint32_t kAverageBits = 0;
static constexpr float kSamplesPerSecond = 50.0;
static constexpr float kCalibrationSampleTime = 5.0;
static constexpr float kDefaultVoltsPerDegreePerSecond = 0.007;
explicit AnalogGyro(int32_t channel);
explicit AnalogGyro(AnalogInput *channel);
explicit AnalogGyro(std::shared_ptr<AnalogInput> channel);
AnalogGyro(int32_t channel, uint32_t center, float offset);
AnalogGyro(std::shared_ptr<AnalogInput> channel, uint32_t center, float offset);
virtual ~AnalogGyro() = default;
float GetAngle() const override;
double GetRate() const override;
virtual uint32_t GetCenter() const;
virtual float GetOffset() const;
void SetSensitivity(float voltsPerDegreePerSecond);
void SetDeadband(float volts);
void Reset() override;
virtual void InitGyro();
void Calibrate() override;
protected:
std::shared_ptr<AnalogInput> m_analog;
private:
float m_voltsPerDegreePerSecond;
float m_offset;
uint32_t m_center;
};

View File

@ -0,0 +1,88 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "SensorBase.h"
#include "PIDSource.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* Analog input class.
*
* Connected to each analog channel is an averaging and oversampling engine.
* This engine accumulates
* the specified ( by SetAverageBits() and SetOversampleBits() ) number of
* samples before returning a new
* value. This is not a sliding window average. The only difference between
* the oversampled samples and
* the averaged samples is that the oversampled samples are simply accumulated
* effectively increasing the
* resolution, while the averaged samples are divided by the number of samples
* to retain the resolution,
* but get more stable values.
*/
class AnalogInput : public SensorBase,
public PIDSource,
public LiveWindowSendable {
public:
static const uint8_t kAccumulatorModuleNumber = 1;
static const uint32_t kAccumulatorNumChannels = 2;
static const uint32_t kAccumulatorChannels[kAccumulatorNumChannels];
explicit AnalogInput(uint32_t channel);
virtual ~AnalogInput();
int16_t GetValue() const;
int32_t GetAverageValue() const;
float GetVoltage() const;
float GetAverageVoltage() const;
uint32_t GetChannel() const;
void SetAverageBits(uint32_t bits);
uint32_t GetAverageBits() const;
void SetOversampleBits(uint32_t bits);
uint32_t GetOversampleBits() const;
uint32_t GetLSBWeight() const;
int32_t GetOffset() const;
bool IsAccumulatorChannel() const;
void InitAccumulator();
void SetAccumulatorInitialValue(int64_t value);
void ResetAccumulator();
void SetAccumulatorCenter(int32_t center);
void SetAccumulatorDeadband(int32_t deadband);
int64_t GetAccumulatorValue() const;
uint32_t GetAccumulatorCount() const;
void GetAccumulatorOutput(int64_t &value, uint32_t &count) const;
static void SetSampleRate(float samplesPerSecond);
static float GetSampleRate();
double PIDGet() override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
private:
uint32_t m_channel;
//TODO: Adjust HAL to avoid use of raw pointers.
void *m_port;
int64_t m_accumulatorOffset;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,39 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "SensorBase.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
#include <cstdint>
/**
* MXP analog output class.
*/
class AnalogOutput : public SensorBase, public LiveWindowSendable {
public:
explicit AnalogOutput(uint32_t channel);
virtual ~AnalogOutput();
void SetVoltage(float voltage);
float GetVoltage() const;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
protected:
uint32_t m_channel;
void *m_port;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,92 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "AnalogInput.h"
#include "interfaces/Potentiometer.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* Class for reading analog potentiometers. Analog potentiometers read
* in an analog voltage that corresponds to a position. The position is
* in whichever units you choose, by way of the scaling and offset
* constants passed to the constructor.
*
* @author Alex Henning
* @author Colby Skeggs (rail voltage)
*/
class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
public:
/**
* AnalogPotentiometer constructor.
*
* Use the fullRange and offset values so that the output produces
* meaningful values. I.E: you have a 270 degree potentiometer and
* you want the output to be degrees with the halfway point as 0
* degrees. The fullRange value is 270.0(degrees) and the offset is
* -135.0 since the halfway point after scaling is 135 degrees.
*
* This will calculate the result from the fullRange times the
* fraction of the supply voltage, plus the offset.
*
* @param channel The analog channel this potentiometer is plugged into.
* @param fullRange The scaling to multiply the voltage by to get a meaningful
* unit.
* @param offset The offset to add to the scaled value for controlling the
* zero value
*/
explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
double offset = 0.0);
explicit AnalogPotentiometer(AnalogInput *input, double fullRange = 1.0,
double offset = 0.0);
explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
double fullRange = 1.0, double offset = 0.0);
virtual ~AnalogPotentiometer() = default;
/**
* Get the current reading of the potentiomer.
*
* @return The current position of the potentiometer.
*/
virtual double Get() const override;
/**
* Implement the PIDSource interface.
*
* @return The current reading.
*/
virtual double PIDGet() override;
/*
* Live Window code, only does anything if live window is activated.
*/
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(std::shared_ptr<ITable> subtable) override;
virtual void UpdateTable() override;
virtual std::shared_ptr<ITable> GetTable() const override;
/**
* AnalogPotentiometers don't have to do anything special when entering the
* LiveWindow.
*/
virtual void StartLiveWindowMode() override {}
/**
* AnalogPotentiometers don't have to do anything special when exiting the
* LiveWindow.
*/
virtual void StopLiveWindowMode() override {}
private:
std::shared_ptr<AnalogInput> m_analog_input;
double m_fullRange, m_offset;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,36 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "AnalogTriggerOutput.h"
#include "SensorBase.h"
class AnalogInput;
class AnalogTrigger : public SensorBase {
friend class AnalogTriggerOutput;
public:
explicit AnalogTrigger(int32_t channel);
explicit AnalogTrigger(AnalogInput *channel);
virtual ~AnalogTrigger();
void SetLimitsVoltage(float lower, float upper);
void SetLimitsRaw(int32_t lower, int32_t upper);
void SetAveraged(bool useAveragedValue);
void SetFiltered(bool useFilteredValue);
uint32_t GetIndex() const;
bool GetInWindow();
bool GetTriggerState();
std::shared_ptr<AnalogTriggerOutput> CreateOutput(AnalogTriggerType type) const;
private:
uint8_t m_index;
void *m_trigger;
};

View File

@ -0,0 +1,78 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "DigitalSource.h"
class AnalogTrigger;
/**
* Class to represent a specific output from an analog trigger.
* This class is used to get the current output value and also as a
* DigitalSource
* to provide routing of an output to digital subsystems on the FPGA such as
* Counter, Encoder, and Interrupt.
*
* The TriggerState output indicates the primary output value of the trigger.
* If the analog
* signal is less than the lower limit, the output is false. If the analog
* value is greater
* than the upper limit, then the output is true. If the analog value is in
* between, then
* the trigger output state maintains its most recent value.
*
* The InWindow output indicates whether or not the analog signal is inside the
* range defined
* by the limits.
*
* The RisingPulse and FallingPulse outputs detect an instantaneous transition
* from above the
* upper limit to below the lower limit, and vise versa. These pulses represent
* a rollover
* condition of a sensor and can be routed to an up / down couter or to
* interrupts. Because
* the outputs generate a pulse, they cannot be read directly. To help ensure
* that a rollover
* condition is not missed, there is an average rejection filter available that
* operates on the
* upper 8 bits of a 12 bit number and selects the nearest outlyer of 3 samples.
* This will reject
* a sample that is (due to averaging or sampling) errantly between the two
* limits. This filter
* will fail if more than one sample in a row is errantly in between the two
* limits. You may see
* this problem if attempting to use this feature with a mechanical rollover
* sensor, such as a
* 360 degree no-stop potentiometer without signal conditioning, because the
* rollover transition
* is not sharp / clean enough. Using the averaging engine may help with this,
* but rotational speeds of
* the sensor will then be limited.
*/
class AnalogTriggerOutput : public DigitalSource {
friend class AnalogTrigger;
public:
virtual ~AnalogTriggerOutput();
bool Get() const;
// DigitalSource interface
virtual uint32_t GetChannelForRouting() const override;
virtual uint32_t GetModuleForRouting() const override;
virtual bool GetAnalogTriggerForRouting() const override;
protected:
AnalogTriggerOutput(const AnalogTrigger &trigger, AnalogTriggerType outputType);
private:
// Uses reference rather than smart pointer because a user can not construct
// an AnalogTriggerOutput themselves and because the AnalogTriggerOutput
// should always be in scope at the same time as an AnalogTrigger.
const AnalogTrigger &m_trigger;
AnalogTriggerType m_outputType;
};

View File

@ -0,0 +1,117 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
// MSVC 2013 doesn't allow "= default" on move constructors, but since we are
// (currently) only actually using the move constructors in non-MSVC situations
// (ie, wpilibC++Devices), we can just ignore it in MSVC.
#if !defined(_MSC_VER)
#define DEFAULT_MOVE_CONSTRUCTOR(ClassName) \
ClassName(ClassName &&) = default
#else
#define DEFAULT_MOVE_CONSTRUCTOR(ClassName)
#endif
#if (__cplusplus < 201103L)
#if !defined(_MSC_VER)
#define nullptr NULL
#endif
#define constexpr const
#endif
#if defined(_MSC_VER)
#define noexcept throw()
#endif
// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9.
// We provide an equivalent warning implementation for those compilers here.
#if defined(_MSC_VER)
#define DEPRECATED(msg) __declspec(deprecated(msg))
#elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
#define DEPRECATED(msg) [[deprecated(msg)]]
#else
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
#endif
#elif __cplusplus > 201103L
#define DEPRECATED(msg) [[deprecated(msg)]]
#else
#define DEPRECATED(msg) /*nothing*/
#endif
// Provide std::decay_t when using GCC < 4.9
#if defined(__GNUC__)
#if __GNUC__ == 4 && __GNUC_MINOR__ < 9
#include <type_traits>
namespace std {
template <class T> using decay_t = typename decay<T>::type;
}
#endif
#endif
// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
// that is being deleted by someone else.
template<class T>
struct
NullDeleter {
void operator()(T *) const noexcept {};
};
#include <atomic>
// Use this for determining whether the default move constructor has been
// called on a containing object. This serves the purpose of allowing us to
// use the default move constructor of an object for moving all the data around
// while being able to use this to, for instance, chose not to de-allocate
// a PWM port in a destructor.
struct HasBeenMoved {
HasBeenMoved(HasBeenMoved&& other) {
other.moved = true;
moved = false;
}
HasBeenMoved() = default;
std::atomic<bool> moved{false};
operator bool() const { return moved; }
};
// Define make_unique for C++11-only compilers
#if __cplusplus == 201103L
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
namespace std {
template <class T>
struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template <class T>
struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template <class T, size_t N>
struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template <class T, class... Args>
typename _Unique_if<T>::_Single_object make_unique(Args &&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <class T>
typename _Unique_if<T>::_Unknown_bound make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template <class T, class... Args>
typename _Unique_if<T>::_Known_bound make_unique(Args &&...) = delete;
} // namespace std
#endif

View File

@ -0,0 +1,43 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "interfaces/Accelerometer.h"
#include "SensorBase.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* Built-in accelerometer.
*
* This class allows access to the RoboRIO's internal accelerometer.
*/
class BuiltInAccelerometer : public Accelerometer,
public SensorBase,
public LiveWindowSendable {
public:
BuiltInAccelerometer(Range range = kRange_8G);
virtual ~BuiltInAccelerometer() = default;
// Accelerometer interface
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(std::shared_ptr<ITable> subtable) override;
virtual void UpdateTable() override;
virtual std::shared_ptr<ITable> GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
private:
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,37 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __BUTTON_H__
#define __BUTTON_H__
#include "Buttons/Trigger.h"
#include "Commands/Command.h"
/**
* This class provides an easy way to link commands to OI inputs.
*
* It is very easy to link a button to a command. For instance, you could
* link the trigger button of a joystick to a "score" command.
*
* This class represents a subclass of Trigger that is specifically aimed at
* buttons on an operator interface as a common use case of the more generalized
* Trigger objects. This is a simple wrapper around Trigger with the method
* names
* renamed to fit the Button object use.
*
* @author brad
*/
class Button : public Trigger {
public:
virtual void WhenPressed(Command *command);
virtual void WhileHeld(Command *command);
virtual void WhenReleased(Command *command);
virtual void CancelWhenPressed(Command *command);
virtual void ToggleWhenPressed(Command *command);
};
#endif

View File

@ -0,0 +1,27 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __BUTTON_SCHEDULER_H__
#define __BUTTON_SCHEDULER_H__
class Trigger;
class Command;
class ButtonScheduler {
public:
ButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ButtonScheduler() = default;
virtual void Execute() = 0;
void Start();
protected:
bool m_pressedLast;
Trigger *m_button;
Command *m_command;
};
#endif

View File

@ -0,0 +1,26 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __CANCEL_BUTTON_SCHEDULER_H__
#define __CANCEL_BUTTON_SCHEDULER_H__
#include "Buttons/ButtonScheduler.h"
class Trigger;
class Command;
class CancelButtonScheduler : public ButtonScheduler {
public:
CancelButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~CancelButtonScheduler() = default;
virtual void Execute();
private:
bool pressedLast;
};
#endif

View File

@ -0,0 +1,23 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __HELD_BUTTON_SCHEDULER_H__
#define __HELD_BUTTON_SCHEDULER_H__
#include "Buttons/ButtonScheduler.h"
class Trigger;
class Command;
class HeldButtonScheduler : public ButtonScheduler {
public:
HeldButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~HeldButtonScheduler() = default;
virtual void Execute();
};
#endif

View File

@ -0,0 +1,29 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __INTERNAL_BUTTON_H__
#define __INTERNAL_BUTTON_H__
#include "Buttons/Button.h"
class InternalButton : public Button {
public:
InternalButton() = default;
InternalButton(bool inverted);
virtual ~InternalButton() = default;
void SetInverted(bool inverted);
void SetPressed(bool pressed);
virtual bool Get();
private:
bool m_pressed = false;
bool m_inverted = false;
};
#endif

View File

@ -0,0 +1,26 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __JOYSTICK_BUTTON_H__
#define __JOYSTICK_BUTTON_H__
#include "GenericHID.h"
#include "Buttons/Button.h"
class JoystickButton : public Button {
public:
JoystickButton(GenericHID *joystick, int buttonNumber);
virtual ~JoystickButton() = default;
virtual bool Get();
private:
GenericHID *m_joystick;
int m_buttonNumber;
};
#endif

View File

@ -0,0 +1,28 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __NETWORK_BUTTON_H__
#define __NETWORK_BUTTON_H__
#include "Buttons/Button.h"
#include <string>
#include <memory>
class NetworkButton : public Button {
public:
NetworkButton(const std::string &tableName, const std::string &field);
NetworkButton(std::shared_ptr<ITable> table, const std::string &field);
virtual ~NetworkButton() = default;
virtual bool Get();
private:
std::shared_ptr<ITable> m_netTable;
std::string m_field;
};
#endif

View File

@ -0,0 +1,23 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __PRESSED_BUTTON_SCHEDULER_H__
#define __PRESSED_BUTTON_SCHEDULER_H__
#include "Buttons/ButtonScheduler.h"
class Trigger;
class Command;
class PressedButtonScheduler : public ButtonScheduler {
public:
PressedButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~PressedButtonScheduler() = default;
virtual void Execute();
};
#endif

View File

@ -0,0 +1,23 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __RELEASED_BUTTON_SCHEDULER_H__
#define __RELEASED_BUTTON_SCHEDULER_H__
#include "Buttons/ButtonScheduler.h"
class Trigger;
class Command;
class ReleasedButtonScheduler : public ButtonScheduler {
public:
ReleasedButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ReleasedButtonScheduler() = default;
virtual void Execute();
};
#endif

View File

@ -0,0 +1,26 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __TOGGLE_BUTTON_SCHEDULER_H__
#define __TOGGLE_BUTTON_SCHEDULER_H__
#include "Buttons/ButtonScheduler.h"
class Trigger;
class Command;
class ToggleButtonScheduler : public ButtonScheduler {
public:
ToggleButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ToggleButtonScheduler() = default;
virtual void Execute();
private:
bool pressedLast;
};
#endif

View File

@ -0,0 +1,53 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __TRIGGER_H__
#define __TRIGGER_H__
#include "SmartDashboard/Sendable.h"
#include <memory>
class Command;
/**
* This class provides an easy way to link commands to inputs.
*
* It is very easy to link a polled input to a command. For instance, you could
* link the trigger button of a joystick to a "score" command or an encoder
* reaching
* a particular value.
*
* It is encouraged that teams write a subclass of Trigger if they want to have
* something unusual (for instance, if they want to react to the user holding
* a button while the robot is reading a certain sensor input). For this, they
* only have to write the {@link Trigger#Get()} method to get the full
* functionality
* of the Trigger class.
*
* @author Brad Miller, Joe Grinstead
*/
class Trigger : public Sendable {
public:
Trigger() = default;
virtual ~Trigger() = default;
bool Grab();
virtual bool Get() = 0;
void WhenActive(Command *command);
void WhileActive(Command *command);
void WhenInactive(Command *command);
void CancelWhenActive(Command *command);
void ToggleWhenActive(Command *command);
virtual void InitTable(std::shared_ptr<ITable> table);
virtual std::shared_ptr<ITable> GetTable() const;
virtual std::string GetSmartDashboardType() const;
protected:
std::shared_ptr<ITable> m_table;
};
#endif

View File

@ -0,0 +1,415 @@
//*****************************************************************************
//
// can_proto.h - Definitions for the CAN protocol used to communicate with the
// BDC motor controller.
//
// Copyright (c) 2008 Texas Instruments Incorporated. All rights reserved.
// TI Information - Selective Disclosure
//
//*****************************************************************************
#ifndef __CAN_PROTO_H__
#define __CAN_PROTO_H__
//*****************************************************************************
//
// The masks of the fields that are used in the message identifier.
//
//*****************************************************************************
#define CAN_MSGID_FULL_M 0x1fffffff
#define CAN_MSGID_DEVNO_M 0x0000003f
#define CAN_MSGID_API_M 0x0000ffc0
#define CAN_MSGID_MFR_M 0x00ff0000
#define CAN_MSGID_DTYPE_M 0x1f000000
#define CAN_MSGID_DEVNO_S 0
#define CAN_MSGID_API_S 6
#define CAN_MSGID_MFR_S 16
#define CAN_MSGID_DTYPE_S 24
//*****************************************************************************
//
// The Reserved device number values in the Message Id.
//
//*****************************************************************************
#define CAN_MSGID_DEVNO_BCAST 0x00000000
//*****************************************************************************
//
// The Reserved system control API numbers in the Message Id.
//
//*****************************************************************************
#define CAN_MSGID_API_SYSHALT 0x00000000
#define CAN_MSGID_API_SYSRST 0x00000040
#define CAN_MSGID_API_DEVASSIGN 0x00000080
#define CAN_MSGID_API_DEVQUERY 0x000000c0
#define CAN_MSGID_API_HEARTBEAT 0x00000140
#define CAN_MSGID_API_SYNC 0x00000180
#define CAN_MSGID_API_UPDATE 0x000001c0
#define CAN_MSGID_API_FIRMVER 0x00000200
#define CAN_MSGID_API_ENUMERATE 0x00000240
#define CAN_MSGID_API_SYSRESUME 0x00000280
//*****************************************************************************
//
// The 32 bit values associated with the CAN_MSGID_API_STATUS request.
//
//*****************************************************************************
#define CAN_STATUS_CODE_M 0x0000ffff
#define CAN_STATUS_MFG_M 0x00ff0000
#define CAN_STATUS_DTYPE_M 0x1f000000
#define CAN_STATUS_CODE_S 0
#define CAN_STATUS_MFG_S 16
#define CAN_STATUS_DTYPE_S 24
//*****************************************************************************
//
// The Reserved manufacturer identifiers in the Message Id.
//
//*****************************************************************************
#define CAN_MSGID_MFR_NI 0x00010000
#define CAN_MSGID_MFR_LM 0x00020000
#define CAN_MSGID_MFR_DEKA 0x00030000
//*****************************************************************************
//
// The Reserved device type identifiers in the Message Id.
//
//*****************************************************************************
#define CAN_MSGID_DTYPE_BCAST 0x00000000
#define CAN_MSGID_DTYPE_ROBOT 0x01000000
#define CAN_MSGID_DTYPE_MOTOR 0x02000000
#define CAN_MSGID_DTYPE_RELAY 0x03000000
#define CAN_MSGID_DTYPE_GYRO 0x04000000
#define CAN_MSGID_DTYPE_ACCEL 0x05000000
#define CAN_MSGID_DTYPE_USONIC 0x06000000
#define CAN_MSGID_DTYPE_GEART 0x07000000
#define CAN_MSGID_DTYPE_UPDATE 0x1f000000
//*****************************************************************************
//
// LM Motor Control API Classes API Class and ID masks.
//
//*****************************************************************************
#define CAN_MSGID_API_CLASS_M 0x0000fc00
#define CAN_MSGID_API_ID_M 0x000003c0
//*****************************************************************************
//
// LM Motor Control API Classes in the Message Id for non-broadcast.
// These are the upper 6 bits of the API field, the lower 4 bits determine
// the APIId.
//
//*****************************************************************************
#define CAN_API_MC_VOLTAGE 0x00000000
#define CAN_API_MC_SPD 0x00000400
#define CAN_API_MC_VCOMP 0x00000800
#define CAN_API_MC_POS 0x00000c00
#define CAN_API_MC_ICTRL 0x00001000
#define CAN_API_MC_STATUS 0x00001400
#define CAN_API_MC_PSTAT 0x00001800
#define CAN_API_MC_CFG 0x00001c00
#define CAN_API_MC_ACK 0x00002000
//*****************************************************************************
//
// The Stellaris Motor Class Control Voltage API definitions.
//
//*****************************************************************************
#define LM_API_VOLT \
(CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_VOLTAGE)
#define LM_API_VOLT_EN (LM_API_VOLT | (0 << CAN_MSGID_API_S))
#define LM_API_VOLT_DIS (LM_API_VOLT | (1 << CAN_MSGID_API_S))
#define LM_API_VOLT_SET (LM_API_VOLT | (2 << CAN_MSGID_API_S))
#define LM_API_VOLT_SET_RAMP (LM_API_VOLT | (3 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_VOLT_T_EN (LM_API_VOLT | (4 << CAN_MSGID_API_S))
#define LM_API_VOLT_T_SET (LM_API_VOLT | (5 << CAN_MSGID_API_S))
#define LM_API_VOLT_T_SET_NO_ACK (LM_API_VOLT | (7 << CAN_MSGID_API_S))
//##### FIRST END #####
#define LM_API_VOLT_SET_NO_ACK (LM_API_VOLT | (8 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris Motor Class Control API definitions for LM_API_VOLT_SET_RAMP.
//
//*****************************************************************************
#define LM_API_VOLT_RAMP_DIS 0
//*****************************************************************************
//
// The Stellaris Motor Class Control API definitions for CAN_MSGID_API_SYNC.
//
//*****************************************************************************
#define LM_API_SYNC_PEND_NOW 0
//*****************************************************************************
//
// The Stellaris Motor Class Speed Control API definitions.
//
//*****************************************************************************
#define LM_API_SPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_SPD)
#define LM_API_SPD_EN (LM_API_SPD | (0 << CAN_MSGID_API_S))
#define LM_API_SPD_DIS (LM_API_SPD | (1 << CAN_MSGID_API_S))
#define LM_API_SPD_SET (LM_API_SPD | (2 << CAN_MSGID_API_S))
#define LM_API_SPD_PC (LM_API_SPD | (3 << CAN_MSGID_API_S))
#define LM_API_SPD_IC (LM_API_SPD | (4 << CAN_MSGID_API_S))
#define LM_API_SPD_DC (LM_API_SPD | (5 << CAN_MSGID_API_S))
#define LM_API_SPD_REF (LM_API_SPD | (6 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_SPD_T_EN (LM_API_SPD | (7 << CAN_MSGID_API_S))
#define LM_API_SPD_T_SET (LM_API_SPD | (8 << CAN_MSGID_API_S))
#define LM_API_SPD_T_SET_NO_ACK (LM_API_SPD | (10 << CAN_MSGID_API_S))
//##### FIRST END #####
#define LM_API_SPD_SET_NO_ACK (LM_API_SPD | (11 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris Motor Control Voltage Compensation Control API definitions.
//
//*****************************************************************************
#define LM_API_VCOMP \
(CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_VCOMP)
#define LM_API_VCOMP_EN (LM_API_VCOMP | (0 << CAN_MSGID_API_S))
#define LM_API_VCOMP_DIS (LM_API_VCOMP | (1 << CAN_MSGID_API_S))
#define LM_API_VCOMP_SET (LM_API_VCOMP | (2 << CAN_MSGID_API_S))
#define LM_API_VCOMP_IN_RAMP (LM_API_VCOMP | (3 << CAN_MSGID_API_S))
#define LM_API_VCOMP_COMP_RAMP (LM_API_VCOMP | (4 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_VCOMP_T_EN (LM_API_VCOMP | (5 << CAN_MSGID_API_S))
#define LM_API_VCOMP_T_SET (LM_API_VCOMP | (6 << CAN_MSGID_API_S))
#define LM_API_VCOMP_T_SET_NO_ACK (LM_API_VCOMP | (8 << CAN_MSGID_API_S))
//##### FIRST END #####
#define LM_API_VCOMP_SET_NO_ACK (LM_API_VCOMP | (9 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris Motor Class Position Control API definitions.
//
//*****************************************************************************
#define LM_API_POS (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_POS)
#define LM_API_POS_EN (LM_API_POS | (0 << CAN_MSGID_API_S))
#define LM_API_POS_DIS (LM_API_POS | (1 << CAN_MSGID_API_S))
#define LM_API_POS_SET (LM_API_POS | (2 << CAN_MSGID_API_S))
#define LM_API_POS_PC (LM_API_POS | (3 << CAN_MSGID_API_S))
#define LM_API_POS_IC (LM_API_POS | (4 << CAN_MSGID_API_S))
#define LM_API_POS_DC (LM_API_POS | (5 << CAN_MSGID_API_S))
#define LM_API_POS_REF (LM_API_POS | (6 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_POS_T_EN (LM_API_POS | (7 << CAN_MSGID_API_S))
#define LM_API_POS_T_SET (LM_API_POS | (8 << CAN_MSGID_API_S))
#define LM_API_POS_T_SET_NO_ACK (LM_API_POS | (10 << CAN_MSGID_API_S))
//##### FIRST END #####
#define LM_API_POS_SET_NO_ACK (LM_API_POS | (11 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris Motor Class Current Control API definitions.
//
//*****************************************************************************
#define LM_API_ICTRL \
(CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_ICTRL)
#define LM_API_ICTRL_EN (LM_API_ICTRL | (0 << CAN_MSGID_API_S))
#define LM_API_ICTRL_DIS (LM_API_ICTRL | (1 << CAN_MSGID_API_S))
#define LM_API_ICTRL_SET (LM_API_ICTRL | (2 << CAN_MSGID_API_S))
#define LM_API_ICTRL_PC (LM_API_ICTRL | (3 << CAN_MSGID_API_S))
#define LM_API_ICTRL_IC (LM_API_ICTRL | (4 << CAN_MSGID_API_S))
#define LM_API_ICTRL_DC (LM_API_ICTRL | (5 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_ICTRL_T_EN (LM_API_ICTRL | (6 << CAN_MSGID_API_S))
#define LM_API_ICTRL_T_SET (LM_API_ICTRL | (7 << CAN_MSGID_API_S))
#define LM_API_ICTRL_T_SET_NO_ACK (LM_API_ICTRL | (9 << CAN_MSGID_API_S))
//##### FIRST END #####
#define LM_API_ICTRL_SET_NO_ACK (LM_API_ICTRL | (10 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris Motor Class Firmware Update API definitions.
//
//*****************************************************************************
#define LM_API_UPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_UPDATE)
#define LM_API_UPD_PING (LM_API_UPD | (0 << CAN_MSGID_API_S))
#define LM_API_UPD_DOWNLOAD (LM_API_UPD | (1 << CAN_MSGID_API_S))
#define LM_API_UPD_SEND_DATA (LM_API_UPD | (2 << CAN_MSGID_API_S))
#define LM_API_UPD_RESET (LM_API_UPD | (3 << CAN_MSGID_API_S))
#define LM_API_UPD_ACK (LM_API_UPD | (4 << CAN_MSGID_API_S))
#define LM_API_HWVER (LM_API_UPD | (5 << CAN_MSGID_API_S))
#define LM_API_UPD_REQUEST (LM_API_UPD | (6 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#define LM_API_UNTRUST_EN (LM_API_UPD | (11 << CAN_MSGID_API_S))
#define LM_API_TRUST_EN (LM_API_UPD | (12 << CAN_MSGID_API_S))
#define LM_API_TRUST_HEARTBEAT (LM_API_UPD | (13 << CAN_MSGID_API_S))
//##### FIRST END #####
//*****************************************************************************
//
// The Stellaris Motor Class Status API definitions.
//
//*****************************************************************************
#define LM_API_STATUS \
(CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_STATUS)
#define LM_API_STATUS_VOLTOUT (LM_API_STATUS | (0 << CAN_MSGID_API_S))
#define LM_API_STATUS_VOLTBUS (LM_API_STATUS | (1 << CAN_MSGID_API_S))
#define LM_API_STATUS_CURRENT (LM_API_STATUS | (2 << CAN_MSGID_API_S))
#define LM_API_STATUS_TEMP (LM_API_STATUS | (3 << CAN_MSGID_API_S))
#define LM_API_STATUS_POS (LM_API_STATUS | (4 << CAN_MSGID_API_S))
#define LM_API_STATUS_SPD (LM_API_STATUS | (5 << CAN_MSGID_API_S))
#define LM_API_STATUS_LIMIT (LM_API_STATUS | (6 << CAN_MSGID_API_S))
#define LM_API_STATUS_FAULT (LM_API_STATUS | (7 << CAN_MSGID_API_S))
#define LM_API_STATUS_POWER (LM_API_STATUS | (8 << CAN_MSGID_API_S))
#define LM_API_STATUS_CMODE (LM_API_STATUS | (9 << CAN_MSGID_API_S))
#define LM_API_STATUS_VOUT (LM_API_STATUS | (10 << CAN_MSGID_API_S))
#define LM_API_STATUS_STKY_FLT (LM_API_STATUS | (11 << CAN_MSGID_API_S))
#define LM_API_STATUS_FLT_COUNT (LM_API_STATUS | (12 << CAN_MSGID_API_S))
//*****************************************************************************
//
// These definitions are used with the byte that is returned from
// the status request for LM_API_STATUS_LIMIT.
//
//*****************************************************************************
#define LM_STATUS_LIMIT_FWD 0x01
#define LM_STATUS_LIMIT_REV 0x02
#define LM_STATUS_LIMIT_SFWD 0x04
#define LM_STATUS_LIMIT_SREV 0x08
#define LM_STATUS_LIMIT_STKY_FWD 0x10
#define LM_STATUS_LIMIT_STKY_REV 0x20
#define LM_STATUS_LIMIT_STKY_SFWD 0x40
#define LM_STATUS_LIMIT_STKY_SREV 0x80
//*****************************************************************************
//
// LM Motor Control status codes returned due to the CAN_STATUS_CODE_M field.
//
//*****************************************************************************
#define LM_STATUS_FAULT_ILIMIT 0x01
#define LM_STATUS_FAULT_TLIMIT 0x02
#define LM_STATUS_FAULT_VLIMIT 0x04
//*****************************************************************************
//
// The Stellaris Motor Class Configuration API definitions.
//
//*****************************************************************************
#define LM_API_CFG (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_CFG)
#define LM_API_CFG_NUM_BRUSHES (LM_API_CFG | (0 << CAN_MSGID_API_S))
#define LM_API_CFG_ENC_LINES (LM_API_CFG | (1 << CAN_MSGID_API_S))
#define LM_API_CFG_POT_TURNS (LM_API_CFG | (2 << CAN_MSGID_API_S))
#define LM_API_CFG_BRAKE_COAST (LM_API_CFG | (3 << CAN_MSGID_API_S))
#define LM_API_CFG_LIMIT_MODE (LM_API_CFG | (4 << CAN_MSGID_API_S))
#define LM_API_CFG_LIMIT_FWD (LM_API_CFG | (5 << CAN_MSGID_API_S))
#define LM_API_CFG_LIMIT_REV (LM_API_CFG | (6 << CAN_MSGID_API_S))
#define LM_API_CFG_MAX_VOUT (LM_API_CFG | (7 << CAN_MSGID_API_S))
#define LM_API_CFG_FAULT_TIME (LM_API_CFG | (8 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The Stellaris ACK API definition.
//
//*****************************************************************************
#define LM_API_ACK (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_ACK)
//*****************************************************************************
//
// The 8 bit values that can be returned by a call to LM_API_STATUS_HWVER.
//
//*****************************************************************************
#define LM_HWVER_UNKNOWN 0x00
#define LM_HWVER_JAG_1_0 0x01
#define LM_HWVER_JAG_2_0 0x02
//*****************************************************************************
//
// The 8 bit values that can be returned by a call to LM_API_STATUS_CMODE.
//
//*****************************************************************************
#define LM_STATUS_CMODE_VOLT 0x00
#define LM_STATUS_CMODE_CURRENT 0x01
#define LM_STATUS_CMODE_SPEED 0x02
#define LM_STATUS_CMODE_POS 0x03
#define LM_STATUS_CMODE_VCOMP 0x04
//*****************************************************************************
//
// The values that can specified as the position or speed reference. Not all
// values are valid for each reference; if an invalid reference is set, then
// none will be selected.
//
//*****************************************************************************
#define LM_REF_ENCODER 0x00
#define LM_REF_POT 0x01
#define LM_REF_INV_ENCODER 0x02
#define LM_REF_QUAD_ENCODER 0x03
#define LM_REF_NONE 0xff
//*****************************************************************************
//
// The flags that are used to indicate the currently active fault sources.
//
//*****************************************************************************
#define LM_FAULT_CURRENT 0x01
#define LM_FAULT_TEMP 0x02
#define LM_FAULT_VBUS 0x04
#define LM_FAULT_GATE_DRIVE 0x08
#define LM_FAULT_COMM 0x10
//*****************************************************************************
//
// The Stellaris Motor Class Periodic Status API definitions.
//
//*****************************************************************************
#define LM_API_PSTAT \
(CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_PSTAT)
#define LM_API_PSTAT_PER_EN_S0 (LM_API_PSTAT | (0 << CAN_MSGID_API_S))
#define LM_API_PSTAT_PER_EN_S1 (LM_API_PSTAT | (1 << CAN_MSGID_API_S))
#define LM_API_PSTAT_PER_EN_S2 (LM_API_PSTAT | (2 << CAN_MSGID_API_S))
#define LM_API_PSTAT_PER_EN_S3 (LM_API_PSTAT | (3 << CAN_MSGID_API_S))
#define LM_API_PSTAT_CFG_S0 (LM_API_PSTAT | (4 << CAN_MSGID_API_S))
#define LM_API_PSTAT_CFG_S1 (LM_API_PSTAT | (5 << CAN_MSGID_API_S))
#define LM_API_PSTAT_CFG_S2 (LM_API_PSTAT | (6 << CAN_MSGID_API_S))
#define LM_API_PSTAT_CFG_S3 (LM_API_PSTAT | (7 << CAN_MSGID_API_S))
#define LM_API_PSTAT_DATA_S0 (LM_API_PSTAT | (8 << CAN_MSGID_API_S))
#define LM_API_PSTAT_DATA_S1 (LM_API_PSTAT | (9 << CAN_MSGID_API_S))
#define LM_API_PSTAT_DATA_S2 (LM_API_PSTAT | (10 << CAN_MSGID_API_S))
#define LM_API_PSTAT_DATA_S3 (LM_API_PSTAT | (11 << CAN_MSGID_API_S))
//*****************************************************************************
//
// The values that can be used to configure the data the Periodic Status
// Message bytes. Bytes of a multi-byte data values are encoded as
// little-endian, therefore B0 is the least significant byte.
//
//*****************************************************************************
#define LM_PSTAT_END 0
#define LM_PSTAT_VOLTOUT_B0 1
#define LM_PSTAT_VOLTOUT_B1 2
#define LM_PSTAT_VOLTBUS_B0 3
#define LM_PSTAT_VOLTBUS_B1 4
#define LM_PSTAT_CURRENT_B0 5
#define LM_PSTAT_CURRENT_B1 6
#define LM_PSTAT_TEMP_B0 7
#define LM_PSTAT_TEMP_B1 8
#define LM_PSTAT_POS_B0 9
#define LM_PSTAT_POS_B1 10
#define LM_PSTAT_POS_B2 11
#define LM_PSTAT_POS_B3 12
#define LM_PSTAT_SPD_B0 13
#define LM_PSTAT_SPD_B1 14
#define LM_PSTAT_SPD_B2 15
#define LM_PSTAT_SPD_B3 16
#define LM_PSTAT_LIMIT_NCLR 17
#define LM_PSTAT_LIMIT_CLR 18
#define LM_PSTAT_FAULT 19
#define LM_PSTAT_STKY_FLT_NCLR 20
#define LM_PSTAT_STKY_FLT_CLR 21
#define LM_PSTAT_VOUT_B0 22
#define LM_PSTAT_VOUT_B1 23
#define LM_PSTAT_FLT_COUNT_CURRENT 24
#define LM_PSTAT_FLT_COUNT_TEMP 25
#define LM_PSTAT_FLT_COUNT_VOLTBUS 26
#define LM_PSTAT_FLT_COUNT_GATE 27
#define LM_PSTAT_FLT_COUNT_COMM 28
#define LM_PSTAT_CANSTS 29
#define LM_PSTAT_CANERR_B0 30
#define LM_PSTAT_CANERR_B1 31
#endif // __CAN_PROTO_H__

View File

@ -0,0 +1,252 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2009-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "ErrorBase.h"
#include "MotorSafety.h"
#include "Resource.h"
#include "MotorSafetyHelper.h"
#include "PIDOutput.h"
#include "CANSpeedController.h"
#include "HAL/cpp/Semaphore.hpp"
#include "HAL/HAL.hpp"
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITableListener.h"
#include "NetworkCommunication/CANSessionMux.h"
#include "CAN/can_proto.h"
#include <atomic>
#include "HAL/cpp/priority_mutex.h"
#include <memory>
#include <utility>
#include <sstream>
/**
* Luminary Micro / Vex Robotics Jaguar Speed Control
*/
class CANJaguar : public MotorSafety,
public CANSpeedController,
public ErrorBase,
public LiveWindowSendable,
public ITableListener {
public:
// The internal PID control loop in the Jaguar runs at 1kHz.
static const int32_t kControllerRate = 1000;
static constexpr double kApproxBusVoltage = 12.0;
// Control mode tags
/** Sets an encoder as the speed reference only. <br> Passed as the "tag" when
* setting the control mode.*/
static const struct EncoderStruct {
} Encoder;
/** Sets a quadrature encoder as the position and speed reference. <br> Passed
* as the "tag" when setting the control mode.*/
static const struct QuadEncoderStruct {
} QuadEncoder;
/** Sets a potentiometer as the position reference only. <br> Passed as the
* "tag" when setting the control mode. */
static const struct PotentiometerStruct {
} Potentiometer;
explicit CANJaguar(uint8_t deviceNumber);
virtual ~CANJaguar();
uint8_t getDeviceNumber() const;
uint8_t GetHardwareVersion() const;
// PIDOutput interface
virtual void PIDWrite(float output) override;
// Control mode methods
void EnableControl(double encoderInitialPosition = 0.0);
void DisableControl();
void SetPercentMode();
void SetPercentMode(EncoderStruct, uint16_t codesPerRev);
void SetPercentMode(QuadEncoderStruct, uint16_t codesPerRev);
void SetPercentMode(PotentiometerStruct);
void SetCurrentMode(double p, double i, double d);
void SetCurrentMode(EncoderStruct, uint16_t codesPerRev, double p, double i,
double d);
void SetCurrentMode(QuadEncoderStruct, uint16_t codesPerRev, double p,
double i, double d);
void SetCurrentMode(PotentiometerStruct, double p, double i, double d);
void SetSpeedMode(EncoderStruct, uint16_t codesPerRev, double p, double i,
double d);
void SetSpeedMode(QuadEncoderStruct, uint16_t codesPerRev, double p, double i,
double d);
void SetPositionMode(QuadEncoderStruct, uint16_t codesPerRev, double p,
double i, double d);
void SetPositionMode(PotentiometerStruct, double p, double i, double d);
void SetVoltageMode();
void SetVoltageMode(EncoderStruct, uint16_t codesPerRev);
void SetVoltageMode(QuadEncoderStruct, uint16_t codesPerRev);
void SetVoltageMode(PotentiometerStruct);
// CANSpeedController interface
virtual float Get() const override;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual void Disable() override;
virtual void SetP(double p) override;
virtual void SetI(double i) override;
virtual void SetD(double d) override;
virtual void SetPID(double p, double i, double d) override;
virtual double GetP() const override;
virtual double GetI() const override;
virtual double GetD() const override;
virtual bool IsModePID(CANSpeedController::ControlMode mode) const override;
virtual float GetBusVoltage() const override;
virtual float GetOutputVoltage() const override;
virtual float GetOutputCurrent() const override;
virtual float GetTemperature() const override;
virtual double GetPosition() const override;
virtual double GetSpeed() const override;
virtual bool GetForwardLimitOK() const override;
virtual bool GetReverseLimitOK() const override;
virtual uint16_t GetFaults() const override;
virtual void SetVoltageRampRate(double rampRate) override;
virtual uint32_t GetFirmwareVersion() const override;
virtual void ConfigNeutralMode(NeutralMode mode) override;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override;
virtual void ConfigPotentiometerTurns(uint16_t turns) override;
virtual void ConfigSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition) override;
virtual void DisableSoftPositionLimits() override;
virtual void ConfigLimitMode(LimitMode mode) override;
virtual void ConfigForwardLimit(double forwardLimitPosition) override;
virtual void ConfigReverseLimit(double reverseLimitPosition) override;
virtual void ConfigMaxOutputVoltage(double voltage) override;
virtual void ConfigFaultTime(float faultTime) override;
virtual void SetControlMode(ControlMode mode);
virtual ControlMode GetControlMode() const;
static void UpdateSyncGroup(uint8_t syncGroup);
void SetExpiration(float timeout) override;
float GetExpiration() const override;
bool IsAlive() const override;
void StopMotor() override;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(std::ostringstream& desc) const override;
uint8_t GetDeviceID() const;
// SpeedController overrides
virtual void SetInverted(bool isInverted) override;
virtual bool GetInverted() const override;
protected:
// Control mode helpers
void SetSpeedReference(uint8_t reference);
uint8_t GetSpeedReference() const;
void SetPositionReference(uint8_t reference);
uint8_t GetPositionReference() const;
uint8_t packPercentage(uint8_t *buffer, double value);
uint8_t packFXP8_8(uint8_t *buffer, double value);
uint8_t packFXP16_16(uint8_t *buffer, double value);
uint8_t packint16_t(uint8_t *buffer, int16_t value);
uint8_t packint32_t(uint8_t *buffer, int32_t value);
double unpackPercentage(uint8_t *buffer) const;
double unpackFXP8_8(uint8_t *buffer) const;
double unpackFXP16_16(uint8_t *buffer) const;
int16_t unpackint16_t(uint8_t *buffer) const;
int32_t unpackint32_t(uint8_t *buffer) const;
void sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize,
int32_t period = CAN_SEND_PERIOD_NO_REPEAT);
void requestMessage(uint32_t messageID,
int32_t period = CAN_SEND_PERIOD_NO_REPEAT);
bool getMessage(uint32_t messageID, uint32_t mask, uint8_t *data,
uint8_t *dataSize) const;
void setupPeriodicStatus();
void updatePeriodicStatus() const;
mutable priority_recursive_mutex m_mutex;
uint8_t m_deviceNumber;
float m_value = 0.0f;
// Parameters/configuration
ControlMode m_controlMode = kPercentVbus;
uint8_t m_speedReference = LM_REF_NONE;
uint8_t m_positionReference = LM_REF_NONE;
double m_p = 0.0;
double m_i = 0.0;
double m_d = 0.0;
NeutralMode m_neutralMode = kNeutralMode_Jumper;
uint16_t m_encoderCodesPerRev = 0;
uint16_t m_potentiometerTurns = 0;
LimitMode m_limitMode = kLimitMode_SwitchInputsOnly;
double m_forwardLimit = 0.0;
double m_reverseLimit = 0.0;
double m_maxOutputVoltage = 30.0;
double m_voltageRampRate = 0.0;
float m_faultTime = 0.0f;
// Which parameters have been verified since they were last set?
bool m_controlModeVerified = false; // Needs to be verified because it's set in the constructor
bool m_speedRefVerified = true;
bool m_posRefVerified = true;
bool m_pVerified = true;
bool m_iVerified = true;
bool m_dVerified = true;
bool m_neutralModeVerified = true;
bool m_encoderCodesPerRevVerified = true;
bool m_potentiometerTurnsVerified = true;
bool m_forwardLimitVerified = true;
bool m_reverseLimitVerified = true;
bool m_limitModeVerified = true;
bool m_maxOutputVoltageVerified = true;
bool m_voltageRampRateVerified = true;
bool m_faultTimeVerified = true;
// Status data
mutable float m_busVoltage = 0.0f;
mutable float m_outputVoltage = 0.0f;
mutable float m_outputCurrent = 0.0f;
mutable float m_temperature = 0.0f;
mutable double m_position = 0.0;
mutable double m_speed = 0.0;
mutable uint8_t m_limits = 0x00;
mutable uint16_t m_faults = 0x0000;
uint32_t m_firmwareVersion = 0;
uint8_t m_hardwareVersion = 0;
// Which periodic status messages have we received at least once?
mutable std::atomic<bool> m_receivedStatusMessage0{false};
mutable std::atomic<bool> m_receivedStatusMessage1{false};
mutable std::atomic<bool> m_receivedStatusMessage2{false};
bool m_controlEnabled = false;
void verify();
std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
std::shared_ptr<ITable> m_table;
private:
void InitCANJaguar();
bool m_isInverted = false;
};

View File

@ -0,0 +1,101 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "SpeedController.h"
/**
* Interface for "smart" CAN-based speed controllers.
* @see CANJaguar
* @see CANTalon
*/
class CANSpeedController : public SpeedController {
public:
enum ControlMode {
kPercentVbus = 0,
kCurrent = 1,
kSpeed = 2,
kPosition = 3,
kVoltage = 4,
kFollower = 5, // Not supported in Jaguar.
kMotionProfile = 6, // Not supported in Jaguar.
};
// Helper function for the ControlMode enum
virtual bool IsModePID(ControlMode mode) const = 0;
enum Faults {
kCurrentFault = 1,
kTemperatureFault = 2,
kBusVoltageFault = 4,
kGateDriverFault = 8,
/* SRX extensions */
kFwdLimitSwitch = 0x10,
kRevLimitSwitch = 0x20,
kFwdSoftLimit = 0x40,
kRevSoftLimit = 0x80,
};
enum Limits { kForwardLimit = 1, kReverseLimit = 2 };
enum NeutralMode {
/** Use the NeutralMode that is set by the jumper wire on the CAN device */
kNeutralMode_Jumper = 0,
/** Stop the motor's rotation by applying a force. */
kNeutralMode_Brake = 1,
/** Do not attempt to stop the motor. Instead allow it to coast to a stop
without applying resistance. */
kNeutralMode_Coast = 2
};
enum LimitMode {
/** Only use switches for limits */
kLimitMode_SwitchInputsOnly = 0,
/** Use both switches and soft limits */
kLimitMode_SoftPositionLimits = 1,
/* SRX extensions */
/** Disable switches and disable soft limits */
kLimitMode_SrxDisableSwitchInputs = 2,
};
virtual float Get() const = 0;
virtual void Set(float value, uint8_t syncGroup = 0) = 0;
virtual void Disable() = 0;
virtual void SetP(double p) = 0;
virtual void SetI(double i) = 0;
virtual void SetD(double d) = 0;
virtual void SetPID(double p, double i, double d) = 0;
virtual double GetP() const = 0;
virtual double GetI() const = 0;
virtual double GetD() const = 0;
virtual float GetBusVoltage() const = 0;
virtual float GetOutputVoltage() const = 0;
virtual float GetOutputCurrent() const = 0;
virtual float GetTemperature() const = 0;
virtual double GetPosition() const = 0;
virtual double GetSpeed() const = 0;
virtual bool GetForwardLimitOK() const = 0;
virtual bool GetReverseLimitOK() const = 0;
virtual uint16_t GetFaults() const = 0;
virtual void SetVoltageRampRate(double rampRate) = 0;
virtual uint32_t GetFirmwareVersion() const = 0;
virtual void ConfigNeutralMode(NeutralMode mode) = 0;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) = 0;
virtual void ConfigPotentiometerTurns(uint16_t turns) = 0;
virtual void ConfigSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition) = 0;
virtual void DisableSoftPositionLimits() = 0;
virtual void ConfigLimitMode(LimitMode mode) = 0;
virtual void ConfigForwardLimit(double forwardLimitPosition) = 0;
virtual void ConfigReverseLimit(double reverseLimitPosition) = 0;
virtual void ConfigMaxOutputVoltage(double voltage) = 0;
virtual void ConfigFaultTime(float faultTime) = 0;
// Hold off on interface until we figure out ControlMode enums.
// virtual void SetControlMode(ControlMode mode) = 0;
// virtual ControlMode GetControlMode() const = 0;
};

View File

@ -0,0 +1,528 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "SafePWM.h"
#include "CANSpeedController.h"
#include "PIDOutput.h"
#include "PIDSource.h"
#include "PIDInterface.h"
#include "HAL/CanTalonSRX.h"
#include "MotorSafetyHelper.h"
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITable.h"
#include <memory>
/**
* CTRE Talon SRX Speed Controller with CAN Control
*/
class CANTalon : public MotorSafety,
public CANSpeedController,
public ErrorBase,
public LiveWindowSendable,
public ITableListener,
public PIDSource,
public PIDInterface {
public:
enum FeedbackDevice {
QuadEncoder = 0,
AnalogPot = 2,
AnalogEncoder = 3,
EncRising = 4,
EncFalling = 5,
CtreMagEncoder_Relative = 6, //!< Cross The Road Electronics Magnetic Encoder in Absolute/PulseWidth Mode
CtreMagEncoder_Absolute = 7, //!< Cross The Road Electronics Magnetic Encoder in Relative/Quadrature Mode
PulseWidth = 8,
};
/**
* Depending on the sensor type, Talon can determine if sensor is plugged in ot not.
*/
enum FeedbackDeviceStatus {
FeedbackStatusUnknown = 0, //!< Sensor status could not be determined. Not all sensors can do this.
FeedbackStatusPresent = 1, //!< Sensor is present and working okay.
FeedbackStatusNotPresent = 2, //!< Sensor is not present, not plugged in, not powered, etc...
};
enum StatusFrameRate {
StatusFrameRateGeneral = 0,
StatusFrameRateFeedback = 1,
StatusFrameRateQuadEncoder = 2,
StatusFrameRateAnalogTempVbat = 3,
StatusFrameRatePulseWidthMeas = 4,
};
/**
* Enumerated types for Motion Control Set Values.
* When in Motion Profile control mode, these constants are paseed
* into set() to manipulate the motion profile executer.
* When changing modes, be sure to read the value back using getMotionProfileStatus()
* to ensure changes in output take effect before performing buffering actions.
* Disable will signal Talon to put motor output into neutral drive.
* Talon will stop processing motion profile points. This means the buffer is
* effectively disconnected from the executer, allowing the robot to gracefully
* clear and push new traj points. isUnderrun will get cleared.
* The active trajectory is also cleared.
* Enable will signal Talon to pop a trajectory point from it's buffer and process it.
* If the active trajectory is empty, Talon will shift in the next point.
* If the active traj is empty, and so is the buffer, the motor drive is neutral and
* isUnderrun is set. When active traj times out, and buffer has at least one point,
* Talon shifts in next one, and isUnderrun is cleared. When active traj times out,
* and buffer is empty, Talon keeps processing active traj and sets IsUnderrun.
* Hold will signal Talon keep processing the active trajectory indefinitely.
* If the active traj is cleared, Talon will neutral motor drive. Otherwise
* Talon will keep processing the active traj but it will not shift in
* points from the buffer. This means the buffer is effectively disconnected
* from the executer, allowing the robot to gracefully clear and push
* new traj points.
* isUnderrun is set if active traj is empty, otherwise it is cleared.
* isLast signal is also cleared.
*
* Typical workflow:
* set(Disable),
* Confirm Disable takes effect,
* clear buffer and push buffer points,
* set(Enable) when enough points have been pushed to ensure no underruns,
* wait for MP to finish or decide abort,
* If MP finished gracefully set(Hold) to hold position servo and disconnect buffer,
* If MP is being aborted set(Disable) to neutral the motor and disconnect buffer,
* Confirm mode takes effect,
* clear buffer and push buffer points, and rinse-repeat.
*/
enum SetValueMotionProfile {
SetValueMotionProfileDisable = 0,
SetValueMotionProfileEnable = 1,
SetValueMotionProfileHold = 2,
};
/**
* Motion Profile Trajectory Point
* This is simply a data transer object.
*/
struct TrajectoryPoint {
double position; //!< The position to servo to.
double velocity; //!< The velocity to feed-forward.
/**
* Time in milliseconds to process this point.
* Value should be between 1ms and 255ms. If value is zero
* then Talon will default to 1ms. If value exceeds 255ms API will cap it.
*/
unsigned int timeDurMs;
/**
* Which slot to get PIDF gains.
* PID is used for position servo.
* F is used as the Kv constant for velocity feed-forward.
* Typically this is hardcoded to the a particular slot, but you are free
* gain schedule if need be.
*/
unsigned int profileSlotSelect;
/**
* Set to true to only perform the velocity feed-forward and not perform
* position servo. This is useful when learning how the position servo
* changes the motor response. The same could be accomplish by clearing the
* PID gains, however this is synchronous the streaming, and doesn't require restoing
* gains when finished.
*
* Additionaly setting this basically gives you direct control of the motor output
* since motor output = targetVelocity X Kv, where Kv is our Fgain.
* This means you can also scheduling straight-throttle curves without relying on
* a sensor.
*/
bool velocityOnly;
/**
* Set to true to signal Talon that this is the final point, so do not
* attempt to pop another trajectory point from out of the Talon buffer.
* Instead continue processing this way point. Typically the velocity
* member variable should be zero so that the motor doesn't spin indefinitely.
*/
bool isLastPoint;
/**
* Set to true to signal Talon to zero the selected sensor.
* When generating MPs, one simple method is to make the first target position zero,
* and the final target position the target distance from the current position.
* Then when you fire the MP, the current position gets set to zero.
* If this is the intent, you can set zeroPos on the first trajectory point.
*
* Otherwise you can leave this false for all points, and offset the positions
* of all trajectory points so they are correct.
*/
bool zeroPos;
};
/**
* Motion Profile Status
* This is simply a data transer object.
*/
struct MotionProfileStatus {
/**
* The available empty slots in the trajectory buffer.
*
* The robot API holds a "top buffer" of trajectory points, so your applicaion
* can dump several points at once. The API will then stream them into the Talon's
* low-level buffer, allowing the Talon to act on them.
*/
unsigned int topBufferRem;
/**
* The number of points in the top trajectory buffer.
*/
unsigned int topBufferCnt;
/**
* The number of points in the low level Talon buffer.
*/
unsigned int btmBufferCnt;
/**
* Set if isUnderrun ever gets set.
* Only is cleared by clearMotionProfileHasUnderrun() to ensure
* robot logic can react or instrument it.
* @see clearMotionProfileHasUnderrun()
*/
bool hasUnderrun;
/**
* This is set if Talon needs to shift a point from its buffer into
* the active trajectory point however the buffer is empty. This gets cleared
* automatically when is resolved.
*/
bool isUnderrun;
/**
* True if the active trajectory point has not empty, false otherwise.
* The members in activePoint are only valid if this signal is set.
*/
bool activePointValid;
/**
* The number of points in the low level Talon buffer.
*/
TrajectoryPoint activePoint;
/**
* The current output mode of the motion profile executer (disabled, enabled, or hold).
* When changing the set() value in MP mode, it's important to check this signal to
* confirm the change takes effect before interacting with the top buffer.
*/
SetValueMotionProfile outputEnable;
};
explicit CANTalon(int deviceNumber);
explicit CANTalon(int deviceNumber, int controlPeriodMs);
DEFAULT_MOVE_CONSTRUCTOR(CANTalon);
virtual ~CANTalon();
// PIDOutput interface
virtual void PIDWrite(float output) override;
// PIDSource interface
virtual double PIDGet() override;
// MotorSafety interface
virtual void SetExpiration(float timeout) override;
virtual float GetExpiration() const override;
virtual bool IsAlive() const override;
virtual void StopMotor() override;
virtual void SetSafetyEnabled(bool enabled) override;
virtual bool IsSafetyEnabled() const override;
virtual void GetDescription(std::ostringstream& desc) const override;
// CANSpeedController interface
virtual float Get() const override;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual void Reset() override;
virtual void SetSetpoint(float value) override;
virtual void Disable() override;
virtual void EnableControl();
virtual void Enable() override;
virtual void SetP(double p) override;
virtual void SetI(double i) override;
virtual void SetD(double d) override;
void SetF(double f);
void SetIzone(unsigned iz);
virtual void SetPID(double p, double i, double d) override;
virtual void SetPID(double p, double i, double d, double f);
virtual double GetP() const override;
virtual double GetI() const override;
virtual double GetD() const override;
virtual double GetF() const;
virtual bool IsModePID(CANSpeedController::ControlMode mode) const override;
virtual float GetBusVoltage() const override;
virtual float GetOutputVoltage() const override;
virtual float GetOutputCurrent() const override;
virtual float GetTemperature() const override;
void SetPosition(double pos);
virtual double GetPosition() const override;
virtual double GetSpeed() const override;
virtual int GetClosedLoopError() const;
virtual void SetAllowableClosedLoopErr(uint32_t allowableCloseLoopError);
virtual int GetAnalogIn() const;
virtual void SetAnalogPosition(int newPosition);
virtual int GetAnalogInRaw() const;
virtual int GetAnalogInVel() const;
virtual int GetEncPosition() const;
virtual void SetEncPosition(int);
virtual int GetEncVel() const;
int GetPinStateQuadA() const;
int GetPinStateQuadB() const;
int GetPinStateQuadIdx() const;
int IsFwdLimitSwitchClosed() const;
int IsRevLimitSwitchClosed() const;
int GetNumberOfQuadIdxRises() const;
void SetNumberOfQuadIdxRises(int rises);
virtual int GetPulseWidthPosition() const;
virtual void SetPulseWidthPosition(int newpos);
virtual int GetPulseWidthVelocity() const;
virtual int GetPulseWidthRiseToFallUs() const;
virtual int GetPulseWidthRiseToRiseUs() const;
virtual FeedbackDeviceStatus IsSensorPresent(FeedbackDevice feedbackDevice)const;
virtual bool GetForwardLimitOK() const override;
virtual bool GetReverseLimitOK() const override;
virtual uint16_t GetFaults() const override;
uint16_t GetStickyFaults() const;
void ClearStickyFaults();
virtual void SetVoltageRampRate(double rampRate) override;
virtual void SetVoltageCompensationRampRate(double rampRate);
virtual uint32_t GetFirmwareVersion() const override;
virtual void ConfigNeutralMode(NeutralMode mode) override;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override;
virtual void ConfigPotentiometerTurns(uint16_t turns) override;
virtual void ConfigSoftPositionLimits(double forwardLimitPosition,
double reverseLimitPosition) override;
virtual void DisableSoftPositionLimits() override;
virtual void ConfigLimitMode(LimitMode mode) override;
virtual void ConfigForwardLimit(double forwardLimitPosition) override;
virtual void ConfigReverseLimit(double reverseLimitPosition) override;
/**
* Change the fwd limit switch setting to normally open or closed.
* Talon will disable momentarilly if the Talon's current setting
* is dissimilar to the caller's requested setting.
*
* Since Talon saves setting to flash this should only affect
* a given Talon initially during robot install.
*
* @param normallyOpen true for normally open. false for normally closed.
*/
void ConfigFwdLimitSwitchNormallyOpen(bool normallyOpen);
/**
* Change the rev limit switch setting to normally open or closed.
* Talon will disable momentarilly if the Talon's current setting
* is dissimilar to the caller's requested setting.
*
* Since Talon saves setting to flash this should only affect
* a given Talon initially during robot install.
*
* @param normallyOpen true for normally open. false for normally closed.
*/
void ConfigRevLimitSwitchNormallyOpen(bool normallyOpen);
virtual void ConfigMaxOutputVoltage(double voltage) override;
void ConfigPeakOutputVoltage(double forwardVoltage,double reverseVoltage);
void ConfigNominalOutputVoltage(double forwardVoltage,double reverseVoltage);
/**
* Enables Talon SRX to automatically zero the Sensor Position whenever an
* edge is detected on the index signal.
* @param enable boolean input, pass true to enable feature or false to disable.
* @param risingEdge boolean input, pass true to clear the position on rising edge,
* pass false to clear the position on falling edge.
*/
void EnableZeroSensorPositionOnIndex(bool enable, bool risingEdge);
void ConfigSetParameter(uint32_t paramEnum, double value);
bool GetParameter(uint32_t paramEnum, double & dvalue) const;
virtual void ConfigFaultTime(float faultTime) override;
virtual void SetControlMode(ControlMode mode);
void SetFeedbackDevice(FeedbackDevice device);
void SetStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs);
virtual ControlMode GetControlMode() const;
void SetSensorDirection(bool reverseSensor);
void SetClosedLoopOutputDirection(bool reverseOutput);
void SetCloseLoopRampRate(double rampRate);
void SelectProfileSlot(int slotIdx);
int GetIzone() const;
int GetIaccum() const;
void ClearIaccum();
int GetBrakeEnableDuringNeutral() const;
bool IsControlEnabled() const;
bool IsEnabled() const override;
double GetSetpoint() const override;
/**
* Calling application can opt to speed up the handshaking between the robot API and the Talon to increase the
* download rate of the Talon's Motion Profile. Ideally the period should be no more than half the period
* of a trajectory point.
*/
void ChangeMotionControlFramePeriod(int periodMs);
/**
* Clear the buffered motion profile in both Talon RAM (bottom), and in the API (top).
* Be sure to check GetMotionProfileStatus() to know when the buffer is actually cleared.
*/
void ClearMotionProfileTrajectories();
/**
* Retrieve just the buffer count for the api-level (top) buffer.
* This routine performs no CAN or data structure lookups, so its fast and ideal
* if caller needs to quickly poll the progress of trajectory points being emptied
* into Talon's RAM. Otherwise just use GetMotionProfileStatus.
* @return number of trajectory points in the top buffer.
*/
int GetMotionProfileTopLevelBufferCount();
/**
* Push another trajectory point into the top level buffer (which is emptied into
* the Talon's bottom buffer as room allows).
* @param trajPt the trajectory point to insert into buffer.
* @return true if trajectory point push ok. CTR_BufferFull if buffer is full
* due to kMotionProfileTopBufferCapacity.
*/
bool PushMotionProfileTrajectory(const TrajectoryPoint & trajPt);
/**
* @return true if api-level (top) buffer is full.
*/
bool IsMotionProfileTopLevelBufferFull();
/**
* This must be called periodically to funnel the trajectory points from the API's top level buffer to
* the Talon's bottom level buffer. Recommendation is to call this twice as fast as the executation rate of the motion profile.
* So if MP is running with 20ms trajectory points, try calling this routine every 10ms. All motion profile functions are thread-safe
* through the use of a mutex, so there is no harm in having the caller utilize threading.
*/
void ProcessMotionProfileBuffer();
/**
* Retrieve all status information.
* Since this all comes from one CAN frame, its ideal to have one routine to retrieve the frame once and decode everything.
* @param [out] motionProfileStatus contains all progress information on the currently running MP.
*/
void GetMotionProfileStatus(MotionProfileStatus & motionProfileStatus);
/**
* Clear the hasUnderrun flag in Talon's Motion Profile Executer when MPE is ready for another point,
* but the low level buffer is empty.
*
* Once the Motion Profile Executer sets the hasUnderrun flag, it stays set until
* Robot Application clears it with this routine, which ensures Robot Application
* gets a chance to instrument or react. Caller could also check the isUnderrun flag
* which automatically clears when fault condition is removed.
*/
void ClearMotionProfileHasUnderrun();
// LiveWindow stuff.
void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
// SpeedController overrides
virtual void SetInverted(bool isInverted) override;
virtual bool GetInverted() const override;
private:
// Values for various modes as is sent in the CAN packets for the Talon.
enum TalonControlMode {
kThrottle = 0,
kFollowerMode = 5,
kVoltageMode = 4,
kPositionMode = 1,
kSpeedMode = 2,
kCurrentMode = 3,
kMotionProfileMode = 6,
kDisabled = 15
};
int m_deviceNumber;
std::unique_ptr<CanTalonSRX> m_impl;
std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
int m_profile = 0; // Profile from CANTalon to use. Set to zero until we can
// actually test this.
bool m_controlEnabled = true;
ControlMode m_controlMode = kPercentVbus;
TalonControlMode m_sendMode;
double m_setPoint = 0;
/**
* Encoder CPR, counts per rotations, also called codes per revoluion.
* Default value of zero means the API behaves as it did during the 2015 season, each position
* unit is a single pulse and there are four pulses per count (4X).
* Caller can use ConfigEncoderCodesPerRev to set the quadrature encoder CPR.
*/
uint32_t m_codesPerRev = 0;
/**
* Number of turns per rotation. For example, a 10-turn pot spins ten full rotations from
* a wiper voltage of zero to 3.3 volts. Therefore knowing the
* number of turns a full voltage sweep represents is necessary for calculating rotations
* and velocity.
* A default value of zero means the API behaves as it did during the 2015 season, there are 1024
* position units from zero to 3.3V.
*/
uint32_t m_numPotTurns = 0;
/**
* Although the Talon handles feedback selection, caching the feedback selection is helpful at the API level
* for scaling into rotations and RPM.
*/
FeedbackDevice m_feedbackDevice = QuadEncoder;
static const unsigned int kDelayForSolicitedSignalsUs = 4000;
/**
* @param devToLookup FeedbackDevice to lookup the scalar for. Because Talon
* allows multiple sensors to be attached simultaneously, caller must
* specify which sensor to lookup.
* @return The number of native Talon units per rotation of the selected sensor.
* Zero if the necessary sensor information is not available.
* @see ConfigEncoderCodesPerRev
* @see ConfigPotentiometerTurns
*/
double GetNativeUnitsPerRotationScalar(FeedbackDevice devToLookup)const;
/**
* Fixup the sendMode so Set() serializes the correct demand value.
* Also fills the modeSelecet in the control frame to disabled.
* @param mode Control mode to ultimately enter once user calls Set().
* @see Set()
*/
void ApplyControlMode(CANSpeedController::ControlMode mode);
/**
* @param fullRotations double precision value representing number of rotations of selected feedback sensor.
* If user has never called the config routine for the selected sensor, then the caller
* is likely passing rotations in engineering units already, in which case it is returned
* as is.
* @see ConfigPotentiometerTurns
* @see ConfigEncoderCodesPerRev
* @return fullRotations in native engineering units of the Talon SRX firmware.
*/
int32_t ScaleRotationsToNativeUnits(FeedbackDevice devToLookup, double fullRotations) const;
/**
* @param rpm double precision value representing number of rotations per minute of selected feedback sensor.
* If user has never called the config routine for the selected sensor, then the caller
* is likely passing rotations in engineering units already, in which case it is returned
* as is.
* @see ConfigPotentiometerTurns
* @see ConfigEncoderCodesPerRev
* @return sensor velocity in native engineering units of the Talon SRX firmware.
*/
int32_t ScaleVelocityToNativeUnits(FeedbackDevice devToLookup, double rpm) const;
/**
* @param nativePos integral position of the feedback sensor in native Talon SRX units.
* If user has never called the config routine for the selected sensor, then the return
* will be in TALON SRX units as well to match the behavior in the 2015 season.
* @see ConfigPotentiometerTurns
* @see ConfigEncoderCodesPerRev
* @return double precision number of rotations, unless config was never performed.
*/
double ScaleNativeUnitsToRotations(FeedbackDevice devToLookup, int32_t nativePos) const;
/**
* @param nativeVel integral velocity of the feedback sensor in native Talon SRX units.
* If user has never called the config routine for the selected sensor, then the return
* will be in TALON SRX units as well to match the behavior in the 2015 season.
* @see ConfigPotentiometerTurns
* @see ConfigEncoderCodesPerRev
* @return double precision of sensor velocity in RPM, unless config was never performed.
*/
double ScaleNativeUnitsToRpm(FeedbackDevice devToLookup, int32_t nativeVel) const;
// LiveWindow stuff.
std::shared_ptr<ITable> m_table;
bool m_isInverted;
HasBeenMoved m_hasBeenMoved;
};

View File

@ -0,0 +1,83 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "USBCamera.h"
#include "ErrorBase.h"
#include "nivision.h"
#include "NIIMAQdx.h"
#include "HAL/cpp/priority_mutex.h"
#include <thread>
#include <memory>
#include <condition_variable>
#include <tuple>
#include <vector>
class CameraServer : public ErrorBase {
private:
static constexpr uint16_t kPort = 1180;
static constexpr uint8_t kMagicNumber[] = {0x01, 0x00, 0x00, 0x00};
static constexpr uint32_t kSize640x480 = 0;
static constexpr uint32_t kSize320x240 = 1;
static constexpr uint32_t kSize160x120 = 2;
static constexpr int32_t kHardwareCompression = -1;
static constexpr uint32_t kMaxImageSize = 200000;
protected:
CameraServer();
std::shared_ptr<USBCamera> m_camera;
std::thread m_serverThread;
std::thread m_captureThread;
priority_recursive_mutex m_imageMutex;
std::condition_variable_any m_newImageVariable;
std::vector<uint8_t*> m_dataPool;
unsigned int m_quality;
bool m_autoCaptureStarted;
bool m_hwClient;
std::tuple<uint8_t*, unsigned int, unsigned int, bool> m_imageData;
void Serve();
void AutoCapture();
void SetImageData(uint8_t* data, unsigned int size, unsigned int start = 0,
bool imaqData = false);
void FreeImageData(
std::tuple<uint8_t*, unsigned int, unsigned int, bool> imageData);
struct Request {
uint32_t fps;
int32_t compression;
uint32_t size;
};
public:
static CameraServer* GetInstance();
void SetImage(Image const* image);
void StartAutomaticCapture(
char const* cameraName = USBCamera::kDefaultCameraName);
/**
* Start automatically capturing images to send to the dashboard.
*
* You should call this method to just see a camera feed on the
* dashboard without doing any vision processing on the roboRIO.
* {@link #SetImage} should not be called after this is called.
*
* @param camera The camera interface (eg. USBCamera)
*/
void StartAutomaticCapture(std::shared_ptr<USBCamera> camera);
bool IsAutoCaptureStarted();
void SetQuality(unsigned int quality);
unsigned int GetQuality();
void SetSize(unsigned int size);
};

View File

@ -0,0 +1,45 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <stdint.h>
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h"
#include "FRC_FPGA_ChipObject/tDMAManager.h"
#include "FRC_FPGA_ChipObject/tInterruptManager.h"
#include "FRC_FPGA_ChipObject/tSystem.h"
#include "FRC_FPGA_ChipObject/tSystemInterface.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h"
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h"
// FIXME: these should not be here!
using namespace nFPGA;
using namespace nRoboRIO_FPGANamespace;
#pragma GCC diagnostic pop

View File

@ -0,0 +1,44 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2015-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <vector>
#include <cstddef>
/**
* This is a simple circular buffer so we don't need to "bucket brigade" copy
* old values.
*/
template <class T>
class CircularBuffer {
public:
CircularBuffer(size_t size);
void PushFront(T value);
void PushBack(T value);
T PopFront();
T PopBack();
void Reset();
T& operator[](size_t index);
const T& operator[](size_t index) const;
private:
std::vector<T> m_data;
// Index of element at front of buffer
size_t m_front = 0;
// Number of elements used in buffer
size_t m_length = 0;
size_t ModuloInc(size_t index);
size_t ModuloDec(size_t index);
};
#include "CircularBuffer.inc"

View File

@ -0,0 +1,123 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2015-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include <algorithm>
template <class T>
CircularBuffer<T>::CircularBuffer(size_t size) : m_data(size, 0) {}
/**
* Push new value onto front of the buffer. The value at the back is overwritten
* if the buffer is full.
*/
template <class T>
void CircularBuffer<T>::PushFront(T value) {
if (m_data.size() == 0) {
return;
}
m_front = ModuloDec(m_front);
m_data[m_front] = value;
if (m_length < m_data.size()) {
m_length++;
}
}
/**
* Push new value onto back of the buffer. The value at the front is overwritten
* if the buffer is full.
*/
template <class T>
void CircularBuffer<T>::PushBack(T value) {
if (m_data.size() == 0) {
return;
}
m_data[(m_front + m_length) % m_data.size()] = value;
if (m_length < m_data.size()) {
m_length++;
} else {
// Increment front if buffer is full to maintain size
m_front = ModuloInc(m_front);
}
}
/**
* Pop value at front of buffer.
*/
template <class T>
T CircularBuffer<T>::PopFront() {
// If there are no elements in the buffer, do nothing
if (m_length == 0) {
return 0;
}
T& temp = m_data[m_front];
m_front = ModuloInc(m_front);
m_length--;
return temp;
}
/**
* Pop value at back of buffer.
*/
template <class T>
T CircularBuffer<T>::PopBack() {
// If there are no elements in the buffer, do nothing
if (m_length == 0) {
return 0;
}
m_length--;
return m_data[(m_front + m_length) % m_data.size()];
}
template <class T>
void CircularBuffer<T>::Reset() {
std::fill(m_data.begin(), m_data.end(), 0);
m_front = 0;
m_length = 0;
}
/**
* Returns element at index starting from front of buffer.
*/
template <class T>
T& CircularBuffer<T>::operator[](size_t index) {
return m_data[(m_front + index) % m_data.size()];
}
/**
* Returns element at index starting from front of buffer.
*/
template <class T>
const T& CircularBuffer<T>::operator[](size_t index) const {
return m_data[(m_front + index) % m_data.size()];
}
/**
* Increment an index modulo the length of the m_data buffer
*/
template <class T>
size_t CircularBuffer<T>::ModuloInc(size_t index) {
return (index + 1) % m_data.size();
}
/**
* Decrement an index modulo the length of the m_data buffer
*/
template <class T>
size_t CircularBuffer<T>::ModuloDec(size_t index) {
if (index == 0) {
return m_data.size() - 1;
} else {
return index - 1;
}
}

View File

@ -0,0 +1,190 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __COMMAND_H__
#define __COMMAND_H__
#include "ErrorBase.h"
#include "SmartDashboard/NamedSendable.h"
#include "tables/ITableListener.h"
#include <set>
#include <string>
#include <memory>
class CommandGroup;
class Subsystem;
/**
* The Command class is at the very core of the entire command framework.
* Every command can be started with a call to {@link Command#Start() Start()}.
* Once a command is started it will call {@link Command#Initialize()
* Initialize()}, and then
* will repeatedly call {@link Command#Execute() Execute()} until the {@link
*Command#IsFinished() IsFinished()}
* returns true. Once it does, {@link Command#End() End()} will be called.
*
* <p>However, if at any point while it is running {@link Command#Cancel()
* Cancel()} is called, then
* the command will be stopped and {@link Command#Interrupted() Interrupted()}
* will be called.</p>
*
* <p>If a command uses a {@link Subsystem}, then it should specify that it does
* so by
* calling the {@link Command#Requires(Subsystem) Requires(...)} method
* in its constructor. Note that a Command may have multiple requirements, and
* {@link Command#Requires(Subsystem) Requires(...)} should be
* called for each one.</p>
*
* <p>If a command is running and a new command with shared requirements is
* started,
* then one of two things will happen. If the active command is interruptible,
* then {@link Command#Cancel() Cancel()} will be called and the command will be
* removed
* to make way for the new one. If the active command is not interruptible, the
* other one will not even be started, and the active one will continue
* functioning.</p>
*
* @see CommandGroup
* @see Subsystem
*/
class Command : public ErrorBase, public NamedSendable, public ITableListener {
friend class CommandGroup;
friend class Scheduler;
public:
Command();
Command(const std::string &name);
Command(double timeout);
Command(const std::string &name, double timeout);
virtual ~Command();
double TimeSinceInitialized() const;
void Requires(Subsystem *s);
bool IsCanceled() const;
void Start();
bool Run();
void Cancel();
bool IsRunning() const;
bool IsInterruptible() const;
void SetInterruptible(bool interruptible);
bool DoesRequire(Subsystem *subsystem) const;
typedef std::set<Subsystem *> SubsystemSet;
SubsystemSet GetRequirements() const;
CommandGroup *GetGroup() const;
void SetRunWhenDisabled(bool run);
bool WillRunWhenDisabled() const;
int GetID() const;
protected:
void SetTimeout(double timeout);
bool IsTimedOut() const;
bool AssertUnlocked(const std::string &message);
void SetParent(CommandGroup *parent);
/**
* The initialize method is called the first time this Command is run after
* being started.
*/
virtual void Initialize() = 0;
/**
* The execute method is called repeatedly until this Command either finishes
* or is canceled.
*/
virtual void Execute() = 0;
/**
* Returns whether this command is finished.
* If it is, then the command will be removed
* and {@link Command#end() end()} will be called.
*
* <p>It may be useful for a team to reference the {@link Command#isTimedOut()
* isTimedOut()} method
* for time-sensitive commands.</p>
* @return whether this command is finished.
* @see Command#isTimedOut() isTimedOut()
*/
virtual bool IsFinished() = 0;
/**
* Called when the command ended peacefully. This is where you may want
* to wrap up loose ends, like shutting off a motor that was being used
* in the command.
*/
virtual void End() = 0;
/**
* Called when the command ends because somebody called {@link
*Command#cancel() cancel()}
* or another command shared the same requirements as this one, and booted
* it out.
*
* <p>This is where you may want
* to wrap up loose ends, like shutting off a motor that was being used
* in the command.</p>
*
* <p>Generally, it is useful to simply call the {@link Command#end() end()}
* method
* within this method</p>
*/
virtual void Interrupted() = 0;
virtual void _Initialize();
virtual void _Interrupted();
virtual void _Execute();
virtual void _End();
virtual void _Cancel();
private:
void LockChanges();
/*synchronized*/ void Removed();
void StartRunning();
void StartTiming();
/** The name of this command */
std::string m_name;
/** The time since this command was initialized */
double m_startTime = -1;
/** The time (in seconds) before this command "times out" (or -1 if no
* timeout) */
double m_timeout;
/** Whether or not this command has been initialized */
bool m_initialized = false;
/** The requirements (or null if no requirements) */
SubsystemSet m_requirements;
/** Whether or not it is running */
bool m_running = false;
/** Whether or not it is interruptible*/
bool m_interruptible = true;
/** Whether or not it has been canceled */
bool m_canceled = false;
/** Whether or not it has been locked */
bool m_locked = false;
/** Whether this command should run when the robot is disabled */
bool m_runWhenDisabled = false;
/** The {@link CommandGroup} this is in */
CommandGroup *m_parent = nullptr;
int m_commandID = m_commandCounter++;
static int m_commandCounter;
public:
virtual std::string GetName() const;
virtual void InitTable(std::shared_ptr<ITable> table);
virtual std::shared_ptr<ITable> GetTable() const;
virtual std::string GetSmartDashboardType() const;
virtual void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew);
protected:
std::shared_ptr<ITable> m_table;
};
#endif

View File

@ -0,0 +1,74 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __COMMAND_GROUP_H__
#define __COMMAND_GROUP_H__
#include "Commands/Command.h"
#include "Commands/CommandGroupEntry.h"
#include <list>
#include <vector>
/**
* A {@link CommandGroup} is a list of commands which are executed in sequence.
*
* <p>Commands in a {@link CommandGroup} are added using the {@link
* CommandGroup#AddSequential(Command) AddSequential(...)} method
* and are called sequentially.
* {@link CommandGroup CommandGroups} are themselves {@link Command Commands}
* and can be given to other {@link CommandGroup CommandGroups}.</p>
*
* <p>{@link CommandGroup CommandGroups} will carry all of the requirements of
* their {@link Command subcommands}. Additional
* requirements can be specified by calling {@link
*CommandGroup#Requires(Subsystem) Requires(...)}
* normally in the constructor.</P>
*
* <p>CommandGroups can also execute commands in parallel, simply by adding them
* using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.</p>
*
* @see Command
* @see Subsystem
*/
class CommandGroup : public Command {
public:
CommandGroup() = default;
CommandGroup(const std::string &name);
virtual ~CommandGroup() = default;
void AddSequential(Command *command);
void AddSequential(Command *command, double timeout);
void AddParallel(Command *command);
void AddParallel(Command *command, double timeout);
bool IsInterruptible() const;
int GetSize() const;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
virtual void _Initialize();
virtual void _Interrupted();
virtual void _Execute();
virtual void _End();
private:
void CancelConflicts(Command *command);
/** The commands in this group (stored in entries) */
std::vector<CommandGroupEntry> m_commands;
/** The active children in this group (stored in entries) */
std::list<CommandGroupEntry> m_children;
/** The current command, -1 signifies that none have been run */
int m_currentCommandIndex = -1;
};
#endif

View File

@ -0,0 +1,30 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __COMMAND_GROUP_ENTRY_H__
#define __COMMAND_GROUP_ENTRY_H__
class Command;
class CommandGroupEntry {
public:
typedef enum {
kSequence_InSequence,
kSequence_BranchPeer,
kSequence_BranchChild
} Sequence;
CommandGroupEntry() = default;
CommandGroupEntry(Command *command, Sequence state, double timeout = -1.0);
bool IsTimedOut() const;
double m_timeout = -1.0;
Command *m_command = nullptr;
Sequence m_state = kSequence_InSequence;
};
#endif

View File

@ -0,0 +1,58 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __PID_COMMAND_H__
#define __PID_COMMAND_H__
#include "Commands/Command.h"
#include "PIDController.h"
#include "PIDSource.h"
#include "PIDOutput.h"
#include <memory>
class PIDCommand : public Command, public PIDOutput, public PIDSource {
public:
PIDCommand(const std::string &name, double p, double i, double d);
PIDCommand(const std::string &name, double p, double i, double d, double period);
PIDCommand(const std::string &name, double p, double i, double d, double f,
double period);
PIDCommand(double p, double i, double d);
PIDCommand(double p, double i, double d, double period);
PIDCommand(double p, double i, double d, double f, double period);
virtual ~PIDCommand() = default;
void SetSetpointRelative(double deltaSetpoint);
// PIDOutput interface
virtual void PIDWrite(float output);
// PIDSource interface
virtual double PIDGet();
protected:
std::shared_ptr<PIDController> GetPIDController() const;
virtual void _Initialize();
virtual void _Interrupted();
virtual void _End();
void SetSetpoint(double setpoint);
double GetSetpoint() const;
double GetPosition();
virtual double ReturnPIDInput() = 0;
virtual void UsePIDOutput(double output) = 0;
private:
/** The internal {@link PIDController} */
std::shared_ptr<PIDController> m_controller;
public:
virtual void InitTable(std::shared_ptr<ITable> table);
virtual std::string GetSmartDashboardType() const;
};
#endif

View File

@ -0,0 +1,76 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __PID_SUBSYSTEM_H__
#define __PID_SUBSYSTEM_H__
#include "Commands/Subsystem.h"
#include "PIDController.h"
#include "PIDSource.h"
#include "PIDOutput.h"
#include <memory>
/**
* This class is designed to handle the case where there is a {@link Subsystem}
* which uses a single {@link PIDController} almost constantly (for instance,
* an elevator which attempts to stay at a constant height).
*
* <p>It provides some convenience methods to run an internal {@link
* PIDController}.
* It also allows access to the internal {@link PIDController} in order to give
* total control
* to the programmer.</p>
*
*/
class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
public:
PIDSubsystem(const std::string &name, double p, double i, double d);
PIDSubsystem(const std::string &name, double p, double i, double d, double f);
PIDSubsystem(const std::string &name, double p, double i, double d, double f,
double period);
PIDSubsystem(double p, double i, double d);
PIDSubsystem(double p, double i, double d, double f);
PIDSubsystem(double p, double i, double d, double f, double period);
virtual ~PIDSubsystem() = default;
void Enable();
void Disable();
// PIDOutput interface
virtual void PIDWrite(float output);
// PIDSource interface
virtual double PIDGet();
void SetSetpoint(double setpoint);
void SetSetpointRelative(double deltaSetpoint);
void SetInputRange(float minimumInput, float maximumInput);
void SetOutputRange(float minimumOutput, float maximumOutput);
double GetSetpoint();
double GetPosition();
double GetRate();
virtual void SetAbsoluteTolerance(float absValue);
virtual void SetPercentTolerance(float percent);
virtual bool OnTarget() const;
protected:
std::shared_ptr<PIDController> GetPIDController();
virtual double ReturnPIDInput() = 0;
virtual void UsePIDOutput(double output) = 0;
private:
/** The internal {@link PIDController} */
std::shared_ptr<PIDController> m_controller;
public:
virtual void InitTable(std::shared_ptr<ITable> table);
virtual std::string GetSmartDashboardType() const;
};
#endif

View File

@ -0,0 +1,30 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __PRINT_COMMAND_H__
#define __PRINT_COMMAND_H__
#include "Commands/Command.h"
#include <string>
class PrintCommand : public Command {
public:
PrintCommand(const std::string &message);
virtual ~PrintCommand() = default;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
private:
std::string m_message;
};
#endif

View File

@ -0,0 +1,70 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __SCHEDULER_H__
#define __SCHEDULER_H__
#include "Commands/Command.h"
#include "ErrorBase.h"
#include "SmartDashboard/NamedSendable.h"
#include "networktables/NetworkTable.h"
#include "SmartDashboard/SmartDashboard.h"
#include <list>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "HAL/cpp/priority_mutex.h"
class ButtonScheduler;
class Subsystem;
class Scheduler : public ErrorBase, public NamedSendable {
public:
static Scheduler *GetInstance();
void AddCommand(Command *command);
void AddButton(ButtonScheduler *button);
void RegisterSubsystem(Subsystem *subsystem);
void Run();
void Remove(Command *command);
void RemoveAll();
void ResetAll();
void SetEnabled(bool enabled);
void UpdateTable();
std::string GetSmartDashboardType() const;
void InitTable(std::shared_ptr<ITable> subTable);
std::shared_ptr<ITable> GetTable() const;
std::string GetName() const;
std::string GetType() const;
private:
Scheduler();
virtual ~Scheduler() = default;
void ProcessCommandAddition(Command *command);
Command::SubsystemSet m_subsystems;
priority_mutex m_buttonsLock;
typedef std::vector<ButtonScheduler *> ButtonVector;
ButtonVector m_buttons;
typedef std::vector<Command *> CommandVector;
priority_mutex m_additionsLock;
CommandVector m_additions;
typedef std::set<Command *> CommandSet;
CommandSet m_commands;
bool m_adding = false;
bool m_enabled = true;
std::vector<std::string> commands;
std::vector<double> ids;
std::vector<double> toCancel;
std::shared_ptr<ITable> m_table;
bool m_runningCommandsChanged = false;
};
#endif

View File

@ -0,0 +1,29 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __START_COMMAND_H__
#define __START_COMMAND_H__
#include "Commands/Command.h"
class StartCommand : public Command {
public:
StartCommand(Command *commandToStart);
virtual ~StartCommand() = default;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
private:
Command *m_commandToFork;
};
#endif

View File

@ -0,0 +1,50 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __SUBSYSTEM_H__
#define __SUBSYSTEM_H__
#include "ErrorBase.h"
#include "SmartDashboard/NamedSendable.h"
#include <string>
#include <memory>
class Command;
class Subsystem : public ErrorBase, public NamedSendable {
friend class Scheduler;
public:
Subsystem(const std::string &name);
virtual ~Subsystem() = default;
void SetDefaultCommand(Command *command);
Command *GetDefaultCommand();
void SetCurrentCommand(Command *command);
Command *GetCurrentCommand() const;
virtual void InitDefaultCommand();
private:
void ConfirmCommand();
Command *m_currentCommand = nullptr;
bool m_currentCommandChanged = true;
Command *m_defaultCommand = nullptr;
std::string m_name;
bool m_initializedDefaultCommand = false;
public:
virtual std::string GetName() const;
virtual void InitTable(std::shared_ptr<ITable> table);
virtual std::shared_ptr<ITable> GetTable() const;
virtual std::string GetSmartDashboardType() const;
protected:
std::shared_ptr<ITable> m_table;
};
#endif

View File

@ -0,0 +1,27 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __WAIT_COMMAND_H__
#define __WAIT_COMMAND_H__
#include "Commands/Command.h"
class WaitCommand : public Command {
public:
WaitCommand(double timeout);
WaitCommand(const std::string &name, double timeout);
virtual ~WaitCommand() = default;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
};
#endif

View File

@ -0,0 +1,27 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __WAIT_FOR_CHILDREN_H__
#define __WAIT_FOR_CHILDREN_H__
#include "Commands/Command.h"
class WaitForChildren : public Command {
public:
WaitForChildren(double timeout);
WaitForChildren(const std::string &name, double timeout);
virtual ~WaitForChildren() = default;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
};
#endif

View File

@ -0,0 +1,30 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __WAIT_UNTIL_COMMAND_H__
#define __WAIT_UNTIL_COMMAND_H__
#include "Commands/Command.h"
class WaitUntilCommand : public Command {
public:
WaitUntilCommand(double time);
WaitUntilCommand(const std::string &name, double time);
virtual ~WaitUntilCommand() = default;
protected:
virtual void Initialize();
virtual void Execute();
virtual bool IsFinished();
virtual void End();
virtual void Interrupted();
private:
double m_time;
};
#endif

View File

@ -0,0 +1,66 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef Compressor_H_
#define Compressor_H_
#include "HAL/HAL.hpp"
#include "SensorBase.h"
#include "tables/ITableListener.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
/**
* PCM compressor
*/
class Compressor : public SensorBase,
public LiveWindowSendable,
public ITableListener {
public:
// Default PCM ID is 0
explicit Compressor(uint8_t pcmID = GetDefaultSolenoidModule());
virtual ~Compressor() = default;
void Start();
void Stop();
bool Enabled() const;
bool GetPressureSwitchValue() const;
float GetCompressorCurrent() const;
void SetClosedLoopControl(bool on);
bool GetClosedLoopControl() const;
bool GetCompressorCurrentTooHighFault() const;
bool GetCompressorCurrentTooHighStickyFault() const;
bool GetCompressorShortedStickyFault() const;
bool GetCompressorShortedFault() const;
bool GetCompressorNotConnectedStickyFault() const;
bool GetCompressorNotConnectedFault() const;
void ClearAllPCMStickyFaults();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew) override;
protected:
void *m_pcm_pointer;
private:
void SetCompressor(bool on);
std::shared_ptr<ITable> m_table;
};
#endif /* Compressor_H_ */

View File

@ -0,0 +1,32 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
/**
* Interface for Controllers
* Common interface for controllers. Controllers run control loops, the most
* common
* are PID controllers and their variants, but this includes anything that is
* controlling
* an actuator in a separate thread.
*/
class Controller {
public:
virtual ~Controller() = default;
/**
* Allows the control loop to run
*/
virtual void Enable() = 0;
/**
* Stops the control loop from running until explicitly re-enabled by calling
* enable()
*/
virtual void Disable() = 0;
};

View File

@ -0,0 +1,28 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef __CONTROLLER_POWER_H__
#define __CONTROLLER_POWER_H__
class ControllerPower {
public:
static double GetInputVoltage();
static double GetInputCurrent();
static double GetVoltage3V3();
static double GetCurrent3V3();
static bool GetEnabled3V3();
static int GetFaultCount3V3();
static double GetVoltage5V();
static double GetCurrent5V();
static bool GetEnabled5V();
static int GetFaultCount5V();
static double GetVoltage6V();
static double GetCurrent6V();
static bool GetEnabled6V();
static int GetFaultCount6V();
};
#endif

View File

@ -0,0 +1,108 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "AnalogTriggerOutput.h"
#include "CounterBase.h"
#include "SensorBase.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
class DigitalGlitchFilter;
/**
* Class for counting the number of ticks on a digital input channel.
* This is a general purpose class for counting repetitive events. It can return
* the number
* of counts, the period of the most recent cycle, and detect when the signal
* being counted
* has stopped by supplying a maximum cycle time.
*
* All counters will immediately start counting - Reset() them if you need them
* to be zeroed before use.
*/
class Counter : public SensorBase,
public CounterBase,
public LiveWindowSendable {
public:
explicit Counter(Mode mode = kTwoPulse);
explicit Counter(int32_t channel);
explicit Counter(DigitalSource *source);
explicit Counter(std::shared_ptr<DigitalSource> source);
DEPRECATED("Use pass-by-reference instead.")
explicit Counter(AnalogTrigger *trigger);
explicit Counter(const AnalogTrigger &trigger);
Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted);
Counter(EncodingType encodingType, std::shared_ptr<DigitalSource> upSource,
std::shared_ptr<DigitalSource> downSource, bool inverted);
virtual ~Counter();
void SetUpSource(int32_t channel);
void SetUpSource(AnalogTrigger *analogTrigger, AnalogTriggerType triggerType);
void SetUpSource(std::shared_ptr<AnalogTrigger> analogTrigger,
AnalogTriggerType triggerType);
void SetUpSource(DigitalSource *source);
void SetUpSource(std::shared_ptr<DigitalSource> source);
void SetUpSource(DigitalSource &source);
void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
void ClearUpSource();
void SetDownSource(int32_t channel);
void SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType);
void SetDownSource(std::shared_ptr<AnalogTrigger> analogTrigger,
AnalogTriggerType triggerType);
void SetDownSource(DigitalSource *source);
void SetDownSource(std::shared_ptr<DigitalSource> source);
void SetDownSource(DigitalSource &source);
void SetDownSourceEdge(bool risingEdge, bool fallingEdge);
void ClearDownSource();
void SetUpDownCounterMode();
void SetExternalDirectionMode();
void SetSemiPeriodMode(bool highSemiPeriod);
void SetPulseLengthMode(float threshold);
void SetReverseDirection(bool reverseDirection);
// CounterBase interface
int32_t Get() const override;
void Reset() override;
double GetPeriod() const override;
void SetMaxPeriod(double maxPeriod) override;
void SetUpdateWhenEmpty(bool enabled);
bool GetStopped() const override;
bool GetDirection() const override;
void SetSamplesToAverage(int samplesToAverage);
int GetSamplesToAverage() const;
uint32_t GetFPGAIndex() const { return m_index; }
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
virtual std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
protected:
// Makes the counter count up.
std::shared_ptr<DigitalSource> m_upSource;
// Makes the counter count down.
std::shared_ptr<DigitalSource> m_downSource;
// The FPGA counter object
void *m_counter = nullptr; ///< The FPGA counter object.
private:
uint32_t m_index = 0; ///< The index of this counter.
std::shared_ptr<ITable> m_table;
friend class DigitalGlitchFilter;
};

View File

@ -0,0 +1,31 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>
/**
* Interface for counting the number of ticks on a digital input channel.
* Encoders, Gear tooth sensors, and counters should all subclass this so it can
* be used to build more advanced classes for control and driving.
*
* All counters will immediately start counting - Reset() them if you need them
* to be zeroed before use.
*/
class CounterBase {
public:
enum EncodingType { k1X, k2X, k4X };
virtual ~CounterBase() = default;
virtual int32_t Get() const = 0;
virtual void Reset() = 0;
virtual double GetPeriod() const = 0;
virtual void SetMaxPeriod(double maxPeriod) = 0;
virtual bool GetStopped() const = 0;
virtual bool GetDirection() const = 0;
};

View File

@ -0,0 +1,52 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2015-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <array>
#include "HAL/cpp/priority_mutex.h"
#include "DigitalSource.h"
class Encoder;
class Counter;
/**
* Class to enable glitch filtering on a set of digital inputs.
* This class will manage adding and removing digital inputs from a FPGA glitch
* filter. The filter lets the user configure the time that an input must remain
* high or low before it is classified as high or low.
*/
class DigitalGlitchFilter : public SensorBase {
public:
DigitalGlitchFilter();
~DigitalGlitchFilter();
void Add(DigitalSource *input);
void Add(Encoder *input);
void Add(Counter *input);
void Remove(DigitalSource *input);
void Remove(Encoder *input);
void Remove(Counter *input);
void SetPeriodCycles(uint32_t fpga_cycles);
void SetPeriodNanoSeconds(uint64_t nanoseconds);
uint32_t GetPeriodCycles();
uint64_t GetPeriodNanoSeconds();
private:
// Sets the filter for the input to be the requested index. A value of 0
// disables the filter, and the filter value must be between 1 and 3,
// inclusive.
void DoAdd(DigitalSource *input, int requested_index);
int m_channelIndex = -1;
static priority_mutex m_mutex;
static ::std::array<bool, 3> m_filterAllocated;
};

View File

@ -0,0 +1,52 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "DigitalSource.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
#include <cstdint>
class DigitalGlitchFilter;
/**
* Class to read a digital input.
* This class will read digital inputs and return the current value on the
* channel. Other devices
* such as encoders, gear tooth sensors, etc. that are implemented elsewhere
* will automatically
* allocate digital inputs and outputs as required. This class is only for
* devices like switches
* etc. that aren't implemented anywhere else.
*/
class DigitalInput : public DigitalSource, public LiveWindowSendable {
public:
explicit DigitalInput(uint32_t channel);
virtual ~DigitalInput();
bool Get() const;
uint32_t GetChannel() const;
// Digital Source Interface
virtual uint32_t GetChannelForRouting() const;
virtual uint32_t GetModuleForRouting() const;
virtual bool GetAnalogTriggerForRouting() const;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType() const;
void InitTable(std::shared_ptr<ITable> subTable);
std::shared_ptr<ITable> GetTable() const;
private:
uint32_t m_channel;
std::shared_ptr<ITable> m_table;
friend class DigitalGlitchFilter;
};

View File

@ -0,0 +1,56 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "DigitalSource.h"
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITableListener.h"
#include <memory>
/**
* Class to write to digital outputs.
* Write values to the digital output channels. Other devices implemented
* elsewhere will allocate
* channels automatically so for those devices it shouldn't be done here.
*/
class DigitalOutput : public DigitalSource,
public ITableListener,
public LiveWindowSendable {
public:
explicit DigitalOutput(uint32_t channel);
virtual ~DigitalOutput();
void Set(uint32_t value);
uint32_t GetChannel() const;
void Pulse(float length);
bool IsPulsing() const;
void SetPWMRate(float rate);
void EnablePWM(float initialDutyCycle);
void DisablePWM();
void UpdateDutyCycle(float dutyCycle);
// Digital Source Interface
virtual uint32_t GetChannelForRouting() const;
virtual uint32_t GetModuleForRouting() const;
virtual bool GetAnalogTriggerForRouting() const;
virtual void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType() const;
void InitTable(std::shared_ptr<ITable> subTable);
std::shared_ptr<ITable> GetTable() const;
private:
uint32_t m_channel;
void *m_pwmGenerator;
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,28 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "InterruptableSensorBase.h"
/**
* DigitalSource Interface.
* The DigitalSource represents all the possible inputs for a counter or a
* quadrature encoder. The source may be
* either a digital input or an analog input. If the caller just provides a
* channel, then a digital input will be
* constructed and freed when finished for the source. The source can either be
* a digital input or analog trigger
* but not both.
*/
class DigitalSource : public InterruptableSensorBase {
public:
virtual ~DigitalSource() = default;
virtual uint32_t GetChannelForRouting() const = 0;
virtual uint32_t GetModuleForRouting() const = 0;
virtual bool GetAnalogTriggerForRouting() const = 0;
};

View File

@ -0,0 +1,54 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "SolenoidBase.h"
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITableListener.h"
#include <memory>
/**
* DoubleSolenoid class for running 2 channels of high voltage Digital Output
* (PCM).
*
* The DoubleSolenoid class is typically used for pneumatics solenoids that
* have two positions controlled by two separate channels.
*/
class DoubleSolenoid : public SolenoidBase,
public LiveWindowSendable,
public ITableListener {
public:
enum Value { kOff, kForward, kReverse };
explicit DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel);
DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
uint32_t reverseChannel);
virtual ~DoubleSolenoid();
virtual void Set(Value value);
virtual Value Get() const;
bool IsFwdSolenoidBlackListed() const;
bool IsRevSolenoidBlackListed() const;
void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType() const;
void InitTable(std::shared_ptr<ITable> subTable);
std::shared_ptr<ITable> GetTable() const;
private:
uint32_t m_forwardChannel; ///< The forward channel on the module to control.
uint32_t m_reverseChannel; ///< The reverse channel on the module to control.
uint8_t m_forwardMask; ///< The mask for the forward channel.
uint8_t m_reverseMask; ///< The mask for the reverse channel.
std::shared_ptr<ITable> m_table;
};

View File

@ -0,0 +1,118 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "SensorBase.h"
#include "RobotState.h"
#include "Task.h"
#include "HAL/HAL.hpp"
#include "HAL/cpp/Semaphore.hpp"
#include "HAL/cpp/priority_mutex.h"
#include "HAL/cpp/priority_condition_variable.h"
#include <condition_variable>
#include <atomic>
struct HALControlWord;
class AnalogInput;
/**
* Provide access to the network communication data to / from the Driver
* Station.
*/
class DriverStation : public SensorBase, public RobotStateInterface {
public:
enum Alliance { kRed, kBlue, kInvalid };
virtual ~DriverStation();
static DriverStation &GetInstance();
static void ReportError(std::string error);
static const uint32_t kJoystickPorts = 6;
float GetStickAxis(uint32_t stick, uint32_t axis);
int GetStickPOV(uint32_t stick, uint32_t pov);
uint32_t GetStickButtons(uint32_t stick) const;
bool GetStickButton(uint32_t stick, uint8_t button);
int GetStickAxisCount(uint32_t stick) const;
int GetStickPOVCount(uint32_t stick) const;
int GetStickButtonCount(uint32_t stick) const;
bool GetJoystickIsXbox(uint32_t stick) const;
int GetJoystickType(uint32_t stick) const;
std::string GetJoystickName(uint32_t stick) const;
int GetJoystickAxisType(uint32_t stick, uint8_t axis) const;
bool IsEnabled() const override;
bool IsDisabled() const override;
bool IsAutonomous() const override;
bool IsOperatorControl() const override;
bool IsTest() const override;
bool IsDSAttached() const;
bool IsNewControlData() const;
bool IsFMSAttached() const;
bool IsSysActive() const;
bool IsSysBrownedOut() const;
Alliance GetAlliance() const;
uint32_t GetLocation() const;
void WaitForData();
double GetMatchTime() const;
float GetBatteryVoltage() const;
/** Only to be used to tell the Driver Station what code you claim to be
* executing
* for diagnostic purposes only
* @param entering If true, starting disabled code; if false, leaving disabled
* code */
void InDisabled(bool entering) { m_userInDisabled = entering; }
/** Only to be used to tell the Driver Station what code you claim to be
* executing
* for diagnostic purposes only
* @param entering If true, starting autonomous code; if false, leaving
* autonomous code */
void InAutonomous(bool entering) { m_userInAutonomous = entering; }
/** Only to be used to tell the Driver Station what code you claim to be
* executing
* for diagnostic purposes only
* @param entering If true, starting teleop code; if false, leaving teleop
* code */
void InOperatorControl(bool entering) { m_userInTeleop = entering; }
/** Only to be used to tell the Driver Station what code you claim to be
* executing
* for diagnostic purposes only
* @param entering If true, starting test code; if false, leaving test code */
void InTest(bool entering) { m_userInTest = entering; }
protected:
DriverStation();
void GetData();
private:
static DriverStation *m_instance;
void ReportJoystickUnpluggedError(std::string message);
void Run();
HALJoystickAxes m_joystickAxes[kJoystickPorts];
HALJoystickPOVs m_joystickPOVs[kJoystickPorts];
HALJoystickButtons m_joystickButtons[kJoystickPorts];
HALJoystickDescriptor m_joystickDescriptor[kJoystickPorts];
Task m_task;
std::atomic<bool> m_isRunning{false};
mutable Semaphore m_newControlData{Semaphore::kEmpty};
mutable priority_condition_variable m_packetDataAvailableCond;
priority_mutex m_packetDataAvailableMutex;
std::condition_variable_any m_waitForDataCond;
priority_mutex m_waitForDataMutex;
bool m_userInDisabled = false;
bool m_userInAutonomous = false;
bool m_userInTeleop = false;
bool m_userInTest = false;
double m_nextMessageTime = 0;
};

View File

@ -0,0 +1,114 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "CounterBase.h"
#include "SensorBase.h"
#include "Counter.h"
#include "PIDSource.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
class DigitalSource;
class DigitalGlitchFilter;
/**
* Class to read quad encoders.
* Quadrature encoders are devices that count shaft rotation and can sense
* direction. The output of
* the QuadEncoder class is an integer that can count either up or down, and can
* go negative for
* reverse direction counting. When creating QuadEncoders, a direction is
* supplied that changes the
* sense of the output to make code more readable if the encoder is mounted such
* that forward movement
* generates negative values. Quadrature encoders have two digital outputs, an A
* Channel and a B Channel
* that are out of phase with each other to allow the FPGA to do direction
* sensing.
*
* All encoders will immediately start counting - Reset() them if you need them
* to be zeroed before use.
*/
class Encoder : public SensorBase,
public CounterBase,
public PIDSource,
public LiveWindowSendable {
public:
enum IndexingType {
kResetWhileHigh,
kResetWhileLow,
kResetOnFallingEdge,
kResetOnRisingEdge
};
Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection = false,
EncodingType encodingType = k4X);
Encoder(std::shared_ptr<DigitalSource> aSource,
std::shared_ptr<DigitalSource> bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection = false, EncodingType encodingType = k4X);
virtual ~Encoder();
// CounterBase interface
int32_t Get() const override;
int32_t GetRaw() const;
int32_t GetEncodingScale() const;
void Reset() override;
double GetPeriod() const override;
void SetMaxPeriod(double maxPeriod) override;
bool GetStopped() const override;
bool GetDirection() const override;
double GetDistance() const;
double GetRate() const;
void SetMinRate(double minRate);
void SetDistancePerPulse(double distancePerPulse);
void SetReverseDirection(bool reverseDirection);
void SetSamplesToAverage(int samplesToAverage);
int GetSamplesToAverage() const;
double PIDGet() override;
void SetIndexSource(uint32_t channel, IndexingType type = kResetOnRisingEdge);
DEPRECATED("Use pass-by-reference instead.")
void SetIndexSource(DigitalSource *source,
IndexingType type = kResetOnRisingEdge);
void SetIndexSource(const DigitalSource &source,
IndexingType type = kResetOnRisingEdge);
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(std::shared_ptr<ITable> subTable) override;
std::shared_ptr<ITable> GetTable() const override;
int32_t GetFPGAIndex() const { return m_index; }
private:
void InitEncoder(bool _reverseDirection, EncodingType encodingType);
double DecodingScaleFactor() const;
std::shared_ptr<DigitalSource> m_aSource; // the A phase of the quad encoder
std::shared_ptr<DigitalSource> m_bSource; // the B phase of the quad encoder
void *m_encoder = nullptr;
int32_t m_index = 0; // The encoder's FPGA index.
double m_distancePerPulse = 1.0; // distance of travel for each encoder tick
std::unique_ptr<Counter> m_counter =
nullptr; // Counter object for 1x and 2x encoding
EncodingType m_encodingType; // Encoding type
int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType
std::shared_ptr<ITable> m_table;
friend class DigitalGlitchFilter;
};

View File

@ -0,0 +1,60 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "Base.h"
#ifdef _WIN32
#include <Windows.h>
//Windows.h defines #define GetMessage GetMessageW, which is stupid and we don't want it.
#undef GetMessage
#endif
#include <string>
#include <stdint.h>
#include "llvm/StringRef.h"
// Forward declarations
class ErrorBase;
/**
* Error object represents a library error.
*/
class Error {
public:
typedef int32_t Code;
Error() = default;
Error(const Error&) = delete;
Error& operator=(const Error&) = delete;
void Clone(const Error& error);
Code GetCode() const;
std::string GetMessage() const;
std::string GetFilename() const;
std::string GetFunction() const;
uint32_t GetLineNumber() const;
const ErrorBase* GetOriginatingObject() const;
double GetTimestamp() const;
void Clear();
void Set(Code code, llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber, const ErrorBase* originatingObject);
private:
void Report();
Code m_code = 0;
std::string m_message;
std::string m_filename;
std::string m_function;
uint32_t m_lineNumber = 0;
const ErrorBase* m_originatingObject = nullptr;
double m_timestamp = 0.0;
};

View File

@ -0,0 +1,107 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "Base.h"
#include "Error.h"
#include "HAL/cpp/priority_mutex.h"
#include "llvm/StringRef.h"
#define wpi_setErrnoErrorWithContext(context) \
this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
#define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
#define wpi_setImaqErrorWithContext(code, context) \
do { \
if ((code) != 0) \
this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
} while (0)
#define wpi_setErrorWithContext(code, context) \
do { \
if ((code) != 0) \
this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
} while (0)
#define wpi_setError(code) wpi_setErrorWithContext(code, "")
#define wpi_setStaticErrorWithContext(object, code, context) \
do { \
if ((code) != 0) \
object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
} while (0)
#define wpi_setStaticError(object, code) \
wpi_setStaticErrorWithContext(object, code, "")
#define wpi_setGlobalErrorWithContext(code, context) \
do { \
if ((code) != 0) \
ErrorBase::SetGlobalError((code), (context), __FILE__, __FUNCTION__, \
__LINE__); \
} while (0)
#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
#define wpi_setWPIErrorWithContext(error, context) \
this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \
(context), __FILE__, __FUNCTION__, __LINE__)
#define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, ""))
#define wpi_setStaticWPIErrorWithContext(object, error, context) \
object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \
__FUNCTION__, __LINE__)
#define wpi_setStaticWPIError(object, error) \
wpi_setStaticWPIErrorWithContext(object, error, "")
#define wpi_setGlobalWPIErrorWithContext(error, context) \
ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), __FILE__, \
__FUNCTION__, __LINE__)
#define wpi_setGlobalWPIError(error) \
wpi_setGlobalWPIErrorWithContext(error, "")
/**
* Base class for most objects.
* ErrorBase is the base class for most objects since it holds the generated
* error
* for that object. In addition, there is a single instance of a global error
* object
*/
class ErrorBase {
// TODO: Consider initializing instance variables and cleanup in destructor
public:
ErrorBase() = default;
virtual ~ErrorBase() = default;
ErrorBase(const ErrorBase&) = delete;
ErrorBase& operator=(const ErrorBase&) = delete;
virtual Error& GetError();
virtual const Error& GetError() const;
virtual void SetErrnoError(llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber) const;
virtual void SetImaqError(int success, llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber) const;
virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber) const;
virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber) const;
virtual void CloneError(const ErrorBase& rhs) const;
virtual void ClearError() const;
virtual bool StatusIsFatal() const;
static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
llvm::StringRef filename, llvm::StringRef function,
uint32_t lineNumber);
static void SetGlobalWPIError(llvm::StringRef errorMessage,
llvm::StringRef contextMessage,
llvm::StringRef filename,
llvm::StringRef function, uint32_t lineNumber);
static Error& GetGlobalError();
protected:
mutable Error m_error;
// TODO: Replace globalError with a global list of all errors.
static priority_mutex _globalErrorMutex;
static Error _globalError;
};

View File

@ -0,0 +1,10 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __FRC_FPGA_ChipObject_Aliases_h__
#define __FRC_FPGA_ChipObject_Aliases_h__
#define nRuntimeFPGANamespace nFRC_2012_1_6_4
#define nInvariantFPGANamespace nFRC_C0EF_1_1_0
#endif // __FRC_FPGA_ChipObject_Aliases_h__

View File

@ -0,0 +1,9 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
#define __RoboRIO_FRC_ChipObject_Aliases_h__
#define nRoboRIO_FPGANamespace nFRC_2016_16_1_0
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__

View File

@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
#define __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_C0EF_1_1_0
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__

View File

@ -0,0 +1,73 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_C0EF_1_1_0_AI_h__
#define __nFRC_C0EF_1_1_0_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_C0EF_1_1_0
{
class tAI
{
public:
tAI(){}
virtual ~tAI(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAI* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 2,
} tIfaceConstants;
typedef enum
{
} tCalOK_IfaceConstants;
virtual bool readCalOK(tRioStatusCode *status) = 0;
typedef enum
{
} tDoneTime_IfaceConstants;
virtual unsigned int readDoneTime(tRioStatusCode *status) = 0;
typedef enum
{
kNumOffsetRegisters = 8,
} tOffset_IfaceConstants;
virtual signed int readOffset(unsigned char reg_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumLSBWeightRegisters = 8,
} tLSBWeight_IfaceConstants;
virtual unsigned int readLSBWeight(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tAI(const tAI&);
void operator=(const tAI&);
};
}
}
#endif // __nFRC_C0EF_1_1_0_AI_h__

View File

@ -0,0 +1,69 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_C0EF_1_1_0_Global_h__
#define __nFRC_C0EF_1_1_0_Global_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_C0EF_1_1_0
{
class tGlobal
{
public:
tGlobal(){}
virtual ~tGlobal(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tGlobal* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
} tVersion_IfaceConstants;
virtual unsigned short readVersion(tRioStatusCode *status) = 0;
typedef enum
{
} tLocalTime_IfaceConstants;
virtual unsigned int readLocalTime(tRioStatusCode *status) = 0;
typedef enum
{
} tRevision_IfaceConstants;
virtual unsigned int readRevision(tRioStatusCode *status) = 0;
typedef enum
{
} tReserved_IfaceConstants;
virtual unsigned char readReserved(tRioStatusCode *status) = 0;
private:
tGlobal(const tGlobal&);
void operator=(const tGlobal&);
};
}
}
#endif // __nFRC_C0EF_1_1_0_Global_h__

View File

@ -0,0 +1,79 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_C0EF_1_1_0_LoadOut_h__
#define __nFRC_C0EF_1_1_0_LoadOut_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_C0EF_1_1_0
{
class tLoadOut
{
public:
tLoadOut(){}
virtual ~tLoadOut(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tLoadOut* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
} tReady_IfaceConstants;
virtual bool readReady(tRioStatusCode *status) = 0;
typedef enum
{
} tDoneTime_IfaceConstants;
virtual unsigned int readDoneTime(tRioStatusCode *status) = 0;
typedef enum
{
kNumVendorIDRegisters = 8,
} tVendorID_IfaceConstants;
virtual unsigned short readVendorID(unsigned char reg_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumSerialNumberRegisters = 8,
} tSerialNumber_IfaceConstants;
virtual unsigned int readSerialNumber(unsigned char reg_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumModuleIDRegisters = 8,
} tModuleID_IfaceConstants;
virtual unsigned short readModuleID(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tLoadOut(const tLoadOut&);
void operator=(const tLoadOut&);
};
}
}
#endif // __nFRC_C0EF_1_1_0_LoadOut_h__

View File

@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_nInterfaceGlobals_h__
#define __nFRC_2016_16_1_0_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2016_16_1_0_nInterfaceGlobals_h__

View File

@ -0,0 +1,143 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_AI_h__
#define __nFRC_2016_16_1_0_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAI
{
public:
tAI(){}
virtual ~tAI(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAI* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned ScanSize : 3;
unsigned ConvertRate : 26;
#else
unsigned ConvertRate : 26;
unsigned ScanSize : 3;
#endif
};
struct{
unsigned value : 29;
};
} tConfig;
typedef
union{
struct{
#ifdef __vxworks
unsigned Channel : 3;
unsigned Averaged : 1;
#else
unsigned Averaged : 1;
unsigned Channel : 3;
#endif
};
struct{
unsigned value : 4;
};
} tReadSelect;
typedef enum
{
} tOutput_IfaceConstants;
virtual signed int readOutput(tRioStatusCode *status) = 0;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0;
virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0;
typedef enum
{
} tLoopTiming_IfaceConstants;
virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0;
typedef enum
{
kNumOversampleBitsElements = 8,
} tOversampleBits_IfaceConstants;
virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumAverageBitsElements = 8,
} tAverageBits_IfaceConstants;
virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumScanListElements = 8,
} tScanList_IfaceConstants;
virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tLatchOutput_IfaceConstants;
virtual void strobeLatchOutput(tRioStatusCode *status) = 0;
typedef enum
{
} tReadSelect_IfaceConstants;
virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0;
virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0;
virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0;
virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0;
virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0;
private:
tAI(const tAI&);
void operator=(const tAI&);
};
}
}
#endif // __nFRC_2016_16_1_0_AI_h__

View File

@ -0,0 +1,50 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_AO_h__
#define __nFRC_2016_16_1_0_AO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAO
{
public:
tAO(){}
virtual ~tAO(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAO* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
kNumMXPRegisters = 2,
} tMXP_IfaceConstants;
virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tAO(const tAO&);
void operator=(const tAO&);
};
}
}
#endif // __nFRC_2016_16_1_0_AO_h__

View File

@ -0,0 +1,102 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Accel_h__
#define __nFRC_2016_16_1_0_Accel_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAccel
{
public:
tAccel(){}
virtual ~tAccel(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAccel* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
} tSTAT_IfaceConstants;
virtual unsigned char readSTAT(tRioStatusCode *status) = 0;
typedef enum
{
} tCNTR_IfaceConstants;
virtual void writeCNTR(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readCNTR(tRioStatusCode *status) = 0;
typedef enum
{
} tDATO_IfaceConstants;
virtual void writeDATO(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readDATO(tRioStatusCode *status) = 0;
typedef enum
{
} tCNFG_IfaceConstants;
virtual void writeCNFG(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readCNFG(tRioStatusCode *status) = 0;
typedef enum
{
} tCNTL_IfaceConstants;
virtual void writeCNTL(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readCNTL(tRioStatusCode *status) = 0;
typedef enum
{
} tDATI_IfaceConstants;
virtual unsigned char readDATI(tRioStatusCode *status) = 0;
typedef enum
{
} tGO_IfaceConstants;
virtual void strobeGO(tRioStatusCode *status) = 0;
typedef enum
{
} tADDR_IfaceConstants;
virtual void writeADDR(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readADDR(tRioStatusCode *status) = 0;
private:
tAccel(const tAccel&);
void operator=(const tAccel&);
};
}
}
#endif // __nFRC_2016_16_1_0_Accel_h__

View File

@ -0,0 +1,87 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Accumulator_h__
#define __nFRC_2016_16_1_0_Accumulator_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAccumulator
{
public:
tAccumulator(){}
virtual ~tAccumulator(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 2,
} tIfaceConstants;
typedef
union{
struct{
signed long long Value;
unsigned Count : 32;
};
struct{
unsigned value : 32;
unsigned value2 : 32;
unsigned value3 : 32;
};
} tOutput;
typedef enum
{
} tOutput_IfaceConstants;
virtual tOutput readOutput(tRioStatusCode *status) = 0;
virtual signed long long readOutput_Value(tRioStatusCode *status) = 0;
virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0;
typedef enum
{
} tCenter_IfaceConstants;
virtual void writeCenter(signed int value, tRioStatusCode *status) = 0;
virtual signed int readCenter(tRioStatusCode *status) = 0;
typedef enum
{
} tDeadband_IfaceConstants;
virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0;
virtual signed int readDeadband(tRioStatusCode *status) = 0;
typedef enum
{
} tReset_IfaceConstants;
virtual void strobeReset(tRioStatusCode *status) = 0;
private:
tAccumulator(const tAccumulator&);
void operator=(const tAccumulator&);
};
}
}
#endif // __nFRC_2016_16_1_0_Accumulator_h__

View File

@ -0,0 +1,57 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Alarm_h__
#define __nFRC_2016_16_1_0_Alarm_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAlarm
{
public:
tAlarm(){}
virtual ~tAlarm(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAlarm* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
} tEnable_IfaceConstants;
virtual void writeEnable(bool value, tRioStatusCode *status) = 0;
virtual bool readEnable(tRioStatusCode *status) = 0;
typedef enum
{
} tTriggerTime_IfaceConstants;
virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0;
private:
tAlarm(const tAlarm&);
void operator=(const tAlarm&);
};
}
}
#endif // __nFRC_2016_16_1_0_Alarm_h__

View File

@ -0,0 +1,129 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_AnalogTrigger_h__
#define __nFRC_2016_16_1_0_AnalogTrigger_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tAnalogTrigger
{
public:
tAnalogTrigger(){}
virtual ~tAnalogTrigger(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 8,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned InHysteresis : 1;
unsigned OverLimit : 1;
unsigned Rising : 1;
unsigned Falling : 1;
#else
unsigned Falling : 1;
unsigned Rising : 1;
unsigned OverLimit : 1;
unsigned InHysteresis : 1;
#endif
};
struct{
unsigned value : 4;
};
} tOutput;
typedef
union{
struct{
#ifdef __vxworks
unsigned Channel : 3;
unsigned Averaged : 1;
unsigned Filter : 1;
unsigned FloatingRollover : 1;
signed RolloverLimit : 8;
#else
signed RolloverLimit : 8;
unsigned FloatingRollover : 1;
unsigned Filter : 1;
unsigned Averaged : 1;
unsigned Channel : 3;
#endif
};
struct{
unsigned value : 14;
};
} tSourceSelect;
typedef enum
{
} tSourceSelect_IfaceConstants;
virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0;
virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0;
virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0;
virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0;
virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0;
virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0;
virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0;
virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0;
virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0;
virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0;
virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0;
typedef enum
{
} tUpperLimit_IfaceConstants;
virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0;
virtual signed int readUpperLimit(tRioStatusCode *status) = 0;
typedef enum
{
} tLowerLimit_IfaceConstants;
virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0;
virtual signed int readLowerLimit(tRioStatusCode *status) = 0;
typedef enum
{
kNumOutputElements = 8,
} tOutput_IfaceConstants;
virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0;
private:
tAnalogTrigger(const tAnalogTrigger&);
void operator=(const tAnalogTrigger&);
};
}
}
#endif // __nFRC_2016_16_1_0_AnalogTrigger_h__

View File

@ -0,0 +1,90 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_BIST_h__
#define __nFRC_2016_16_1_0_BIST_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tBIST
{
public:
tBIST(){}
virtual ~tBIST(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tBIST* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef enum
{
} tDO0SquareTicks_IfaceConstants;
virtual void writeDO0SquareTicks(unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readDO0SquareTicks(tRioStatusCode *status) = 0;
typedef enum
{
} tEnable_IfaceConstants;
virtual void writeEnable(bool value, tRioStatusCode *status) = 0;
virtual bool readEnable(tRioStatusCode *status) = 0;
typedef enum
{
} tDO1SquareEnable_IfaceConstants;
virtual void writeDO1SquareEnable(bool value, tRioStatusCode *status) = 0;
virtual bool readDO1SquareEnable(tRioStatusCode *status) = 0;
typedef enum
{
} tDO0SquareEnable_IfaceConstants;
virtual void writeDO0SquareEnable(bool value, tRioStatusCode *status) = 0;
virtual bool readDO0SquareEnable(tRioStatusCode *status) = 0;
typedef enum
{
} tDO1SquareTicks_IfaceConstants;
virtual void writeDO1SquareTicks(unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readDO1SquareTicks(tRioStatusCode *status) = 0;
typedef enum
{
kNumDORegisters = 2,
} tDO_IfaceConstants;
virtual void writeDO(unsigned char reg_index, bool value, tRioStatusCode *status) = 0;
virtual bool readDO(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tBIST(const tBIST&);
void operator=(const tBIST&);
};
}
}
#endif // __nFRC_2016_16_1_0_BIST_h__

View File

@ -0,0 +1,219 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Counter_h__
#define __nFRC_2016_16_1_0_Counter_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tCounter
{
public:
tCounter(){}
virtual ~tCounter(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tCounter* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 8,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Direction : 1;
signed Value : 31;
#else
signed Value : 31;
unsigned Direction : 1;
#endif
};
struct{
unsigned value : 32;
};
} tOutput;
typedef
union{
struct{
#ifdef __vxworks
unsigned UpSource_Channel : 4;
unsigned UpSource_Module : 1;
unsigned UpSource_AnalogTrigger : 1;
unsigned DownSource_Channel : 4;
unsigned DownSource_Module : 1;
unsigned DownSource_AnalogTrigger : 1;
unsigned IndexSource_Channel : 4;
unsigned IndexSource_Module : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexEdgeSensitive : 1;
unsigned UpRisingEdge : 1;
unsigned UpFallingEdge : 1;
unsigned DownRisingEdge : 1;
unsigned DownFallingEdge : 1;
unsigned Mode : 2;
unsigned PulseLengthThreshold : 6;
#else
unsigned PulseLengthThreshold : 6;
unsigned Mode : 2;
unsigned DownFallingEdge : 1;
unsigned DownRisingEdge : 1;
unsigned UpFallingEdge : 1;
unsigned UpRisingEdge : 1;
unsigned IndexEdgeSensitive : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexSource_Module : 1;
unsigned IndexSource_Channel : 4;
unsigned DownSource_AnalogTrigger : 1;
unsigned DownSource_Module : 1;
unsigned DownSource_Channel : 4;
unsigned UpSource_AnalogTrigger : 1;
unsigned UpSource_Module : 1;
unsigned UpSource_Channel : 4;
#endif
};
struct{
unsigned value : 32;
};
} tConfig;
typedef
union{
struct{
#ifdef __vxworks
unsigned Period : 23;
signed Count : 8;
unsigned Stalled : 1;
#else
unsigned Stalled : 1;
signed Count : 8;
unsigned Period : 23;
#endif
};
struct{
unsigned value : 32;
};
} tTimerOutput;
typedef
union{
struct{
#ifdef __vxworks
unsigned StallPeriod : 24;
unsigned AverageSize : 7;
unsigned UpdateWhenEmpty : 1;
#else
unsigned UpdateWhenEmpty : 1;
unsigned AverageSize : 7;
unsigned StallPeriod : 24;
#endif
};
struct{
unsigned value : 32;
};
} tTimerConfig;
typedef enum
{
} tOutput_IfaceConstants;
virtual tOutput readOutput(tRioStatusCode *status) = 0;
virtual bool readOutput_Direction(tRioStatusCode *status) = 0;
virtual signed int readOutput_Value(tRioStatusCode *status) = 0;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0;
virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0;
virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0;
typedef enum
{
} tTimerOutput_IfaceConstants;
virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0;
virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0;
virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0;
virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0;
typedef enum
{
} tReset_IfaceConstants;
virtual void strobeReset(tRioStatusCode *status) = 0;
typedef enum
{
} tTimerConfig_IfaceConstants;
virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0;
virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0;
virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0;
virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0;
virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0;
private:
tCounter(const tCounter&);
void operator=(const tCounter&);
};
}
}
#endif // __nFRC_2016_16_1_0_Counter_h__

View File

@ -0,0 +1,248 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_DIO_h__
#define __nFRC_2016_16_1_0_DIO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tDIO
{
public:
tDIO(){}
virtual ~tDIO(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tDIO* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Headers : 10;
unsigned Reserved : 6;
unsigned MXP : 16;
#else
unsigned MXP : 16;
unsigned Reserved : 6;
unsigned Headers : 10;
#endif
};
struct{
unsigned value : 32;
};
} tDO;
typedef
union{
struct{
#ifdef __vxworks
unsigned Headers : 10;
unsigned Reserved : 6;
unsigned MXP : 16;
#else
unsigned MXP : 16;
unsigned Reserved : 6;
unsigned Headers : 10;
#endif
};
struct{
unsigned value : 32;
};
} tOutputEnable;
typedef
union{
struct{
#ifdef __vxworks
unsigned Headers : 10;
unsigned Reserved : 6;
unsigned MXP : 16;
#else
unsigned MXP : 16;
unsigned Reserved : 6;
unsigned Headers : 10;
#endif
};
struct{
unsigned value : 32;
};
} tPulse;
typedef
union{
struct{
#ifdef __vxworks
unsigned Headers : 10;
unsigned Reserved : 6;
unsigned MXP : 16;
#else
unsigned MXP : 16;
unsigned Reserved : 6;
unsigned Headers : 10;
#endif
};
struct{
unsigned value : 32;
};
} tDI;
typedef enum
{
} tDO_IfaceConstants;
virtual void writeDO(tDO value, tRioStatusCode *status) = 0;
virtual void writeDO_Headers(unsigned short value, tRioStatusCode *status) = 0;
virtual void writeDO_Reserved(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeDO_MXP(unsigned short value, tRioStatusCode *status) = 0;
virtual tDO readDO(tRioStatusCode *status) = 0;
virtual unsigned short readDO_Headers(tRioStatusCode *status) = 0;
virtual unsigned char readDO_Reserved(tRioStatusCode *status) = 0;
virtual unsigned short readDO_MXP(tRioStatusCode *status) = 0;
typedef enum
{
kNumPWMDutyCycleAElements = 4,
} tPWMDutyCycleA_IfaceConstants;
virtual void writePWMDutyCycleA(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPWMDutyCycleA(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumPWMDutyCycleBElements = 2,
} tPWMDutyCycleB_IfaceConstants;
virtual void writePWMDutyCycleB(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPWMDutyCycleB(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterSelectHdrElements = 16,
} tFilterSelectHdr_IfaceConstants;
virtual void writeFilterSelectHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readFilterSelectHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tOutputEnable_IfaceConstants;
virtual void writeOutputEnable(tOutputEnable value, tRioStatusCode *status) = 0;
virtual void writeOutputEnable_Headers(unsigned short value, tRioStatusCode *status) = 0;
virtual void writeOutputEnable_Reserved(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeOutputEnable_MXP(unsigned short value, tRioStatusCode *status) = 0;
virtual tOutputEnable readOutputEnable(tRioStatusCode *status) = 0;
virtual unsigned short readOutputEnable_Headers(tRioStatusCode *status) = 0;
virtual unsigned char readOutputEnable_Reserved(tRioStatusCode *status) = 0;
virtual unsigned short readOutputEnable_MXP(tRioStatusCode *status) = 0;
typedef enum
{
kNumPWMOutputSelectElements = 6,
} tPWMOutputSelect_IfaceConstants;
virtual void writePWMOutputSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPWMOutputSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tPulse_IfaceConstants;
virtual void writePulse(tPulse value, tRioStatusCode *status) = 0;
virtual void writePulse_Headers(unsigned short value, tRioStatusCode *status) = 0;
virtual void writePulse_Reserved(unsigned char value, tRioStatusCode *status) = 0;
virtual void writePulse_MXP(unsigned short value, tRioStatusCode *status) = 0;
virtual tPulse readPulse(tRioStatusCode *status) = 0;
virtual unsigned short readPulse_Headers(tRioStatusCode *status) = 0;
virtual unsigned char readPulse_Reserved(tRioStatusCode *status) = 0;
virtual unsigned short readPulse_MXP(tRioStatusCode *status) = 0;
typedef enum
{
} tDI_IfaceConstants;
virtual tDI readDI(tRioStatusCode *status) = 0;
virtual unsigned short readDI_Headers(tRioStatusCode *status) = 0;
virtual unsigned char readDI_Reserved(tRioStatusCode *status) = 0;
virtual unsigned short readDI_MXP(tRioStatusCode *status) = 0;
typedef enum
{
} tEnableMXPSpecialFunction_IfaceConstants;
virtual void writeEnableMXPSpecialFunction(unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readEnableMXPSpecialFunction(tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterSelectMXPElements = 16,
} tFilterSelectMXP_IfaceConstants;
virtual void writeFilterSelectMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readFilterSelectMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tPulseLength_IfaceConstants;
virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPulseLength(tRioStatusCode *status) = 0;
typedef enum
{
} tPWMPeriodPower_IfaceConstants;
virtual void writePWMPeriodPower(unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readPWMPeriodPower(tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterPeriodMXPRegisters = 3,
} tFilterPeriodMXP_IfaceConstants;
virtual void writeFilterPeriodMXP(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readFilterPeriodMXP(unsigned char reg_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterPeriodHdrRegisters = 3,
} tFilterPeriodHdr_IfaceConstants;
virtual void writeFilterPeriodHdr(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readFilterPeriodHdr(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tDIO(const tDIO&);
void operator=(const tDIO&);
};
}
}
#endif // __nFRC_2016_16_1_0_DIO_h__

View File

@ -0,0 +1,197 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_DMA_h__
#define __nFRC_2016_16_1_0_DMA_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tDMA
{
public:
tDMA(){}
virtual ~tDMA(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tDMA* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Pause : 1;
unsigned Enable_AI0_Low : 1;
unsigned Enable_AI0_High : 1;
unsigned Enable_AIAveraged0_Low : 1;
unsigned Enable_AIAveraged0_High : 1;
unsigned Enable_AI1_Low : 1;
unsigned Enable_AI1_High : 1;
unsigned Enable_AIAveraged1_Low : 1;
unsigned Enable_AIAveraged1_High : 1;
unsigned Enable_Accumulator0 : 1;
unsigned Enable_Accumulator1 : 1;
unsigned Enable_DI : 1;
unsigned Enable_AnalogTriggers : 1;
unsigned Enable_Counters_Low : 1;
unsigned Enable_Counters_High : 1;
unsigned Enable_CounterTimers_Low : 1;
unsigned Enable_CounterTimers_High : 1;
unsigned Enable_Encoders_Low : 1;
unsigned Enable_Encoders_High : 1;
unsigned Enable_EncoderTimers_Low : 1;
unsigned Enable_EncoderTimers_High : 1;
unsigned ExternalClock : 1;
#else
unsigned ExternalClock : 1;
unsigned Enable_EncoderTimers_High : 1;
unsigned Enable_EncoderTimers_Low : 1;
unsigned Enable_Encoders_High : 1;
unsigned Enable_Encoders_Low : 1;
unsigned Enable_CounterTimers_High : 1;
unsigned Enable_CounterTimers_Low : 1;
unsigned Enable_Counters_High : 1;
unsigned Enable_Counters_Low : 1;
unsigned Enable_AnalogTriggers : 1;
unsigned Enable_DI : 1;
unsigned Enable_Accumulator1 : 1;
unsigned Enable_Accumulator0 : 1;
unsigned Enable_AIAveraged1_High : 1;
unsigned Enable_AIAveraged1_Low : 1;
unsigned Enable_AI1_High : 1;
unsigned Enable_AI1_Low : 1;
unsigned Enable_AIAveraged0_High : 1;
unsigned Enable_AIAveraged0_Low : 1;
unsigned Enable_AI0_High : 1;
unsigned Enable_AI0_Low : 1;
unsigned Pause : 1;
#endif
};
struct{
unsigned value : 22;
};
} tConfig;
typedef
union{
struct{
#ifdef __vxworks
unsigned ExternalClockSource_Channel : 4;
unsigned ExternalClockSource_Module : 1;
unsigned ExternalClockSource_AnalogTrigger : 1;
unsigned RisingEdge : 1;
unsigned FallingEdge : 1;
#else
unsigned FallingEdge : 1;
unsigned RisingEdge : 1;
unsigned ExternalClockSource_AnalogTrigger : 1;
unsigned ExternalClockSource_Module : 1;
unsigned ExternalClockSource_Channel : 4;
#endif
};
struct{
unsigned value : 8;
};
} tExternalTriggers;
typedef enum
{
} tRate_IfaceConstants;
virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0;
virtual unsigned int readRate(tRioStatusCode *status) = 0;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Encoders_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_Encoders_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_EncoderTimers_Low(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable_EncoderTimers_High(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual bool readConfig_Pause(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Encoders_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_Encoders_High(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_EncoderTimers_Low(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable_EncoderTimers_High(tRioStatusCode *status) = 0;
virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0;
typedef enum
{
kNumExternalTriggersRegisters = 2,
kNumExternalTriggersElements = 4,
} tExternalTriggers_IfaceConstants;
virtual void writeExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0;
virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
virtual void writeExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
virtual void writeExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
virtual tExternalTriggers readExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
virtual bool readExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0;
private:
tDMA(const tDMA&);
void operator=(const tDMA&);
};
}
}
#endif // __nFRC_2016_16_1_0_DMA_h__

View File

@ -0,0 +1,199 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Encoder_h__
#define __nFRC_2016_16_1_0_Encoder_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tEncoder
{
public:
tEncoder(){}
virtual ~tEncoder(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tEncoder* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 8,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Direction : 1;
signed Value : 31;
#else
signed Value : 31;
unsigned Direction : 1;
#endif
};
struct{
unsigned value : 32;
};
} tOutput;
typedef
union{
struct{
#ifdef __vxworks
unsigned ASource_Channel : 4;
unsigned ASource_Module : 1;
unsigned ASource_AnalogTrigger : 1;
unsigned BSource_Channel : 4;
unsigned BSource_Module : 1;
unsigned BSource_AnalogTrigger : 1;
unsigned IndexSource_Channel : 4;
unsigned IndexSource_Module : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexEdgeSensitive : 1;
unsigned Reverse : 1;
#else
unsigned Reverse : 1;
unsigned IndexEdgeSensitive : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexSource_Module : 1;
unsigned IndexSource_Channel : 4;
unsigned BSource_AnalogTrigger : 1;
unsigned BSource_Module : 1;
unsigned BSource_Channel : 4;
unsigned ASource_AnalogTrigger : 1;
unsigned ASource_Module : 1;
unsigned ASource_Channel : 4;
#endif
};
struct{
unsigned value : 21;
};
} tConfig;
typedef
union{
struct{
#ifdef __vxworks
unsigned Period : 23;
signed Count : 8;
unsigned Stalled : 1;
#else
unsigned Stalled : 1;
signed Count : 8;
unsigned Period : 23;
#endif
};
struct{
unsigned value : 32;
};
} tTimerOutput;
typedef
union{
struct{
#ifdef __vxworks
unsigned StallPeriod : 24;
unsigned AverageSize : 7;
unsigned UpdateWhenEmpty : 1;
#else
unsigned UpdateWhenEmpty : 1;
unsigned AverageSize : 7;
unsigned StallPeriod : 24;
#endif
};
struct{
unsigned value : 32;
};
} tTimerConfig;
typedef enum
{
} tOutput_IfaceConstants;
virtual tOutput readOutput(tRioStatusCode *status) = 0;
virtual bool readOutput_Direction(tRioStatusCode *status) = 0;
virtual signed int readOutput_Value(tRioStatusCode *status) = 0;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0;
virtual bool readConfig_Reverse(tRioStatusCode *status) = 0;
typedef enum
{
} tTimerOutput_IfaceConstants;
virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0;
virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0;
virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0;
virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0;
typedef enum
{
} tReset_IfaceConstants;
virtual void strobeReset(tRioStatusCode *status) = 0;
typedef enum
{
} tTimerConfig_IfaceConstants;
virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0;
virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0;
virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0;
virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0;
virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0;
private:
tEncoder(const tEncoder&);
void operator=(const tEncoder&);
};
}
}
#endif // __nFRC_2016_16_1_0_Encoder_h__

View File

@ -0,0 +1,104 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Global_h__
#define __nFRC_2016_16_1_0_Global_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tGlobal
{
public:
tGlobal(){}
virtual ~tGlobal(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tGlobal* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Radio : 8;
unsigned Comm : 8;
unsigned Mode : 8;
unsigned RSL : 1;
#else
unsigned RSL : 1;
unsigned Mode : 8;
unsigned Comm : 8;
unsigned Radio : 8;
#endif
};
struct{
unsigned value : 25;
};
} tLEDs;
typedef enum
{
} tLEDs_IfaceConstants;
virtual void writeLEDs(tLEDs value, tRioStatusCode *status) = 0;
virtual void writeLEDs_Radio(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeLEDs_Comm(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeLEDs_Mode(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeLEDs_RSL(bool value, tRioStatusCode *status) = 0;
virtual tLEDs readLEDs(tRioStatusCode *status) = 0;
virtual unsigned char readLEDs_Radio(tRioStatusCode *status) = 0;
virtual unsigned char readLEDs_Comm(tRioStatusCode *status) = 0;
virtual unsigned char readLEDs_Mode(tRioStatusCode *status) = 0;
virtual bool readLEDs_RSL(tRioStatusCode *status) = 0;
typedef enum
{
} tVersion_IfaceConstants;
virtual unsigned short readVersion(tRioStatusCode *status) = 0;
typedef enum
{
} tLocalTime_IfaceConstants;
virtual unsigned int readLocalTime(tRioStatusCode *status) = 0;
typedef enum
{
} tUserButton_IfaceConstants;
virtual bool readUserButton(tRioStatusCode *status) = 0;
typedef enum
{
} tRevision_IfaceConstants;
virtual unsigned int readRevision(tRioStatusCode *status) = 0;
private:
tGlobal(const tGlobal&);
void operator=(const tGlobal&);
};
}
}
#endif // __nFRC_2016_16_1_0_Global_h__

View File

@ -0,0 +1,100 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Interrupt_h__
#define __nFRC_2016_16_1_0_Interrupt_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tInterrupt
{
public:
tInterrupt(){}
virtual ~tInterrupt(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 8,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Source_Channel : 4;
unsigned Source_Module : 1;
unsigned Source_AnalogTrigger : 1;
unsigned RisingEdge : 1;
unsigned FallingEdge : 1;
unsigned WaitForAck : 1;
#else
unsigned WaitForAck : 1;
unsigned FallingEdge : 1;
unsigned RisingEdge : 1;
unsigned Source_AnalogTrigger : 1;
unsigned Source_Module : 1;
unsigned Source_Channel : 4;
#endif
};
struct{
unsigned value : 9;
};
} tConfig;
typedef enum
{
} tFallingTimeStamp_IfaceConstants;
virtual unsigned int readFallingTimeStamp(tRioStatusCode *status) = 0;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0;
virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0;
typedef enum
{
} tRisingTimeStamp_IfaceConstants;
virtual unsigned int readRisingTimeStamp(tRioStatusCode *status) = 0;
private:
tInterrupt(const tInterrupt&);
void operator=(const tInterrupt&);
};
}
}
#endif // __nFRC_2016_16_1_0_Interrupt_h__

View File

@ -0,0 +1,120 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_PWM_h__
#define __nFRC_2016_16_1_0_PWM_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tPWM
{
public:
tPWM(){}
virtual ~tPWM(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tPWM* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Period : 16;
unsigned MinHigh : 16;
#else
unsigned MinHigh : 16;
unsigned Period : 16;
#endif
};
struct{
unsigned value : 32;
};
} tConfig;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_Period(unsigned short value, tRioStatusCode *status) = 0;
virtual void writeConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned short readConfig_Period(tRioStatusCode *status) = 0;
virtual unsigned short readConfig_MinHigh(tRioStatusCode *status) = 0;
typedef enum
{
} tLoopTiming_IfaceConstants;
virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0;
typedef enum
{
kNumPeriodScaleMXPElements = 10,
} tPeriodScaleMXP_IfaceConstants;
virtual void writePeriodScaleMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPeriodScaleMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumPeriodScaleHdrElements = 10,
} tPeriodScaleHdr_IfaceConstants;
virtual void writePeriodScaleHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readPeriodScaleHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumZeroLatchElements = 20,
} tZeroLatch_IfaceConstants;
virtual void writeZeroLatch(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
virtual bool readZeroLatch(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumHdrRegisters = 10,
} tHdr_IfaceConstants;
virtual void writeHdr(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readHdr(unsigned char reg_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumMXPRegisters = 10,
} tMXP_IfaceConstants;
virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0;
private:
tPWM(const tPWM&);
void operator=(const tPWM&);
};
}
}
#endif // __nFRC_2016_16_1_0_PWM_h__

View File

@ -0,0 +1,220 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Power_h__
#define __nFRC_2016_16_1_0_Power_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tPower
{
public:
tPower(){}
virtual ~tPower(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tPower* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned User3V3 : 8;
unsigned User5V : 8;
unsigned User6V : 8;
#else
unsigned User6V : 8;
unsigned User5V : 8;
unsigned User3V3 : 8;
#endif
};
struct{
unsigned value : 24;
};
} tStatus;
typedef
union{
struct{
#ifdef __vxworks
unsigned OverCurrentFaultCount3V3 : 8;
unsigned OverCurrentFaultCount5V : 8;
unsigned OverCurrentFaultCount6V : 8;
unsigned UnderVoltageFaultCount5V : 8;
#else
unsigned UnderVoltageFaultCount5V : 8;
unsigned OverCurrentFaultCount6V : 8;
unsigned OverCurrentFaultCount5V : 8;
unsigned OverCurrentFaultCount3V3 : 8;
#endif
};
struct{
unsigned value : 32;
};
} tFaultCounts;
typedef
union{
struct{
#ifdef __vxworks
unsigned User3V3 : 1;
unsigned User5V : 1;
unsigned User6V : 1;
#else
unsigned User6V : 1;
unsigned User5V : 1;
unsigned User3V3 : 1;
#endif
};
struct{
unsigned value : 3;
};
} tDisable;
typedef enum
{
} tUserVoltage3V3_IfaceConstants;
virtual unsigned short readUserVoltage3V3(tRioStatusCode *status) = 0;
typedef enum
{
} tStatus_IfaceConstants;
virtual tStatus readStatus(tRioStatusCode *status) = 0;
virtual unsigned char readStatus_User3V3(tRioStatusCode *status) = 0;
virtual unsigned char readStatus_User5V(tRioStatusCode *status) = 0;
virtual unsigned char readStatus_User6V(tRioStatusCode *status) = 0;
typedef enum
{
} tUserVoltage6V_IfaceConstants;
virtual unsigned short readUserVoltage6V(tRioStatusCode *status) = 0;
typedef enum
{
} tOnChipTemperature_IfaceConstants;
virtual unsigned short readOnChipTemperature(tRioStatusCode *status) = 0;
typedef enum
{
} tUserVoltage5V_IfaceConstants;
virtual unsigned short readUserVoltage5V(tRioStatusCode *status) = 0;
typedef enum
{
} tResetFaultCounts_IfaceConstants;
virtual void strobeResetFaultCounts(tRioStatusCode *status) = 0;
typedef enum
{
} tIntegratedIO_IfaceConstants;
virtual unsigned short readIntegratedIO(tRioStatusCode *status) = 0;
typedef enum
{
} tMXP_DIOVoltage_IfaceConstants;
virtual unsigned short readMXP_DIOVoltage(tRioStatusCode *status) = 0;
typedef enum
{
} tUserCurrent3V3_IfaceConstants;
virtual unsigned short readUserCurrent3V3(tRioStatusCode *status) = 0;
typedef enum
{
} tVinVoltage_IfaceConstants;
virtual unsigned short readVinVoltage(tRioStatusCode *status) = 0;
typedef enum
{
} tUserCurrent6V_IfaceConstants;
virtual unsigned short readUserCurrent6V(tRioStatusCode *status) = 0;
typedef enum
{
} tUserCurrent5V_IfaceConstants;
virtual unsigned short readUserCurrent5V(tRioStatusCode *status) = 0;
typedef enum
{
} tAOVoltage_IfaceConstants;
virtual unsigned short readAOVoltage(tRioStatusCode *status) = 0;
typedef enum
{
} tFaultCounts_IfaceConstants;
virtual tFaultCounts readFaultCounts(tRioStatusCode *status) = 0;
virtual unsigned char readFaultCounts_OverCurrentFaultCount3V3(tRioStatusCode *status) = 0;
virtual unsigned char readFaultCounts_OverCurrentFaultCount5V(tRioStatusCode *status) = 0;
virtual unsigned char readFaultCounts_OverCurrentFaultCount6V(tRioStatusCode *status) = 0;
virtual unsigned char readFaultCounts_UnderVoltageFaultCount5V(tRioStatusCode *status) = 0;
typedef enum
{
} tVinCurrent_IfaceConstants;
virtual unsigned short readVinCurrent(tRioStatusCode *status) = 0;
typedef enum
{
} tDisable_IfaceConstants;
virtual void writeDisable(tDisable value, tRioStatusCode *status) = 0;
virtual void writeDisable_User3V3(bool value, tRioStatusCode *status) = 0;
virtual void writeDisable_User5V(bool value, tRioStatusCode *status) = 0;
virtual void writeDisable_User6V(bool value, tRioStatusCode *status) = 0;
virtual tDisable readDisable(tRioStatusCode *status) = 0;
virtual bool readDisable_User3V3(tRioStatusCode *status) = 0;
virtual bool readDisable_User5V(tRioStatusCode *status) = 0;
virtual bool readDisable_User6V(tRioStatusCode *status) = 0;
private:
tPower(const tPower&);
void operator=(const tPower&);
};
}
}
#endif // __nFRC_2016_16_1_0_Power_h__

View File

@ -0,0 +1,68 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_Relay_h__
#define __nFRC_2016_16_1_0_Relay_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tRelay
{
public:
tRelay(){}
virtual ~tRelay(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tRelay* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Forward : 4;
unsigned Reverse : 4;
#else
unsigned Reverse : 4;
unsigned Forward : 4;
#endif
};
struct{
unsigned value : 8;
};
} tValue;
typedef enum
{
} tValue_IfaceConstants;
virtual void writeValue(tValue value, tRioStatusCode *status) = 0;
virtual void writeValue_Forward(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeValue_Reverse(unsigned char value, tRioStatusCode *status) = 0;
virtual tValue readValue(tRioStatusCode *status) = 0;
virtual unsigned char readValue_Forward(tRioStatusCode *status) = 0;
virtual unsigned char readValue_Reverse(tRioStatusCode *status) = 0;
private:
tRelay(const tRelay&);
void operator=(const tRelay&);
};
}
}
#endif // __nFRC_2016_16_1_0_Relay_h__

View File

@ -0,0 +1,68 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_SPI_h__
#define __nFRC_2016_16_1_0_SPI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tSPI
{
public:
tSPI(){}
virtual ~tSPI(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tSPI* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Hdr : 4;
unsigned MXP : 1;
#else
unsigned MXP : 1;
unsigned Hdr : 4;
#endif
};
struct{
unsigned value : 5;
};
} tChipSelectActiveHigh;
typedef enum
{
} tChipSelectActiveHigh_IfaceConstants;
virtual void writeChipSelectActiveHigh(tChipSelectActiveHigh value, tRioStatusCode *status) = 0;
virtual void writeChipSelectActiveHigh_Hdr(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeChipSelectActiveHigh_MXP(unsigned char value, tRioStatusCode *status) = 0;
virtual tChipSelectActiveHigh readChipSelectActiveHigh(tRioStatusCode *status) = 0;
virtual unsigned char readChipSelectActiveHigh_Hdr(tRioStatusCode *status) = 0;
virtual unsigned char readChipSelectActiveHigh_MXP(tRioStatusCode *status) = 0;
private:
tSPI(const tSPI&);
void operator=(const tSPI&);
};
}
}
#endif // __nFRC_2016_16_1_0_SPI_h__

View File

@ -0,0 +1,108 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2016_16_1_0_SysWatchdog_h__
#define __nFRC_2016_16_1_0_SysWatchdog_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2016_16_1_0
{
class tSysWatchdog
{
public:
tSysWatchdog(){}
virtual ~tSysWatchdog(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tSysWatchdog* create(tRioStatusCode *status);
typedef enum
{
kNumSystems = 1,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned SystemActive : 1;
unsigned PowerAlive : 1;
unsigned SysDisableCount : 15;
unsigned PowerDisableCount : 15;
#else
unsigned PowerDisableCount : 15;
unsigned SysDisableCount : 15;
unsigned PowerAlive : 1;
unsigned SystemActive : 1;
#endif
};
struct{
unsigned value : 32;
};
} tStatus;
typedef enum
{
} tStatus_IfaceConstants;
virtual tStatus readStatus(tRioStatusCode *status) = 0;
virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0;
virtual bool readStatus_PowerAlive(tRioStatusCode *status) = 0;
virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0;
virtual unsigned short readStatus_PowerDisableCount(tRioStatusCode *status) = 0;
typedef enum
{
} tCommand_IfaceConstants;
virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0;
virtual unsigned short readCommand(tRioStatusCode *status) = 0;
typedef enum
{
} tChallenge_IfaceConstants;
virtual unsigned char readChallenge(tRioStatusCode *status) = 0;
typedef enum
{
} tActive_IfaceConstants;
virtual void writeActive(bool value, tRioStatusCode *status) = 0;
virtual bool readActive(tRioStatusCode *status) = 0;
typedef enum
{
} tTimer_IfaceConstants;
virtual unsigned int readTimer(tRioStatusCode *status) = 0;
typedef enum
{
} tForcedKills_IfaceConstants;
virtual unsigned short readForcedKills(tRioStatusCode *status) = 0;
private:
tSysWatchdog(const tSysWatchdog&);
void operator=(const tSysWatchdog&);
};
}
}
#endif // __nFRC_2016_16_1_0_SysWatchdog_h__

View File

@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2012_1_6_4_nInterfaceGlobals_h__
#define __nFRC_2012_1_6_4_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2012_1_6_4
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2012_1_6_4_nInterfaceGlobals_h__

View File

@ -0,0 +1,149 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2012_1_6_4_AI_h__
#define __nFRC_2012_1_6_4_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2012_1_6_4
{
class tAI
{
public:
tAI(){}
virtual ~tAI(){}
virtual tSystemInterface* getSystemInterface() = 0;
static tAI* create(unsigned char sys_index, tRioStatusCode *status);
virtual unsigned char getSystemIndex() = 0;
typedef enum
{
kNumSystems = 2,
} tIfaceConstants;
typedef
union{
struct{
#ifdef __vxworks
unsigned Channel : 3;
unsigned Module : 1;
unsigned Averaged : 1;
#else
unsigned Averaged : 1;
unsigned Module : 1;
unsigned Channel : 3;
#endif
};
struct{
unsigned value : 5;
};
} tReadSelect;
typedef
union{
struct{
#ifdef __vxworks
unsigned ScanSize : 3;
unsigned ConvertRate : 26;
#else
unsigned ConvertRate : 26;
unsigned ScanSize : 3;
#endif
};
struct{
unsigned value : 29;
};
} tConfig;
typedef enum
{
} tConfig_IfaceConstants;
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0;
virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0;
typedef enum
{
} tLoopTiming_IfaceConstants;
virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0;
typedef enum
{
kNumOversampleBitsElements = 8,
} tOversampleBits_IfaceConstants;
virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumAverageBitsElements = 8,
} tAverageBits_IfaceConstants;
virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumScanListElements = 8,
} tScanList_IfaceConstants;
virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tOutput_IfaceConstants;
virtual signed int readOutput(tRioStatusCode *status) = 0;
typedef enum
{
} tLatchOutput_IfaceConstants;
virtual void strobeLatchOutput(tRioStatusCode *status) = 0;
typedef enum
{
} tReadSelect_IfaceConstants;
virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0;
virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeReadSelect_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0;
virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0;
virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readReadSelect_Module(tRioStatusCode *status) = 0;
virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0;
private:
tAI(const tAI&);
void operator=(const tAI&);
};
}
}
#endif // __nFRC_2012_1_6_4_AI_h__

Some files were not shown because too many files have changed in this diff Show More