mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
Compare commits
82 Commits
jenkins-re
...
jenkins-re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99dc3c90ed | ||
|
|
4ad8818a8a | ||
|
|
e4babbe4d6 | ||
|
|
9ec5164075 | ||
|
|
033e5f37b4 | ||
|
|
e3d256e441 | ||
|
|
867e4080dc | ||
|
|
4be9732e9c | ||
|
|
cd29e1c32f | ||
|
|
e73b3ed7b5 | ||
|
|
c7a90b2ccc | ||
|
|
e5443f0e78 | ||
|
|
0abe19a1ae | ||
|
|
ccd64090bb | ||
|
|
c6891fc034 | ||
|
|
6f4d6ed998 | ||
|
|
0670ff145f | ||
|
|
655ade6436 | ||
|
|
7cfa0d04d7 | ||
|
|
f1476be276 | ||
|
|
9be6ee4712 | ||
|
|
9050ea7e3d | ||
|
|
c1f68eb2b0 | ||
|
|
fb53eea6b2 | ||
|
|
6c294e137b | ||
|
|
988defee16 | ||
|
|
279ae1cd9d | ||
|
|
49f6b90d15 | ||
|
|
6cd5eeab6f | ||
|
|
c883c9e2fc | ||
|
|
54951c888f | ||
|
|
739508ff83 | ||
|
|
f67849a9b1 | ||
|
|
7c5b3c6286 | ||
|
|
eb536ba340 | ||
|
|
19737ba443 | ||
|
|
9f0bed2e6f | ||
|
|
86e4c3b77c | ||
|
|
e216d1abd6 | ||
|
|
20aeb5c6cc | ||
|
|
3ad31dd4d7 | ||
|
|
4c5b8c8c46 | ||
|
|
747cdc8a58 | ||
|
|
c3c7baa15c | ||
|
|
2fdb7c8eba | ||
|
|
1d0a6b8ace | ||
|
|
08fdf45f6e | ||
|
|
7338471194 | ||
|
|
da0cc0c83f | ||
|
|
6e0637e771 | ||
|
|
8d49d8255b | ||
|
|
3b53f84c8f | ||
|
|
05bb3cdd71 | ||
|
|
18de3aebdd | ||
|
|
de5e5ab405 | ||
|
|
6b6e5d9530 | ||
|
|
fa20e6ca4f | ||
|
|
e56aa87af4 | ||
|
|
63bb8e1f32 | ||
|
|
c1e63acc14 | ||
|
|
68ba9bfeae | ||
|
|
aa643d8ba7 | ||
|
|
1f8a3d5bf3 | ||
|
|
2fa04c1750 | ||
|
|
cd3db9631e | ||
|
|
8ccb99d87c | ||
|
|
b14ca08474 | ||
|
|
b898cec901 | ||
|
|
687e2c6711 | ||
|
|
594d0d8029 | ||
|
|
0f825b7179 | ||
|
|
345ceafa0d | ||
|
|
b030be68d3 | ||
|
|
fba155804e | ||
|
|
97f954aef6 | ||
|
|
80194e9809 | ||
|
|
767686ae2e | ||
|
|
7f30b6bff4 | ||
|
|
8c395ca292 | ||
|
|
5b2520c35f | ||
|
|
fa8d7b843c | ||
|
|
c68ee3001e |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -17,8 +17,9 @@ test-reports
|
||||
# Added by the users of vagrant
|
||||
jdk-7u45-linux-arm-vfp-sflt.gz
|
||||
|
||||
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/
|
||||
|
||||
# Created by http://www.gitignore.io
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.8)
|
||||
project(All-WPILib)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -fPIC")
|
||||
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
|
||||
file(GLOB_RECURSE NI_LIBS ni-libraries/*.so*)
|
||||
list(REMOVE_ITEM NI_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/ni-libraries/libwpi.so ${CMAKE_CURRENT_SOURCE_DIR}/ni-libraries/libwpi_2015.so)
|
||||
|
||||
@@ -52,4 +52,11 @@
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="edu.wpi.first.wpilib.plugins.riolog"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
toolbarPath="WPILib"
|
||||
tooltip="Launch the SmartDashboard to get feedback from the robot.">
|
||||
</action>
|
||||
<action
|
||||
class="edu.wpi.first.wpilib.plugins.core.actions.RunSimulationSmartDashboardAction"
|
||||
icon="icons/smartdashboard16x16.png"
|
||||
id="edu.wpi.first.wpilib.plugins.core.actions.RunSimulationSmartDashboardAction"
|
||||
label="Run S&imulation SmartDashboard"
|
||||
menubarPath="edu.wpi.first.wpilib.plugins.core.menu/edu.wpi.first.wpilib.plugins.core.actions"
|
||||
tooltip="Launch the SmartDashboard to get feedback from a simulated robot.">
|
||||
</action>
|
||||
<action
|
||||
class="edu.wpi.first.wpilib.plugins.core.actions.RunRobotBuilderAction"
|
||||
icon="icons/robotbuilder16x16.png"
|
||||
|
||||
@@ -85,6 +85,13 @@
|
||||
<outputDirectory>${tools-zip}</outputDirectory>
|
||||
<destFileName>SmartDashboard.jar</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>edu.wpi.first.wpilib.networktables</groupId>
|
||||
<artifactId>OutlineViewer</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<outputDirectory>${tools-zip}</outputDirectory>
|
||||
<destFileName>OutlineViewer.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
|
||||
<overWriteReleases>false</overWriteReleases>
|
||||
@@ -194,5 +201,10 @@
|
||||
<artifactId>SmartDashboard</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.wpilib.networktables</groupId>
|
||||
<artifactId>OutlineViewer</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package edu.wpi.first.wpilib.plugins.core.launching;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
|
||||
public class SimulationNotification {
|
||||
private static final String URL = "https://wpilib.screenstepslive.com/s/4485/m/23353";
|
||||
private static final String SIMULATION_UNSUPPORTED_MSG =
|
||||
"Simulation is unsupported on your current setup.\n" +
|
||||
"For more information see: " + URL;
|
||||
|
||||
public static void showUnsupported() {
|
||||
String title = "Simulation Unsupported";
|
||||
String message = SIMULATION_UNSUPPORTED_MSG;
|
||||
JOptionPane.showMessageDialog(null, message, title, JOptionPane.OK_OPTION);
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(URL));
|
||||
} catch (IOException e) {
|
||||
WPILibCore.logError("Can't open "+URL, e);
|
||||
} catch (URISyntaxException e) {
|
||||
WPILibCore.logError("Can't open "+URL, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean supportsSimulation() {
|
||||
String[] cmd = {"frcsim", "--version"};
|
||||
try {
|
||||
DebugPlugin.exec(cmd, new File(System.getProperty("user.home")));
|
||||
return true;
|
||||
} catch (CoreException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,10 +36,10 @@ public abstract class ExampleWizard extends Wizard implements INewWizard {
|
||||
*/
|
||||
protected abstract void doFinish(IExampleProject ex, String teamNumber) throws CoreException;
|
||||
|
||||
protected abstract IWizardPage getDetailsPage();
|
||||
protected abstract IWizardPage getDetailsPage(INewProjectInfo info);
|
||||
|
||||
public abstract IExampleProject makeExampleProject(String name, String description,
|
||||
List<String> tags, List<String> folders, List<IExampleProject.ExportFile> files);
|
||||
List<String> tags, String world, List<String> folders, List<IExampleProject.ExportFile> files);
|
||||
|
||||
public abstract URL getResourceURL();
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class ExampleWizard extends Wizard implements INewWizard {
|
||||
}
|
||||
page1 = new ExampleWizardChoicePage(this, selection);
|
||||
addPage(page1);
|
||||
page2 = getDetailsPage();
|
||||
page2 = getDetailsPage(page1);
|
||||
addPage(page2);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@@ -36,11 +37,12 @@ import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
* OR with the extension that matches the expected one (mpe).
|
||||
*/
|
||||
|
||||
public class ExampleWizardChoicePage extends WizardPage {
|
||||
public class ExampleWizardChoicePage extends WizardPage implements INewProjectInfo {
|
||||
private Tree exampleTree;
|
||||
private Browser descriptionText;
|
||||
private IExampleProject selectedExample;
|
||||
private ExampleWizard parent;
|
||||
private ChangeListener listener;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizardPage.
|
||||
@@ -89,6 +91,20 @@ public class ExampleWizardChoicePage extends WizardPage {
|
||||
dialogChanged();
|
||||
setControl(container);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (selectedExample != null) {
|
||||
return selectedExample.getName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getWorld() {
|
||||
if (selectedExample != null) {
|
||||
return selectedExample.getWorld();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the current workbench selection is a suitable container to use.
|
||||
@@ -137,7 +153,6 @@ public class ExampleWizardChoicePage extends WizardPage {
|
||||
/**
|
||||
* Ensures that both text fields are set.
|
||||
*/
|
||||
|
||||
private void dialogChanged() {
|
||||
if (exampleTree.getSelection().length > 0) {
|
||||
Object selectedData = exampleTree.getSelection()[0].getData();
|
||||
@@ -157,6 +172,7 @@ public class ExampleWizardChoicePage extends WizardPage {
|
||||
return;
|
||||
}
|
||||
|
||||
listener.stateChanged(null);
|
||||
updateStatus(null);
|
||||
}
|
||||
|
||||
@@ -211,6 +227,11 @@ public class ExampleWizardChoicePage extends WizardPage {
|
||||
tags.add(tagElementList.item(i).getTextContent());
|
||||
}
|
||||
}
|
||||
String world = "";
|
||||
if (element.getElementsByTagName("world") != null &&
|
||||
element.getElementsByTagName("world").item(0) != null) {
|
||||
world = element.getElementsByTagName("world").item(0).getTextContent();
|
||||
}
|
||||
List<String> packages = new ArrayList<String>();
|
||||
tagsElement = element.getElementsByTagName("packages").item(0);
|
||||
if (tagsElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
@@ -231,10 +252,15 @@ public class ExampleWizardChoicePage extends WizardPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent.makeExampleProject(name, description, tags, packages, files);
|
||||
return parent.makeExampleProject(name, description, tags, world, packages, files);
|
||||
}
|
||||
|
||||
public IExampleProject getExampleProject() {
|
||||
return selectedExample;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerChangeListener(ChangeListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,10 @@ public interface IExampleProject extends ProjectType {
|
||||
this.destination = destination;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The world file to use for simulation, if empty
|
||||
* the default is used.
|
||||
*/
|
||||
String getWorld();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package edu.wpi.first.wpilib.plugins.core.wizards;
|
||||
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
public interface INewProjectInfo {
|
||||
String getName();
|
||||
String getWorld();
|
||||
void registerChangeListener(ChangeListener changeListener);
|
||||
|
||||
public static INewProjectInfo Null = new INewProjectInfo() {
|
||||
@Override
|
||||
public String getWorld() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerChangeListener(ChangeListener changeListener) {}
|
||||
};
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class NewProjectMainPage extends WizardPage {
|
||||
private boolean showPackage;
|
||||
private boolean showProjectTypes;
|
||||
private TeamNumberPage teamNumberPage;
|
||||
private INewProjectInfo info;
|
||||
|
||||
/**
|
||||
* Constructor for SampleNewWizardPage.
|
||||
@@ -46,17 +47,20 @@ public class NewProjectMainPage extends WizardPage {
|
||||
*
|
||||
* @param pageName
|
||||
*/
|
||||
public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage) {
|
||||
public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage, INewProjectInfo info) {
|
||||
super("wizardPage");
|
||||
this.teamNumberPage = teamNumberPage;
|
||||
showPackage = true;
|
||||
showProjectTypes = false;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDialogPage#createControl(Composite)
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
System.out.println(info.getName() +" -- "+ info.getWorld());
|
||||
|
||||
Composite container = new Composite(parent, SWT.NULL);
|
||||
GridLayout layout = new GridLayout();
|
||||
container.setLayout(layout);
|
||||
@@ -130,7 +134,7 @@ public class NewProjectMainPage extends WizardPage {
|
||||
comp.setLayout(groupLayout);
|
||||
worldText = new Text(comp, SWT.BORDER | SWT.SINGLE);
|
||||
worldText.setLayoutData(gd);
|
||||
worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world");
|
||||
worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world");
|
||||
worldText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
dialogChanged();
|
||||
@@ -161,11 +165,18 @@ public class NewProjectMainPage extends WizardPage {
|
||||
@Override public void stateChanged(ChangeEvent e) {
|
||||
String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
|
||||
packageText.setText("org.usfirst.frc.team"+teamNumber+".robot");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
info.registerChangeListener(new ChangeListener() {
|
||||
@Override public void stateChanged(ChangeEvent e) {
|
||||
projectNameText.setText(info.getName());
|
||||
if (!"".equals(info.getWorld())) {
|
||||
worldText.setText(info.getWorld());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,6 +80,12 @@ public class ProjectCreationUtils {
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
WPILibCore.logError("Can't create new project.", e);
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error creating project! This may occur if a project of the same name with different case exists in the Workspace");
|
||||
}
|
||||
});
|
||||
}
|
||||
}else {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<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=""${WPILIB}/cpp/current/include""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.dialect.std.1060340803" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++1y" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
@@ -40,6 +41,7 @@
|
||||
<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=""${WPILIB}/cpp/current/lib""/>
|
||||
</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" 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)"/>
|
||||
@@ -55,55 +57,6 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.300115601">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.300115601" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<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.GmakeErrorParser" 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.CWDLocator" 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.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.300115601" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.300115601." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.2008160346" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.511797597" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="arm-frc-linux-gnueabi-" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2130959809" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/$project}/Release" id="cdt.managedbuild.builder.gnu.cross.1554116591" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.985086840" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.2030238370" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.188807954" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.884664323" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1342658383" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.1371546365" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1242574722" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1782227077" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1397048702" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.716979188" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.126686576" 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.886832650" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1915412749" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.671283127" 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>
|
||||
<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="Simulate">
|
||||
<externalSettings/>
|
||||
@@ -143,9 +96,7 @@
|
||||
<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="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="WPILibSim"/>
|
||||
<listOptionValue builtIn="false" value="WPILib"/>
|
||||
<listOptionValue builtIn="false" value="gazebo"/>
|
||||
<listOptionValue builtIn="false" value="gazebo_transport"/>
|
||||
<listOptionValue builtIn="false" value="gazebo_msgs"/>
|
||||
@@ -182,12 +133,6 @@
|
||||
<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.cross.exe.release.300115601;cdt.managedbuild.config.gnu.cross.exe.release.300115601.;cdt.managedbuild.tool.gnu.cross.c.compiler.985086840;cdt.managedbuild.tool.gnu.c.compiler.input.884664323">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.300115601;cdt.managedbuild.config.gnu.cross.exe.release.300115601.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1342658383;cdt.managedbuild.tool.gnu.cpp.compiler.input.1782227077">
|
||||
<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>
|
||||
@@ -197,9 +142,6 @@
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/$project"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/$project"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Simulate">
|
||||
<resource resourceType="PROJECT" workspacePath="/$project"/>
|
||||
</configuration>
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
password=
|
||||
deploy.dir=/home/admin
|
||||
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
|
||||
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
|
||||
command.dir=/home/lvuser/
|
||||
|
||||
# Libraries to use
|
||||
wpilib=${user.home}/wpilib/cpp/${cpp-version}
|
||||
wpilib.lib=${wpilib}/lib
|
||||
|
||||
# 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
|
||||
|
||||
# Build information
|
||||
out=FRCUserProgram
|
||||
src.dir=src
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<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"/>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
*/
|
||||
void OperatorControl()
|
||||
{
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
|
||||
Wait(0.005); // wait for a motor update time
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
*/
|
||||
void OperatorControl()
|
||||
{
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
// Get the current going through channel 7, in Amperes.
|
||||
// The PDP returns the current in increments of 0.125A.
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
*/
|
||||
void OperatorControl()
|
||||
{
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
// Retrieve the net displacement of the Encoder since the lsat Reset.
|
||||
SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance());
|
||||
|
||||
@@ -13,7 +13,7 @@ private:
|
||||
SpeedController* motor;
|
||||
Potentiometer* pot;
|
||||
|
||||
static const double kP_real = 4, kI_real = 0.07,
|
||||
static constexpr double kP_real = 4, kI_real = 0.07,
|
||||
kP_simulation = 18, kI_simulation = 0.2;
|
||||
|
||||
public:
|
||||
|
||||
@@ -13,7 +13,7 @@ private:
|
||||
SpeedController* motor;
|
||||
Potentiometer* pot; // TODO: Make Potentiometer
|
||||
|
||||
static const double kP_real = 1, kP_simulation = 0.05;
|
||||
static constexpr double kP_real = 1, kP_simulation = 0.05;
|
||||
|
||||
public:
|
||||
Wrist();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
* Uses IMAQdx to manually acquire a new image each frame, and annotate the image by drawing
|
||||
* a circle on it, and show it on the FRC Dashboard.
|
||||
*/
|
||||
class IntermediateVisionRobot : public SampleRobot
|
||||
{
|
||||
IMAQdxSession session;
|
||||
Image *frame;
|
||||
|
||||
public:
|
||||
void RobotInit() override {
|
||||
// create an image
|
||||
frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0);
|
||||
// open the camera
|
||||
IMAQdxOpenCamera("cam1", IMAQdxCameraControlModeController, &session);
|
||||
IMAQdxConfigureGrab(session);
|
||||
}
|
||||
|
||||
void OperatorControl() override {
|
||||
// acquire images
|
||||
IMAQdxStartAcquisition(session);
|
||||
|
||||
// grab an image, draw the circle, and provide it for the camera server which will
|
||||
// in turn send it to the dashboard.
|
||||
while(IsOperatorControl() && IsEnabled()) {
|
||||
IMAQdxGrab(session, frame, true, NULL);
|
||||
|
||||
imaqDrawShapeOnImage(frame, frame, { 10, 10, 100, 100 }, DrawMode::IMAQ_DRAW_VALUE, ShapeMode::IMAQ_SHAPE_OVAL, 0.0f);
|
||||
|
||||
CameraServer::GetInstance()->SetImage(frame);
|
||||
}
|
||||
// stop image acquisition
|
||||
IMAQdxStopAcquisition(session);
|
||||
}
|
||||
};
|
||||
|
||||
START_ROBOT_CLASS(IntermediateVisionRobot);
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
void OperatorControl()
|
||||
{
|
||||
robotDrive.SetSafetyEnabled(false);
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
// Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation.
|
||||
// This sample does not use field-oriented drive, so the gyro input is set to zero.
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
* Runs the motor from the output of a Joystick.
|
||||
*/
|
||||
void OperatorControl() {
|
||||
while (IsOperatorControl()) {
|
||||
while (IsOperatorControl() && IsEnabled()) {
|
||||
// Set the motor controller's output.
|
||||
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
|
||||
m_motor.Set(m_stick.GetY());
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
* Simultaneously displays encoder values on the SmartDashboard.
|
||||
*/
|
||||
void OperatorControl() {
|
||||
while (IsOperatorControl()) {
|
||||
while (IsOperatorControl() && IsEnabled()) {
|
||||
// Set the motor controller's output.
|
||||
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
|
||||
m_motor.Set(m_stick.GetY());
|
||||
|
||||
@@ -12,8 +12,8 @@ private:
|
||||
double driveForwardSpeed;
|
||||
double distance;
|
||||
double error;
|
||||
static const double TOLERANCE = .1;
|
||||
static const double KP = -1.0 / 5.0;
|
||||
static constexpr double TOLERANCE = .1;
|
||||
static constexpr double KP = -1.0 / 5.0;
|
||||
void init(double dist, double maxSpeed);
|
||||
public:
|
||||
DriveForward();
|
||||
|
||||
@@ -13,9 +13,9 @@ class Collector: public Subsystem
|
||||
{
|
||||
public:
|
||||
// Constants for some useful speeds
|
||||
static const double FORWARD = 1;
|
||||
static const double STOP = 0;
|
||||
static const double REVERSE = -1;
|
||||
static constexpr double FORWARD = 1;
|
||||
static constexpr double STOP = 0;
|
||||
static constexpr double REVERSE = -1;
|
||||
|
||||
private:
|
||||
// Subsystem devices
|
||||
|
||||
@@ -12,10 +12,10 @@ class Pivot: public PIDSubsystem
|
||||
{
|
||||
public:
|
||||
// Constants for some useful angles
|
||||
static const double COLLECT = 105;
|
||||
static const double LOW_GOAL = 90;
|
||||
static const double SHOOT = 45;
|
||||
static const double SHOOT_NEAR = 30;
|
||||
static constexpr double COLLECT = 105;
|
||||
static constexpr double LOW_GOAL = 90;
|
||||
static constexpr double SHOOT = 45;
|
||||
static constexpr double SHOOT_NEAR = 30;
|
||||
|
||||
private:
|
||||
// Subsystem devices
|
||||
|
||||
@@ -17,7 +17,7 @@ private:
|
||||
Compressor* compressor;
|
||||
#endif
|
||||
|
||||
static const double MAX_PRESSURE = 2.55;
|
||||
static constexpr double MAX_PRESSURE = 2.55;
|
||||
|
||||
public:
|
||||
Pneumatics();
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
* Uses the CameraServer class to automatically capture video from a USB webcam
|
||||
* and send it to the FRC dashboard without doing any vision processing. This
|
||||
* is the easiest way to get camera images to the dashboard. Just add this to the
|
||||
* RobotInit() method in your program.
|
||||
*/
|
||||
class QuickVisionRobot : public SampleRobot
|
||||
{
|
||||
public:
|
||||
void RobotInit() override {
|
||||
CameraServer::GetInstance()->SetQuality(75);
|
||||
CameraServer::GetInstance()->StartAutomaticCapture();
|
||||
}
|
||||
|
||||
void OperatorControl() override {
|
||||
}
|
||||
};
|
||||
|
||||
START_ROBOT_CLASS(QuickVisionRobot);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
*/
|
||||
void OperatorControl()
|
||||
{
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
// Retrieve the button values. GetRawButton will return
|
||||
// true if the button is pressed and false if not.
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
*/
|
||||
void OperatorControl()
|
||||
{
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
// The output of GetRawButton is true/false depending on whether
|
||||
// the button is pressed; Set takes a boolean for for whether to
|
||||
|
||||
@@ -87,7 +87,12 @@
|
||||
<description>Example programs that demonstrate the use of the various commonly used sensors on FRC robots</description>
|
||||
</tagDescription>
|
||||
|
||||
<example>
|
||||
<tagDescription>
|
||||
<name>Vision</name>
|
||||
<description>Example programs that demonstrate the use of a camera for image acquisition and processing</description>
|
||||
</tagDescription>
|
||||
|
||||
<example>
|
||||
<name>Motor Controller</name>
|
||||
<description>Demonstrate controlling a single motor with a Joystick.</description>
|
||||
<tags>
|
||||
@@ -240,8 +245,45 @@
|
||||
destination="src/Robot.cpp"></file>
|
||||
</files>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
|
||||
<example>
|
||||
<name>Simple vision program</name>
|
||||
<description>The minimal program to acquire images from an attached USB camera on the robot
|
||||
and send them to the dashboard.</description>
|
||||
<tags>
|
||||
<tag>Vision</tag>
|
||||
<tag>Complete List</tag>
|
||||
</tags>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
</packages>
|
||||
<files>
|
||||
<file source="examples/QuickVision/src/Robot.cpp"
|
||||
destination="src/Robot.cpp"></file>
|
||||
</files>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<name>Getting Started</name>
|
||||
<description>An example program that acquires images from an attached USB camera and adds some
|
||||
annotation to the image as you might do for showing operators the result of some image
|
||||
recognition, and sends it to the dashboard for display.
|
||||
</description>
|
||||
<tags>
|
||||
<tag>Vision</tag>
|
||||
<tag>Complete List</tag>
|
||||
</tags>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
</packages>
|
||||
<files>
|
||||
<file source="examples/IntermediateVision/src/Robot.cpp"
|
||||
destination="src/Robot.cpp"></file>
|
||||
</files>
|
||||
</example>
|
||||
|
||||
|
||||
<example>
|
||||
<name>GearsBot</name>
|
||||
<description>A fully functional example CommandBased program for
|
||||
WPIs GearsBot robot. This code can run on your computer if it
|
||||
@@ -250,6 +292,7 @@
|
||||
<tag>CommandBased Robot</tag>
|
||||
<tag>Complete List</tag>
|
||||
</tags>
|
||||
<world>/usr/share/frcsim/worlds/GearsBotDemo.world</world>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
<package>src/Commands</package>
|
||||
@@ -333,7 +376,8 @@
|
||||
<tags>
|
||||
<tag>CommandBased Robot</tag>
|
||||
<tag>Complete List</tag>
|
||||
</tags>
|
||||
</tags>
|
||||
<world>/usr/share/frcsim/worlds/PacGoat2014.world</world>
|
||||
<packages>
|
||||
<package>src</package>
|
||||
<package>src/Commands</package>
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
void OperatorControl()
|
||||
{
|
||||
myRobot.SetSafetyEnabled(true);
|
||||
while (IsOperatorControl())
|
||||
while (IsOperatorControl() && IsEnabled())
|
||||
{
|
||||
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
|
||||
Wait(0.005); // wait for a motor update time
|
||||
|
||||
@@ -154,7 +154,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut
|
||||
"Debug/FRCUserProgram");
|
||||
|
||||
config.setAttribute("org.eclipse.cdt.dsf.gdb.DEBUG_NAME", "arm-frc-linux-gnueabi-gdb");
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/admin/FRCUserProgram");
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/lvuser/FRCUserProgram");
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, remote_connection);
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false);
|
||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, "2345");
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
|
||||
import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,12 @@ public class SimulateLaunchShortcut implements ILaunchShortcut {
|
||||
* @param activeProj The project that the script will be run on/from
|
||||
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
|
||||
*/
|
||||
public void runConfig(IProject activeProj, String mode){
|
||||
public void runConfig(IProject activeProj, String mode) {
|
||||
if (!SimulationNotification.supportsSimulation()) {
|
||||
SimulationNotification.showUnsupported();
|
||||
return;
|
||||
}
|
||||
|
||||
String targets = "simulate";
|
||||
|
||||
if(mode.equals(ILaunchManager.RUN_MODE)){
|
||||
|
||||
@@ -7,16 +7,17 @@ import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.CPPProjectType;
|
||||
|
||||
public class ExampleCPPProject extends CPPProjectType implements IExampleProject {
|
||||
private String name, description;
|
||||
private String name, description, world;
|
||||
private List<String> tags;
|
||||
private List<String> directories;
|
||||
private List<ExportFile> files;
|
||||
|
||||
public ExampleCPPProject(String name, String description, List<String> tags,
|
||||
List<String> directories, List<ExportFile> files) {
|
||||
String world, List<String> directories, List<ExportFile> files) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.tags = tags;
|
||||
this.world = world;
|
||||
this.directories = directories;
|
||||
this.files = files;
|
||||
}
|
||||
@@ -32,6 +33,10 @@ public class ExampleCPPProject extends CPPProjectType implements IExampleProject
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public String getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFolders(String packageName) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
|
||||
@@ -38,9 +39,9 @@ public class ExampleCPPWizard extends ExampleWizard {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IWizardPage getDetailsPage() {
|
||||
protected IWizardPage getDetailsPage(INewProjectInfo info) {
|
||||
if (detailsPage != null) return detailsPage;
|
||||
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
|
||||
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info);
|
||||
detailsPage.setTitle("Create Example Robot C++ Project");
|
||||
detailsPage.setDescription("This wizard creates a new example project based on your selection.");
|
||||
detailsPage.setShowPackage(false);
|
||||
@@ -49,8 +50,8 @@ public class ExampleCPPWizard extends ExampleWizard {
|
||||
|
||||
@Override
|
||||
public IExampleProject makeExampleProject(String name, String description,
|
||||
List<String> tags, List<String> folders, List<ExportFile> files) {
|
||||
return new ExampleCPPProject(name, description, tags, folders, files);
|
||||
List<String> tags, String world, List<String> folders, List<ExportFile> files) {
|
||||
return new ExampleCPPProject(name, description, tags, world, folders, files);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchWizard;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
|
||||
@@ -56,7 +57,7 @@ public class NewCPPWizard extends Wizard implements INewWizard {
|
||||
teamNumberPage = new TeamNumberPage(selection);
|
||||
addPage(teamNumberPage);
|
||||
}
|
||||
page = new NewProjectMainPage(selection, teamNumberPage);
|
||||
page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null);
|
||||
page.setTitle("Create New Robot C++ Project");
|
||||
page.setDescription("This wizard creates a new Robot C++ Project configured to use WPILib for programming FRC robots.");
|
||||
page.setShowPackage(false);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
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=18
|
||||
|
||||
# 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
|
||||
@@ -20,10 +20,25 @@
|
||||
|
||||
<target name="get-target-ip">
|
||||
<property name="target" value="roboRIO-${team-number}.local" />
|
||||
<echo>Target: ${target}</echo>
|
||||
<echo>Trying Target: ${target}</echo>
|
||||
<if>
|
||||
<isreachable host="${target}"/>
|
||||
<then>
|
||||
<echo>roboRIO found via mDNS</echo>
|
||||
</then>
|
||||
<else>
|
||||
<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 mDNS, 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">
|
||||
<isreachable host="${target}"/>
|
||||
</assert>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
|
||||
<target name="deploy" depends="get-target-ip, dependencies" description="Deploy the progam and start it running.">
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
@@ -42,11 +57,6 @@
|
||||
trust="true"
|
||||
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="tail -F -n 0 ${deploy.log.file}"/>
|
||||
</target>
|
||||
|
||||
<target name="kill-program" depends="get-target-ip" description="Kill the currently running FRC program">
|
||||
@@ -57,28 +67,6 @@
|
||||
command="/usr/local/frc/bin/frcKillRobot.sh"/>
|
||||
</target>
|
||||
|
||||
<target name="debug-deploy" depends="get-target-ip" description="Deploy the jar and start the program running in debug mode.">
|
||||
<echo>[athena-deploy] Killing running program</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="killall FRCUserProgram; sleep 1"/>
|
||||
<echo>[athena-debug-deploy] Copying code over.</echo>
|
||||
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/debugcppprogram" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/debugjavaprogram" todir="${username}@${target}:${deploy.dir}"
|
||||
password="${password}" trust="true"/>
|
||||
<echo>[athena-debug-deploy] Starting program.</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="chmod a+x debug*program; ${deploy.debug.command}"/>
|
||||
</target>
|
||||
|
||||
<!-- Simulation support -->
|
||||
<target name="simulate">
|
||||
<parallel>
|
||||
@@ -102,4 +90,20 @@
|
||||
</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">
|
||||
<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_2015_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>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -1 +1 @@
|
||||
/home/admin/FRCUserProgram
|
||||
/usr/local/frc/bin/netconsole-host /home/lvuser/FRCUserProgram
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Robot extends SampleRobot {
|
||||
*/
|
||||
public void operatorControl() {
|
||||
robotDrive.setSafetyEnabled(true);
|
||||
while (isOperatorControl()) {
|
||||
while (isOperatorControl() && isEnabled()) {
|
||||
|
||||
// Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation.
|
||||
// This sample does not use field-oriented drive, so the gyro input is set to zero.
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Robot extends SampleRobot {
|
||||
* Runs the motor from a joystick.
|
||||
*/
|
||||
public void operatorControl() {
|
||||
while (isOperatorControl()) {
|
||||
while (isOperatorControl() && isEnabled()) {
|
||||
// Set the motor's output.
|
||||
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed going forward)
|
||||
motor.set(stick.getY());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Robot extends SampleRobot {
|
||||
*/
|
||||
public void operatorControl() {
|
||||
myRobot.setSafetyEnabled(true);
|
||||
while (isOperatorControl()) {
|
||||
while (isOperatorControl() && isEnabled()) {
|
||||
myRobot.tankDrive(leftStick, rightStick);
|
||||
Timer.delay(0.005); // wait for a motor update time
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
<tags>
|
||||
<tag>CommandBased Robot</tag>
|
||||
</tags>
|
||||
<world>/usr/share/frcsim/worlds/GearsBotDemo.world</world>
|
||||
<packages>
|
||||
<package>src/$package-dir</package>
|
||||
<package>src/$package-dir/commands</package>
|
||||
@@ -198,6 +199,7 @@
|
||||
<tags>
|
||||
<tag>CommandBased Robot</tag>
|
||||
</tags>
|
||||
<world>/usr/share/frcsim/worlds/PacGoat2014.world</world>
|
||||
<packages>
|
||||
<package>src/$package-dir</package>
|
||||
<package>src/$package-dir/commands</package>
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Robot extends SampleRobot {
|
||||
*/
|
||||
public void operatorControl() {
|
||||
myRobot.setSafetyEnabled(true);
|
||||
while (isOperatorControl()) {
|
||||
while (isOperatorControl() && isEnabled()) {
|
||||
myRobot.arcadeDrive(stick); // drive with arcade style (use right stick)
|
||||
Timer.delay(0.005); // wait for a motor update time
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package edu.wpi.first.wpilib.plugins.java.launching;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification;
|
||||
|
||||
public class SimulateLaunchShortcut extends JavaLaunchShortcut {
|
||||
|
||||
|
||||
@@ -11,7 +13,11 @@ public class SimulateLaunchShortcut extends JavaLaunchShortcut {
|
||||
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
|
||||
*/
|
||||
public void runConfig(IProject activeProj, String mode){
|
||||
runConfigHelper(activeProj, mode, "simulate", "debug-simulate");
|
||||
if (SimulationNotification.supportsSimulation()) {
|
||||
runConfigHelper(activeProj, mode, "simulate", "debug-simulate");
|
||||
} else {
|
||||
SimulationNotification.showUnsupported();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getHostname(IProject proj) {
|
||||
|
||||
@@ -7,16 +7,17 @@ import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.java.wizards.newproject.JavaProjectType;
|
||||
|
||||
public class ExampleJavaProject extends JavaProjectType implements IExampleProject {
|
||||
private String name, description;
|
||||
private String name, description, world;
|
||||
private List<String> tags;
|
||||
private List<String> packages;
|
||||
private List<ExportFile> files;
|
||||
|
||||
public ExampleJavaProject(String name, String description, List<String> tags,
|
||||
List<String> packages, List<ExportFile> files) {
|
||||
String world, List<String> packages, List<ExportFile> files) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.tags = tags;
|
||||
this.world = world;
|
||||
this.packages = packages;
|
||||
this.files = files;
|
||||
}
|
||||
@@ -32,6 +33,10 @@ public class ExampleJavaProject extends JavaProjectType implements IExampleProje
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public String getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFolders(String packageName) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.eclipse.jface.wizard.IWizardPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
@@ -40,9 +41,9 @@ public class ExampleJavaWizard extends ExampleWizard {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IWizardPage getDetailsPage() {
|
||||
protected IWizardPage getDetailsPage(INewProjectInfo info) {
|
||||
if (detailsPage != null) return detailsPage;
|
||||
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage());
|
||||
detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info);
|
||||
detailsPage.setTitle("Create Example Robot Java Project");
|
||||
detailsPage.setDescription("This wizard creates a new example project based on your selection.");
|
||||
return detailsPage;
|
||||
@@ -50,8 +51,8 @@ public class ExampleJavaWizard extends ExampleWizard {
|
||||
|
||||
@Override
|
||||
public IExampleProject makeExampleProject(String name, String description,
|
||||
List<String> tags, List<String> folders, List<ExportFile> files) {
|
||||
return new ExampleJavaProject(name, description, tags, folders, files);
|
||||
List<String> tags, String world, List<String> folders, List<ExportFile> files) {
|
||||
return new ExampleJavaProject(name, description, tags, world, folders, files);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchWizard;
|
||||
|
||||
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils;
|
||||
import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
|
||||
@@ -56,7 +57,7 @@ public class NewJavaWizard extends Wizard implements INewWizard {
|
||||
teamNumberPage = new TeamNumberPage(selection);
|
||||
addPage(teamNumberPage);
|
||||
}
|
||||
page = new NewProjectMainPage(selection, teamNumberPage);
|
||||
page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null);
|
||||
page.setProjectTypes(JavaProjectType.TYPES);
|
||||
page.setTitle("Create New Robot Java Project");
|
||||
page.setDescription("This wizard creates a new Robot Java Project configured to use WPILib for programming FRC robots.");
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# Deployment information
|
||||
username=admin
|
||||
password=
|
||||
deploy.dir=/home/admin
|
||||
deploy.dir=/home/lvuser
|
||||
deploy.kill.command=. /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r
|
||||
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
|
||||
deploy.log.command=tail -F -n 0 ${deploy.log.file}
|
||||
debug.flag.dir=/tmp/
|
||||
debug.flag.command=chown lvuser:ni ${debug.flag.dir}frcdebug
|
||||
command.dir=/home/lvuser/
|
||||
version=current
|
||||
roboRIOJRE.dir=/usr/local/frc/JRE
|
||||
|
||||
# Libraries to use
|
||||
wpilib=${user.home}/wpilib/java/${version}
|
||||
@@ -21,6 +20,7 @@ networktables.sources=${wpilib.lib}/NetworkTables-sources.jar
|
||||
#jnaerator.jar=${wpilib.lib}/jnaerator-runtime.jar
|
||||
#classpath=${wpilib.jar}:${networktables.jar}:${jna.jar}:${jnaerator.jar}
|
||||
classpath=${wpilib.jar}:${networktables.jar}
|
||||
roboRIOAllowedImages=18
|
||||
|
||||
# Ant support
|
||||
wpilib.ant.dir=${wpilib}/ant
|
||||
|
||||
@@ -20,7 +20,22 @@
|
||||
|
||||
<target name="get-target-ip">
|
||||
<property name="target" value="roboRIO-${team-number}.local" />
|
||||
<echo>Target: ${target}</echo>
|
||||
<echo>Trying Target: ${target}</echo>
|
||||
<if>
|
||||
<isreachable host="${target}"/>
|
||||
<then>
|
||||
<echo>roboRIO found via mDNS</echo>
|
||||
</then>
|
||||
<else>
|
||||
<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 mDNS, 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">
|
||||
<isreachable host="${target}"/>
|
||||
</assert>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile the source code.">
|
||||
@@ -66,7 +81,11 @@
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">
|
||||
<!-- We're running a clean here to get around a known ant issue where it does not detected changed constant variables.
|
||||
To get around this, we're recompiling the entire project, which is not an issue for most teams. If this is an issue
|
||||
for you, you can remove the clean here, just be sure to do a full rebuild after you've changed any constants.
|
||||
Reference: http://stackoverflow.com/questions/6430001/ant-doesnt-recompile-constants -->
|
||||
<target name="deploy" depends="clean,jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
|
||||
<echo>[athena-deploy] Copying code over.</echo>
|
||||
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
|
||||
<scp file="${wpilib.ant.dir}/robotCommand" todir="${username}@${target}:${command.dir}" password="${password}" trust="true"/>
|
||||
@@ -78,14 +97,9 @@
|
||||
trust="true"
|
||||
command="${deploy.kill.command};"/>
|
||||
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="${deploy.log.command}"/>
|
||||
</target>
|
||||
|
||||
<target name="debug-deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">
|
||||
<target name="debug-deploy" depends="jar,get-target-ip,dependencies" description="Deploy the jar and start the program running.">
|
||||
<echo>[athena-deploy] Copying code over.</echo>
|
||||
<scp file="${dist.jar}" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
|
||||
<!-- The remoteDebugCommand file is used by /usr/local/frc/bin/frcRunRobot.sh on the roboRIO -->
|
||||
@@ -105,11 +119,6 @@
|
||||
trust="true"
|
||||
command="${deploy.kill.command}"/>
|
||||
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
command="${deploy.log.command}"/>
|
||||
</target>
|
||||
|
||||
<!-- Simulate -->
|
||||
@@ -180,4 +189,27 @@
|
||||
</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">
|
||||
<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_2015_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>Checking for JRE. If this fails install the JRE using these instructions: http://wpilib.screenstepslive.com/s/4485/m/13809/l/243933-installing-java-8-on-the-roborio-java-only</echo>
|
||||
<sshexec host="${target}"
|
||||
username="${username}"
|
||||
password="${password}"
|
||||
trust="true"
|
||||
failonerror="true"
|
||||
command="test -d ${roboRIOJRE.dir}"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
/usr/local/frc/JRE/bin/java
|
||||
-jar /home/admin/FRCUserProgram.jar
|
||||
/usr/local/frc/JRE/bin/java -jar /home/lvuser/FRCUserProgram.jar
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
/usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y
|
||||
-jar /home/admin/FRCUserProgram.jar
|
||||
/usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y -jar /home/lvuser/FRCUserProgram.jar
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: WPILib_Riolog
|
||||
Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.riolog;singleton:=true
|
||||
Bundle-Version: 0.1.0.qualifier
|
||||
Bundle-Activator: netconsole2.Activator
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Vendor: WPI & FIRST
|
||||
13
eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/README
Normal file
13
eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/README
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
Riolog
|
||||
|
||||
This is an Eclipse plugin that receives and displays text from UDP port 6666. It
|
||||
defines a new view that displays the received text.
|
||||
|
||||
To compile, open project in an Eclipse instance with the appropriate plugin
|
||||
development tools, and Export as a deployable plugin/fragment.
|
||||
|
||||
To install, copy the resulting jar file into $eclipse/dropins/, and start
|
||||
Eclipse (-clean may be necessary).
|
||||
|
||||
To enable, go to Window>Show View>Other... and choose General>Riolog.
|
||||
@@ -0,0 +1,7 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
.,\
|
||||
icons/,\
|
||||
contexts.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<contexts>
|
||||
<context id="text" title="Riolog">
|
||||
<description>This is the context help for the Riolog It was generated by a PDE template.</description>
|
||||
<topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
|
||||
<enablement>
|
||||
<with variable="platform">
|
||||
<test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
|
||||
</with>
|
||||
</enablement>
|
||||
</topic>
|
||||
</context>
|
||||
</contexts>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.views">
|
||||
<view
|
||||
name="Riolog"
|
||||
icon="icons/riolog.png"
|
||||
category="org.eclipse.ui"
|
||||
class="netconsole2.views.RiologView"
|
||||
id="netconsole2.views.RiologView">
|
||||
</view>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.perspectiveExtensions">
|
||||
<perspectiveExtension
|
||||
targetID="org.eclipse.jdt.ui.JavaPerspective">
|
||||
<view
|
||||
ratio="0.5"
|
||||
relative="org.eclipse.ui.views.ProblemView"
|
||||
relationship="right"
|
||||
id="netconsole2.views.RiologView">
|
||||
</view>
|
||||
</perspectiveExtension>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.help.contexts">
|
||||
<contexts
|
||||
file="contexts.xml">
|
||||
</contexts>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
15
eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/pom.xml
Normal file
15
eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/pom.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>edu.wpi.first.wpilib.plugins.riolog</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>edu.wpi.first.wpilib.plugins</groupId>
|
||||
<artifactId>edu.wpi.first.wpilib.plugins</artifactId>
|
||||
<version>0.1.0.qualifier</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,61 @@
|
||||
package netconsole2;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "riolog"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an image descriptor for the image file at the given
|
||||
* plug-in relative path
|
||||
*
|
||||
* @param path the path
|
||||
* @return the image descriptor
|
||||
*/
|
||||
public static ImageDescriptor getImageDescriptor(String path) {
|
||||
return imageDescriptorFromPlugin(PLUGIN_ID, path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
package netconsole2.views;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IActionBars;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.part.ViewPart;
|
||||
|
||||
|
||||
public class RiologView extends ViewPart {
|
||||
public static Action confAction(String name, String tooltip, String img,
|
||||
Action e) {
|
||||
e.setText(name);
|
||||
e.setToolTipText(tooltip);
|
||||
e.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
|
||||
.getImageDescriptor(img));
|
||||
return e;
|
||||
}
|
||||
|
||||
public static byte[] getPacket(DatagramSocket socket, DatagramPacket buf) {
|
||||
try {
|
||||
socket.receive(buf);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
byte[] ret = new byte[buf.getLength()];
|
||||
System.arraycopy(buf.getData(), 0, ret, 0, ret.length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static DatagramSocket makeRecvSocket() {
|
||||
DatagramSocket socket = null;
|
||||
try {
|
||||
socket = new DatagramSocket(null);
|
||||
socket.setReuseAddress(true);
|
||||
socket.bind(new InetSocketAddress(6666));
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
socket.close();
|
||||
return null;
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
|
||||
public static Thread startDaemonThread(Runnable r, String name) {
|
||||
Thread t = new Thread(r, name);
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the view as specified by the extension.
|
||||
*/
|
||||
public static final String ID = "netconsole2.views.RiologView";
|
||||
|
||||
Text text;
|
||||
Thread listener;
|
||||
Thread transferer;
|
||||
|
||||
volatile DatagramSocket socket_hook = null;
|
||||
volatile boolean discard = false;
|
||||
volatile boolean paused = false;
|
||||
volatile boolean cleanup = false;
|
||||
|
||||
private Action clearAction;
|
||||
private Action pauseAction;
|
||||
private Action discardAction;
|
||||
private Action unpauseAction;
|
||||
private Action undiscardAction;
|
||||
private Button discardButton;
|
||||
private Button pauseButton;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*/
|
||||
public RiologView() {
|
||||
}
|
||||
|
||||
private void contributeToActionBars() {
|
||||
IActionBars bars = getViewSite().getActionBars();
|
||||
fillLocalPullDown(bars.getMenuManager());
|
||||
fillLocalToolBar(bars.getToolBarManager());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a callback that will allow us to create the viewer and initialize
|
||||
* it.
|
||||
*/
|
||||
public void createPartControl(Composite parent) {
|
||||
GridLayout glayout = new GridLayout();
|
||||
glayout.numColumns = 1;
|
||||
parent.setLayout(glayout);
|
||||
|
||||
text = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
|
||||
| SWT.READ_ONLY);
|
||||
{
|
||||
GridData gdata = new GridData();
|
||||
gdata.grabExcessVerticalSpace = true;
|
||||
gdata.grabExcessHorizontalSpace = true;
|
||||
gdata.horizontalAlignment = SWT.FILL;
|
||||
gdata.verticalAlignment = SWT.FILL;
|
||||
text.setLayoutData(gdata);
|
||||
}
|
||||
|
||||
Composite row = new Composite(parent, SWT.NONE);
|
||||
|
||||
row.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
|
||||
{
|
||||
GridData gdata = new GridData();
|
||||
gdata.grabExcessVerticalSpace = false;
|
||||
gdata.grabExcessHorizontalSpace = true;
|
||||
gdata.horizontalAlignment = SWT.FILL;
|
||||
gdata.verticalAlignment = SWT.CENTER;
|
||||
row.setLayoutData(gdata);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Create the help context id for the viewer's control
|
||||
PlatformUI.getWorkbench().getHelpSystem()
|
||||
.setHelp(parent, "netconsole2.text");
|
||||
makeActions();
|
||||
makeButtons(row);
|
||||
hookContextMenu();
|
||||
contributeToActionBars();
|
||||
startListening();
|
||||
}
|
||||
|
||||
public void makeButtons(Composite parent) {
|
||||
pauseButton = new Button(parent, SWT.TOGGLE);
|
||||
pauseButton.setText(pauseAction.getText());
|
||||
pauseButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (pauseButton.getSelection()) {
|
||||
pauseAction.run();
|
||||
} else {
|
||||
unpauseAction.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
discardButton = new Button(parent, SWT.TOGGLE);
|
||||
discardButton.setText(discardAction.getText());
|
||||
discardButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (discardButton.getSelection()) {
|
||||
discardAction.run();
|
||||
} else {
|
||||
undiscardAction.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
Button clearButton = new Button(parent, SWT.PUSH);
|
||||
clearButton.setText(clearAction.getText());
|
||||
clearButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
clearAction.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
stopListening();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private void fillContextMenu(IMenuManager manager) {
|
||||
manager.add(pauseAction);
|
||||
manager.add(unpauseAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(clearAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(discardAction);
|
||||
manager.add(undiscardAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(confAction("Copy", "Copy selected text",
|
||||
ISharedImages.IMG_TOOL_COPY, new Action() {
|
||||
@Override
|
||||
public void run() {
|
||||
text.copy();
|
||||
}
|
||||
}));
|
||||
manager.add(confAction("Select All", "Select all text", "",
|
||||
new Action() {
|
||||
@Override
|
||||
public void run() {
|
||||
text.selectAll();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void fillLocalPullDown(IMenuManager manager) {
|
||||
manager.add(pauseAction);
|
||||
manager.add(unpauseAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(clearAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(discardAction);
|
||||
manager.add(undiscardAction);
|
||||
}
|
||||
|
||||
private void fillLocalToolBar(IToolBarManager manager) {
|
||||
manager.add(pauseAction);
|
||||
manager.add(unpauseAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(clearAction);
|
||||
manager.add(new Separator());
|
||||
manager.add(discardAction);
|
||||
manager.add(undiscardAction);
|
||||
}
|
||||
|
||||
private void hookContextMenu() {
|
||||
MenuManager menuMgr = new MenuManager("#PopupMenu");
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
RiologView.this.fillContextMenu(manager);
|
||||
}
|
||||
});
|
||||
Menu menu = menuMgr.createContextMenu(text);
|
||||
text.setMenu(menu);
|
||||
}
|
||||
|
||||
private void makeActions() {
|
||||
clearAction = confAction("Clear Log", "Empty the textbox",
|
||||
ISharedImages.IMG_ETOOL_CLEAR, new Action() {
|
||||
public void run() {
|
||||
text.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
pauseAction = confAction("Pause Display",
|
||||
"Stop adding packets to the textbox",
|
||||
ISharedImages.IMG_ELCL_STOP, new Action() {
|
||||
public void run() {
|
||||
pauseAction.setEnabled(false);
|
||||
unpauseAction.setEnabled(true);
|
||||
pauseButton.setSelection(true);
|
||||
pauseButton.setText("Show 0 Packets");
|
||||
paused = true;
|
||||
}
|
||||
});
|
||||
pauseAction.setEnabled(true);
|
||||
unpauseAction = confAction("Continue Display",
|
||||
"Continue adding packets to the textbox",
|
||||
ISharedImages.IMG_TOOL_FORWARD, new Action() {
|
||||
public void run() {
|
||||
paused = false;
|
||||
transferer.interrupt();
|
||||
pauseAction.setEnabled(true);
|
||||
unpauseAction.setEnabled(false);
|
||||
pauseButton.setSelection(false);
|
||||
pauseButton.setText(pauseAction.getText());
|
||||
}
|
||||
});
|
||||
unpauseAction.setEnabled(false);
|
||||
|
||||
discardAction = confAction("Discard Incoming",
|
||||
"Drop all incoming packets", ISharedImages.IMG_ETOOL_DELETE,
|
||||
new Action() {
|
||||
public void run() {
|
||||
discard = true;
|
||||
discardAction.setEnabled(false);
|
||||
undiscardAction.setEnabled(true);
|
||||
discardButton.setSelection(true);
|
||||
discardButton.setText(undiscardAction.getText());
|
||||
}
|
||||
});
|
||||
discardAction.setEnabled(true);
|
||||
undiscardAction = confAction("Accept Incoming",
|
||||
"Accept all incoming packets", ISharedImages.IMG_OBJ_ADD,
|
||||
new Action() {
|
||||
public void run() {
|
||||
discard = false;
|
||||
discardAction.setEnabled(true);
|
||||
undiscardAction.setEnabled(false);
|
||||
discardButton.setSelection(false);
|
||||
discardButton.setText(discardAction.getText());
|
||||
}
|
||||
});
|
||||
undiscardAction.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passing the focus request to the viewer's control.
|
||||
*/
|
||||
public void setFocus() {
|
||||
text.setFocus();
|
||||
}
|
||||
|
||||
public static String drainToString(ArrayList<byte[]> arr) {
|
||||
int netlength = 0;
|
||||
for (byte[] b : arr) {
|
||||
netlength += b.length;
|
||||
}
|
||||
|
||||
byte[] sum = new byte[netlength];
|
||||
int mark = 0;
|
||||
for (int i=0;i<arr.size();i++) {
|
||||
byte[] b = arr.get(i);
|
||||
System.arraycopy(b, 0, sum, mark, b.length);
|
||||
arr.set(i, null);
|
||||
mark += b.length;
|
||||
}
|
||||
arr.clear();
|
||||
return new String(sum);
|
||||
|
||||
}
|
||||
|
||||
void startListening() {
|
||||
final BlockingQueue<byte[]> queue = new LinkedBlockingQueue<>();
|
||||
listener = startDaemonThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DatagramSocket socket = makeRecvSocket();
|
||||
if (socket == null)
|
||||
return;
|
||||
socket_hook = socket;
|
||||
byte[] buf = new byte[4096];
|
||||
DatagramPacket datagram = new DatagramPacket(buf, buf.length);
|
||||
while (!Thread.interrupted()) {
|
||||
byte[] s = getPacket(socket, datagram);
|
||||
if (s != null && !discard) {
|
||||
try {
|
||||
queue.put(s);
|
||||
} catch (InterruptedException e) {
|
||||
socket.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
socket.close();
|
||||
}
|
||||
}, "Riolog-Listener");
|
||||
transferer = startDaemonThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final ArrayList<byte[]> temp = new ArrayList<>();
|
||||
while (!cleanup) {
|
||||
try {
|
||||
temp.add(queue.take());
|
||||
} catch (InterruptedException e) {
|
||||
if (cleanup) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
queue.drainTo(temp);
|
||||
if (!paused) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (text.isDisposed())
|
||||
return;
|
||||
text.append(drainToString(temp));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (paused) {
|
||||
if (temp.size() == 1) {
|
||||
pauseButton.setText("Show 1 Packet\u2002");
|
||||
} else {
|
||||
pauseButton.setText("Show " + String.valueOf(temp.size()) + " Packets");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "Riolog-Transfer");
|
||||
}
|
||||
|
||||
void stopListening() {
|
||||
cleanup = true;
|
||||
if (socket_hook != null) {
|
||||
socket_hook.close();
|
||||
}
|
||||
listener.interrupt();
|
||||
transferer.interrupt();
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,13 @@
|
||||
<module>edu.wpi.first.wpilib.plugins.cpp.feature</module>
|
||||
<module>edu.wpi.first.wpilib.plugins.java</module>
|
||||
<module>edu.wpi.first.wpilib.plugins.java.feature</module>
|
||||
<module>edu.wpi.first.wpilib.plugins.riolog</module>
|
||||
<module>edu.wpi.first.wpilib.plugins.updatesite</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<!-- local-repository>C:/Users/wpilibj-buildmaster/maven-repository</local-repository-->
|
||||
<tycho-version>0.18.1</tycho-version>
|
||||
<tycho-version>0.21.0</tycho-version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
||||
@@ -45,3 +45,16 @@
|
||||
#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE "HAL: Attempted to read AnalogTrigger pulse output."
|
||||
#define PARAMETER_OUT_OF_RANGE -1028
|
||||
#define PARAMETER_OUT_OF_RANGE_MESSAGE "HAL: A parameter is out of range."
|
||||
|
||||
#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error";
|
||||
#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object"
|
||||
#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked"
|
||||
#define VI_ERROR_RSRC_NFOUND_MESSAGE "HAL - VISA: Resource Not Found"
|
||||
#define VI_ERROR_INV_RSRC_NAME_MESSAGE "HAL - VISA: Invalid Resource Name"
|
||||
#define VI_ERROR_QUEUE_OVERFLOW_MESSAGE "HAL - VISA: Queue Overflow"
|
||||
#define VI_ERROR_IO_MESSAGE "HAL - VISA: General IO Error"
|
||||
#define VI_ERROR_ASRL_PARITY_MESSAGE "HAL - VISA: Parity Error"
|
||||
#define VI_ERROR_ASRL_FRAMING_MESSAGE "HAL - VISA: Framing Error"
|
||||
#define VI_ERROR_ASRL_OVERRUN_MESSAGE "HAL - VISA: Buffer Overrun Error"
|
||||
#define VI_ERROR_RSRC_BUSY_MESSAGE "HAL - VISA: Resource Busy"
|
||||
#define VI_ERROR_INV_PARAMETER_MESSAGE "HAL - VISA: Invalid Parameter"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Errors.hpp"
|
||||
#include "PDP.hpp"
|
||||
#include "Power.hpp"
|
||||
#include "SerialPort.hpp"
|
||||
|
||||
#include "Utilities.hpp"
|
||||
#include "Semaphore.hpp"
|
||||
@@ -214,7 +215,10 @@ extern "C"
|
||||
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
|
||||
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
|
||||
|
||||
void HALSetNewDataSem(pthread_mutex_t *);
|
||||
void HALSetNewDataSem(pthread_cond_t *);
|
||||
|
||||
bool HALGetSystemActive(int32_t *status);
|
||||
bool HALGetBrownedOut(int32_t *status);
|
||||
|
||||
int HALInitialize(int mode = 0);
|
||||
void HALNetworkCommunicationObserveUserProgramStarting();
|
||||
|
||||
@@ -8,8 +8,14 @@ extern "C"
|
||||
float getVinCurrent(int32_t *status);
|
||||
float getUserVoltage6V(int32_t *status);
|
||||
float getUserCurrent6V(int32_t *status);
|
||||
bool getUserActive6V(int32_t *status);
|
||||
int getUserCurrentFaults6V(int32_t *status);
|
||||
float getUserVoltage5V(int32_t *status);
|
||||
float getUserCurrent5V(int32_t *status);
|
||||
bool getUserActive5V(int32_t *status);
|
||||
int getUserCurrentFaults5V(int32_t *status);
|
||||
float getUserVoltage3V3(int32_t *status);
|
||||
float getUserCurrent3V3(int32_t *status);
|
||||
bool getUserActive3V3(int32_t *status);
|
||||
int getUserCurrentFaults3V3(int32_t *status);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ extern "C"
|
||||
|
||||
MULTIWAIT_ID initializeMultiWait();
|
||||
void deleteMultiWait(MULTIWAIT_ID sem);
|
||||
int8_t takeMultiWait(MULTIWAIT_ID sem, int32_t timeout);
|
||||
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout);
|
||||
int8_t giveMultiWait(MULTIWAIT_ID sem);
|
||||
}
|
||||
|
||||
|
||||
29
hal/include/HAL/SerialPort.hpp
Normal file
29
hal/include/HAL/SerialPort.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __vxworks
|
||||
#include <vxWorks.h>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void serialInitializePort(uint8_t port, int32_t *status);
|
||||
void serialSetBaudRate(uint8_t port, uint32_t baud, int32_t *status);
|
||||
void serialSetDataBits(uint8_t port, uint8_t bits, int32_t *status);
|
||||
void serialSetParity(uint8_t port, uint8_t parity, int32_t *status);
|
||||
void serialSetStopBits(uint8_t port, uint8_t stopBits, int32_t *status);
|
||||
void serialSetWriteMode(uint8_t port, uint8_t mode, int32_t *status);
|
||||
void serialSetFlowControl(uint8_t port, uint8_t flow, int32_t *status);
|
||||
void serialSetTimeout(uint8_t port, float timeout, int32_t *status);
|
||||
void serialEnableTermination(uint8_t port, char terminator, int32_t *status);
|
||||
void serialDisableTermination(uint8_t port, int32_t *status);
|
||||
void serialSetReadBufferSize(uint8_t port, uint32_t size, int32_t *status);
|
||||
void serialSetWriteBufferSize(uint8_t port, uint32_t size, int32_t *status);
|
||||
int32_t serialGetBytesReceived(uint8_t port, int32_t *status);
|
||||
uint32_t serialRead(uint8_t port, char* buffer, int32_t count, int32_t *status);
|
||||
uint32_t serialWrite(uint8_t port, const char *buffer, int32_t count, int32_t *status);
|
||||
void serialFlush(uint8_t port, int32_t *status);
|
||||
void serialClear(uint8_t port, int32_t *status);
|
||||
void serialClose(uint8_t port, int32_t *status);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ void setPWMPeriodScale(void* digital_port_pointer, uint32_t squelchMask, int32_t
|
||||
|
||||
/**
|
||||
* Allocate a DO PWM Generator.
|
||||
* Allocate PWM generators so that they are not accidently reused.
|
||||
* Allocate PWM generators so that they are not accidentally reused.
|
||||
*
|
||||
* @return PWM Generator refnum
|
||||
*/
|
||||
@@ -299,12 +299,12 @@ void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status) {
|
||||
if(id < 4)
|
||||
digitalSystem->writePWMDutyCycleA(id, (uint8_t)rawDutyCycle, status);
|
||||
else
|
||||
digitalSystem->writePWMDutyCycleB(id - 3, (uint8_t)rawDutyCycle, status);
|
||||
digitalSystem->writePWMDutyCycleB(id - 4, (uint8_t)rawDutyCycle, status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure which DO channel the PWM siganl is output on
|
||||
* Configure which DO channel the PWM signal is output on
|
||||
*
|
||||
* @param pwmGenerator The generator index reserved by AllocateDO_PWM()
|
||||
* @param channel The Digital Output channel to output on
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
#define __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
|
||||
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_9
|
||||
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_A
|
||||
|
||||
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
|
||||
@@ -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__
|
||||
@@ -1,15 +1,15 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_nInterfaceGlobals_h__
|
||||
#define __nFRC_2015_1_0_9_nInterfaceGlobals_h__
|
||||
#ifndef __nFRC_2015_1_0_A_nInterfaceGlobals_h__
|
||||
#define __nFRC_2015_1_0_A_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_nInterfaceGlobals_h__
|
||||
#endif // __nFRC_2015_1_0_A_nInterfaceGlobals_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_AI_h__
|
||||
#define __nFRC_2015_1_0_9_AI_h__
|
||||
#ifndef __nFRC_2015_1_0_A_AI_h__
|
||||
#define __nFRC_2015_1_0_A_AI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAI
|
||||
@@ -140,4 +140,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_AI_h__
|
||||
#endif // __nFRC_2015_1_0_A_AI_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_AO_h__
|
||||
#define __nFRC_2015_1_0_9_AO_h__
|
||||
#ifndef __nFRC_2015_1_0_A_AO_h__
|
||||
#define __nFRC_2015_1_0_A_AO_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAO
|
||||
@@ -47,4 +47,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_AO_h__
|
||||
#endif // __nFRC_2015_1_0_A_AO_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Accel_h__
|
||||
#define __nFRC_2015_1_0_9_Accel_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Accel_h__
|
||||
#define __nFRC_2015_1_0_A_Accel_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAccel
|
||||
@@ -99,4 +99,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Accel_h__
|
||||
#endif // __nFRC_2015_1_0_A_Accel_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Accumulator_h__
|
||||
#define __nFRC_2015_1_0_9_Accumulator_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Accumulator_h__
|
||||
#define __nFRC_2015_1_0_A_Accumulator_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAccumulator
|
||||
@@ -84,4 +84,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Accumulator_h__
|
||||
#endif // __nFRC_2015_1_0_A_Accumulator_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Alarm_h__
|
||||
#define __nFRC_2015_1_0_9_Alarm_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Alarm_h__
|
||||
#define __nFRC_2015_1_0_A_Alarm_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAlarm
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Alarm_h__
|
||||
#endif // __nFRC_2015_1_0_A_Alarm_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_AnalogTrigger_h__
|
||||
#define __nFRC_2015_1_0_9_AnalogTrigger_h__
|
||||
#ifndef __nFRC_2015_1_0_A_AnalogTrigger_h__
|
||||
#define __nFRC_2015_1_0_A_AnalogTrigger_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tAnalogTrigger
|
||||
@@ -126,4 +126,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_AnalogTrigger_h__
|
||||
#endif // __nFRC_2015_1_0_A_AnalogTrigger_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_BIST_h__
|
||||
#define __nFRC_2015_1_0_9_BIST_h__
|
||||
#ifndef __nFRC_2015_1_0_A_BIST_h__
|
||||
#define __nFRC_2015_1_0_A_BIST_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tBIST
|
||||
@@ -87,4 +87,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_BIST_h__
|
||||
#endif // __nFRC_2015_1_0_A_BIST_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Counter_h__
|
||||
#define __nFRC_2015_1_0_9_Counter_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Counter_h__
|
||||
#define __nFRC_2015_1_0_A_Counter_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tCounter
|
||||
@@ -216,4 +216,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Counter_h__
|
||||
#endif // __nFRC_2015_1_0_A_Counter_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_DIO_h__
|
||||
#define __nFRC_2015_1_0_9_DIO_h__
|
||||
#ifndef __nFRC_2015_1_0_A_DIO_h__
|
||||
#define __nFRC_2015_1_0_A_DIO_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tDIO
|
||||
@@ -245,4 +245,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_DIO_h__
|
||||
#endif // __nFRC_2015_1_0_A_DIO_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_DMA_h__
|
||||
#define __nFRC_2015_1_0_9_DMA_h__
|
||||
#ifndef __nFRC_2015_1_0_A_DMA_h__
|
||||
#define __nFRC_2015_1_0_A_DMA_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tDMA
|
||||
@@ -185,4 +185,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_DMA_h__
|
||||
#endif // __nFRC_2015_1_0_A_DMA_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Encoder_h__
|
||||
#define __nFRC_2015_1_0_9_Encoder_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Encoder_h__
|
||||
#define __nFRC_2015_1_0_A_Encoder_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tEncoder
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 4,
|
||||
kNumSystems = 8,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
@@ -196,4 +196,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Encoder_h__
|
||||
#endif // __nFRC_2015_1_0_A_Encoder_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Global_h__
|
||||
#define __nFRC_2015_1_0_9_Global_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Global_h__
|
||||
#define __nFRC_2015_1_0_A_Global_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tGlobal
|
||||
@@ -101,4 +101,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Global_h__
|
||||
#endif // __nFRC_2015_1_0_A_Global_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Interrupt_h__
|
||||
#define __nFRC_2015_1_0_9_Interrupt_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Interrupt_h__
|
||||
#define __nFRC_2015_1_0_A_Interrupt_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tInterrupt
|
||||
@@ -97,4 +97,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Interrupt_h__
|
||||
#endif // __nFRC_2015_1_0_A_Interrupt_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_PWM_h__
|
||||
#define __nFRC_2015_1_0_9_PWM_h__
|
||||
#ifndef __nFRC_2015_1_0_A_PWM_h__
|
||||
#define __nFRC_2015_1_0_A_PWM_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tPWM
|
||||
@@ -117,4 +117,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_PWM_h__
|
||||
#endif // __nFRC_2015_1_0_A_PWM_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Power_h__
|
||||
#define __nFRC_2015_1_0_9_Power_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Power_h__
|
||||
#define __nFRC_2015_1_0_A_Power_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tPower
|
||||
@@ -214,4 +214,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Power_h__
|
||||
#endif // __nFRC_2015_1_0_A_Power_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_Relay_h__
|
||||
#define __nFRC_2015_1_0_9_Relay_h__
|
||||
#ifndef __nFRC_2015_1_0_A_Relay_h__
|
||||
#define __nFRC_2015_1_0_A_Relay_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tRelay
|
||||
@@ -65,4 +65,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_Relay_h__
|
||||
#endif // __nFRC_2015_1_0_A_Relay_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_SPI_h__
|
||||
#define __nFRC_2015_1_0_9_SPI_h__
|
||||
#ifndef __nFRC_2015_1_0_A_SPI_h__
|
||||
#define __nFRC_2015_1_0_A_SPI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tSPI
|
||||
@@ -65,4 +65,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_SPI_h__
|
||||
#endif // __nFRC_2015_1_0_A_SPI_h__
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_9_SysWatchdog_h__
|
||||
#define __nFRC_2015_1_0_9_SysWatchdog_h__
|
||||
#ifndef __nFRC_2015_1_0_A_SysWatchdog_h__
|
||||
#define __nFRC_2015_1_0_A_SysWatchdog_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_9
|
||||
namespace nFRC_2015_1_0_A
|
||||
{
|
||||
|
||||
class tSysWatchdog
|
||||
@@ -105,4 +105,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_9_SysWatchdog_h__
|
||||
#endif // __nFRC_2015_1_0_A_SysWatchdog_h__
|
||||
|
||||
@@ -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__
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Port.h"
|
||||
#include "HAL/Errors.hpp"
|
||||
#include "ctre/ctre.h"
|
||||
#include "visa/visa.h"
|
||||
#include "ChipObject.h"
|
||||
#include "NetworkCommunication/FRCComm.h"
|
||||
#include "NetworkCommunication/UsageReporting.h"
|
||||
@@ -10,6 +11,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <signal.h> // linux for kill
|
||||
const uint32_t solenoid_kNumDO7_0Elements = 8;
|
||||
const uint32_t dio_kNumSystems = tDIO::kNumSystems;
|
||||
@@ -17,6 +19,7 @@ const uint32_t interrupt_kNumSystems = tInterrupt::kNumSystems;
|
||||
const uint32_t kSystemClockTicksPerMicrosecond = 40;
|
||||
|
||||
static tGlobal *global;
|
||||
static tSysWatchdog *watchdog;
|
||||
|
||||
void* getPort(uint8_t pin)
|
||||
{
|
||||
@@ -101,7 +104,31 @@ const char* getHALErrorMessage(int32_t code)
|
||||
case ERR_CANSessionMux_NotAllowed:
|
||||
return ERR_CANSessionMux_NotAllowed_MESSAGE;
|
||||
case ERR_CANSessionMux_NotInitialized:
|
||||
return ERR_CANSessionMux_NotInitialized_MESSAGE;
|
||||
return ERR_CANSessionMux_NotInitialized_MESSAGE;
|
||||
case VI_ERROR_SYSTEM_ERROR:
|
||||
return VI_ERROR_SYSTEM_ERROR_MESSAGE;
|
||||
case VI_ERROR_INV_OBJECT:
|
||||
return VI_ERROR_INV_OBJECT_MESSAGE;
|
||||
case VI_ERROR_RSRC_LOCKED:
|
||||
return VI_ERROR_RSRC_LOCKED_MESSAGE;
|
||||
case VI_ERROR_RSRC_NFOUND:
|
||||
return VI_ERROR_RSRC_NFOUND_MESSAGE;
|
||||
case VI_ERROR_INV_RSRC_NAME:
|
||||
return VI_ERROR_INV_RSRC_NAME_MESSAGE;
|
||||
case VI_ERROR_QUEUE_OVERFLOW:
|
||||
return VI_ERROR_QUEUE_OVERFLOW_MESSAGE;
|
||||
case VI_ERROR_IO:
|
||||
return VI_ERROR_IO_MESSAGE;
|
||||
case VI_ERROR_ASRL_PARITY:
|
||||
return VI_ERROR_ASRL_PARITY_MESSAGE;
|
||||
case VI_ERROR_ASRL_FRAMING:
|
||||
return VI_ERROR_ASRL_FRAMING_MESSAGE;
|
||||
case VI_ERROR_ASRL_OVERRUN:
|
||||
return VI_ERROR_ASRL_OVERRUN_MESSAGE;
|
||||
case VI_ERROR_RSRC_BUSY:
|
||||
return VI_ERROR_RSRC_BUSY_MESSAGE;
|
||||
case VI_ERROR_INV_PARAMETER:
|
||||
return VI_ERROR_INV_PARAMETER_MESSAGE;
|
||||
default:
|
||||
return "Unknown error status";
|
||||
}
|
||||
@@ -179,16 +206,31 @@ int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint
|
||||
return FRC_NetworkCommunication_getJoystickButtons(joystickNum, buttons, count);
|
||||
}
|
||||
|
||||
void HALSetNewDataSem(pthread_mutex_t * param)
|
||||
void HALSetNewDataSem(pthread_cond_t * param)
|
||||
{
|
||||
setNewDataSem(param);
|
||||
}
|
||||
|
||||
bool HALGetSystemActive(int32_t *status)
|
||||
{
|
||||
return watchdog->readStatus_SystemActive(status);
|
||||
}
|
||||
|
||||
bool HALGetBrownedOut(int32_t *status)
|
||||
{
|
||||
return !(watchdog->readStatus_PowerAlive(status));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to start up HAL. This is required for robot programs.
|
||||
*/
|
||||
int HALInitialize(int mode)
|
||||
{
|
||||
setlinebuf(stdin);
|
||||
setlinebuf(stdout);
|
||||
|
||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
||||
|
||||
FRC_NetworkCommunication_Reserve(nullptr);
|
||||
// image 4; Fixes errors caused by multiple processes. Talk to NI about this
|
||||
nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
|
||||
@@ -196,6 +238,7 @@ int HALInitialize(int mode)
|
||||
|
||||
int32_t status;
|
||||
global = tGlobal::create(&status);
|
||||
watchdog = tSysWatchdog::create(&status);
|
||||
|
||||
// Kill any previous robot programs
|
||||
std::fstream fs;
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
*/
|
||||
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
|
||||
|
||||
#if defined(__linux)
|
||||
/**
|
||||
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
|
||||
*
|
||||
@@ -67,6 +68,7 @@ public:
|
||||
* @return This should return 0 if all status was retrieved successfully or an error code if not.
|
||||
*/
|
||||
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,7 +91,7 @@ extern "C" {
|
||||
# if defined (__vxworks)
|
||||
void EXPORT_FUNC setNewDataSem(SEM_ID);
|
||||
# else
|
||||
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
|
||||
void EXPORT_FUNC setNewDataSem(pthread_cond_t *);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,7 +68,11 @@ namespace nUsageReporting
|
||||
kResourceType_HiTechnicColorSensor,
|
||||
kResourceType_HiTechnicAccel,
|
||||
kResourceType_HiTechnicCompass,
|
||||
kResourceType_SRF08,
|
||||
kResourceType_SRF08,
|
||||
kResourceType_AnalogOutput,
|
||||
kResourceType_VictorSP,
|
||||
kResourceType_TalonSRX,
|
||||
kResourceType_CANTalonSRX,
|
||||
} tResourceType;
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -41,12 +41,28 @@ float getUserCurrent6V(int32_t *status) {
|
||||
return power->readUserCurrent6V(status) / 4.096f * 0.005566f - 0.009f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active state of the 6V rail
|
||||
*/
|
||||
bool getUserActive6V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readStatus_User6V(status) == 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fault count for the 6V rail
|
||||
*/
|
||||
int getUserCurrentFaults6V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount6V(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the 5V rail voltage
|
||||
*/
|
||||
float getUserVoltage5V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readUserVoltage5V(status) / 4.096f * 0.004962f - 0.013f;
|
||||
return power->readUserVoltage5V(status) / 4.096f * 0.005962f - 0.013f;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,6 +73,27 @@ float getUserCurrent5V(int32_t *status) {
|
||||
return power->readUserCurrent5V(status) / 4.096f * 0.001996f - 0.002f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active state of the 5V rail
|
||||
*/
|
||||
bool getUserActive5V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readStatus_User5V(status) == 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fault count for the 5V rail
|
||||
*/
|
||||
int getUserCurrentFaults5V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount5V(status);
|
||||
}
|
||||
|
||||
unsigned char getUserStatus5V(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readStatus_User5V(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the 3.3V rail voltage
|
||||
*/
|
||||
@@ -72,3 +109,19 @@ float getUserCurrent3V3(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readUserCurrent3V3(status) / 4.096f * 0.002486f - 0.003f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active state of the 3.3V rail
|
||||
*/
|
||||
bool getUserActive3V3(int32_t *status) {
|
||||
initializePower(status);
|
||||
return power->readStatus_User3V3(status) == 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fault count for the 3.3V rail
|
||||
*/
|
||||
int getUserCurrentFaults3V3(int32_t *status) {
|
||||
initializePower(status);
|
||||
return (int)power->readOverCurrentFaultCounts_OverCurrentFaultCount3V3(status);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#include "HAL/Semaphore.hpp"
|
||||
|
||||
#include "Log.hpp"
|
||||
@@ -122,11 +121,10 @@ void deleteMultiWait(MULTIWAIT_ID sem) {
|
||||
delete sem;
|
||||
}
|
||||
|
||||
int8_t takeMultiWait(MULTIWAIT_ID sem, int32_t timeout) {
|
||||
MUTEX_ID m = initializeMutexNormal();
|
||||
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout) {
|
||||
takeMutex(m);
|
||||
int8_t val = pthread_cond_wait(sem, m);
|
||||
deleteMutex(m);
|
||||
giveMutex(m);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
146
hal/lib/Athena/SerialPort.cpp
Normal file
146
hal/lib/Athena/SerialPort.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
#include "HAL/SerialPort.hpp"
|
||||
#include "visa/visa.h"
|
||||
|
||||
|
||||
uint32_t m_resourceManagerHandle;
|
||||
uint32_t m_portHandle[2];
|
||||
|
||||
void serialInitializePort(uint8_t port, int32_t *status) {
|
||||
char const * portName;
|
||||
|
||||
if (m_resourceManagerHandle ==0)
|
||||
viOpenDefaultRM((ViSession*)&m_resourceManagerHandle);
|
||||
|
||||
if(port == 0)
|
||||
portName = "ASRL1::INSTR";
|
||||
else
|
||||
portName = "ASRL2::INSTR";
|
||||
|
||||
*status = viOpen(m_resourceManagerHandle, const_cast<char*>(portName), VI_NULL, VI_NULL, (ViSession*)&m_portHandle[port]);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetBaudRate(uint8_t port, uint32_t baud, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_BAUD, baud);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetDataBits(uint8_t port, uint8_t bits, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_DATA_BITS, bits);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetParity(uint8_t port, uint8_t parity, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_PARITY, parity);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetStopBits(uint8_t port, uint8_t stopBits, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_STOP_BITS, stopBits);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetWriteMode(uint8_t port, uint8_t mode, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_WR_BUF_OPER_MODE, mode);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetFlowControl(uint8_t port, uint8_t flow, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_FLOW_CNTRL, flow);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetTimeout(uint8_t port, float timeout, int32_t *status) {
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_TMO_VALUE, (uint32_t)(timeout * 1e3));
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialEnableTermination(uint8_t port, char terminator, int32_t *status) {
|
||||
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR_EN, VI_TRUE);
|
||||
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR, terminator);
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_END_IN, VI_ASRL_END_TERMCHAR);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialDisableTermination(uint8_t port, int32_t *status) {
|
||||
viSetAttribute(m_portHandle[port], VI_ATTR_TERMCHAR_EN, VI_FALSE);
|
||||
*status = viSetAttribute(m_portHandle[port], VI_ATTR_ASRL_END_IN, VI_ASRL_END_NONE);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetReadBufferSize(uint8_t port, uint32_t size, int32_t *status) {
|
||||
*status = viSetBuf(m_portHandle[port], VI_READ_BUF, size);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialSetWriteBufferSize(uint8_t port, uint32_t size, int32_t *status) {
|
||||
*status = viSetBuf(m_portHandle[port], VI_WRITE_BUF, size);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
int32_t serialGetBytesReceived(uint8_t port, int32_t *status) {
|
||||
int32_t bytes = 0;
|
||||
|
||||
*status = viGetAttribute(m_portHandle[port], VI_ATTR_ASRL_AVAIL_NUM, &bytes);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
uint32_t serialRead(uint8_t port, char* buffer, int32_t count, int32_t *status) {
|
||||
uint32_t retCount = 0;
|
||||
|
||||
*status = viRead(m_portHandle[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
|
||||
|
||||
if(*status == VI_ERROR_IO || *status == VI_ERROR_ASRL_OVERRUN || *status == VI_ERROR_ASRL_FRAMING || *status == VI_ERROR_ASRL_PARITY)
|
||||
{
|
||||
int32_t localStatus = 0;
|
||||
serialClear(port, &localStatus);
|
||||
}
|
||||
|
||||
if(*status == VI_ERROR_TMO || *status > 0)
|
||||
*status = 0;
|
||||
return retCount;
|
||||
}
|
||||
|
||||
uint32_t serialWrite(uint8_t port, const char *buffer, int32_t count, int32_t *status) {
|
||||
uint32_t retCount = 0;
|
||||
|
||||
*status = viWrite(m_portHandle[port], (ViPBuf)buffer, count, (ViPUInt32)&retCount);
|
||||
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
return retCount;
|
||||
}
|
||||
|
||||
void serialFlush(uint8_t port, int32_t *status) {
|
||||
*status = viFlush(m_portHandle[port], VI_WRITE_BUF);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialClear(uint8_t port, int32_t *status) {
|
||||
*status = viClear(m_portHandle[port]);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
void serialClose(uint8_t port, int32_t *status) {
|
||||
*status = viClose(m_portHandle[port]);
|
||||
if(*status > 0)
|
||||
*status = 0;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user