Initial commit of the WPILib simulation support in an alpha quality state.

Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.

Added Omar's changes to the compressor interface

Fixes to make C++ plugin compile on linux.

Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.

Fixed wpilibJavaSim artifactId to mirror the new convention.

Modified the build of the java plugin to pull in the simulation dependencies.

Added stacktrace printing.

Fixed support for creating projects.

Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.

Added support for a "WPILib Simulate" button.

Added GearsBot to the built in examples.

Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.

Removed unused import.

Added file browser for world files.

Added support for debugging in simulation.

Change simulate icon to be a Gazebo icon.

Switched over to the gazebo messaging system.

Updated location of default world file.

Reverted cmake change.

Fixed bug in WPILibJSim, added better logging and cleaned up code.

Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.

Added installation to frc_gazebo_plugin Makefile.

Fixed running of simulation to actually use frcsim.

Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.

Added notes for generating protobuf messages.

Import of the debuild process into the main repository.

Moved frc_gazebo_plugin under simulation and removed the gazebo folder.

Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].

Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.

Reduced delay between starting frcsim and the users program to 1 second.

Updated GearsBot example.

Fixed a few minor issues for demoable state.

Added simulator support for Victors, Jaguars and Talons.

Added NetworkTables, SmartDashboard and LiveWindow to the simulator.

Added AnalogPotentiometer for simulation.

Added support for simulating encoders.

Added simulation support for Gyro.

Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.

Added RobotDrive support to simulation.

Separated out JavaGazebo so that SimDS will be able to reuse it.

Separated out SimDS into its own application..

Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.

Added DriverStation support to WPILibCSim

Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.

Cleanup of includes for WPILibCSim

Added AnalogPotentiometer to the real WPILibC.

Added AnalogPotentiometer to the real WPILibC.

Added GearsBot example to C++ eclipse plugin.

WPILibCSim fixes to work with launching from the plugin.

Package libwpilibsim in a deb file.

Added includes to plugin distribution.

Added support for external-limit-switches to Gazebo, Java and C++.

Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.

Added support for internal limit switches.

Updated GearsBot programs to use limit switches + range finders.

Added disabling of motors when robot is disabled to more closely mimic the real robot.

Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.

Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
This commit is contained in:
Alex Henning
2014-06-12 11:02:26 -07:00
committed by thomasclark
parent d5a509c7e7
commit cb56c9a144
425 changed files with 38450 additions and 335 deletions

View File

@@ -64,8 +64,8 @@ public class AntPropertiesParser {
matcher.appendReplacement(sb, Matcher.quoteReplacement(props.getProperty(prop)));
} else if (prop.equals("user.home")) {
matcher.appendReplacement(sb, Matcher.quoteReplacement(System.getProperty("user.home")));
} else {
throw new CoreException(new Status(0, "WPI", "Could not parse build.properties file, unsupported property: "+prop));
} else {
matcher.appendReplacement(sb, Matcher.quoteReplacement(matcher.group()));
}
}
matcher.appendTail( sb );

View File

@@ -12,7 +12,6 @@ import javax.swing.JOptionPane;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.omg.CORBA.Environment;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;

View File

@@ -2,6 +2,7 @@ package edu.wpi.first.wpilib.plugins.core.wizards;
import java.util.Map;
import javax.activation.FileDataSource;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -11,10 +12,14 @@ import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
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.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -29,6 +34,8 @@ public class NewProjectMainPage extends WizardPage {
private Text projectNameText;
private Text packageText;
Map<String, ProjectType> types;
private Text worldText;
private Button worldButton;
Button simpleRobot, iterativeRobot, commandRobot;
private boolean showPackage;
@@ -113,6 +120,32 @@ public class NewProjectMainPage extends WizardPage {
gd.widthHint = 300;
commandRobot.setLayoutData(gd);
}
label = new Label(container, SWT.NULL);
label.setText("Simulation &World:");
Composite comp = new Composite(container, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
comp.setLayoutData(gd);
GridLayout groupLayout = new GridLayout();
groupLayout.numColumns = 2;
comp.setLayout(groupLayout);
worldText = new Text(comp, SWT.BORDER | SWT.SINGLE);
worldText.setLayoutData(gd);
worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world");
worldText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialogChanged();
}
});
worldButton = new Button(comp, SWT.NULL);
worldButton.setText("Browse");
worldButton.addSelectionListener(new SelectionAdapter() {
@Override public void widgetSelected(SelectionEvent e) {
browse();
}
});
initialize();
dialogChanged();
@@ -125,12 +158,12 @@ public class NewProjectMainPage extends WizardPage {
private void initialize() {
String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
if (showPackage) {
packageText.setText("com.first.team"+teamNumber+".robot");
packageText.setText("org.usfirst.frc.team"+teamNumber+".robot");
if (teamNumberPage != null) {
teamNumberPage.registerChangeListener(new ChangeListener() {
@Override public void stateChanged(ChangeEvent e) {
String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
packageText.setText("com.first.team"+teamNumber+".robot");
packageText.setText("org.usfirst.frc.team"+teamNumber+".robot");
}
});
@@ -159,9 +192,22 @@ public class NewProjectMainPage extends WizardPage {
updateStatus("Must be valid java package");
return;
}
updateStatus(null);
}
private void browse() {
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
dialog.setText("Pick a World to Simulate");
dialog.setFileName(worldText.getText());
dialog.setFilterNames(new String[] { "World Files", "All Files (*.*)" });
dialog.setFilterExtensions(new String[] { "*.world", "*.*" });
String result = dialog.open();
if (result != null) {
worldText.setText(result);
}
}
private void updateStatus(String message) {
setErrorMessage(message);
setPageComplete(message == null);
@@ -182,6 +228,10 @@ public class NewProjectMainPage extends WizardPage {
else return types.get(ProjectType.COMMAND_BASED);
}
public String getWorld() {
return worldText.getText().replace(System.getenv("HOME"), "${user.home}");
}
public void setShowPackage(boolean bool) {
showPackage = bool;
}
@@ -194,4 +244,4 @@ public class NewProjectMainPage extends WizardPage {
showProjectTypes = true;
this.types = types;
}
}
}

View File

@@ -180,6 +180,41 @@
mode="debug">
</description>
</shortcut>
<shortcut
class="edu.wpi.first.wpilib.plugins.cpp.launching.SimulateLaunchShortcut"
description="Test the WPILib project using the Gazebo simulator."
icon="resources/icons/wpi.ico"
id="edu.wpi.first.wpilib.plugins.cpp.launching.simulate"
label="WPILib Simulate"
modes="run,debug">
<contextualLaunch>
<enablement>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</contextualLaunch>
<description
description="Test the WPILib project using the Gazebo simulator."
mode="run">
</description>
<description
description="Debug the WPILib project using the Gazebo simulator."
mode="debug">
</description>
</shortcut>
</extension>
<extension
point="org.eclipse.ui.startup">

View File

@@ -63,9 +63,16 @@
<groupId>edu.wpi.first.wpilib.cmake</groupId>
<artifactId>cpp-root</artifactId>
<version>1.0.0</version>
<type>zip</type>
<type>zip</type>
<destFileName>cpp-root.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibc.simulation</groupId>
<artifactId>WPILibCSim</artifactId>
<version>0.1.0</version>
<type>zip</type>
<destFileName>sim-include.zip</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
@@ -73,6 +80,38 @@
<prependGroupId>true</prependGroupId>
</configuration>
</execution>
<!-- Simulation -->
<execution>
<id>fetch-sim-jar-zip-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${cpp-zip}/sim/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<artifactItems>
<artifactItem>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<version>2.0.5</version>
<classifier>natives-linux</classifier>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj.simulation</groupId>
<artifactId>SimDS</artifactId>
<version>0.1.0-SNAPSHOT</version>
<destFileName>SimDS.jar</destFileName>
<outputDirectory>${cpp-zip}/sim/tools</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
@@ -80,6 +119,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<!-- Set time stamp and version properties. -->
<execution>
<id>set-version-info</id>
@@ -100,6 +140,7 @@
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
<!-- Unzip the include files for cpp.zip. -->
<execution>
<id>unzip-cpp-includes</id>
@@ -112,11 +153,29 @@
<unzip dest="${cpp-zip}">
<fileset dir="${project.build.directory}">
<include name="cpp-root.jar"/>
<include name="sim-include.zip"/>
</fileset>
</unzip>
</target>
</configuration>
</execution>
<!-- Unzip jinput *.so's -->
<execution>
<id>unzip-jinput-libs</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<unzip src="${cpp-zip}/sim/lib/jinput-platform-2.0.5-natives-linux.jar"
dest="${cpp-zip}/sim/lib"
overwrite="true" />
</target>
</configuration>
</execution>
<!-- Generate zip file to unzip for the user. -->
<execution>
<id>generate-cpp-zip</id>
@@ -141,5 +200,11 @@
<version>1.0.0</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilibc.simulation</groupId>
<artifactId>WPILibCSim</artifactId>
<version>0.1.0</version>
<type>zip</type>
</dependency>
</dependencies>
</project>

View File

@@ -128,6 +128,76 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318.2017904325">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318.2017904325" moduleId="org.eclipse.cdt.core.settings" name="Simulate">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" 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.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</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.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser" id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318.2017904325" name="Simulate" parent="cdt.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.418253318.2017904325." name="/" resourcePath="">
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.base.1184188597" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1621111203" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder buildPath="${workspace_loc:/${ProjName}}/Simulate" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.target.gnu.builder.base.840272037" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.158466008" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2105416021" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option id="gnu.cpp.compiler.option.include.paths.1645322059" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/src&quot;"/>
<listOptionValue builtIn="false" value="$cpp-location/sim/include"/>
<listOptionValue builtIn="false" value="/usr/include"/>
<listOptionValue builtIn="false" value="/usr/include/gazebo-2.2"/>
<listOptionValue builtIn="false" value="/usr/include/sdformat-1.4"/>
</option>
<option id="gnu.cpp.compiler.option.optimization.level.1648211502" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.937474733" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1758810658" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.c.compiler.base.2039239712" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.2100353684" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.1900634657" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1197133064" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.66697269" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" 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="WPILibSim"/>
<listOptionValue builtIn="false" value="gazebo"/>
<listOptionValue builtIn="false" value="gazebo_transport"/>
<listOptionValue builtIn="false" value="gazebo_msgs"/>
<listOptionValue builtIn="false" value="gazebo_common"/>
<listOptionValue builtIn="false" value="protobuf"/>
<listOptionValue builtIn="false" value="boost_system"/>
<listOptionValue builtIn="false" value="dl"/>
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.paths.1677933356" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="/usr/lib/x86_64-linux-gnu"/>
<listOptionValue builtIn="false" value="/usr/lib/x86_64-linux-gnu/gazebo-2.2/plugins"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.152327207" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.tool.gnu.assembler.base.2105089872" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.254601899" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="$project.cdt.managedbuild.target.gnu.cross.exe.548740421" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
@@ -195,5 +265,8 @@
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/$project"/>
</configuration>
<configuration configurationName="Simulate">
<resource resourceType="PROJECT" workspacePath="/$project"/>
</configuration>
</storageModule>
</cproject>

View File

@@ -18,4 +18,11 @@ classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar
out=FRCUserProgram
src.dir=src
build.dir=build
out.exe=Debug/${out}
out.exe=Debug/${out}
# Simulation
simulation.world.file=$world
sim.exe=Simulate/${out}
wpilib.sim=${wpilib}/sim
sim.tools=${wpilib.sim}/tools
sim.lib=${wpilib.sim}/lib

View File

@@ -0,0 +1,22 @@
#include "Autonomous.h"
#include "PrepareToPickup.h"
#include "Pickup.h"
#include "Place.h"
#include "SetDistanceToBox.h"
#include "DriveStraight.h"
#include "SetWristSetpoint.h"
#include "CloseClaw.h"
#include <iostream>
Autonomous::Autonomous() : CommandGroup("Autonomous") {
AddSequential(new PrepareToPickup());
AddSequential(new Pickup());
AddSequential(new SetDistanceToBox(0.10));
// AddSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is broken
AddSequential(new Place());
AddSequential(new SetDistanceToBox(0.60));
// addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic is broken
AddParallel(new SetWristSetpoint(-45));
AddSequential(new CloseClaw());
}

View File

@@ -0,0 +1,15 @@
#ifndef Autonomous_H
#define Autonomous_H
#include "Commands/CommandGroup.h"
/**
* The main autonomous command to pickup and deliver the
* soda to the box.
*/
class Autonomous: public CommandGroup {
public:
Autonomous();
};
#endif

View File

@@ -0,0 +1,34 @@
#include "CloseClaw.h"
#include "Robot.h"
CloseClaw::CloseClaw() : Command("CloseClaw") {
Requires(Robot::claw);
}
// Called just before this Command runs the first time
void CloseClaw::Initialize() {
Robot::claw->Close();
}
// Called repeatedly when this Command is scheduled to run
void CloseClaw::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool CloseClaw::IsFinished() {
return Robot::claw->IsGripping() ;
}
// Called once after isFinished returns true
void CloseClaw::End() {
// NOTE: Doesn't stop in simulation due to lower friction causing the can to fall out
// + there is no need to worry about stalling the motor or crushing the can.
#ifdef REAL
Robot::claw->Stop();
#endif
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void CloseClaw::Interrupted() {
End();
}

View File

@@ -0,0 +1,20 @@
#ifndef CloseClaw_H
#define CloseClaw_H
#include "Commands/Command.h"
/**
* Opens the claw for one second. Real robots should use sensors, stalling
* motors is BAD!
*/
class CloseClaw: public Command {
public:
CloseClaw();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@@ -0,0 +1,50 @@
#include "DriveStraight.h"
#include "Robot.h"
DriveStraight::DriveStraight(double distance) {
Requires(Robot::drivetrain);
pid = new PIDController(4, 0, 0, new DriveStraightPIDSource(),
new DriveStraightPIDOutput());
pid->SetAbsoluteTolerance(0.01);
pid->SetSetpoint(distance);
}
// Called just before this Command runs the first time
void DriveStraight::Initialize() {
// Get everything in a safe starting state.
Robot::drivetrain->Reset();
pid->Reset();
pid->Enable();
}
// Called repeatedly when this Command is scheduled to run
void DriveStraight::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool DriveStraight::IsFinished() {
return pid->OnTarget();
}
// Called once after isFinished returns true
void DriveStraight::End() {
// Stop PID and the wheels
pid->Disable();
Robot::drivetrain->Drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void DriveStraight::Interrupted() {
End();
}
DriveStraightPIDSource::~DriveStraightPIDSource() {}
double DriveStraightPIDSource::PIDGet() {
return Robot::drivetrain->GetDistance();
}
DriveStraightPIDOutput::~DriveStraightPIDOutput() {}
void DriveStraightPIDOutput::PIDWrite(float d) {
Robot::drivetrain->Drive(d, d);
}

View File

@@ -0,0 +1,37 @@
#ifndef DriveStraight_H
#define DriveStraight_H
#include "WPILib.h"
#include "Commands/Command.h"
/**
* Drive the given distance straight (negative values go backwards).
* Uses a local PID controller to run a simple PID loop that is only
* enabled while this command is running. The input is the averaged
* values of the left and right encoders.
*/
class DriveStraight: public Command {
public:
DriveStraight(double distance);
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
private:
PIDController* pid;
};
class DriveStraightPIDSource: public PIDSource {
public:
virtual ~DriveStraightPIDSource();
double PIDGet();
};
class DriveStraightPIDOutput: public PIDOutput {
public:
virtual ~DriveStraightPIDOutput();
void PIDWrite(float d);
};
#endif

View File

@@ -0,0 +1,31 @@
#include "OpenClaw.h"
#include "Robot.h"
OpenClaw::OpenClaw() : Command("OpenClaw") {
Requires(Robot::claw);
SetTimeout(1);
}
// Called just before this Command runs the first time
void OpenClaw::Initialize() {
Robot::claw->Open();
}
// Called repeatedly when this Command is scheduled to run
void OpenClaw::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool OpenClaw::IsFinished() {
return IsTimedOut();
}
// Called once after isFinished returns true
void OpenClaw::End() {
Robot::claw->Stop();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void OpenClaw::Interrupted() {
End();
}

View File

@@ -0,0 +1,20 @@
#ifndef OpenClaw_H
#define OpenClaw_H
#include "Commands/Command.h"
/**
* Opens the claw for one second. Real robots should use sensors, stalling
* motors is BAD!
*/
class OpenClaw: public Command {
public:
OpenClaw();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@@ -0,0 +1,12 @@
#include "Pickup.h"
#include "CloseClaw.h"
#include "SetWristSetpoint.h"
#include "SetElevatorSetpoint.h"
#include <iostream>
Pickup::Pickup() : CommandGroup("Pickup") {
AddSequential(new CloseClaw());
AddParallel(new SetWristSetpoint(-45));
AddSequential(new SetElevatorSetpoint(0.25));
}

View File

@@ -0,0 +1,15 @@
#ifndef Pickup_H
#define Pickup_H
#include "Commands/CommandGroup.h"
/**
* Pickup a soda can (if one is between the open claws) and
* get it in a safe state to drive around.
*/
class Pickup: public CommandGroup {
public:
Pickup();
};
#endif

View File

@@ -0,0 +1,12 @@
#include "Place.h"
#include "OpenClaw.h"
#include "SetWristSetpoint.h"
#include "SetElevatorSetpoint.h"
#include <iostream>
Place::Place() : CommandGroup("Place") {
AddSequential(new SetElevatorSetpoint(0.25));
AddSequential(new SetWristSetpoint(0));
AddSequential(new OpenClaw());
}

View File

@@ -0,0 +1,14 @@
#ifndef Place_H
#define Place_H
#include "Commands/CommandGroup.h"
/**
* Place a held soda can onto the platform.
*/
class Place: public CommandGroup {
public:
Place();
};
#endif

View File

@@ -0,0 +1,12 @@
#include "PrepareToPickup.h"
#include "OpenClaw.h"
#include "SetWristSetpoint.h"
#include "SetElevatorSetpoint.h"
#include <iostream>
PrepareToPickup::PrepareToPickup() : CommandGroup("PrepareToPickup") {
AddParallel(new OpenClaw());
AddParallel(new SetWristSetpoint(0));
AddSequential(new SetElevatorSetpoint(0));
}

View File

@@ -0,0 +1,14 @@
#ifndef PrepareToPickup_H
#define PrepareToPickup_H
#include "Commands/CommandGroup.h"
/**
* Make sure the robot is in a state to pickup soda cans.
*/
class PrepareToPickup: public CommandGroup {
public:
PrepareToPickup();
};
#endif

View File

@@ -0,0 +1,50 @@
#include "SetDistanceToBox.h"
#include "Robot.h"
SetDistanceToBox::SetDistanceToBox(double distance) {
Requires(Robot::drivetrain);
pid = new PIDController(-2, 0, 0, new SetDistanceToBoxPIDSource(),
new SetDistanceToBoxPIDOutput());
pid->SetAbsoluteTolerance(0.01);
pid->SetSetpoint(distance);
}
// Called just before this Command runs the first time
void SetDistanceToBox::Initialize() {
// Get everything in a safe starting state.
Robot::drivetrain->Reset();
pid->Reset();
pid->Enable();
}
// Called repeatedly when this Command is scheduled to run
void SetDistanceToBox::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool SetDistanceToBox::IsFinished() {
return pid->OnTarget();
}
// Called once after isFinished returns true
void SetDistanceToBox::End() {
// Stop PID and the wheels
pid->Disable();
Robot::drivetrain->Drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void SetDistanceToBox::Interrupted() {
End();
}
SetDistanceToBoxPIDSource::~SetDistanceToBoxPIDSource() {}
double SetDistanceToBoxPIDSource::PIDGet() {
return Robot::drivetrain->GetDistanceToObstacle();
}
SetDistanceToBoxPIDOutput::~SetDistanceToBoxPIDOutput() {}
void SetDistanceToBoxPIDOutput::PIDWrite(float d) {
Robot::drivetrain->Drive(d, d);
}

View File

@@ -0,0 +1,37 @@
#ifndef SetDistanceToBox_H
#define SetDistanceToBox_H
#include "WPILib.h"
#include "Commands/Command.h"
/**
* Drive until the robot is the given distance away from the box. Uses a local
* PID controller to run a simple PID loop that is only enabled while this
* command is running. The input is the averaged values of the left and right
* encoders.
*/
class SetDistanceToBox: public Command {
public:
SetDistanceToBox(double distance);
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
private:
PIDController* pid;
};
class SetDistanceToBoxPIDSource: public PIDSource {
public:
virtual ~SetDistanceToBoxPIDSource();
double PIDGet();
};
class SetDistanceToBoxPIDOutput: public PIDOutput {
public:
virtual ~SetDistanceToBoxPIDOutput();
void PIDWrite(float d);
};
#endif

View File

@@ -0,0 +1,29 @@
#include "SetElevatorSetpoint.h"
#include "Robot.h"
#include <math.h>
SetElevatorSetpoint::SetElevatorSetpoint(double setpoint) : Command("SetElevatorSetpoint") {
this->setpoint = setpoint;
Requires(Robot::elevator);
}
// Called just before this Command runs the first time
void SetElevatorSetpoint::Initialize() {
Robot::elevator->SetSetpoint(setpoint);
Robot::elevator->Enable();
}
// Called repeatedly when this Command is scheduled to run
void SetElevatorSetpoint::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool SetElevatorSetpoint::IsFinished() {
return Robot::elevator->OnTarget();
}
// Called once after isFinished returns true
void SetElevatorSetpoint::End() {}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void SetElevatorSetpoint::Interrupted() {}

View File

@@ -0,0 +1,23 @@
#ifndef SetElevatorSetpoint_H
#define SetElevatorSetpoint_H
#include "Commands/Command.h"
/**
* Move the elevator to a given location. This command finishes when it is within
* the tolerance, but leaves the PID loop running to maintain the position. Other
* commands using the elevator should make sure they disable PID!
*/
class SetElevatorSetpoint: public Command {
private:
double setpoint;
public:
SetElevatorSetpoint(double setpoint);
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@@ -0,0 +1,28 @@
#include "SetWristSetpoint.h"
#include "Robot.h"
SetWristSetpoint::SetWristSetpoint(double setpoint) : Command("SetWristSetpoint") {
this->setpoint = setpoint;
Requires(Robot::wrist);
}
// Called just before this Command runs the first time
void SetWristSetpoint::Initialize() {
Robot::wrist->SetSetpoint(setpoint);
Robot::wrist->Enable();
}
// Called repeatedly when this Command is scheduled to run
void SetWristSetpoint::Execute() {}
// Make this return true when this Command no longer needs to run execute()
bool SetWristSetpoint::IsFinished() {
return Robot::wrist->OnTarget();
}
// Called once after isFinished returns true
void SetWristSetpoint::End() {}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void SetWristSetpoint::Interrupted() {}

View File

@@ -0,0 +1,23 @@
#ifndef SetWristSetpoint_H
#define SetWristSetpoint_H
#include "Commands/Command.h"
/**
* Move the wrist to a given angle. This command finishes when it is within
* the tolerance, but leaves the PID loop running to maintain the position.
* Other commands using the wrist should make sure they disable PID!
*/
class SetWristSetpoint: public Command {
private:
double setpoint;
public:
SetWristSetpoint(double setpoint);
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@@ -0,0 +1,30 @@
#include "TankDriveWithJoystick.h"
#include "Robot.h"
TankDriveWithJoystick::TankDriveWithJoystick() : Command("TankDriveWithJoystick") {
Requires(Robot::drivetrain);
}
// Called just before this Command runs the first time
void TankDriveWithJoystick::Initialize() {}
// Called repeatedly when this Command is scheduled to run
void TankDriveWithJoystick::Execute() {
Robot::drivetrain->Drive(Robot::oi->GetJoystick());
}
// Make this return true when this Command no longer needs to run execute()
bool TankDriveWithJoystick::IsFinished() {
return false;
}
// Called once after isFinished returns true
void TankDriveWithJoystick::End() {
Robot::drivetrain->Drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
void TankDriveWithJoystick::Interrupted() {
End();
}

View File

@@ -0,0 +1,19 @@
#ifndef TankDriveWithJoystick_H
#define TankDriveWithJoystick_H
#include "Commands/Command.h"
/**
* Have the robot drive tank style using the PS3 Joystick until interrupted.
*/
class TankDriveWithJoystick: public Command {
public:
TankDriveWithJoystick();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif

View File

@@ -0,0 +1,50 @@
/*
* OI.cpp
*
* Created on: Jun 3, 2014
* Author: alex
*/
#include "OI.h"
#include "Commands/SetElevatorSetpoint.h"
#include "Commands/OpenClaw.h"
#include "Commands/CloseClaw.h"
#include "Commands/PrepareToPickup.h"
#include "Commands/Pickup.h"
#include "Commands/Place.h"
#include "Commands/Autonomous.h"
OI::OI() {
SmartDashboard::PutData("Open Claw", new OpenClaw());
SmartDashboard::PutData("Close Claw", new CloseClaw());
joy= new Joystick(1);
// Create some buttons
JoystickButton* d_up = new JoystickButton(joy, 5);
JoystickButton* d_right= new JoystickButton(joy, 6);
JoystickButton* d_down= new JoystickButton(joy, 7);
JoystickButton* d_left = new JoystickButton(joy, 8);
JoystickButton* l2 = new JoystickButton(joy, 9);
JoystickButton* r2 = new JoystickButton(joy, 10);
JoystickButton* l1 = new JoystickButton(joy, 11);
JoystickButton* r1 = new JoystickButton(joy, 12);
// Connect the buttons to commands
d_up->WhenPressed(new SetElevatorSetpoint(0.2));
d_down->WhenPressed(new SetElevatorSetpoint(-0.2));
d_right->WhenPressed(new CloseClaw());
d_left->WhenPressed(new OpenClaw());
r1->WhenPressed(new PrepareToPickup());
r2->WhenPressed(new Pickup());
l1->WhenPressed(new Place());
l2->WhenPressed(new Autonomous());
}
Joystick* OI::GetJoystick() {
return joy;
}

View File

@@ -0,0 +1,22 @@
/*
* OI.h
*
* Created on: Jun 3, 2014
* Author: alex
*/
#ifndef OI_H_
#define OI_H_
#include "WPILib.h"
class OI {
public:
OI();
Joystick* GetJoystick();
private:
Joystick* joy;
};
#endif /* OI_H_ */

View File

@@ -0,0 +1,56 @@
#include "Robot.h"
#include "Commands/Autonomous.h"
DriveTrain* Robot::drivetrain = NULL;
Elevator* Robot::elevator = NULL;
Wrist* Robot::wrist = NULL;
Claw* Robot::claw = NULL;
OI* Robot::oi = NULL;
void Robot::RobotInit() {
drivetrain = new DriveTrain();
elevator = new Elevator();
wrist = new Wrist();
claw = new Claw();
oi = new OI();
autonomousCommand = new Autonomous();
lw = LiveWindow::GetInstance();
// Show what command your subsystem is running on the SmartDashboard
SmartDashboard::PutData(drivetrain);
SmartDashboard::PutData(elevator);
SmartDashboard::PutData(wrist);
SmartDashboard::PutData(claw);
}
void Robot::AutonomousInit() {
autonomousCommand->Start();
std::cout << "Starting Auto" << std::endl;
}
void Robot::AutonomousPeriodic() {
Scheduler::GetInstance()->Run();
}
void Robot::TeleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
autonomousCommand->Cancel();
std::cout << "Starting Teleop" << std::endl;
}
void Robot::TeleopPeriodic() {
Scheduler::GetInstance()->Run();
}
void Robot::TestPeriodic() {
lw->Run();
}
START_ROBOT_CLASS(Robot);

View File

@@ -0,0 +1,41 @@
/*
* Robot.h
*
* Created on: Jun 3, 2014
* Author: alex
*/
#ifndef MY_ROBOT_H_
#define MY_ROBOT_H_
#include "WPILib.h"
#include "Commands/Command.h"
#include "Subsystems/DriveTrain.h"
#include "Subsystems/Elevator.h"
#include "Subsystems/Wrist.h"
#include "Subsystems/Claw.h"
#include "OI.h"
class Robot: public IterativeRobot {
public:
static DriveTrain* drivetrain;
static Elevator* elevator;
static Wrist* wrist;
static Claw* claw;
static OI* oi;
private:
Command *autonomousCommand;
LiveWindow *lw;
void RobotInit();
void AutonomousInit();
void AutonomousPeriodic();
void TeleopInit();
void TeleopPeriodic();
void TestPeriodic();
};
#endif /* ROBOT_H_ */

View File

@@ -0,0 +1,31 @@
#include "Subsystems/Claw.h"
Claw::Claw() : Subsystem("Claw") {
motor = new Victor(7);
contact = new DigitalInput(5);
// Let's show everything on the LiveWindow
// TODO: LiveWindow::GetInstance()->AddActuator("Claw", "Motor", (Victor) motor);
// TODO: contact
}
void Claw::Open()
{
motor->Set(-1);
}
void Claw::Close()
{
motor->Set(1);
}
void Claw::Stop() {
motor->Set(0);
}
bool Claw::IsGripping() {
return contact->Get();
}

View File

@@ -0,0 +1,45 @@
#ifndef Claw_H
#define Claw_H
#include "Commands/Subsystem.h"
#include "WPILib.h"
/**
* The claw subsystem is a simple system with a motor for opening and closing.
* If using stronger motors, you should probably use a sensor so that the
* motors don't stall.
*/
class Claw: public Subsystem {
private:
SpeedController* motor;
DigitalInput* contact;
public:
Claw();
void InitDefaultCommand() {}
/**
* Set the claw motor to move in the open direction.
*/
void Open();
/**
* Set the claw motor to move in the close direction.
*/
void Close();
/**
* Stops the claw motor from moving.
*/
void Stop();
/**
* Return true when the robot is grabbing an object hard enough
* to trigger the limit switch.
*/
bool IsGripping();
void Log() {}
};
#endif

View File

@@ -0,0 +1,90 @@
#include "DriveTrain.h"
#include "Commands/TankDriveWithJoystick.h"
DriveTrain::DriveTrain() : Subsystem("DriveTrain") {
front_left_motor = new Talon(1);
back_left_motor = new Talon(2);
front_right_motor = new Talon(3);
back_right_motor = new Talon(4);
drive = new RobotDrive(front_left_motor, back_left_motor,
front_right_motor, back_right_motor);
left_encoder = new Encoder(1, 2);
right_encoder = new Encoder(3, 4);
// Encoders may measure differently in the real world and in
// simulation. In this example the robot moves 0.042 barleycorns
// per tick in the real world, but the simulated encoders
// simulate 360 tick encoders. This if statement allows for the
// real robot to handle this difference in devices.
#ifdef REAL
left_encoder->SetDistancePerPulse(0.042);
right_encoder->SetDistancePerPulse(0.042);
#else
// Circumference in ft = 4in/12(in/ft)*PI
left_encoder->SetDistancePerPulse((double) (4.0/12.0*M_PI) / 360.0);
right_encoder->SetDistancePerPulse((double) (4.0/12.0*M_PI) / 360.0);
#endif
left_encoder->Start();
right_encoder->Start();
rangefinder = new AnalogChannel(6);
gyro = new Gyro(1);
// Let's show everything on the LiveWindow
// TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Front_Left Motor", (Talon) front_left_motor);
// TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Back Left Motor", (Talon) back_left_motor);
// TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Front Right Motor", (Talon) front_right_motor);
// TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Back Right Motor", (Talon) back_right_motor);
LiveWindow::GetInstance()->AddSensor("Drive Train", "Left Encoder", left_encoder);
LiveWindow::GetInstance()->AddSensor("Drive Train", "Right Encoder", right_encoder);
LiveWindow::GetInstance()->AddSensor("Drive Train", "Rangefinder", rangefinder);
LiveWindow::GetInstance()->AddSensor("Drive Train", "Gyro", gyro);
}
/**
* When no other command is running let the operator drive around
* using the PS3 joystick.
*/
void DriveTrain::InitDefaultCommand() {
SetDefaultCommand(new TankDriveWithJoystick());
}
/**
* The log method puts interesting information to the SmartDashboard.
*/
void DriveTrain::Log() {
SmartDashboard::PutNumber("Left Distance", left_encoder->GetDistance());
SmartDashboard::PutNumber("Right Distance", right_encoder->GetDistance());
SmartDashboard::PutNumber("Left Speed", left_encoder->GetRate());
SmartDashboard::PutNumber("Right Speed", right_encoder->GetRate());
SmartDashboard::PutNumber("Gyro", gyro->GetAngle());
}
void DriveTrain::Drive(double left, double right) {
drive->TankDrive(left, right);
}
void DriveTrain::Drive(Joystick* joy) {
Drive(-joy->GetY(), -joy->GetRawAxis(4));
}
double DriveTrain::GetHeading() {
return gyro->GetAngle();
}
void DriveTrain::Reset() {
gyro->Reset();
left_encoder->Reset();
right_encoder->Reset();
}
double DriveTrain::GetDistance() {
return (left_encoder->GetDistance() + right_encoder->GetDistance())/2;
}
double DriveTrain::GetDistanceToObstacle() {
// Really meters in simulation since it's a rangefinder...
return rangefinder->GetAverageVoltage();
}

View File

@@ -0,0 +1,68 @@
#ifndef DriveTrain_H
#define DriveTrain_H
#include "Commands/Subsystem.h"
#include "WPILib.h"
/**
* The DriveTrain subsystem incorporates the sensors and actuators attached to
* the robots chassis. These include four drive motors, a left and right encoder
* and a gyro.
*/
class DriveTrain : public Subsystem {
private:
SpeedController *front_left_motor, *back_left_motor,
*front_right_motor, *back_right_motor;
RobotDrive* drive;
Encoder *left_encoder, *right_encoder;
AnalogChannel* rangefinder;
Gyro* gyro;
public:
DriveTrain();
/**
* When no other command is running let the operator drive around
* using the PS3 joystick.
*/
void InitDefaultCommand();
/**
* The log method puts interesting information to the SmartDashboard.
*/
void Log();
/**
* Tank style driving for the DriveTrain.
* @param left Speed in range [-1,1]
* @param right Speed in range [-1,1]
*/
void Drive(double left, double right);
/**
* @param joy The ps3 style joystick to use to drive tank style.
*/
void Drive(Joystick* joy);
/**
* @return The robots heading in degrees.
*/
double GetHeading();
/**
* Reset the robots sensors to the zero states.
*/
void Reset();
/**
* @return The distance driven (average of left and right encoders).
*/
double GetDistance();
/**
* @return The distance to the obstacle detected by the rangefinder.
*/
double GetDistanceToObstacle();
};
#endif

View File

@@ -0,0 +1,36 @@
#include "Elevator.h"
#include "SmartDashboard/SmartDashboard.h"
#include "LiveWindow/LiveWindow.h"
Elevator::Elevator() : PIDSubsystem("Elevator", kP_real, kI_real, 0.0) {
#ifdef SIMULATION // Check for simulation and update PID values
GetPIDController()->SetPID(kP_simulation, kI_simulation, 0, 0);
#endif
SetAbsoluteTolerance(0.005);
motor = new Victor(5);
// Conversion value of potentiometer varies between the real world and simulation
#ifdef REAL
pot = new AnalogPotentiometer(2, -2.0/5);
#else
pot = new AnalogPotentiometer(2); // Defaults to meters
#endif
// Let's show everything on the LiveWindow
// TODO: LiveWindow::GetInstance()->AddActuator("Elevator", "Motor", (Victor) motor);
// TODO: LiveWindow::GetInstance()->AddSensor("Elevator", "Pot", (AnalogPotentiometer) pot);
LiveWindow::GetInstance()->AddActuator("Elevator", "PID", GetPIDController());
}
void Elevator::Log() {
// TODO: SmartDashboard::PutData("Wrist Pot", (AnalogPotentiometer) pot);
}
double Elevator::ReturnPIDInput() {
return pot->Get();
}
void Elevator::UsePIDOutput(double d) {
motor->Set(d);
}

View File

@@ -0,0 +1,42 @@
#ifndef Elevator_H
#define Elevator_H
#include "Commands/PIDSubsystem.h"
#include "WPILib.h"
/**
* The elevator subsystem uses PID to go to a given height. Unfortunately, in it's current
* state PID values for simulation are different than in the real world do to minor differences.
*/
class Elevator : public PIDSubsystem {
private:
SpeedController* motor;
Potentiometer* pot;
static const double kP_real = 4, kI_real = 0.07,
kP_simulation = 18, kI_simulation = 0.2;
public:
Elevator();
void InitDefaultCommand() {}
/**
* The log method puts interesting information to the SmartDashboard.
*/
void Log();
/**
* Use the potentiometer as the PID sensor. This method is automatically
* called by the subsystem.
*/
double ReturnPIDInput();
/**
* Use the motor as the PID output. This method is automatically called by
* the subsystem.
*/
void UsePIDOutput(double d);
};
#endif

View File

@@ -0,0 +1,36 @@
#include "Wrist.h"
#include "SmartDashboard/SmartDashboard.h"
#include "LiveWindow/LiveWindow.h"
Wrist::Wrist() : PIDSubsystem("Wrist", kP_real, 0.0, 0.0) {
#ifdef SIMULATION // Check for simulation and update PID values
GetPIDController()->SetPID(kP_simulation, 0, 0, 0);
#endif
SetAbsoluteTolerance(2.5);
motor = new Victor(6);
// Conversion value of potentiometer varies between the real world and simulation
#ifdef REAL
pot = new AnalogPotentiometer(3, -270.0/5);
#else
pot = new AnalogPotentiometer(3); // Defaults to degrees
#endif
// Let's show everything on the LiveWindow
// TODO: LiveWindow::GetInstance()->AddActuator("Wrist", "Motor", (Victor) motor);
// TODO: LiveWindow::GetInstance()->AddSensor("Wrist", "Pot", (AnalogPotentiometer) pot);
LiveWindow::GetInstance()->AddActuator("Wrist", "PID", GetPIDController());
}
void Wrist::Log() {
// TODO: SmartDashboard::PutData("Wrist Angle", (AnalogPotentiometer) pot);
}
double Wrist::ReturnPIDInput() {
return pot->Get();
}
void Wrist::UsePIDOutput(double d) {
motor->Set(d);
}

View File

@@ -0,0 +1,40 @@
#ifndef Wrist_H
#define Wrist_H
#include "Commands/PIDSubsystem.h"
#include "WPILib.h"
/**
* The wrist subsystem is like the elevator, but with a rotational joint instead
* of a linear joint.
*/
class Wrist : public PIDSubsystem {
private:
SpeedController* motor;
Potentiometer* pot; // TODO: Make Potentiometer
static const double kP_real = 1, kP_simulation = 0.05;
public:
Wrist();
void InitDefaultCommand() {}
/**
* The log method puts interesting information to the SmartDashboard.
*/
void Log();
/**
* Use the potentiometer as the PID sensor. This method is automatically
* called by the subsystem.
*/
double ReturnPIDInput();
/**
* Use the motor as the PID output. This method is automatically called by
* the subsystem.
*/
void UsePIDOutput(double d);
};
#endif

View File

@@ -8,7 +8,15 @@
<name>Network Tables</name>
<description>Examples of how to use Network Tables to accomplish a
variety of tasks such as sending and receiving values to both
dashboards and co-processors..</description>
dashboards and co-processors.</description>
</tagDescription>
<tagDescription>
<name>CommandBased Robot</name>
<description>Examples for CommandBased robot programs.</description>
</tagDescription>
<tagDescription>
<name>Simulation</name>
<description>Examples that can be run in simulation.</description>
</tagDescription>
<example>
@@ -43,5 +51,92 @@
<file source="examples/Network Table Counter/Robot.cpp" destination="src/Robot.cpp" />
</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
supports simulation.</description>
<tags>
<tag>CommandBased Robot</tag>
<tag>Simulation</tag>
</tags>
<packages>
<package>src</package>
<package>src/Commands</package>
<package>src/Subsystems</package>
</packages>
<files>
<file source="examples/GearsBot/src/Commands/Autonomous.cpp"
destination="src/Commands/Autonomous.cpp"></file>
<file source="examples/GearsBot/src/Commands/Autonomous.h"
destination="src/Commands/Autonomous.h"></file>
<file source="examples/GearsBot/src/Commands/CloseClaw.cpp"
destination="src/Commands/CloseClaw.cpp"></file>
<file source="examples/GearsBot/src/Commands/CloseClaw.h"
destination="src/Commands/CloseClaw.h"></file>
<file source="examples/GearsBot/src/Commands/DriveStraight.cpp"
destination="src/Commands/DriveStraight.cpp"></file>
<file source="examples/GearsBot/src/Commands/DriveStraight.h"
destination="src/Commands/DriveStraight.h"></file>
<file source="examples/GearsBot/src/Commands/OpenClaw.cpp"
destination="src/Commands/OpenClaw.cpp"></file>
<file source="examples/GearsBot/src/Commands/OpenClaw.h"
destination="src/Commands/OpenClaw.h"></file>
<file source="examples/GearsBot/src/Commands/Pickup.cpp"
destination="src/Commands/Pickup.cpp"></file>
<file source="examples/GearsBot/src/Commands/Pickup.h"
destination="src/Commands/Pickup.h"></file>
<file source="examples/GearsBot/src/Commands/Place.cpp"
destination="src/Commands/Place.cpp"></file>
<file source="examples/GearsBot/src/Commands/Place.h"
destination="src/Commands/Place.h"></file>
<file source="examples/GearsBot/src/Commands/PrepareToPickup.cpp"
destination="src/Commands/PrepareToPickup.cpp"></file>
<file source="examples/GearsBot/src/Commands/PrepareToPickup.h"
destination="src/Commands/PrepareToPickup.h"></file>
<file source="examples/GearsBot/src/Commands/SetDistanceToBox.cpp"
destination="src/Commands/SetDistanceToBox.cpp"></file>
<file source="examples/GearsBot/src/Commands/SetDistanceToBox.h"
destination="src/Commands/SetDistanceToBox.h"></file>
<file source="examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp"
destination="src/Commands/SetElevatorSetpoint.cpp"></file>
<file source="examples/GearsBot/src/Commands/SetElevatorSetpoint.h"
destination="src/Commands/SetElevatorSetpoint.h"></file>
<file source="examples/GearsBot/src/Commands/SetWristSetpoint.cpp"
destination="src/Commands/SetWristSetpoint.cpp"></file>
<file source="examples/GearsBot/src/Commands/SetWristSetpoint.h"
destination="src/Commands/SetWristSetpoint.h"></file>
<file source="examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp"
destination="src/Commands/TankDriveWithJoystick.cpp"></file>
<file source="examples/GearsBot/src/Commands/TankDriveWithJoystick.h"
destination="src/Commands/TankDriveWithJoystick.h"></file>
<file source="examples/GearsBot/src/OI.cpp"
destination="src/OI.cpp"></file>
<file source="examples/GearsBot/src/OI.h"
destination="src/OI.h"></file>
<file source="examples/GearsBot/src/Robot.cpp"
destination="src/Robot.cpp"></file>
<file source="examples/GearsBot/src/Robot.h"
destination="src/Robot.h"></file>
<file source="examples/GearsBot/src/Subsystems/Claw.cpp"
destination="src/Subsystems/Claw.cpp"></file>
<file source="examples/GearsBot/src/Subsystems/Claw.h"
destination="src/Subsystems/Claw.h"></file>
<file source="examples/GearsBot/src/Subsystems/DriveTrain.cpp"
destination="src/Subsystems/DriveTrain.cpp"></file>
<file source="examples/GearsBot/src/Subsystems/DriveTrain.h"
destination="src/Subsystems/DriveTrain.h"></file>
<file source="examples/GearsBot/src/Subsystems/Elevator.cpp"
destination="src/Subsystems/Elevator.cpp"></file>
<file source="examples/GearsBot/src/Subsystems/Elevator.h"
destination="src/Subsystems/Elevator.h"></file>
<file source="examples/GearsBot/src/Subsystems/Wrist.cpp"
destination="src/Subsystems/Wrist.cpp"></file>
<file source="examples/GearsBot/src/Subsystems/Wrist.h"
destination="src/Subsystems/Wrist.h"></file>
</files>
</example>
</examples>

View File

@@ -0,0 +1,137 @@
package edu.wpi.first.wpilib.plugins.cpp.launching;
import java.io.File;
import java.lang.reflect.Method;
import java.util.Vector;
import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
/**
* Launch shortcut base functionality, common for deploying to the robot.
* Retrieves the project the operation is being called on, and runs the correct
* ant targets based on polymorphically determined data values
*
* @author Ryan O'Meara
* @author Alex Henning
*/
@SuppressWarnings("restriction")
public class SimulateLaunchShortcut implements ILaunchShortcut {
//Class constants - used to delineate types for launch shortcuts
public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy";
private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection";
private static ILaunch lastDeploy = null;
/**
* Returns the launch type of the shortcut that was used, one of the constants
* defined in BaseLaunchShortcut
* @return Launch shortcut type
*/
public String getLaunchType() {return DEPLOY_TYPE;}
@Override
public void launch(ISelection selection, String mode) {
//Extract resource from selection
StructuredSelection sel = (StructuredSelection)selection;
IProject activeProject = null;
if (sel.getFirstElement() instanceof IProject) {
activeProject = (IProject) sel.getFirstElement();
} else {
return;
}
//Run config using project found in extracted resource, with indicated mode
runConfig(activeProject, mode);
}
@Override
public void launch(IEditorPart editor, String mode) {
//Extract resource from editor
if(editor != null){
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput();
IFile file = input.getFile();
IProject activeProject = file.getProject();
//If editor existed, run config using extracted resource in indicated mode
runConfig(activeProject, mode);
}else{
System.err.println("editor was null");
}
}
/**
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
* @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){
String targets = "simulate";
if(mode.equals(ILaunchManager.RUN_MODE)){
if(getLaunchType().equals(DEPLOY_TYPE)){
targets = "simulate";
}
} else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
targets = "debug-simulate";
try{
PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}catch(Exception e){}
}
if((lastDeploy != null)&&(!lastDeploy.isTerminated())){
System.out.println("Last deploy running");
//Find the server connection thread and kill it
Vector<ThreadGroup> threadGroups = new Vector<ThreadGroup>();
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {root = root.getParent();}
threadGroups.add(root);
ThreadGroup threadGroup = threadGroups.remove(0);
int numThreads = threadGroup.activeCount();
Thread[] threads = new Thread[numThreads*100];
numThreads = threadGroup.enumerate(threads, true);
for(Thread current: threads){
if(current != null){
if(current.getName().equals(ANT_SERVER_THREAD_NAME)){
try{
//Manually end thread and then try terminating launch
Method stopMethod = current.getClass().getMethod("stop");
stopMethod.invoke(current);
lastDeploy.terminate();
break;
}catch(Exception e){e.printStackTrace();}
}
}
}
System.out.println("Waiting");
try{wait(1000);}catch(Exception e){}
}
System.out.println("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml");
System.out.println("Targets: " + targets + ", Mode: " + mode);
lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode);
try {
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
} catch (Exception e) {}
}
}

View File

@@ -34,7 +34,7 @@ public class ExampleCPPWizard extends ExampleWizard {
WPILibCore.getDefault().saveGlobalProperties(props);
final String projectName = detailsPage.getProjectName();
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, ex));
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, ex, detailsPage.getWorld()));
}
@Override

View File

@@ -72,11 +72,12 @@ public class NewCPPWizard extends Wizard implements INewWizard {
final String projectName = page.getProjectName();
final String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
final ProjectType projectType = page.getProjectType();
final String worldName = page.getWorld();
System.out.println("Project: "+projectName+" Project Type: "+projectType);
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(projectName, teamNumber, projectType, monitor);
doFinish(projectName, teamNumber, projectType, worldName, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
@@ -102,11 +103,11 @@ public class NewCPPWizard extends Wizard implements INewWizard {
* the editor on the newly created file.
*/
private void doFinish(String projectName, String teamNumber, ProjectType projectType, IProgressMonitor monitor) throws CoreException {
private void doFinish(String projectName, String teamNumber, ProjectType projectType, String worldName, IProgressMonitor monitor) throws CoreException {
Properties props = WPILibCore.getDefault().getProjectProperties(null);
props.setProperty("team-number", teamNumber);
WPILibCore.getDefault().saveGlobalProperties(props);
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, projectType));
ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, projectType, worldName));
}
/**

View File

@@ -22,10 +22,12 @@ import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
public class WPIRobotCPPProjectCreator implements IProjectCreator {
String projectName;
ProjectType projectType;
private String worldName;
public WPIRobotCPPProjectCreator(String projectName, ProjectType projectType) {
public WPIRobotCPPProjectCreator(String projectName, ProjectType projectType, String worldName) {
this.projectName = projectName;
this.projectType = projectType;
this.worldName = worldName;
}
@Override
@@ -44,6 +46,7 @@ public class WPIRobotCPPProjectCreator implements IProjectCreator {
vals.put("$project", projectName);
vals.put("$toolchain", WPILibCPPPlugin.getDefault().getToolchain());
vals.put("$cpp-location", WPILibCPPPlugin.getDefault().getCPPDir());
vals.put("$world", worldName);
return vals;
}

View File

@@ -147,4 +147,28 @@ ${md5.hal} usr/local/frc/lib/libHALAthena.so</echo>
trust="true"
command="chmod a+x debug*program; ${deploy.debug.command}"/>
</target>
<!-- Simulation support -->
<target name="simulate">
<parallel>
<sequential>
<echo>[simulate] Running Gazebo.</echo>
<exec executable="frcsim">
<arg value="${simulation.world.file}"/>
</exec>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[simulate] Running DriverStation.</echo>
<java jar="${sim.tools}/SimDS.jar" fork="true">
<jvmarg value="-Djava.library.path=${sim.lib}" />
</java>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[simulate] Running Code.</echo>
<exec executable="${sim.exe}"></exec>
</sequential>
</parallel>
</target>
</project>

View File

@@ -179,6 +179,41 @@
mode="debug">
</description>
</shortcut>
<shortcut
class="edu.wpi.first.wpilib.plugins.java.launching.SimulateLaunchShortcut"
description="Test your WPILib program with the Gazebo simulator."
icon="resources/icons/Gazebo.png"
id="edu.wpi.first.wpilib.plugins.java.launching.simulate"
label="WPILib Simulation"
modes="run,debug">
<contextualLaunch>
<enablement>
<with
variable="selection">
<iterate>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</contextualLaunch>
<description
description="Test your WPILib program with the Gazebo simulator."
mode="run">
</description>
<description
description="Test your WPILib program with the Gazebo simulator and use the debugger to debug."
mode="debug">
</description>
</shortcut>
</extension>
<extension
point="org.eclipse.ui.startup">

View File

@@ -16,19 +16,6 @@
<build-number>DEVELOPMENT</build-number>
<java-zip>${project.build.directory}/java-zip</java-zip>
</properties>
<repositories>
<!-- repository>
<id>sonatype</id>
<name>Sonatype OSS Snapshots Repository</name>
<url>http://oss.sonatype.org/content/groups/public</url>
</repository-->
<!-- For old snapshots, please use groupId `com.jnaerator` and the following repo -->
<!-- repository>
<id>nativelibs4java-repo</id>
<url>http://nativelibs4java.sourceforge.net/maven</url>
</repository-->
</repositories>
<build>
<resources>
@@ -88,27 +75,12 @@
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaFinal</artifactId>
<artifactId>wpilibJava</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
<destFileName>WPILib.jar</destFileName>
<outputDirectory>${java-zip}/lib</outputDirectory>
</artifactItem>
<!-- artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.0.0</version>
<type>jar</type>
<outputDirectory>${java-zip}/lib</outputDirectory>
</artifactItem-->
<!-- artifactItem>
<groupId>com.nativelibs4java</groupId>
<artifactId>jnaerator-runtime</artifactId>
<version>0.12-SNAPSHOT</version>
<type>jar</type>
<destFileName>jnaerator-runtime.jar</destFileName>
<outputDirectory>${java-zip}/lib</outputDirectory>
</artifactItem-->
<!-- Library sources for debugging WPILib on the Athena -->
<artifactItem>
<groupId>edu.wpi.first.wpilib.networktables.java</groupId>
@@ -136,10 +108,76 @@
<outputDirectory>${java-zip}/javadoc-jar</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
<!-- Simulation -->
<execution>
<id>fetch-sim-jar-zip-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${java-zip}/sim/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<artifactItems>
<artifactItem>
<groupId>org.gazebosim</groupId>
<artifactId>JavaGazebo</artifactId>
<version>0.1.0-SNAPSHOT</version>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaSim</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilib.networktables.java</groupId>
<artifactId>NetworkTables</artifactId>
<version>0.1.0-SNAPSHOT</version>
</artifactItem>
<artifactItem>
<groupId>net.java.jinput</groupId>
<artifactId>jinput</artifactId>
<version>2.0.5</version>
</artifactItem>
<artifactItem>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<version>2.0.5</version>
<classifier>natives-linux</classifier>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>net.java.jutils</groupId>
<artifactId>jutils</artifactId>
<version>1.0.0</version>
</artifactItem>
<artifactItem>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj.simulation</groupId>
<artifactId>SimDS</artifactId>
<version>0.1.0-SNAPSHOT</version>
<destFileName>SimDS.jar</destFileName>
<outputDirectory>${java-zip}/sim/tools</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
@@ -187,7 +225,23 @@
</target>
</configuration>
</execution>
<!-- Unzip jinput *.so's -->
<execution>
<id>unzip-jinput-libs</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<unzip src="${java-zip}/sim/lib/jinput-platform-2.0.5-natives-linux.jar"
dest="${java-zip}/sim/lib"
overwrite="true" />
</target>
</configuration>
</execution>
<!-- Generate zip file to unzip for the user. -->
<execution>
<id>generate-jar-zip</id>
@@ -259,7 +313,13 @@
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaFinal</artifactId>
<artifactId>wpilibJava</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaSim</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
@@ -287,7 +347,6 @@
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<version>0.1.0-SNAPSHOT</version>
<classifier>sources</classifier>
</dependency>
<!-- Javadoc -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

View File

@@ -1,3 +1,4 @@
# Project specific information
package=$package
main=${package}.Robot
robot.class=${package}.Robot
simulation.world.file=$world

View File

@@ -0,0 +1,57 @@
package $package;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import $package.commands.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
private Joystick joy = new Joystick(1);
public OI() {
// Put Some buttons on the SmartDashboard
SmartDashboard.putData("Elevator Bottom", new SetElevatorSetpoint(0));
SmartDashboard.putData("Elevator Platform", new SetElevatorSetpoint(0.2));
SmartDashboard.putData("Elevator Top", new SetElevatorSetpoint(0.3));
SmartDashboard.putData("Wrist Horizontal", new SetWristSetpoint(0));
SmartDashboard.putData("Raise Wrist", new SetWristSetpoint(-45));
SmartDashboard.putData("Open Claw", new OpenClaw());
SmartDashboard.putData("Close Claw", new CloseClaw());
SmartDashboard.putData("Deliver Soda", new Autonomous());
// Create some buttons
JoystickButton d_up = new JoystickButton(joy, 5);
JoystickButton d_right= new JoystickButton(joy, 6);
JoystickButton d_down= new JoystickButton(joy, 7);
JoystickButton d_left = new JoystickButton(joy, 8);
JoystickButton l2 = new JoystickButton(joy, 9);
JoystickButton r2 = new JoystickButton(joy, 10);
JoystickButton l1 = new JoystickButton(joy, 11);
JoystickButton r1 = new JoystickButton(joy, 12);
// Connect the buttons to commands
d_up.whenPressed(new SetElevatorSetpoint(0.2));
d_down.whenPressed(new SetElevatorSetpoint(-0.2));
d_right.whenPressed(new CloseClaw());
d_left.whenPressed(new OpenClaw());
r1.whenPressed(new PrepareToPickup());
r2.whenPressed(new Pickup());
l1.whenPressed(new Place());
l2.whenPressed(new Autonomous());
}
public Joystick getJoystick() {
return joy;
}
}

View File

@@ -0,0 +1,103 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package $package;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import $package.commands.Autonomous;
import $package.subsystems.Claw;
import $package.subsystems.DriveTrain;
import $package.subsystems.Elevator;
import $package.subsystems.Wrist;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends IterativeRobot {
Command autonomousCommand;
public static DriveTrain drivetrain;
public static Elevator elevator;
public static Wrist wrist;
public static Claw claw;
public static OI oi;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
// Initialize all subsystems
drivetrain = new DriveTrain();
elevator = new Elevator();
wrist = new Wrist();
claw = new Claw();
oi = new OI();
// instantiate the command used for the autonomous period
autonomousCommand = new Autonomous();
// Show what command your subsystem is running on the SmartDashboard
SmartDashboard.putData(drivetrain);
SmartDashboard.putData(elevator);
SmartDashboard.putData(wrist);
SmartDashboard.putData(claw);
}
public void autonomousInit() {
autonomousCommand.start(); // schedule the autonomous command (example)
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
Scheduler.getInstance().run();
log();
}
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
autonomousCommand.cancel();
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
Scheduler.getInstance().run();
log();
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
}
/**
* The log method puts interesting information to the SmartDashboard.
*/
private void log() {
wrist.log();
elevator.log();
drivetrain.log();
claw.log();
}
}

View File

@@ -0,0 +1,22 @@
package $package.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
* The main autonomous command to pickup and deliver the
* soda to the box.
*/
public class Autonomous extends CommandGroup {
public Autonomous() {
addSequential(new PrepareToPickup());
addSequential(new Pickup());
addSequential(new SetDistanceToBox(0.10));
// addSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is broken
addSequential(new Place());
addSequential(new SetDistanceToBox(0.60));
// addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic is broken
addParallel(new SetWristSetpoint(-45));
addSequential(new CloseClaw());
}
}

View File

@@ -0,0 +1,47 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Closes the claw for one second. Real robots should use sensors, stalling
* motors is BAD!
*/
public class CloseClaw extends Command {
public CloseClaw() {
requires(Robot.claw);
}
// Called just before this Command runs the first time
protected void initialize() {
Robot.claw.close();
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return Robot.claw.isGrabbing();
}
// Called once after isFinished returns true
protected void end() {
// NOTE: Doesn't stop in simulation due to lower friction causing the can to fall out
// + there is no need to worry about stalling the motor or crushing the can.
if (!Robot.isSimulation())
Robot.claw.stop();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

View File

@@ -0,0 +1,63 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Drive the given distance straight (negative values go backwards).
* Uses a local PID controller to run a simple PID loop that is only
* enabled while this command is running. The input is the averaged
* values of the left and right encoders.
*/
public class DriveStraight extends Command {
private PIDController pid;
public DriveStraight(double distance) {
requires(Robot.drivetrain);
pid = new PIDController(4, 0, 0,
new PIDSource() { public double pidGet() {
return Robot.drivetrain.getDistance();
}},
new PIDOutput() { public void pidWrite(double d) {
Robot.drivetrain.drive(d, d);
}});
pid.setAbsoluteTolerance(0.01);
pid.setSetpoint(distance);
}
// Called just before this Command runs the first time
protected void initialize() {
// Get everything in a safe starting state.
Robot.drivetrain.reset();
pid.reset();
pid.enable();
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return pid.onTarget();
}
// Called once after isFinished returns true
protected void end() {
// Stop PID and the wheels
pid.disable();
Robot.drivetrain.drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

View File

@@ -0,0 +1,45 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Opens the claw for one second. Real robots should use sensors, stalling
* motors is BAD!
*/
public class OpenClaw extends Command {
public OpenClaw() {
requires(Robot.claw);
setTimeout(1);
}
// Called just before this Command runs the first time
protected void initialize() {
Robot.claw.open();
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return isTimedOut();
}
// Called once after isFinished returns true
protected void end() {
Robot.claw.stop();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

View File

@@ -0,0 +1,15 @@
package $package.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
* Pickup a soda can (if one is between the open claws) and
* get it in a safe state to drive around.
*/
public class Pickup extends CommandGroup {
public Pickup() {
addSequential(new CloseClaw());
addParallel(new SetWristSetpoint(-45));
addSequential(new SetElevatorSetpoint(0.25));
}
}

View File

@@ -0,0 +1,14 @@
package $package.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
* Place a held soda can onto the platform.
*/
public class Place extends CommandGroup {
public Place() {
addSequential(new SetElevatorSetpoint(0.25));
addSequential(new SetWristSetpoint(0));
addSequential(new OpenClaw());
}
}

View File

@@ -0,0 +1,14 @@
package $package.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
* Make sure the robot is in a state to pickup soda cans.
*/
public class PrepareToPickup extends CommandGroup {
public PrepareToPickup() {
addParallel(new OpenClaw());
addParallel(new SetWristSetpoint(0));
addSequential(new SetElevatorSetpoint(0));
}
}

View File

@@ -0,0 +1,66 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Drive until the robot is the given distance away from the box. Uses a local
* PID controller to run a simple PID loop that is only enabled while this
* command is running. The input is the averaged values of the left and right
* encoders.
*/
public class SetDistanceToBox extends Command {
private PIDController pid;
public SetDistanceToBox(double distance) {
requires(Robot.drivetrain);
pid = new PIDController(-2, 0, 0, new PIDSource() {
public double pidGet() {
return Robot.drivetrain.getDistanceToObstacle();
}
}, new PIDOutput() {
public void pidWrite(double d) {
Robot.drivetrain.drive(d, d);
}
});
pid.setAbsoluteTolerance(0.01);
pid.setSetpoint(distance);
}
// Called just before this Command runs the first time
protected void initialize() {
// Get everything in a safe starting state.
Robot.drivetrain.reset();
pid.reset();
pid.enable();
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return pid.onTarget();
}
// Called once after isFinished returns true
protected void end() {
// Stop PID and the wheels
pid.disable();
Robot.drivetrain.drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

View File

@@ -0,0 +1,46 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Move the elevator to a given location. This command finishes when it is within
* the tolerance, but leaves the PID loop running to maintain the position. Other
* commands using the elevator should make sure they disable PID!
*/
public class SetElevatorSetpoint extends Command {
private double setpoint;
public SetElevatorSetpoint(double setpoint) {
this.setpoint = setpoint;
requires(Robot.elevator);
}
// Called just before this Command runs the first time
protected void initialize() {
Robot.elevator.enable();
Robot.elevator.setSetpoint(setpoint);
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return Robot.elevator.onTarget();
}
// Called once after isFinished returns true
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}

View File

@@ -0,0 +1,46 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import edu.wpi.first.wpilibj.command.Command;
import $package.Robot;
/**
* Move the wrist to a given angle. This command finishes when it is within
* the tolerance, but leaves the PID loop running to maintain the position.
* Other commands using the wrist should make sure they disable PID!
*/
public class SetWristSetpoint extends Command {
private double setpoint;
public SetWristSetpoint(double setpoint) {
this.setpoint = setpoint;
requires(Robot.wrist);
}
// Called just before this Command runs the first time
protected void initialize() {
Robot.wrist.enable();
Robot.wrist.setSetpoint(setpoint);
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return Robot.wrist.onTarget();
}
// Called once after isFinished returns true
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}

View File

@@ -0,0 +1,42 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.commands;
import $package.Robot;
import edu.wpi.first.wpilibj.command.Command;
/**
* Have the robot drive tank style using the PS3 Joystick until interrupted.
*/
public class TankDriveWithJoystick extends Command {
public TankDriveWithJoystick() {
requires(Robot.drivetrain);
}
// Called just before this Command runs the f iirst time
protected void initialize() {}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.drivetrain.drive(Robot.oi.getJoystick());
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false; // Runs until interrupted
}
// Called once after isFinished returns true
protected void end() {
Robot.drivetrain.drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

View File

@@ -0,0 +1,63 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.subsystems;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
/**
* The claw subsystem is a simple system with a motor for opening and closing.
* If using stronger motors, you should probably use a sensor so that the
* motors don't stall.
*/
public class Claw extends Subsystem {
private SpeedController motor;
private DigitalInput contact;
public Claw() {
super();
motor = new Victor(7);
contact = new DigitalInput(5);
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Claw", "Motor", (Victor) motor);
LiveWindow.addActuator("Claw", "Limit Switch", contact);
}
public void initDefaultCommand() {}
public void log() {}
/**
* Set the claw motor to move in the open direction.
*/
public void open() {
motor.set(-1);
}
/**
* Set the claw motor to move in the close direction.
*/
public void close() {
motor.set(1);
}
/**
* Stops the claw motor from moving.
*/
public void stop() {
motor.set(0);
}
/**
* Return true when the robot is grabbing an object hard enough
* to trigger the limit switch.
*/
public boolean isGrabbing() {
return contact.get();
}
}

View File

@@ -0,0 +1,137 @@
package $package.subsystems;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.Joystick.AxisType;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import $package.Robot;
import $package.commands.TankDriveWithJoystick;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
* The DriveTrain subsystem incorporates the sensors and actuators attached to
* the robots chassis. These include four drive motors, a left and right encoder
* and a gyro.
*/
public class DriveTrain extends Subsystem {
private SpeedController front_left_motor, back_left_motor,
front_right_motor, back_right_motor;
private RobotDrive drive;
private Encoder left_encoder, right_encoder;
private AnalogChannel rangefinder;
private Gyro gyro;
public DriveTrain() {
super();
front_left_motor = new Talon(1);
back_left_motor = new Talon(2);
front_right_motor = new Talon(3);
back_right_motor = new Talon(4);
drive = new RobotDrive(front_left_motor, back_left_motor,
front_right_motor, back_right_motor);
left_encoder = new Encoder(1, 2);
right_encoder = new Encoder(3, 4);
// Encoders may measure differently in the real world and in
// simulation. In this example the robot moves 0.042 barleycorns
// per tick in the real world, but the simulated encoders
// simulate 360 tick encoders. This if statement allows for the
// real robot to handle this difference in devices.
if (Robot.isReal()) {
left_encoder.setDistancePerPulse(0.042);
right_encoder.setDistancePerPulse(0.042);
} else {
// Circumference in ft = 4in/12(in/ft)*PI
left_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
right_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
}
left_encoder.start();
right_encoder.start();
rangefinder = new AnalogChannel(6);
gyro = new Gyro(1);
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Drive Train", "Front_Left Motor", (Talon) front_left_motor);
LiveWindow.addActuator("Drive Train", "Back Left Motor", (Talon) back_left_motor);
LiveWindow.addActuator("Drive Train", "Front Right Motor", (Talon) front_right_motor);
LiveWindow.addActuator("Drive Train", "Back Right Motor", (Talon) back_right_motor);
LiveWindow.addSensor("Drive Train", "Left Encoder", left_encoder);
LiveWindow.addSensor("Drive Train", "Right Encoder", right_encoder);
LiveWindow.addSensor("Drive Train", "Rangefinder", rangefinder);
LiveWindow.addSensor("Drive Train", "Gyro", gyro);
}
/**
* When no other command is running let the operator drive around
* using the PS3 joystick.
*/
public void initDefaultCommand() {
setDefaultCommand(new TankDriveWithJoystick());
}
/**
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putNumber("Left Distance", left_encoder.getDistance());
SmartDashboard.putNumber("Right Distance", right_encoder.getDistance());
SmartDashboard.putNumber("Left Speed", left_encoder.getRate());
SmartDashboard.putNumber("Right Speed", right_encoder.getRate());
SmartDashboard.putNumber("Gyro", gyro.getAngle());
}
/**
* Tank style driving for the DriveTrain.
* @param left Speed in range [-1,1]
* @param right Speed in range [-1,1]
*/
public void drive(double left, double right) {
drive.tankDrive(left, right);
}
/**
* @param joy The ps3 style joystick to use to drive tank style.
*/
public void drive(Joystick joy) {
drive(-joy.getY(), -joy.getAxis(AxisType.kThrottle));
}
/**
* @return The robots heading in degrees.
*/
public double getHeading() {
return gyro.getAngle();
}
/**
* Reset the robots sensors to the zero states.
*/
public void reset() {
gyro.reset();
left_encoder.reset();
right_encoder.reset();
}
/**
* @return The distance driven (average of left and right encoders).
*/
public double getDistance() {
return (left_encoder.getDistance() + right_encoder.getDistance())/2;
}
/**
* @return The distance to the obstacle detected by the rangefinder.
*/
public double getDistanceToObstacle() {
// Really meters in simulation since it's a rangefinder...
return rangefinder.getAverageVoltage();
}
}

View File

@@ -0,0 +1,75 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.subsystems;
import edu.wpi.first.wpilibj.AnalogPotentiometer;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.PIDSubsystem;
import edu.wpi.first.wpilibj.interfaces.Potentiometer;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import $package.Robot;
/**
* The elevator subsystem uses PID to go to a given height. Unfortunately, in it's current
* state PID values for simulation are different than in the real world do to minor differences.
*/
public class Elevator extends PIDSubsystem {
private SpeedController motor;
private Potentiometer pot;
private static final double kP_real = 4, kI_real = 0.07,
kP_simulation = 18, kI_simulation = 0.2;
public Elevator() {
super(kP_real, kI_real, 0);
if (Robot.isSimulation()) { // Check for simulation and update PID values
getPIDController().setPID(kP_simulation, kI_simulation, 0, 0);
}
setAbsoluteTolerance(0.005);
motor = new Victor(5);
// Conversion value of potentiometer varies between the real world and simulation
if (Robot.isReal()) {
pot = new AnalogPotentiometer(2, -2.0/5);
} else {
pot = new AnalogPotentiometer(2); // Defaults to meters
}
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Elevator", "Motor", (Victor) motor);
LiveWindow.addSensor("Elevator", "Pot", (AnalogPotentiometer) pot);
LiveWindow.addActuator("Elevator", "PID", getPIDController());
}
public void initDefaultCommand() {}
/**
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Wrist Pot", (AnalogPotentiometer) pot);
}
/**
* Use the potentiometer as the PID sensor. This method is automatically
* called by the subsystem.
*/
protected double returnPIDInput() {
return pot.get();
}
/**
* Use the motor as the PID output. This method is automatically called by
* the subsystem.
*/
protected void usePIDOutput(double d) {
motor.set(d);
}
}

View File

@@ -0,0 +1,74 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package $package.subsystems;
import edu.wpi.first.wpilibj.AnalogPotentiometer;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.PIDSubsystem;
import edu.wpi.first.wpilibj.interfaces.Potentiometer;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import $package.Robot;
/**
* The wrist subsystem is like the elevator, but with a rotational joint instead
* of a linear joint.
*/
public class Wrist extends PIDSubsystem {
private SpeedController motor;
private Potentiometer pot;
private static final double kP_real = 1,
kP_simulation = 0.05;
public Wrist() {
super(kP_real, 0, 0);
if (Robot.isSimulation()) { // Check for simulation and update PID values
getPIDController().setPID(kP_simulation, 0, 0, 0);
}
setAbsoluteTolerance(2.5);
motor = new Victor(6);
// Conversion value of potentiometer varies between the real world and simulation
if (Robot.isReal()) {
pot = new AnalogPotentiometer(3, -270.0/5);
} else {
pot = new AnalogPotentiometer(3); // Defaults to degrees
}
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Wrist", "Motor", (Victor) motor);
LiveWindow.addSensor("Wrist", "Pot", (AnalogPotentiometer) pot);
LiveWindow.addActuator("Wrist", "PID", getPIDController());
}
public void initDefaultCommand() {}
/**
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Wrist Angle", (AnalogPotentiometer) pot);
}
/**
* Use the potentiometer as the PID sensor. This method is automatically
* called by the subsystem.
*/
protected double returnPIDInput() {
return pot.get();
}
/**
* Use the motor as the PID output. This method is automatically called by
* the subsystem.
*/
protected void usePIDOutput(double d) {
motor.set(d);
}
}

View File

@@ -4,11 +4,19 @@
<name>Simple Robot</name>
<description>Examples for simple robot programs.</description>
</tagDescription>
<tagDescription>
<name>CommandBased Robot</name>
<description>Examples for CommandBased robot programs.</description>
</tagDescription>
<tagDescription>
<name>Simulation</name>
<description>Examples that can be run in simulation.</description>
</tagDescription>
<tagDescription>
<name>Network Tables</name>
<description>Examples of how to use Network Tables to accomplish a
variety of tasks such as sending and receiving values to both
dashboards and co-processors..</description>
dashboards and co-processors.</description>
</tagDescription>
<example>
@@ -43,5 +51,37 @@
<file source="examples/Network Table Counter/Robot.java" destination="src/$package-dir/Robot.java" />
</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 supports simulation.</description>
<tags>
<tag>CommandBased Robot</tag>
<tag>Simulation</tag>
</tags>
<packages>
<package>src/$package-dir</package>
<package>src/$package-dir/commands</package>
<package>src/$package-dir/subsystems</package>
</packages>
<files>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/OI.java" destination="src/$package-dir/OI.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/Robot.java" destination="src/$package-dir/Robot.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Autonomous.java" destination="src/$package-dir/commands/Autonomous.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/CloseClaw.java" destination="src/$package-dir/commands/CloseClaw.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/DriveStraight.java" destination="src/$package-dir/commands/DriveStraight.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/OpenClaw.java" destination="src/$package-dir/commands/OpenClaw.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Pickup.java" destination="src/$package-dir/commands/Pickup.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Place.java" destination="src/$package-dir/commands/Place.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/PrepareToPickup.java" destination="src/$package-dir/commands/PrepareToPickup.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetDistanceToBox.java" destination="src/$package-dir/commands/SetDistanceToBox.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetElevatorSetpoint.java" destination="src/$package-dir/commands/SetElevatorSetpoint.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetWristSetpoint.java" destination="src/$package-dir/commands/SetWristSetpoint.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/TankDriveWithJoystick.java" destination="src/$package-dir/commands/TankDriveWithJoystick.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Claw.java" destination="src/$package-dir/subsystems/Claw.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/DriveTrain.java" destination="src/$package-dir/subsystems/DriveTrain.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Elevator.java" destination="src/$package-dir/subsystems/Elevator.java"></file>
<file source="examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Wrist.java" destination="src/$package-dir/subsystems/Wrist.java"></file>
</files>
</example>
</examples>

View File

@@ -73,6 +73,7 @@ public class WPILibJavaPlugin extends AbstractUIPlugin implements IStartup {
return props.getProperty("version");
}
} catch (CoreException e) {
e.printStackTrace(System.err);
return "DEVELOPMENT";
}
}

View File

@@ -1,39 +1,6 @@
package edu.wpi.first.wpilib.plugins.java.launching;
import java.io.File;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IVMConnector;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import com.sun.jdi.connect.Connector.Argument;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
/**
* Launch shortcut base functionality, common for deploying to the robot.
@@ -43,58 +10,7 @@ import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
* @author Ryan O'Meara
* @author Alex Henning
*/
@SuppressWarnings("restriction")
public class DeployLaunchShortcut implements ILaunchShortcut {
//Class constants - used to delineate types for launch shortcuts
public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy";
private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection";
// NOTE: This string must be changed if the port is changed.
private static final String DEBUG_START_TEXT = "Listening for transport dt_socket at address: 8348";
private static ILaunch lastDeploy = null;
/**
* Returns the launch type of the shortcut that was used, one of the constants
* defined in BaseLaunchShortcut
* @return Launch shortcut type
*/
public String getLaunchType() {return DEPLOY_TYPE;}
@Override
public void launch(ISelection selection, String mode) {
//Extract resource from selection
StructuredSelection sel = (StructuredSelection)selection;
IProject activeProject = null;
//NOTE: This caused issues earlier, as the sel return was treated as a workspace, instead of a project
//When it is a valid FIRST project, the selection is always a JavaProject
if(sel.getFirstElement() instanceof IJavaProject){
activeProject = ((IJavaProject)sel.getFirstElement()).getProject();
}else if(sel.getFirstElement() instanceof IJavaElement){
activeProject = ((IJavaElement)sel.getFirstElement()).getJavaProject().getProject();
}else{
return;
}
//Run config using project found in extracted resource, with indicated mode
runConfig(activeProject, mode);
}
@Override
public void launch(IEditorPart editor, String mode) {
//Extract resource from editor
if(editor != null){
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput();
IFile file = input.getFile();
IProject activeProject = file.getProject();
//If editor existed, run config using extracted resource in indicated mode
runConfig(activeProject, mode);
}else{
System.err.println("editor was null");
}
}
public class DeployLaunchShortcut extends JavaLaunchShortcut {
/**
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
@@ -102,106 +18,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut {
* @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE)
*/
public void runConfig(IProject activeProj, String mode){
String targets = "deploy";
if(mode.equals(ILaunchManager.RUN_MODE)){
if(getLaunchType().equals(DEPLOY_TYPE)){
targets = "deploy";
}
} else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
targets = "debug-deploy";
try{
PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}catch(Exception e){}
}
if((lastDeploy != null)&&(!lastDeploy.isTerminated())){
System.out.println("Last deploy running");
//Find the server connection thread and kill it
Vector<ThreadGroup> threadGroups = new Vector<ThreadGroup>();
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {root = root.getParent();}
threadGroups.add(root);
ThreadGroup threadGroup = threadGroups.remove(0);
int numThreads = threadGroup.activeCount();
Thread[] threads = new Thread[numThreads*100];
numThreads = threadGroup.enumerate(threads, true);
for(Thread current: threads){
if(current != null){
if(current.getName().equals(ANT_SERVER_THREAD_NAME)){
try{
//Manually end thread and then try terminating launch
Method stopMethod = current.getClass().getMethod("stop");
stopMethod.invoke(current);
lastDeploy.terminate();
break;
}catch(Exception e){e.printStackTrace();}
}
}
}
System.out.println("Waiting");
try{wait(1000);}catch(Exception e){}
}
System.out.println("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml");
System.out.println("Targets: " + targets + ", Mode: " + mode);
lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode);
if((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
ILaunchConfigurationWorkingCopy config;
try {
config = getRemoteDebugConfig(activeProj);
startDebugConfig(config, lastDeploy);
} catch (CoreException e) {
System.err.println("Debug attach failed.");
e.printStackTrace();
}
}
try {
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
} catch (Exception e) {}
}
private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy config = type.newInstance(null, "Debug "+activeProj.getName());
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName());
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, true);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
IVMConnector connector = JavaRuntime.getVMConnector(IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
Map<String, Argument> def = connector.getDefaultArguments();
Map<String, String> argMap = new HashMap<String, String>(def.size());
argMap.put("hostname", WPILibCore.getDefault().getTargetIP(activeProj));
argMap.put("port", "8348");
System.out.println(argMap);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, argMap);
return config;
}
private void startDebugConfig(final ILaunchConfigurationWorkingCopy config, ILaunch deploy) throws CoreException {
IStreamListener listener = new IStreamListener() {
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
if (text.contains(DEBUG_START_TEXT)) {
try {
config.launch(ILaunchManager.DEBUG_MODE, null);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
monitor.removeListener(this);
}
}
};
deploy.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor().addListener(listener);
runConfigHelper(activeProj, mode, "deploy", "debug-deploy");
}
}

View File

@@ -0,0 +1,208 @@
package edu.wpi.first.wpilib.plugins.java.launching;
import java.io.File;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IVMConnector;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import com.sun.jdi.connect.Connector.Argument;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
@SuppressWarnings("restriction")
public abstract class JavaLaunchShortcut implements ILaunchShortcut {
//Class constants - used to delineate types for launch shortcuts
public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy";
private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection";
// NOTE: This string must be changed if the port is changed.
private static final String DEBUG_START_TEXT = "Listening for transport dt_socket at address: 8348";
private static ILaunch lastDeploy = null;
/**
* Returns the launch type of the shortcut that was used, one of the constants
* defined in BaseLaunchShortcut
* @return Launch shortcut type
*/
public String getLaunchType() {return DEPLOY_TYPE;}
public void launch(ISelection selection, String mode) {
//Extract resource from selection
StructuredSelection sel = (StructuredSelection)selection;
IProject activeProject = null;
//NOTE: This caused issues earlier, as the sel return was treated as a workspace, instead of a project
//When it is a valid FIRST project, the selection is always a JavaProject
if(sel.getFirstElement() instanceof IJavaProject){
activeProject = ((IJavaProject)sel.getFirstElement()).getProject();
}else if(sel.getFirstElement() instanceof IJavaElement){
activeProject = ((IJavaElement)sel.getFirstElement()).getJavaProject().getProject();
}else{
return;
}
//Run config using project found in extracted resource, with indicated mode
runConfig(activeProject, mode);
}
@Override
public void launch(IEditorPart editor, String mode) {
//Extract resource from editor
if(editor != null){
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput();
IFile file = input.getFile();
IProject activeProject = file.getProject();
//If editor existed, run config using extracted resource in indicated mode
runConfig(activeProject, mode);
}else{
System.err.println("editor was null");
}
}
/**
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
* @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)
* @return
*/
public abstract void runConfig(IProject activeProj, String mode);
/**
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
* @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)
*/
protected void runConfigHelper(IProject activeProj, String mode, String runTarget, String debugTarget){
String targets = runTarget;
if(mode.equals(ILaunchManager.RUN_MODE)){
if(getLaunchType().equals(DEPLOY_TYPE)){
targets = runTarget;
}
} else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
targets = debugTarget;
try{
PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}catch(Exception e){}
}
if((lastDeploy != null)&&(!lastDeploy.isTerminated())){
System.out.println("Last deploy running");
//Find the server connection thread and kill it
Vector<ThreadGroup> threadGroups = new Vector<ThreadGroup>();
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {root = root.getParent();}
threadGroups.add(root);
ThreadGroup threadGroup = threadGroups.remove(0);
int numThreads = threadGroup.activeCount();
Thread[] threads = new Thread[numThreads*100];
numThreads = threadGroup.enumerate(threads, true);
for(Thread current: threads){
if(current != null){
if(current.getName().equals(ANT_SERVER_THREAD_NAME)){
try{
//Manually end thread and then try terminating launch
Method stopMethod = current.getClass().getMethod("stop");
stopMethod.invoke(current);
lastDeploy.terminate();
break;
}catch(Exception e){e.printStackTrace();}
}
}
}
System.out.println("Waiting");
try{wait(1000);}catch(Exception e){}
}
System.out.println("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml");
System.out.println("Targets: " + targets + ", Mode: " + mode);
lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode);
if((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) {
ILaunchConfigurationWorkingCopy config;
try {
config = getRemoteDebugConfig(activeProj);
startDebugConfig(config, lastDeploy);
} catch (CoreException e) {
System.err.println("Debug attach failed.");
e.printStackTrace();
}
}
try {
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
} catch (Exception e) {}
}
private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy config = type.newInstance(null, "Debug "+activeProj.getName());
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName());
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, true);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
IVMConnector connector = JavaRuntime.getVMConnector(IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
Map<String, Argument> def = connector.getDefaultArguments();
Map<String, String> argMap = new HashMap<String, String>(def.size());
argMap.put("hostname", getHostname(activeProj));
argMap.put("port", "8348");
System.out.println(argMap);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, argMap);
return config;
}
protected String getHostname(IProject proj) {
return WPILibCore.getDefault().getTargetIP(proj);
}
private void startDebugConfig(final ILaunchConfigurationWorkingCopy config, ILaunch deploy) throws CoreException {
IStreamListener listener = new IStreamListener() {
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
if (text.contains(DEBUG_START_TEXT)) {
try {
config.launch(ILaunchManager.DEBUG_MODE, null);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
monitor.removeListener(this);
}
}
};
deploy.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor().addListener(listener);
}
}

View File

@@ -0,0 +1,20 @@
package edu.wpi.first.wpilib.plugins.java.launching;
import org.eclipse.core.resources.IProject;
public class SimulateLaunchShortcut extends JavaLaunchShortcut {
/**
* Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile)
* @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){
runConfigHelper(activeProj, mode, "simulate", "debug-simulate");
}
protected String getHostname(IProject proj) {
return "localhost";
}
}

View File

@@ -35,7 +35,8 @@ public class ExampleJavaWizard extends ExampleWizard {
final String projectName = detailsPage.getProjectName();
final String packageName = detailsPage.getPackage();
ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, ex));
final String worldName = detailsPage.getWorld();
ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, ex, worldName));
}
@Override

View File

@@ -72,11 +72,12 @@ public class NewJavaWizard extends Wizard implements INewWizard {
final String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
final String packageName = page.getPackage();
final ProjectType projectType = page.getProjectType();
final String worldName = page.getWorld();
System.out.println("Project: "+projectName+" Package: "+packageName+" Project Type: "+projectType);
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(projectName, teamNumber, packageName, projectType, monitor);
doFinish(projectName, teamNumber, packageName, projectType, worldName, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
@@ -102,11 +103,11 @@ public class NewJavaWizard extends Wizard implements INewWizard {
* the editor on the newly created file.
*/
private void doFinish(String projectName, String teamNumber, String packageName, ProjectType projectType, IProgressMonitor monitor) throws CoreException {
private void doFinish(String projectName, String teamNumber, String packageName, ProjectType projectType, String worldName, IProgressMonitor monitor) throws CoreException {
Properties props = WPILibCore.getDefault().getProjectProperties(null);
props.setProperty("team-number", teamNumber);
WPILibCore.getDefault().saveGlobalProperties(props);
ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, projectType));
ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, projectType, worldName));
}
/**

View File

@@ -15,13 +15,14 @@ import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin;
public class WPIRobotJavaProjectCreator implements IProjectCreator {
String projectName, packageName;
String projectName, packageName, worldName;
ProjectType projectType;
public WPIRobotJavaProjectCreator(String projectName, String packageName, ProjectType projectType) {
public WPIRobotJavaProjectCreator(String projectName, String packageName, ProjectType projectType, String worldName) {
this.projectName = projectName;
this.packageName = packageName;
this.projectType = projectType;
this.worldName = worldName;
}
@Override
@@ -39,6 +40,7 @@ public class WPIRobotJavaProjectCreator implements IProjectCreator {
Map<String, String> vals = new HashMap<String, String>();
vals.put("$project", projectName);
vals.put("$package", packageName);
vals.put("$world", worldName);
return vals;
}

View File

@@ -28,4 +28,10 @@ src.dir=src
build.dir=build
build.jars=${build.dir}/jars
dist.dir=dist
dist.jar=${dist.dir}/${jar}
dist.jar=${dist.dir}/${jar}
# Simulation Information
simulation.dist.jar=${dist.dir}/FRCUserProgramSim.jar
wpilib.sim=${wpilib}/sim
wpilib.sim.lib=${wpilib.sim}/lib
wpilib.sim.tools=${wpilib.sim}/tools

View File

@@ -55,9 +55,9 @@
<jar destfile="${dist.jar}" update="false">
<manifest>
<attribute name="Main-Class" value="edu.wpi.first.wpilibj.RobotBase"/>
<attribute name="Robot-Class" value="${main}"/>
<attribute name="Class-Path" value="."/>
<attribute name="Main-Class" value="edu.wpi.first.wpilibj.RobotBase"/>
<attribute name="Robot-Class" value="${robot.class}"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${build.dir}" includes="**/*.class"/>
@@ -96,4 +96,73 @@
trust="true"
command="chmod a+x debug*program; ${deploy.debug.command}"/>
</target>
<!-- Simulate -->
<target name="jar-for-simulation" depends="compile">
<echo>[jar-for-simulation] Building jar.</echo>
<jar destfile="${simulation.dist.jar}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Robot-Class" value="${robot.class}"/>
<attribute name="Main-Class" value="edu.wpi.first.wpilibj.RobotBase"/>
</manifest>
<fileset dir="${build.dir}" />
<zipgroupfileset dir="${wpilib.sim.lib}">
<include name="**/*.jar" />
</zipgroupfileset>
</jar>
</target>
<target name="simulate" depends="jar-for-simulation">
<parallel>
<sequential>
<echo>[simulate] Running Gazebo.</echo>
<exec executable="frcsim">
<arg value="${simulation.world.file}"/>
</exec>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[simulate] Running DriverStation.</echo>
<java jar="${wpilib.sim.tools}/SimDS.jar" fork="true">
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
</java>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[simulate] Running Code.</echo>
<java jar="${simulation.dist.jar}" fork="true">
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
</java>
</sequential>
</parallel>
</target>
<target name="debug-simulate" depends="jar-for-simulation">
<parallel>
<sequential>
<echo>[debug-simulate] Running Gazebo.</echo>
<exec executable="frcsim">
<arg value="${simulation.world.file}"/>
</exec>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[debug-simulate] Running DriverStation.</echo>
<java jar="${wpilib.sim.tools}/SimDS.jar" fork="true">
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
</java>
</sequential>
<sequential>
<sleep seconds="5"/>
<echo>[debug-simulate] Running Code.</echo>
<java jar="${simulation.dist.jar}" fork="true">
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8348" />
<jvmarg value="-Djava.library.path=${wpilib.sim.lib}" />
</java>
</sequential>
</parallel>
</target>
</project>

View File

@@ -5,7 +5,7 @@
/*----------------------------------------------------------------------------*/
#pragma once
#include "HAL/HAL.hpp"
#include "HAL/Semaphore.hpp"
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class

View File

@@ -2,8 +2,7 @@
#include "HAL/Analog.hpp"
#include "Port.h"
#include "HAL/Errors.hpp"
#include "HAL/Semaphore.hpp"
#include "HAL/HAL.hpp"
#include "ChipObject.h"
#include "HAL/cpp/Synchronized.hpp"
#include "HAL/cpp/Resource.hpp"

View File

@@ -1,7 +1,6 @@
#include "HAL/Semaphore.hpp"
#include "ChipObject.h"
#include "Log.hpp"
// set the logging level

View File

@@ -1,9 +1,6 @@
#include "HAL/Task.hpp"
#include "HAL/HAL.hpp"
#include "ChipObject.h"
#include <stdio.h>
#include <signal.h>

View File

@@ -1,8 +1,6 @@
#include "HAL/cpp/StackTrace.hpp"
#include "HAL/HAL.hpp"
#include "../ChipObject.h"
#include <stdio.h>

View File

@@ -25,8 +25,6 @@
+ ((n & 0x01000000LU) ? 64 : 0) \
+ ((n & 0x10000000LU) ? 128 : 0))
#define b(n) ((unsigned char)BINARY_LITERAL_VIA_HEX__(TO_HEX__(n)))
class DataIOStream{
public:
DataIOStream(IOStream* stream);
@@ -49,3 +47,4 @@ public:
#endif

View File

@@ -11,6 +11,7 @@
<module>networktables</module>
<module>wpilibj</module>
<module>driver-station</module>
<module>simulation</module>
</modules>
@@ -23,6 +24,7 @@
</activation>
<modules>
<module>wpilibc/wpilibC++Sim</module>
<module>eclipse-plugins</module>
</modules>
</profile>

View File

@@ -0,0 +1,62 @@
<?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>
<groupId>org.gazebosim</groupId>
<artifactId>JavaGazebo</artifactId>
<packaging>jar</packaging>
<version>0.1.0-SNAPSHOT</version>
<profiles>
<profile>
<id>docline-java8-disable</id>
<activation>
<jdk>[1.8,</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
<!-- TODO: Add unit tests -->
<!-- <dependency> -->
<!-- <groupId>junit</groupId> -->
<!-- <artifactId>junit</artifactId> -->
<!-- <version>4.11</version> -->
<!-- </dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,453 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: frc_gazebo_plugin/msgs/bool.proto
package gazebo.msgs;
public final class GzBool {
private GzBool() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface BoolOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required bool data = 1;
/**
* <code>required bool data = 1;</code>
*/
boolean hasData();
/**
* <code>required bool data = 1;</code>
*/
boolean getData();
}
/**
* Protobuf type {@code gazebo.msgs.Bool}
*/
public static final class Bool extends
com.google.protobuf.GeneratedMessage
implements BoolOrBuilder {
// Use Bool.newBuilder() to construct.
private Bool(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Bool(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Bool defaultInstance;
public static Bool getDefaultInstance() {
return defaultInstance;
}
public Bool getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Bool(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
data_ = input.readBool();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzBool.internal_static_gazebo_msgs_Bool_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzBool.internal_static_gazebo_msgs_Bool_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzBool.Bool.class, gazebo.msgs.GzBool.Bool.Builder.class);
}
public static com.google.protobuf.Parser<Bool> PARSER =
new com.google.protobuf.AbstractParser<Bool>() {
public Bool parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Bool(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Bool> getParserForType() {
return PARSER;
}
private int bitField0_;
// required bool data = 1;
public static final int DATA_FIELD_NUMBER = 1;
private boolean data_;
/**
* <code>required bool data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool data = 1;</code>
*/
public boolean getData() {
return data_;
}
private void initFields() {
data_ = false;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasData()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBool(1, data_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(1, data_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzBool.Bool parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzBool.Bool parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzBool.Bool parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzBool.Bool parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzBool.Bool parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzBool.Bool parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzBool.Bool parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzBool.Bool parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzBool.Bool parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzBool.Bool parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzBool.Bool prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Bool}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzBool.BoolOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzBool.internal_static_gazebo_msgs_Bool_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzBool.internal_static_gazebo_msgs_Bool_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzBool.Bool.class, gazebo.msgs.GzBool.Bool.Builder.class);
}
// Construct using gazebo.msgs.GzBool.Bool.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
data_ = false;
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzBool.internal_static_gazebo_msgs_Bool_descriptor;
}
public gazebo.msgs.GzBool.Bool getDefaultInstanceForType() {
return gazebo.msgs.GzBool.Bool.getDefaultInstance();
}
public gazebo.msgs.GzBool.Bool build() {
gazebo.msgs.GzBool.Bool result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzBool.Bool buildPartial() {
gazebo.msgs.GzBool.Bool result = new gazebo.msgs.GzBool.Bool(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.data_ = data_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzBool.Bool) {
return mergeFrom((gazebo.msgs.GzBool.Bool)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzBool.Bool other) {
if (other == gazebo.msgs.GzBool.Bool.getDefaultInstance()) return this;
if (other.hasData()) {
setData(other.getData());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasData()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzBool.Bool parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzBool.Bool) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required bool data = 1;
private boolean data_ ;
/**
* <code>required bool data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool data = 1;</code>
*/
public boolean getData() {
return data_;
}
/**
* <code>required bool data = 1;</code>
*/
public Builder setData(boolean value) {
bitField0_ |= 0x00000001;
data_ = value;
onChanged();
return this;
}
/**
* <code>required bool data = 1;</code>
*/
public Builder clearData() {
bitField0_ = (bitField0_ & ~0x00000001);
data_ = false;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Bool)
}
static {
defaultInstance = new Bool(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Bool)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Bool_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Bool_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n!frc_gazebo_plugin/msgs/bool.proto\022\013gaz" +
"ebo.msgs\"\024\n\004Bool\022\014\n\004data\030\001 \002(\010B\010B\006GzBool"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Bool_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Bool_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Bool_descriptor,
new java.lang.String[] { "Data", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,645 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: frc_gazebo_plugin/msgs/driver-station.proto
package gazebo.msgs;
public final class GzDriverStation {
private GzDriverStation() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface DriverStationOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required bool enabled = 1;
/**
* <code>required bool enabled = 1;</code>
*/
boolean hasEnabled();
/**
* <code>required bool enabled = 1;</code>
*/
boolean getEnabled();
// required .gazebo.msgs.DriverStation.State state = 2;
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
boolean hasState();
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
gazebo.msgs.GzDriverStation.DriverStation.State getState();
}
/**
* Protobuf type {@code gazebo.msgs.DriverStation}
*/
public static final class DriverStation extends
com.google.protobuf.GeneratedMessage
implements DriverStationOrBuilder {
// Use DriverStation.newBuilder() to construct.
private DriverStation(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private DriverStation(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final DriverStation defaultInstance;
public static DriverStation getDefaultInstance() {
return defaultInstance;
}
public DriverStation getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private DriverStation(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
enabled_ = input.readBool();
break;
}
case 16: {
int rawValue = input.readEnum();
gazebo.msgs.GzDriverStation.DriverStation.State value = gazebo.msgs.GzDriverStation.DriverStation.State.valueOf(rawValue);
if (value == null) {
unknownFields.mergeVarintField(2, rawValue);
} else {
bitField0_ |= 0x00000002;
state_ = value;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzDriverStation.internal_static_gazebo_msgs_DriverStation_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzDriverStation.internal_static_gazebo_msgs_DriverStation_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzDriverStation.DriverStation.class, gazebo.msgs.GzDriverStation.DriverStation.Builder.class);
}
public static com.google.protobuf.Parser<DriverStation> PARSER =
new com.google.protobuf.AbstractParser<DriverStation>() {
public DriverStation parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new DriverStation(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<DriverStation> getParserForType() {
return PARSER;
}
/**
* Protobuf enum {@code gazebo.msgs.DriverStation.State}
*/
public enum State
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>AUTO = 0;</code>
*/
AUTO(0, 0),
/**
* <code>TELEOP = 1;</code>
*/
TELEOP(1, 1),
/**
* <code>TEST = 2;</code>
*/
TEST(2, 2),
;
/**
* <code>AUTO = 0;</code>
*/
public static final int AUTO_VALUE = 0;
/**
* <code>TELEOP = 1;</code>
*/
public static final int TELEOP_VALUE = 1;
/**
* <code>TEST = 2;</code>
*/
public static final int TEST_VALUE = 2;
public final int getNumber() { return value; }
public static State valueOf(int value) {
switch (value) {
case 0: return AUTO;
case 1: return TELEOP;
case 2: return TEST;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<State>
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap<State>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<State>() {
public State findValueByNumber(int number) {
return State.valueOf(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return gazebo.msgs.GzDriverStation.DriverStation.getDescriptor().getEnumTypes().get(0);
}
private static final State[] VALUES = values();
public static State valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private State(int index, int value) {
this.index = index;
this.value = value;
}
// @@protoc_insertion_point(enum_scope:gazebo.msgs.DriverStation.State)
}
private int bitField0_;
// required bool enabled = 1;
public static final int ENABLED_FIELD_NUMBER = 1;
private boolean enabled_;
/**
* <code>required bool enabled = 1;</code>
*/
public boolean hasEnabled() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool enabled = 1;</code>
*/
public boolean getEnabled() {
return enabled_;
}
// required .gazebo.msgs.DriverStation.State state = 2;
public static final int STATE_FIELD_NUMBER = 2;
private gazebo.msgs.GzDriverStation.DriverStation.State state_;
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public boolean hasState() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public gazebo.msgs.GzDriverStation.DriverStation.State getState() {
return state_;
}
private void initFields() {
enabled_ = false;
state_ = gazebo.msgs.GzDriverStation.DriverStation.State.AUTO;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasEnabled()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasState()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBool(1, enabled_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeEnum(2, state_.getNumber());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(1, enabled_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(2, state_.getNumber());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzDriverStation.DriverStation parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzDriverStation.DriverStation prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.DriverStation}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzDriverStation.DriverStationOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzDriverStation.internal_static_gazebo_msgs_DriverStation_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzDriverStation.internal_static_gazebo_msgs_DriverStation_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzDriverStation.DriverStation.class, gazebo.msgs.GzDriverStation.DriverStation.Builder.class);
}
// Construct using gazebo.msgs.GzDriveStation.DriverStation.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
enabled_ = false;
bitField0_ = (bitField0_ & ~0x00000001);
state_ = gazebo.msgs.GzDriverStation.DriverStation.State.AUTO;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzDriverStation.internal_static_gazebo_msgs_DriverStation_descriptor;
}
public gazebo.msgs.GzDriverStation.DriverStation getDefaultInstanceForType() {
return gazebo.msgs.GzDriverStation.DriverStation.getDefaultInstance();
}
public gazebo.msgs.GzDriverStation.DriverStation build() {
gazebo.msgs.GzDriverStation.DriverStation result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzDriverStation.DriverStation buildPartial() {
gazebo.msgs.GzDriverStation.DriverStation result = new gazebo.msgs.GzDriverStation.DriverStation(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.enabled_ = enabled_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.state_ = state_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzDriverStation.DriverStation) {
return mergeFrom((gazebo.msgs.GzDriverStation.DriverStation)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzDriverStation.DriverStation other) {
if (other == gazebo.msgs.GzDriverStation.DriverStation.getDefaultInstance()) return this;
if (other.hasEnabled()) {
setEnabled(other.getEnabled());
}
if (other.hasState()) {
setState(other.getState());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasEnabled()) {
return false;
}
if (!hasState()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzDriverStation.DriverStation parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzDriverStation.DriverStation) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required bool enabled = 1;
private boolean enabled_ ;
/**
* <code>required bool enabled = 1;</code>
*/
public boolean hasEnabled() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool enabled = 1;</code>
*/
public boolean getEnabled() {
return enabled_;
}
/**
* <code>required bool enabled = 1;</code>
*/
public Builder setEnabled(boolean value) {
bitField0_ |= 0x00000001;
enabled_ = value;
onChanged();
return this;
}
/**
* <code>required bool enabled = 1;</code>
*/
public Builder clearEnabled() {
bitField0_ = (bitField0_ & ~0x00000001);
enabled_ = false;
onChanged();
return this;
}
// required .gazebo.msgs.DriverStation.State state = 2;
private gazebo.msgs.GzDriverStation.DriverStation.State state_ = gazebo.msgs.GzDriverStation.DriverStation.State.AUTO;
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public boolean hasState() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public gazebo.msgs.GzDriverStation.DriverStation.State getState() {
return state_;
}
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public Builder setState(gazebo.msgs.GzDriverStation.DriverStation.State value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
state_ = value;
onChanged();
return this;
}
/**
* <code>required .gazebo.msgs.DriverStation.State state = 2;</code>
*/
public Builder clearState() {
bitField0_ = (bitField0_ & ~0x00000002);
state_ = gazebo.msgs.GzDriverStation.DriverStation.State.AUTO;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.DriverStation)
}
static {
defaultInstance = new DriverStation(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.DriverStation)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_DriverStation_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_DriverStation_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n+frc_gazebo_plugin/msgs/driver-station." +
"proto\022\013gazebo.msgs\"z\n\rDriverStation\022\017\n\007e" +
"nabled\030\001 \002(\010\022/\n\005state\030\002 \002(\0162 .gazebo.msg" +
"s.DriverStation.State\"\'\n\005State\022\010\n\004AUTO\020\000" +
"\022\n\n\006TELEOP\020\001\022\010\n\004TEST\020\002B\020B\016GzDriveStation"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_DriverStation_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_DriverStation_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_DriverStation_descriptor,
new java.lang.String[] { "Enabled", "State", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,453 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: msgs/float64.proto
package gazebo.msgs;
public final class GzFloat64 {
private GzFloat64() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface Float64OrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required double data = 1;
/**
* <code>required double data = 1;</code>
*/
boolean hasData();
/**
* <code>required double data = 1;</code>
*/
double getData();
}
/**
* Protobuf type {@code gazebo.msgs.Float64}
*/
public static final class Float64 extends
com.google.protobuf.GeneratedMessage
implements Float64OrBuilder {
// Use Float64.newBuilder() to construct.
private Float64(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Float64(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Float64 defaultInstance;
public static Float64 getDefaultInstance() {
return defaultInstance;
}
public Float64 getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Float64(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 9: {
bitField0_ |= 0x00000001;
data_ = input.readDouble();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzFloat64.internal_static_gazebo_msgs_Float64_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzFloat64.internal_static_gazebo_msgs_Float64_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzFloat64.Float64.class, gazebo.msgs.GzFloat64.Float64.Builder.class);
}
public static com.google.protobuf.Parser<Float64> PARSER =
new com.google.protobuf.AbstractParser<Float64>() {
public Float64 parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Float64(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Float64> getParserForType() {
return PARSER;
}
private int bitField0_;
// required double data = 1;
public static final int DATA_FIELD_NUMBER = 1;
private double data_;
/**
* <code>required double data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required double data = 1;</code>
*/
public double getData() {
return data_;
}
private void initFields() {
data_ = 0D;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasData()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeDouble(1, data_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeDoubleSize(1, data_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzFloat64.Float64 parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzFloat64.Float64 parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzFloat64.Float64 parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzFloat64.Float64 prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Float64}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzFloat64.Float64OrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzFloat64.internal_static_gazebo_msgs_Float64_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzFloat64.internal_static_gazebo_msgs_Float64_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzFloat64.Float64.class, gazebo.msgs.GzFloat64.Float64.Builder.class);
}
// Construct using gazebo.msgs.GzFloat64.Float64.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
data_ = 0D;
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzFloat64.internal_static_gazebo_msgs_Float64_descriptor;
}
public gazebo.msgs.GzFloat64.Float64 getDefaultInstanceForType() {
return gazebo.msgs.GzFloat64.Float64.getDefaultInstance();
}
public gazebo.msgs.GzFloat64.Float64 build() {
gazebo.msgs.GzFloat64.Float64 result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzFloat64.Float64 buildPartial() {
gazebo.msgs.GzFloat64.Float64 result = new gazebo.msgs.GzFloat64.Float64(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.data_ = data_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzFloat64.Float64) {
return mergeFrom((gazebo.msgs.GzFloat64.Float64)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzFloat64.Float64 other) {
if (other == gazebo.msgs.GzFloat64.Float64.getDefaultInstance()) return this;
if (other.hasData()) {
setData(other.getData());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasData()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzFloat64.Float64 parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzFloat64.Float64) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required double data = 1;
private double data_ ;
/**
* <code>required double data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required double data = 1;</code>
*/
public double getData() {
return data_;
}
/**
* <code>required double data = 1;</code>
*/
public Builder setData(double value) {
bitField0_ |= 0x00000001;
data_ = value;
onChanged();
return this;
}
/**
* <code>required double data = 1;</code>
*/
public Builder clearData() {
bitField0_ = (bitField0_ & ~0x00000001);
data_ = 0D;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Float64)
}
static {
defaultInstance = new Float64(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Float64)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Float64_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Float64_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\022msgs/float64.proto\022\013gazebo.msgs\"\027\n\007Flo" +
"at64\022\014\n\004data\030\001 \002(\001B\013B\tGzFloat64"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Float64_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Float64_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Float64_descriptor,
new java.lang.String[] { "Data", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,670 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: frc_gazebo_plugin/msgs/joystick.proto
package gazebo.msgs;
public final class GzJoystick {
private GzJoystick() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface JoystickOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// repeated double axes = 1;
/**
* <code>repeated double axes = 1;</code>
*/
java.util.List<java.lang.Double> getAxesList();
/**
* <code>repeated double axes = 1;</code>
*/
int getAxesCount();
/**
* <code>repeated double axes = 1;</code>
*/
double getAxes(int index);
// repeated bool buttons = 2;
/**
* <code>repeated bool buttons = 2;</code>
*/
java.util.List<java.lang.Boolean> getButtonsList();
/**
* <code>repeated bool buttons = 2;</code>
*/
int getButtonsCount();
/**
* <code>repeated bool buttons = 2;</code>
*/
boolean getButtons(int index);
}
/**
* Protobuf type {@code gazebo.msgs.Joystick}
*/
public static final class Joystick extends
com.google.protobuf.GeneratedMessage
implements JoystickOrBuilder {
// Use Joystick.newBuilder() to construct.
private Joystick(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Joystick(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Joystick defaultInstance;
public static Joystick getDefaultInstance() {
return defaultInstance;
}
public Joystick getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Joystick(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 9: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = new java.util.ArrayList<java.lang.Double>();
mutable_bitField0_ |= 0x00000001;
}
axes_.add(input.readDouble());
break;
}
case 10: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) {
axes_ = new java.util.ArrayList<java.lang.Double>();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
axes_.add(input.readDouble());
}
input.popLimit(limit);
break;
}
case 16: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>();
mutable_bitField0_ |= 0x00000002;
}
buttons_.add(input.readBool());
break;
}
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>();
mutable_bitField0_ |= 0x00000002;
}
while (input.getBytesUntilLimit() > 0) {
buttons_.add(input.readBool());
}
input.popLimit(limit);
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = java.util.Collections.unmodifiableList(axes_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = java.util.Collections.unmodifiableList(buttons_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzJoystick.Joystick.class, gazebo.msgs.GzJoystick.Joystick.Builder.class);
}
public static com.google.protobuf.Parser<Joystick> PARSER =
new com.google.protobuf.AbstractParser<Joystick>() {
public Joystick parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Joystick(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Joystick> getParserForType() {
return PARSER;
}
// repeated double axes = 1;
public static final int AXES_FIELD_NUMBER = 1;
private java.util.List<java.lang.Double> axes_;
/**
* <code>repeated double axes = 1;</code>
*/
public java.util.List<java.lang.Double>
getAxesList() {
return axes_;
}
/**
* <code>repeated double axes = 1;</code>
*/
public int getAxesCount() {
return axes_.size();
}
/**
* <code>repeated double axes = 1;</code>
*/
public double getAxes(int index) {
return axes_.get(index);
}
// repeated bool buttons = 2;
public static final int BUTTONS_FIELD_NUMBER = 2;
private java.util.List<java.lang.Boolean> buttons_;
/**
* <code>repeated bool buttons = 2;</code>
*/
public java.util.List<java.lang.Boolean>
getButtonsList() {
return buttons_;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public int getButtonsCount() {
return buttons_.size();
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public boolean getButtons(int index) {
return buttons_.get(index);
}
private void initFields() {
axes_ = java.util.Collections.emptyList();
buttons_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < axes_.size(); i++) {
output.writeDouble(1, axes_.get(i));
}
for (int i = 0; i < buttons_.size(); i++) {
output.writeBool(2, buttons_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
{
int dataSize = 0;
dataSize = 8 * getAxesList().size();
size += dataSize;
size += 1 * getAxesList().size();
}
{
int dataSize = 0;
dataSize = 1 * getButtonsList().size();
size += dataSize;
size += 1 * getButtonsList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzJoystick.Joystick prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Joystick}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzJoystick.JoystickOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzJoystick.Joystick.class, gazebo.msgs.GzJoystick.Joystick.Builder.class);
}
// Construct using gazebo.msgs.GzJoystick.Joystick.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
axes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
buttons_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
public gazebo.msgs.GzJoystick.Joystick getDefaultInstanceForType() {
return gazebo.msgs.GzJoystick.Joystick.getDefaultInstance();
}
public gazebo.msgs.GzJoystick.Joystick build() {
gazebo.msgs.GzJoystick.Joystick result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzJoystick.Joystick buildPartial() {
gazebo.msgs.GzJoystick.Joystick result = new gazebo.msgs.GzJoystick.Joystick(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = java.util.Collections.unmodifiableList(axes_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.axes_ = axes_;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = java.util.Collections.unmodifiableList(buttons_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.buttons_ = buttons_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzJoystick.Joystick) {
return mergeFrom((gazebo.msgs.GzJoystick.Joystick)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzJoystick.Joystick other) {
if (other == gazebo.msgs.GzJoystick.Joystick.getDefaultInstance()) return this;
if (!other.axes_.isEmpty()) {
if (axes_.isEmpty()) {
axes_ = other.axes_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAxesIsMutable();
axes_.addAll(other.axes_);
}
onChanged();
}
if (!other.buttons_.isEmpty()) {
if (buttons_.isEmpty()) {
buttons_ = other.buttons_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureButtonsIsMutable();
buttons_.addAll(other.buttons_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzJoystick.Joystick parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzJoystick.Joystick) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// repeated double axes = 1;
private java.util.List<java.lang.Double> axes_ = java.util.Collections.emptyList();
private void ensureAxesIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = new java.util.ArrayList<java.lang.Double>(axes_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated double axes = 1;</code>
*/
public java.util.List<java.lang.Double>
getAxesList() {
return java.util.Collections.unmodifiableList(axes_);
}
/**
* <code>repeated double axes = 1;</code>
*/
public int getAxesCount() {
return axes_.size();
}
/**
* <code>repeated double axes = 1;</code>
*/
public double getAxes(int index) {
return axes_.get(index);
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder setAxes(
int index, double value) {
ensureAxesIsMutable();
axes_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder addAxes(double value) {
ensureAxesIsMutable();
axes_.add(value);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder addAllAxes(
java.lang.Iterable<? extends java.lang.Double> values) {
ensureAxesIsMutable();
super.addAll(values, axes_);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder clearAxes() {
axes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
// repeated bool buttons = 2;
private java.util.List<java.lang.Boolean> buttons_ = java.util.Collections.emptyList();
private void ensureButtonsIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>(buttons_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public java.util.List<java.lang.Boolean>
getButtonsList() {
return java.util.Collections.unmodifiableList(buttons_);
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public int getButtonsCount() {
return buttons_.size();
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public boolean getButtons(int index) {
return buttons_.get(index);
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder setButtons(
int index, boolean value) {
ensureButtonsIsMutable();
buttons_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder addButtons(boolean value) {
ensureButtonsIsMutable();
buttons_.add(value);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder addAllButtons(
java.lang.Iterable<? extends java.lang.Boolean> values) {
ensureButtonsIsMutable();
super.addAll(values, buttons_);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder clearButtons() {
buttons_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Joystick)
}
static {
defaultInstance = new Joystick(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Joystick)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Joystick_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Joystick_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n%frc_gazebo_plugin/msgs/joystick.proto\022" +
"\013gazebo.msgs\")\n\010Joystick\022\014\n\004axes\030\001 \003(\001\022\017" +
"\n\007buttons\030\002 \003(\010B\014B\nGzJoystick"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Joystick_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Joystick_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Joystick_descriptor,
new java.lang.String[] { "Axes", "Buttons", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,831 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: packet.proto
package gazebo.msgs;
public final class GzPacket {
private GzPacket() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface PacketOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required .gazebo.msgs.Time stamp = 1;
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
boolean hasStamp();
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
gazebo.msgs.GzTime.Time getStamp();
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
gazebo.msgs.GzTime.TimeOrBuilder getStampOrBuilder();
// required string type = 2;
/**
* <code>required string type = 2;</code>
*/
boolean hasType();
/**
* <code>required string type = 2;</code>
*/
java.lang.String getType();
/**
* <code>required string type = 2;</code>
*/
com.google.protobuf.ByteString
getTypeBytes();
// required bytes serialized_data = 3;
/**
* <code>required bytes serialized_data = 3;</code>
*/
boolean hasSerializedData();
/**
* <code>required bytes serialized_data = 3;</code>
*/
com.google.protobuf.ByteString getSerializedData();
}
/**
* Protobuf type {@code gazebo.msgs.Packet}
*/
public static final class Packet extends
com.google.protobuf.GeneratedMessage
implements PacketOrBuilder {
// Use Packet.newBuilder() to construct.
private Packet(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Packet(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Packet defaultInstance;
public static Packet getDefaultInstance() {
return defaultInstance;
}
public Packet getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Packet(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
gazebo.msgs.GzTime.Time.Builder subBuilder = null;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = stamp_.toBuilder();
}
stamp_ = input.readMessage(gazebo.msgs.GzTime.Time.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(stamp_);
stamp_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000001;
break;
}
case 18: {
bitField0_ |= 0x00000002;
type_ = input.readBytes();
break;
}
case 26: {
bitField0_ |= 0x00000004;
serializedData_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPacket.internal_static_gazebo_msgs_Packet_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPacket.internal_static_gazebo_msgs_Packet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPacket.Packet.class, gazebo.msgs.GzPacket.Packet.Builder.class);
}
public static com.google.protobuf.Parser<Packet> PARSER =
new com.google.protobuf.AbstractParser<Packet>() {
public Packet parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Packet(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Packet> getParserForType() {
return PARSER;
}
private int bitField0_;
// required .gazebo.msgs.Time stamp = 1;
public static final int STAMP_FIELD_NUMBER = 1;
private gazebo.msgs.GzTime.Time stamp_;
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public boolean hasStamp() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public gazebo.msgs.GzTime.Time getStamp() {
return stamp_;
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public gazebo.msgs.GzTime.TimeOrBuilder getStampOrBuilder() {
return stamp_;
}
// required string type = 2;
public static final int TYPE_FIELD_NUMBER = 2;
private java.lang.Object type_;
/**
* <code>required string type = 2;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string type = 2;</code>
*/
public java.lang.String getType() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
type_ = s;
}
return s;
}
}
/**
* <code>required string type = 2;</code>
*/
public com.google.protobuf.ByteString
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required bytes serialized_data = 3;
public static final int SERIALIZED_DATA_FIELD_NUMBER = 3;
private com.google.protobuf.ByteString serializedData_;
/**
* <code>required bytes serialized_data = 3;</code>
*/
public boolean hasSerializedData() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bytes serialized_data = 3;</code>
*/
public com.google.protobuf.ByteString getSerializedData() {
return serializedData_;
}
private void initFields() {
stamp_ = gazebo.msgs.GzTime.Time.getDefaultInstance();
type_ = "";
serializedData_ = com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasStamp()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasType()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasSerializedData()) {
memoizedIsInitialized = 0;
return false;
}
if (!getStamp().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeMessage(1, stamp_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getTypeBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, serializedData_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, stamp_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getTypeBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, serializedData_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPacket.Packet parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzPacket.Packet parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPacket.Packet parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzPacket.Packet prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Packet}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzPacket.PacketOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPacket.internal_static_gazebo_msgs_Packet_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPacket.internal_static_gazebo_msgs_Packet_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPacket.Packet.class, gazebo.msgs.GzPacket.Packet.Builder.class);
}
// Construct using gazebo.msgs.GzPacket.Packet.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getStampFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (stampBuilder_ == null) {
stamp_ = gazebo.msgs.GzTime.Time.getDefaultInstance();
} else {
stampBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000001);
type_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
serializedData_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzPacket.internal_static_gazebo_msgs_Packet_descriptor;
}
public gazebo.msgs.GzPacket.Packet getDefaultInstanceForType() {
return gazebo.msgs.GzPacket.Packet.getDefaultInstance();
}
public gazebo.msgs.GzPacket.Packet build() {
gazebo.msgs.GzPacket.Packet result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzPacket.Packet buildPartial() {
gazebo.msgs.GzPacket.Packet result = new gazebo.msgs.GzPacket.Packet(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
if (stampBuilder_ == null) {
result.stamp_ = stamp_;
} else {
result.stamp_ = stampBuilder_.build();
}
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.type_ = type_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.serializedData_ = serializedData_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzPacket.Packet) {
return mergeFrom((gazebo.msgs.GzPacket.Packet)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzPacket.Packet other) {
if (other == gazebo.msgs.GzPacket.Packet.getDefaultInstance()) return this;
if (other.hasStamp()) {
mergeStamp(other.getStamp());
}
if (other.hasType()) {
bitField0_ |= 0x00000002;
type_ = other.type_;
onChanged();
}
if (other.hasSerializedData()) {
setSerializedData(other.getSerializedData());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasStamp()) {
return false;
}
if (!hasType()) {
return false;
}
if (!hasSerializedData()) {
return false;
}
if (!getStamp().isInitialized()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzPacket.Packet parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzPacket.Packet) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required .gazebo.msgs.Time stamp = 1;
private gazebo.msgs.GzTime.Time stamp_ = gazebo.msgs.GzTime.Time.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
gazebo.msgs.GzTime.Time, gazebo.msgs.GzTime.Time.Builder, gazebo.msgs.GzTime.TimeOrBuilder> stampBuilder_;
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public boolean hasStamp() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public gazebo.msgs.GzTime.Time getStamp() {
if (stampBuilder_ == null) {
return stamp_;
} else {
return stampBuilder_.getMessage();
}
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public Builder setStamp(gazebo.msgs.GzTime.Time value) {
if (stampBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
stamp_ = value;
onChanged();
} else {
stampBuilder_.setMessage(value);
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public Builder setStamp(
gazebo.msgs.GzTime.Time.Builder builderForValue) {
if (stampBuilder_ == null) {
stamp_ = builderForValue.build();
onChanged();
} else {
stampBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public Builder mergeStamp(gazebo.msgs.GzTime.Time value) {
if (stampBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001) &&
stamp_ != gazebo.msgs.GzTime.Time.getDefaultInstance()) {
stamp_ =
gazebo.msgs.GzTime.Time.newBuilder(stamp_).mergeFrom(value).buildPartial();
} else {
stamp_ = value;
}
onChanged();
} else {
stampBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000001;
return this;
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public Builder clearStamp() {
if (stampBuilder_ == null) {
stamp_ = gazebo.msgs.GzTime.Time.getDefaultInstance();
onChanged();
} else {
stampBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public gazebo.msgs.GzTime.Time.Builder getStampBuilder() {
bitField0_ |= 0x00000001;
onChanged();
return getStampFieldBuilder().getBuilder();
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
public gazebo.msgs.GzTime.TimeOrBuilder getStampOrBuilder() {
if (stampBuilder_ != null) {
return stampBuilder_.getMessageOrBuilder();
} else {
return stamp_;
}
}
/**
* <code>required .gazebo.msgs.Time stamp = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
gazebo.msgs.GzTime.Time, gazebo.msgs.GzTime.Time.Builder, gazebo.msgs.GzTime.TimeOrBuilder>
getStampFieldBuilder() {
if (stampBuilder_ == null) {
stampBuilder_ = new com.google.protobuf.SingleFieldBuilder<
gazebo.msgs.GzTime.Time, gazebo.msgs.GzTime.Time.Builder, gazebo.msgs.GzTime.TimeOrBuilder>(
stamp_,
getParentForChildren(),
isClean());
stamp_ = null;
}
return stampBuilder_;
}
// required string type = 2;
private java.lang.Object type_ = "";
/**
* <code>required string type = 2;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string type = 2;</code>
*/
public java.lang.String getType() {
java.lang.Object ref = type_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
type_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string type = 2;</code>
*/
public com.google.protobuf.ByteString
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string type = 2;</code>
*/
public Builder setType(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
type_ = value;
onChanged();
return this;
}
/**
* <code>required string type = 2;</code>
*/
public Builder clearType() {
bitField0_ = (bitField0_ & ~0x00000002);
type_ = getDefaultInstance().getType();
onChanged();
return this;
}
/**
* <code>required string type = 2;</code>
*/
public Builder setTypeBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
type_ = value;
onChanged();
return this;
}
// required bytes serialized_data = 3;
private com.google.protobuf.ByteString serializedData_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes serialized_data = 3;</code>
*/
public boolean hasSerializedData() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required bytes serialized_data = 3;</code>
*/
public com.google.protobuf.ByteString getSerializedData() {
return serializedData_;
}
/**
* <code>required bytes serialized_data = 3;</code>
*/
public Builder setSerializedData(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
serializedData_ = value;
onChanged();
return this;
}
/**
* <code>required bytes serialized_data = 3;</code>
*/
public Builder clearSerializedData() {
bitField0_ = (bitField0_ & ~0x00000004);
serializedData_ = getDefaultInstance().getSerializedData();
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Packet)
}
static {
defaultInstance = new Packet(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Packet)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Packet_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Packet_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\014packet.proto\022\013gazebo.msgs\032\ntime.proto\"" +
"Q\n\006Packet\022 \n\005stamp\030\001 \002(\0132\021.gazebo.msgs.T" +
"ime\022\014\n\004type\030\002 \002(\t\022\027\n\017serialized_data\030\003 \002" +
"(\014B\nB\010GzPacket"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Packet_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Packet_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Packet_descriptor,
new java.lang.String[] { "Stamp", "Type", "SerializedData", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
gazebo.msgs.GzTime.getDescriptor(),
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,947 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: gazebo/src/msgs/publish.proto
package gazebo.msgs;
public final class GzPublish {
private GzPublish() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface PublishOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required string topic = 1;
/**
* <code>required string topic = 1;</code>
*/
boolean hasTopic();
/**
* <code>required string topic = 1;</code>
*/
java.lang.String getTopic();
/**
* <code>required string topic = 1;</code>
*/
com.google.protobuf.ByteString
getTopicBytes();
// required string msg_type = 2;
/**
* <code>required string msg_type = 2;</code>
*/
boolean hasMsgType();
/**
* <code>required string msg_type = 2;</code>
*/
java.lang.String getMsgType();
/**
* <code>required string msg_type = 2;</code>
*/
com.google.protobuf.ByteString
getMsgTypeBytes();
// required string host = 3;
/**
* <code>required string host = 3;</code>
*/
boolean hasHost();
/**
* <code>required string host = 3;</code>
*/
java.lang.String getHost();
/**
* <code>required string host = 3;</code>
*/
com.google.protobuf.ByteString
getHostBytes();
// required uint32 port = 4;
/**
* <code>required uint32 port = 4;</code>
*/
boolean hasPort();
/**
* <code>required uint32 port = 4;</code>
*/
int getPort();
}
/**
* Protobuf type {@code gazebo.msgs.Publish}
*/
public static final class Publish extends
com.google.protobuf.GeneratedMessage
implements PublishOrBuilder {
// Use Publish.newBuilder() to construct.
private Publish(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Publish(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Publish defaultInstance;
public static Publish getDefaultInstance() {
return defaultInstance;
}
public Publish getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Publish(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
topic_ = input.readBytes();
break;
}
case 18: {
bitField0_ |= 0x00000002;
msgType_ = input.readBytes();
break;
}
case 26: {
bitField0_ |= 0x00000004;
host_ = input.readBytes();
break;
}
case 32: {
bitField0_ |= 0x00000008;
port_ = input.readUInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPublish.internal_static_gazebo_msgs_Publish_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPublish.internal_static_gazebo_msgs_Publish_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPublish.Publish.class, gazebo.msgs.GzPublish.Publish.Builder.class);
}
public static com.google.protobuf.Parser<Publish> PARSER =
new com.google.protobuf.AbstractParser<Publish>() {
public Publish parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Publish(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Publish> getParserForType() {
return PARSER;
}
private int bitField0_;
// required string topic = 1;
public static final int TOPIC_FIELD_NUMBER = 1;
private java.lang.Object topic_;
/**
* <code>required string topic = 1;</code>
*/
public boolean hasTopic() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string topic = 1;</code>
*/
public java.lang.String getTopic() {
java.lang.Object ref = topic_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
topic_ = s;
}
return s;
}
}
/**
* <code>required string topic = 1;</code>
*/
public com.google.protobuf.ByteString
getTopicBytes() {
java.lang.Object ref = topic_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
topic_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required string msg_type = 2;
public static final int MSG_TYPE_FIELD_NUMBER = 2;
private java.lang.Object msgType_;
/**
* <code>required string msg_type = 2;</code>
*/
public boolean hasMsgType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string msg_type = 2;</code>
*/
public java.lang.String getMsgType() {
java.lang.Object ref = msgType_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
msgType_ = s;
}
return s;
}
}
/**
* <code>required string msg_type = 2;</code>
*/
public com.google.protobuf.ByteString
getMsgTypeBytes() {
java.lang.Object ref = msgType_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
msgType_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required string host = 3;
public static final int HOST_FIELD_NUMBER = 3;
private java.lang.Object host_;
/**
* <code>required string host = 3;</code>
*/
public boolean hasHost() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string host = 3;</code>
*/
public java.lang.String getHost() {
java.lang.Object ref = host_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
host_ = s;
}
return s;
}
}
/**
* <code>required string host = 3;</code>
*/
public com.google.protobuf.ByteString
getHostBytes() {
java.lang.Object ref = host_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
host_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required uint32 port = 4;
public static final int PORT_FIELD_NUMBER = 4;
private int port_;
/**
* <code>required uint32 port = 4;</code>
*/
public boolean hasPort() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required uint32 port = 4;</code>
*/
public int getPort() {
return port_;
}
private void initFields() {
topic_ = "";
msgType_ = "";
host_ = "";
port_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasTopic()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasMsgType()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasHost()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasPort()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getTopicBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getMsgTypeBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getHostBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeUInt32(4, port_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getTopicBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getMsgTypeBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getHostBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(4, port_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPublish.Publish parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzPublish.Publish parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPublish.Publish parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzPublish.Publish prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Publish}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzPublish.PublishOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPublish.internal_static_gazebo_msgs_Publish_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPublish.internal_static_gazebo_msgs_Publish_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPublish.Publish.class, gazebo.msgs.GzPublish.Publish.Builder.class);
}
// Construct using gazebo.msgs.GzPublish.Publish.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
topic_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
msgType_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
host_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
port_ = 0;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzPublish.internal_static_gazebo_msgs_Publish_descriptor;
}
public gazebo.msgs.GzPublish.Publish getDefaultInstanceForType() {
return gazebo.msgs.GzPublish.Publish.getDefaultInstance();
}
public gazebo.msgs.GzPublish.Publish build() {
gazebo.msgs.GzPublish.Publish result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzPublish.Publish buildPartial() {
gazebo.msgs.GzPublish.Publish result = new gazebo.msgs.GzPublish.Publish(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.topic_ = topic_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.msgType_ = msgType_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.host_ = host_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.port_ = port_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzPublish.Publish) {
return mergeFrom((gazebo.msgs.GzPublish.Publish)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzPublish.Publish other) {
if (other == gazebo.msgs.GzPublish.Publish.getDefaultInstance()) return this;
if (other.hasTopic()) {
bitField0_ |= 0x00000001;
topic_ = other.topic_;
onChanged();
}
if (other.hasMsgType()) {
bitField0_ |= 0x00000002;
msgType_ = other.msgType_;
onChanged();
}
if (other.hasHost()) {
bitField0_ |= 0x00000004;
host_ = other.host_;
onChanged();
}
if (other.hasPort()) {
setPort(other.getPort());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasTopic()) {
return false;
}
if (!hasMsgType()) {
return false;
}
if (!hasHost()) {
return false;
}
if (!hasPort()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzPublish.Publish parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzPublish.Publish) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required string topic = 1;
private java.lang.Object topic_ = "";
/**
* <code>required string topic = 1;</code>
*/
public boolean hasTopic() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string topic = 1;</code>
*/
public java.lang.String getTopic() {
java.lang.Object ref = topic_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
topic_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string topic = 1;</code>
*/
public com.google.protobuf.ByteString
getTopicBytes() {
java.lang.Object ref = topic_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
topic_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string topic = 1;</code>
*/
public Builder setTopic(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
topic_ = value;
onChanged();
return this;
}
/**
* <code>required string topic = 1;</code>
*/
public Builder clearTopic() {
bitField0_ = (bitField0_ & ~0x00000001);
topic_ = getDefaultInstance().getTopic();
onChanged();
return this;
}
/**
* <code>required string topic = 1;</code>
*/
public Builder setTopicBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
topic_ = value;
onChanged();
return this;
}
// required string msg_type = 2;
private java.lang.Object msgType_ = "";
/**
* <code>required string msg_type = 2;</code>
*/
public boolean hasMsgType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string msg_type = 2;</code>
*/
public java.lang.String getMsgType() {
java.lang.Object ref = msgType_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
msgType_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string msg_type = 2;</code>
*/
public com.google.protobuf.ByteString
getMsgTypeBytes() {
java.lang.Object ref = msgType_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
msgType_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string msg_type = 2;</code>
*/
public Builder setMsgType(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
msgType_ = value;
onChanged();
return this;
}
/**
* <code>required string msg_type = 2;</code>
*/
public Builder clearMsgType() {
bitField0_ = (bitField0_ & ~0x00000002);
msgType_ = getDefaultInstance().getMsgType();
onChanged();
return this;
}
/**
* <code>required string msg_type = 2;</code>
*/
public Builder setMsgTypeBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
msgType_ = value;
onChanged();
return this;
}
// required string host = 3;
private java.lang.Object host_ = "";
/**
* <code>required string host = 3;</code>
*/
public boolean hasHost() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required string host = 3;</code>
*/
public java.lang.String getHost() {
java.lang.Object ref = host_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
host_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string host = 3;</code>
*/
public com.google.protobuf.ByteString
getHostBytes() {
java.lang.Object ref = host_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
host_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string host = 3;</code>
*/
public Builder setHost(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
host_ = value;
onChanged();
return this;
}
/**
* <code>required string host = 3;</code>
*/
public Builder clearHost() {
bitField0_ = (bitField0_ & ~0x00000004);
host_ = getDefaultInstance().getHost();
onChanged();
return this;
}
/**
* <code>required string host = 3;</code>
*/
public Builder setHostBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
host_ = value;
onChanged();
return this;
}
// required uint32 port = 4;
private int port_ ;
/**
* <code>required uint32 port = 4;</code>
*/
public boolean hasPort() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>required uint32 port = 4;</code>
*/
public int getPort() {
return port_;
}
/**
* <code>required uint32 port = 4;</code>
*/
public Builder setPort(int value) {
bitField0_ |= 0x00000008;
port_ = value;
onChanged();
return this;
}
/**
* <code>required uint32 port = 4;</code>
*/
public Builder clearPort() {
bitField0_ = (bitField0_ & ~0x00000008);
port_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Publish)
}
static {
defaultInstance = new Publish(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Publish)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Publish_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Publish_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\035gazebo/src/msgs/publish.proto\022\013gazebo." +
"msgs\"F\n\007Publish\022\r\n\005topic\030\001 \002(\t\022\020\n\010msg_ty" +
"pe\030\002 \002(\t\022\014\n\004host\030\003 \002(\t\022\014\n\004port\030\004 \002(\rB\013B\t" +
"GzPublish"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Publish_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Publish_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Publish_descriptor,
new java.lang.String[] { "Topic", "MsgType", "Host", "Port", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,737 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: publishers.proto
package gazebo.msgs;
public final class GzPublishers {
private GzPublishers() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface PublishersOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// repeated .gazebo.msgs.Publish publisher = 1;
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
java.util.List<gazebo.msgs.GzPublish.Publish>
getPublisherList();
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
gazebo.msgs.GzPublish.Publish getPublisher(int index);
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
int getPublisherCount();
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
java.util.List<? extends gazebo.msgs.GzPublish.PublishOrBuilder>
getPublisherOrBuilderList();
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
gazebo.msgs.GzPublish.PublishOrBuilder getPublisherOrBuilder(
int index);
}
/**
* Protobuf type {@code gazebo.msgs.Publishers}
*/
public static final class Publishers extends
com.google.protobuf.GeneratedMessage
implements PublishersOrBuilder {
// Use Publishers.newBuilder() to construct.
private Publishers(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Publishers(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Publishers defaultInstance;
public static Publishers getDefaultInstance() {
return defaultInstance;
}
public Publishers getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Publishers(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
publisher_ = new java.util.ArrayList<gazebo.msgs.GzPublish.Publish>();
mutable_bitField0_ |= 0x00000001;
}
publisher_.add(input.readMessage(gazebo.msgs.GzPublish.Publish.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
publisher_ = java.util.Collections.unmodifiableList(publisher_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPublishers.internal_static_gazebo_msgs_Publishers_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPublishers.internal_static_gazebo_msgs_Publishers_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPublishers.Publishers.class, gazebo.msgs.GzPublishers.Publishers.Builder.class);
}
public static com.google.protobuf.Parser<Publishers> PARSER =
new com.google.protobuf.AbstractParser<Publishers>() {
public Publishers parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Publishers(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Publishers> getParserForType() {
return PARSER;
}
// repeated .gazebo.msgs.Publish publisher = 1;
public static final int PUBLISHER_FIELD_NUMBER = 1;
private java.util.List<gazebo.msgs.GzPublish.Publish> publisher_;
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public java.util.List<gazebo.msgs.GzPublish.Publish> getPublisherList() {
return publisher_;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public java.util.List<? extends gazebo.msgs.GzPublish.PublishOrBuilder>
getPublisherOrBuilderList() {
return publisher_;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public int getPublisherCount() {
return publisher_.size();
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.Publish getPublisher(int index) {
return publisher_.get(index);
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.PublishOrBuilder getPublisherOrBuilder(
int index) {
return publisher_.get(index);
}
private void initFields() {
publisher_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
for (int i = 0; i < getPublisherCount(); i++) {
if (!getPublisher(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < publisher_.size(); i++) {
output.writeMessage(1, publisher_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < publisher_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, publisher_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPublishers.Publishers parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzPublishers.Publishers parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzPublishers.Publishers parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzPublishers.Publishers prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Publishers}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzPublishers.PublishersOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzPublishers.internal_static_gazebo_msgs_Publishers_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzPublishers.internal_static_gazebo_msgs_Publishers_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzPublishers.Publishers.class, gazebo.msgs.GzPublishers.Publishers.Builder.class);
}
// Construct using gazebo.msgs.GzPublishers.Publishers.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getPublisherFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (publisherBuilder_ == null) {
publisher_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
publisherBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzPublishers.internal_static_gazebo_msgs_Publishers_descriptor;
}
public gazebo.msgs.GzPublishers.Publishers getDefaultInstanceForType() {
return gazebo.msgs.GzPublishers.Publishers.getDefaultInstance();
}
public gazebo.msgs.GzPublishers.Publishers build() {
gazebo.msgs.GzPublishers.Publishers result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzPublishers.Publishers buildPartial() {
gazebo.msgs.GzPublishers.Publishers result = new gazebo.msgs.GzPublishers.Publishers(this);
int from_bitField0_ = bitField0_;
if (publisherBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
publisher_ = java.util.Collections.unmodifiableList(publisher_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.publisher_ = publisher_;
} else {
result.publisher_ = publisherBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzPublishers.Publishers) {
return mergeFrom((gazebo.msgs.GzPublishers.Publishers)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzPublishers.Publishers other) {
if (other == gazebo.msgs.GzPublishers.Publishers.getDefaultInstance()) return this;
if (publisherBuilder_ == null) {
if (!other.publisher_.isEmpty()) {
if (publisher_.isEmpty()) {
publisher_ = other.publisher_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensurePublisherIsMutable();
publisher_.addAll(other.publisher_);
}
onChanged();
}
} else {
if (!other.publisher_.isEmpty()) {
if (publisherBuilder_.isEmpty()) {
publisherBuilder_.dispose();
publisherBuilder_ = null;
publisher_ = other.publisher_;
bitField0_ = (bitField0_ & ~0x00000001);
publisherBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getPublisherFieldBuilder() : null;
} else {
publisherBuilder_.addAllMessages(other.publisher_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getPublisherCount(); i++) {
if (!getPublisher(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzPublishers.Publishers parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzPublishers.Publishers) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// repeated .gazebo.msgs.Publish publisher = 1;
private java.util.List<gazebo.msgs.GzPublish.Publish> publisher_ =
java.util.Collections.emptyList();
private void ensurePublisherIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
publisher_ = new java.util.ArrayList<gazebo.msgs.GzPublish.Publish>(publisher_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
gazebo.msgs.GzPublish.Publish, gazebo.msgs.GzPublish.Publish.Builder, gazebo.msgs.GzPublish.PublishOrBuilder> publisherBuilder_;
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public java.util.List<gazebo.msgs.GzPublish.Publish> getPublisherList() {
if (publisherBuilder_ == null) {
return java.util.Collections.unmodifiableList(publisher_);
} else {
return publisherBuilder_.getMessageList();
}
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public int getPublisherCount() {
if (publisherBuilder_ == null) {
return publisher_.size();
} else {
return publisherBuilder_.getCount();
}
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.Publish getPublisher(int index) {
if (publisherBuilder_ == null) {
return publisher_.get(index);
} else {
return publisherBuilder_.getMessage(index);
}
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder setPublisher(
int index, gazebo.msgs.GzPublish.Publish value) {
if (publisherBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePublisherIsMutable();
publisher_.set(index, value);
onChanged();
} else {
publisherBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder setPublisher(
int index, gazebo.msgs.GzPublish.Publish.Builder builderForValue) {
if (publisherBuilder_ == null) {
ensurePublisherIsMutable();
publisher_.set(index, builderForValue.build());
onChanged();
} else {
publisherBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder addPublisher(gazebo.msgs.GzPublish.Publish value) {
if (publisherBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePublisherIsMutable();
publisher_.add(value);
onChanged();
} else {
publisherBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder addPublisher(
int index, gazebo.msgs.GzPublish.Publish value) {
if (publisherBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePublisherIsMutable();
publisher_.add(index, value);
onChanged();
} else {
publisherBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder addPublisher(
gazebo.msgs.GzPublish.Publish.Builder builderForValue) {
if (publisherBuilder_ == null) {
ensurePublisherIsMutable();
publisher_.add(builderForValue.build());
onChanged();
} else {
publisherBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder addPublisher(
int index, gazebo.msgs.GzPublish.Publish.Builder builderForValue) {
if (publisherBuilder_ == null) {
ensurePublisherIsMutable();
publisher_.add(index, builderForValue.build());
onChanged();
} else {
publisherBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder addAllPublisher(
java.lang.Iterable<? extends gazebo.msgs.GzPublish.Publish> values) {
if (publisherBuilder_ == null) {
ensurePublisherIsMutable();
super.addAll(values, publisher_);
onChanged();
} else {
publisherBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder clearPublisher() {
if (publisherBuilder_ == null) {
publisher_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
publisherBuilder_.clear();
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public Builder removePublisher(int index) {
if (publisherBuilder_ == null) {
ensurePublisherIsMutable();
publisher_.remove(index);
onChanged();
} else {
publisherBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.Publish.Builder getPublisherBuilder(
int index) {
return getPublisherFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.PublishOrBuilder getPublisherOrBuilder(
int index) {
if (publisherBuilder_ == null) {
return publisher_.get(index); } else {
return publisherBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public java.util.List<? extends gazebo.msgs.GzPublish.PublishOrBuilder>
getPublisherOrBuilderList() {
if (publisherBuilder_ != null) {
return publisherBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(publisher_);
}
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.Publish.Builder addPublisherBuilder() {
return getPublisherFieldBuilder().addBuilder(
gazebo.msgs.GzPublish.Publish.getDefaultInstance());
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public gazebo.msgs.GzPublish.Publish.Builder addPublisherBuilder(
int index) {
return getPublisherFieldBuilder().addBuilder(
index, gazebo.msgs.GzPublish.Publish.getDefaultInstance());
}
/**
* <code>repeated .gazebo.msgs.Publish publisher = 1;</code>
*/
public java.util.List<gazebo.msgs.GzPublish.Publish.Builder>
getPublisherBuilderList() {
return getPublisherFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
gazebo.msgs.GzPublish.Publish, gazebo.msgs.GzPublish.Publish.Builder, gazebo.msgs.GzPublish.PublishOrBuilder>
getPublisherFieldBuilder() {
if (publisherBuilder_ == null) {
publisherBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
gazebo.msgs.GzPublish.Publish, gazebo.msgs.GzPublish.Publish.Builder, gazebo.msgs.GzPublish.PublishOrBuilder>(
publisher_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
publisher_ = null;
}
return publisherBuilder_;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Publishers)
}
static {
defaultInstance = new Publishers(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Publishers)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Publishers_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Publishers_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\020publishers.proto\022\013gazebo.msgs\032\rpublish" +
".proto\"5\n\nPublishers\022\'\n\tpublisher\030\001 \003(\0132" +
"\024.gazebo.msgs.PublishB\016B\014GzPublishers"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Publishers_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Publishers_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Publishers_descriptor,
new java.lang.String[] { "Publisher", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
gazebo.msgs.GzPublish.getDescriptor(),
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,528 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: gz_string.proto
package gazebo.msgs;
public final class GzString {
private GzString() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface StringOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required string data = 1;
/**
* <code>required string data = 1;</code>
*/
boolean hasData();
/**
* <code>required string data = 1;</code>
*/
java.lang.String getData();
/**
* <code>required string data = 1;</code>
*/
com.google.protobuf.ByteString
getDataBytes();
}
/**
* Protobuf type {@code gazebo.msgs.String}
*/
public static final class String extends
com.google.protobuf.GeneratedMessage
implements StringOrBuilder {
// Use String.newBuilder() to construct.
private String(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private String(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final String defaultInstance;
public static String getDefaultInstance() {
return defaultInstance;
}
public String getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private String(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
data_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzString.internal_static_gazebo_msgs_String_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzString.internal_static_gazebo_msgs_String_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzString.String.class, gazebo.msgs.GzString.String.Builder.class);
}
public static com.google.protobuf.Parser<String> PARSER =
new com.google.protobuf.AbstractParser<String>() {
public String parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new String(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<String> getParserForType() {
return PARSER;
}
private int bitField0_;
// required string data = 1;
public static final int DATA_FIELD_NUMBER = 1;
private java.lang.Object data_;
/**
* <code>required string data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string data = 1;</code>
*/
public java.lang.String getData() {
java.lang.Object ref = data_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
data_ = s;
}
return s;
}
}
/**
* <code>required string data = 1;</code>
*/
public com.google.protobuf.ByteString
getDataBytes() {
java.lang.Object ref = data_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
data_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
data_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasData()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getDataBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getDataBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzString.String parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzString.String parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzString.String parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzString.String parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzString.String parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzString.String parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzString.String parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzString.String parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzString.String parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzString.String parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzString.String prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.String}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzString.StringOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzString.internal_static_gazebo_msgs_String_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzString.internal_static_gazebo_msgs_String_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzString.String.class, gazebo.msgs.GzString.String.Builder.class);
}
// Construct using gazebo.msgs.GzString.String.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
data_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzString.internal_static_gazebo_msgs_String_descriptor;
}
public gazebo.msgs.GzString.String getDefaultInstanceForType() {
return gazebo.msgs.GzString.String.getDefaultInstance();
}
public gazebo.msgs.GzString.String build() {
gazebo.msgs.GzString.String result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzString.String buildPartial() {
gazebo.msgs.GzString.String result = new gazebo.msgs.GzString.String(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.data_ = data_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzString.String) {
return mergeFrom((gazebo.msgs.GzString.String)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzString.String other) {
if (other == gazebo.msgs.GzString.String.getDefaultInstance()) return this;
if (other.hasData()) {
bitField0_ |= 0x00000001;
data_ = other.data_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasData()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzString.String parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzString.String) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required string data = 1;
private java.lang.Object data_ = "";
/**
* <code>required string data = 1;</code>
*/
public boolean hasData() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string data = 1;</code>
*/
public java.lang.String getData() {
java.lang.Object ref = data_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
data_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string data = 1;</code>
*/
public com.google.protobuf.ByteString
getDataBytes() {
java.lang.Object ref = data_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
data_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string data = 1;</code>
*/
public Builder setData(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
data_ = value;
onChanged();
return this;
}
/**
* <code>required string data = 1;</code>
*/
public Builder clearData() {
bitField0_ = (bitField0_ & ~0x00000001);
data_ = getDefaultInstance().getData();
onChanged();
return this;
}
/**
* <code>required string data = 1;</code>
*/
public Builder setDataBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
data_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.String)
}
static {
defaultInstance = new String(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.String)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_String_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_String_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\017gz_string.proto\022\013gazebo.msgs\"\026\n\006String" +
"\022\014\n\004data\030\001 \002(\t"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_String_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_String_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_String_descriptor,
new java.lang.String[] { "Data", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,542 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: time.proto
package gazebo.msgs;
public final class GzTime {
private GzTime() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface TimeOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required int32 sec = 1;
/**
* <code>required int32 sec = 1;</code>
*/
boolean hasSec();
/**
* <code>required int32 sec = 1;</code>
*/
int getSec();
// required int32 nsec = 2;
/**
* <code>required int32 nsec = 2;</code>
*/
boolean hasNsec();
/**
* <code>required int32 nsec = 2;</code>
*/
int getNsec();
}
/**
* Protobuf type {@code gazebo.msgs.Time}
*/
public static final class Time extends
com.google.protobuf.GeneratedMessage
implements TimeOrBuilder {
// Use Time.newBuilder() to construct.
private Time(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Time(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Time defaultInstance;
public static Time getDefaultInstance() {
return defaultInstance;
}
public Time getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Time(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
sec_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
nsec_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzTime.internal_static_gazebo_msgs_Time_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzTime.internal_static_gazebo_msgs_Time_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzTime.Time.class, gazebo.msgs.GzTime.Time.Builder.class);
}
public static com.google.protobuf.Parser<Time> PARSER =
new com.google.protobuf.AbstractParser<Time>() {
public Time parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Time(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Time> getParserForType() {
return PARSER;
}
private int bitField0_;
// required int32 sec = 1;
public static final int SEC_FIELD_NUMBER = 1;
private int sec_;
/**
* <code>required int32 sec = 1;</code>
*/
public boolean hasSec() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 sec = 1;</code>
*/
public int getSec() {
return sec_;
}
// required int32 nsec = 2;
public static final int NSEC_FIELD_NUMBER = 2;
private int nsec_;
/**
* <code>required int32 nsec = 2;</code>
*/
public boolean hasNsec() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 nsec = 2;</code>
*/
public int getNsec() {
return nsec_;
}
private void initFields() {
sec_ = 0;
nsec_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasSec()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasNsec()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, sec_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, nsec_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, sec_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, nsec_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzTime.Time parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzTime.Time parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzTime.Time parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzTime.Time parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzTime.Time parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzTime.Time parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzTime.Time parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzTime.Time parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzTime.Time parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzTime.Time parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzTime.Time prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Time}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzTime.TimeOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzTime.internal_static_gazebo_msgs_Time_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzTime.internal_static_gazebo_msgs_Time_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzTime.Time.class, gazebo.msgs.GzTime.Time.Builder.class);
}
// Construct using gazebo.msgs.GzTime.Time.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
sec_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
nsec_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzTime.internal_static_gazebo_msgs_Time_descriptor;
}
public gazebo.msgs.GzTime.Time getDefaultInstanceForType() {
return gazebo.msgs.GzTime.Time.getDefaultInstance();
}
public gazebo.msgs.GzTime.Time build() {
gazebo.msgs.GzTime.Time result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzTime.Time buildPartial() {
gazebo.msgs.GzTime.Time result = new gazebo.msgs.GzTime.Time(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.sec_ = sec_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.nsec_ = nsec_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzTime.Time) {
return mergeFrom((gazebo.msgs.GzTime.Time)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzTime.Time other) {
if (other == gazebo.msgs.GzTime.Time.getDefaultInstance()) return this;
if (other.hasSec()) {
setSec(other.getSec());
}
if (other.hasNsec()) {
setNsec(other.getNsec());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasSec()) {
return false;
}
if (!hasNsec()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzTime.Time parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzTime.Time) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required int32 sec = 1;
private int sec_ ;
/**
* <code>required int32 sec = 1;</code>
*/
public boolean hasSec() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 sec = 1;</code>
*/
public int getSec() {
return sec_;
}
/**
* <code>required int32 sec = 1;</code>
*/
public Builder setSec(int value) {
bitField0_ |= 0x00000001;
sec_ = value;
onChanged();
return this;
}
/**
* <code>required int32 sec = 1;</code>
*/
public Builder clearSec() {
bitField0_ = (bitField0_ & ~0x00000001);
sec_ = 0;
onChanged();
return this;
}
// required int32 nsec = 2;
private int nsec_ ;
/**
* <code>required int32 nsec = 2;</code>
*/
public boolean hasNsec() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 nsec = 2;</code>
*/
public int getNsec() {
return nsec_;
}
/**
* <code>required int32 nsec = 2;</code>
*/
public Builder setNsec(int value) {
bitField0_ |= 0x00000002;
nsec_ = value;
onChanged();
return this;
}
/**
* <code>required int32 nsec = 2;</code>
*/
public Builder clearNsec() {
bitField0_ = (bitField0_ & ~0x00000002);
nsec_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Time)
}
static {
defaultInstance = new Time(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Time)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Time_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Time_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\ntime.proto\022\013gazebo.msgs\"!\n\004Time\022\013\n\003sec" +
"\030\001 \002(\005\022\014\n\004nsec\030\002 \002(\005B\010B\006GzTime"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Time_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Time_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Time_descriptor,
new java.lang.String[] { "Sec", "Nsec", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,546 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: string_v.proto
package gazebo.msgs;
public final class StringV {
private StringV() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface String_VOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// repeated string data = 1;
/**
* <code>repeated string data = 1;</code>
*/
java.util.List<java.lang.String>
getDataList();
/**
* <code>repeated string data = 1;</code>
*/
int getDataCount();
/**
* <code>repeated string data = 1;</code>
*/
java.lang.String getData(int index);
/**
* <code>repeated string data = 1;</code>
*/
com.google.protobuf.ByteString
getDataBytes(int index);
}
/**
* Protobuf type {@code gazebo.msgs.String_V}
*/
public static final class String_V extends
com.google.protobuf.GeneratedMessage
implements String_VOrBuilder {
// Use String_V.newBuilder() to construct.
private String_V(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private String_V(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final String_V defaultInstance;
public static String_V getDefaultInstance() {
return defaultInstance;
}
public String_V getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private String_V(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
data_ = new com.google.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000001;
}
data_.add(input.readBytes());
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
data_ = new com.google.protobuf.UnmodifiableLazyStringList(data_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.StringV.internal_static_gazebo_msgs_String_V_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.StringV.internal_static_gazebo_msgs_String_V_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.StringV.String_V.class, gazebo.msgs.StringV.String_V.Builder.class);
}
public static com.google.protobuf.Parser<String_V> PARSER =
new com.google.protobuf.AbstractParser<String_V>() {
public String_V parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new String_V(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<String_V> getParserForType() {
return PARSER;
}
// repeated string data = 1;
public static final int DATA_FIELD_NUMBER = 1;
private com.google.protobuf.LazyStringList data_;
/**
* <code>repeated string data = 1;</code>
*/
public java.util.List<java.lang.String>
getDataList() {
return data_;
}
/**
* <code>repeated string data = 1;</code>
*/
public int getDataCount() {
return data_.size();
}
/**
* <code>repeated string data = 1;</code>
*/
public java.lang.String getData(int index) {
return data_.get(index);
}
/**
* <code>repeated string data = 1;</code>
*/
public com.google.protobuf.ByteString
getDataBytes(int index) {
return data_.getByteString(index);
}
private void initFields() {
data_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < data_.size(); i++) {
output.writeBytes(1, data_.getByteString(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
{
int dataSize = 0;
for (int i = 0; i < data_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(data_.getByteString(i));
}
size += dataSize;
size += 1 * getDataList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.StringV.String_V parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.StringV.String_V parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.StringV.String_V parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.StringV.String_V parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.StringV.String_V parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.StringV.String_V parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.StringV.String_V parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.StringV.String_V parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.StringV.String_V parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.StringV.String_V parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.StringV.String_V prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.String_V}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.StringV.String_VOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.StringV.internal_static_gazebo_msgs_String_V_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.StringV.internal_static_gazebo_msgs_String_V_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.StringV.String_V.class, gazebo.msgs.StringV.String_V.Builder.class);
}
// Construct using gazebo.msgs.StringV.String_V.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
data_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.StringV.internal_static_gazebo_msgs_String_V_descriptor;
}
public gazebo.msgs.StringV.String_V getDefaultInstanceForType() {
return gazebo.msgs.StringV.String_V.getDefaultInstance();
}
public gazebo.msgs.StringV.String_V build() {
gazebo.msgs.StringV.String_V result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.StringV.String_V buildPartial() {
gazebo.msgs.StringV.String_V result = new gazebo.msgs.StringV.String_V(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
data_ = new com.google.protobuf.UnmodifiableLazyStringList(
data_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.data_ = data_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.StringV.String_V) {
return mergeFrom((gazebo.msgs.StringV.String_V)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.StringV.String_V other) {
if (other == gazebo.msgs.StringV.String_V.getDefaultInstance()) return this;
if (!other.data_.isEmpty()) {
if (data_.isEmpty()) {
data_ = other.data_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureDataIsMutable();
data_.addAll(other.data_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.StringV.String_V parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.StringV.String_V) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// repeated string data = 1;
private com.google.protobuf.LazyStringList data_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private void ensureDataIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
data_ = new com.google.protobuf.LazyStringArrayList(data_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated string data = 1;</code>
*/
public java.util.List<java.lang.String>
getDataList() {
return java.util.Collections.unmodifiableList(data_);
}
/**
* <code>repeated string data = 1;</code>
*/
public int getDataCount() {
return data_.size();
}
/**
* <code>repeated string data = 1;</code>
*/
public java.lang.String getData(int index) {
return data_.get(index);
}
/**
* <code>repeated string data = 1;</code>
*/
public com.google.protobuf.ByteString
getDataBytes(int index) {
return data_.getByteString(index);
}
/**
* <code>repeated string data = 1;</code>
*/
public Builder setData(
int index, java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureDataIsMutable();
data_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated string data = 1;</code>
*/
public Builder addData(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureDataIsMutable();
data_.add(value);
onChanged();
return this;
}
/**
* <code>repeated string data = 1;</code>
*/
public Builder addAllData(
java.lang.Iterable<java.lang.String> values) {
ensureDataIsMutable();
super.addAll(values, data_);
onChanged();
return this;
}
/**
* <code>repeated string data = 1;</code>
*/
public Builder clearData() {
data_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* <code>repeated string data = 1;</code>
*/
public Builder addDataBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureDataIsMutable();
data_.add(value);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.String_V)
}
static {
defaultInstance = new String_V(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.String_V)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_String_V_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_String_V_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\016string_v.proto\022\013gazebo.msgs\"\030\n\010String_" +
"V\022\014\n\004data\030\001 \003(\t"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_String_V_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_String_V_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_String_V_descriptor,
new java.lang.String[] { "Data", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,135 @@
package org.gazebosim.transport;
import gazebo.msgs.GzPacket.Packet;
import gazebo.msgs.GzTime.Time;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Logger;
import com.google.protobuf.ByteString;
import com.google.protobuf.Message;
/**
* Manages a Gazebo protocol connection.
*
* This can connect to either the Gazebo server, or to a data
* publisher. Additionally, it can act as the TCP client, or as a
* server. In either case, it provides methods to read and write
* structured data on the socket.
*/
public class Connection {
private static int HEADER_SIZE = 8;
public String host;
public int port;
private Socket socket;
private ServerSocket ssocket;
private InputStream is;
private OutputStream os;
private static final Logger LOG = Logger.getLogger("Gazebo Transport");
public Connection() {
}
public void connect(String host, int port) throws UnknownHostException, IOException {
this.host = host;
this.port = port;
socket = new Socket(host, port);
is = socket.getInputStream();
os = socket.getOutputStream();
}
public void serve(final ServerCallback cb) throws IOException {
ssocket = new ServerSocket(0);
host = ssocket.getInetAddress().getHostAddress(); // TODO: get globally addressable name.
port = ssocket.getLocalPort();
new Thread(new Runnable() {
@Override public void run() {
LOG.config("Listening on "+host+":"+port);
while (true) {
Connection conn = new Connection();
try {
conn.socket = ssocket.accept();
conn.is = conn.socket.getInputStream();
conn.os = conn.socket.getOutputStream();
LOG.info("Handling connect from "+conn.socket.getInetAddress());
cb.handle(conn);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}).start();
}
public void close() throws IOException {
LOG.info("Closing connection");
if (socket != null) {
socket.close();
socket = null;
}
if (ssocket != null) {
ssocket.close();
ssocket = null;
}
}
public byte[] rawRead() throws IOException {
synchronized (is) {
// Figure out the message size
byte[] buff= new byte[HEADER_SIZE];
int n = is.read(buff);
if (n != HEADER_SIZE) {
LOG.severe("Only read "+n+" bytes instead of 8 for header.");
return null;
}
int size = Integer.parseInt(new String(buff), 16);
// Read in the actual message
buff = new byte[size];
n = is.read(buff);
if (n != size) {
throw new IOException("Failed to read whole message");
}
return buff;
}
}
public Packet read() throws IOException {
byte[] buff = rawRead();
if (buff == null) {
return null;
}
return Packet.parseFrom(buff);
}
public void write(Message msg) throws IOException {
ByteString data = msg.toByteString();
ByteString header = ByteString.copyFromUtf8(String.format("%08X", data.size()));
ByteString bytes = header.concat(data);
synchronized (os) {
os.write(bytes.toByteArray());
}
}
public void writePacket(String name, Message req) throws IOException {
long ms = System.currentTimeMillis();
Time t = Time.newBuilder().setSec((int) (ms / 1000)).setNsec((int) ((ms%1000)*1000)).build();
Packet pack = Packet.newBuilder().setType(name).setStamp(t)
.setSerializedData(req.toByteString()).build();
write(pack);
}
}

View File

@@ -0,0 +1,31 @@
package org.gazebosim.transport;
import gazebo.msgs.GzBool.Bool;
import gazebo.msgs.GzFloat64;
import gazebo.msgs.GzString;
public class Msgs {
public static GzString.String String() {
return GzString.String.getDefaultInstance();
}
public static GzString.String String(String s) {
return GzString.String.newBuilder().setData(s).build();
}
public static GzFloat64.Float64 Float64() {
return GzFloat64.Float64.getDefaultInstance();
}
public static GzFloat64.Float64 Float64(double d) {
return GzFloat64.Float64.newBuilder().setData(d).build();
}
public static Bool Bool() {
return Bool.getDefaultInstance();
}
public static Bool Bool(boolean b) {
return Bool.newBuilder().setData(b).build();
}
}

View File

@@ -0,0 +1,231 @@
package org.gazebosim.transport;
import gazebo.msgs.GzPacket.Packet;
import gazebo.msgs.GzPublish.Publish;
import gazebo.msgs.GzPublishers.Publishers;
import gazebo.msgs.GzString;
import gazebo.msgs.GzSubscribe.Subscribe;
import gazebo.msgs.StringV.String_V;
import java.io.IOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.ConsoleHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Message;
public class Node implements Runnable, ServerCallback {
private String name;
private Connection master;
private Connection server;
private List<String> namespaces;
private Map<String, PublisherRecord> publishers;
@SuppressWarnings("rawtypes")
private Map<String, Subscriber> subscriptions;
private static final Logger LOG = Logger.getLogger("Gazebo Transport");
public Node(String name) {
this.name = name;
namespaces = new LinkedList<>();
publishers = new HashMap<>();
subscriptions = new HashMap<>();
// Get rid of the excessive information
LOG.setLevel(Level.WARNING);
Handler[] handlers = LOG.getParent().getHandlers();
if (handlers[0] instanceof ConsoleHandler) {
((ConsoleHandler) handlers[0]).setFormatter(new Formatter() {
@Override public String format(LogRecord record) {
return String.format("%s|%s: %s\n", record.getLevel(), record.getLoggerName(), record.getMessage());
}
});
}
try {
master = new Connection();
master.connect("localhost", 11345);
server = new Connection();
server.serve(this);
initializeConnection();
} catch (SocketException e ) {
LOG.severe("Socket error: " + e);
return;
} catch (UnknownHostException e ) {
LOG.severe("Invalid Host");
return;
} catch (IOException e ) {
LOG.severe("I/O error: " + e);
LOG.severe(e.getStackTrace().toString());
return;
}
new Thread(this).start();
}
public <T extends Message> Publisher<T> advertise(String topic, T defaultMessage) {
topic = fixTopic(topic);
LOG.info("ADV "+topic);
String type = defaultMessage.getDescriptorForType().getFullName();
Publisher<T> pub = new Publisher<T>(topic, type, server.host, server.port);
publishers.put(topic, pub);
Publish req = Publish.newBuilder().setTopic(topic).setMsgType(type)
.setHost(server.host).setPort(server.port).build();
try {
master.writePacket("advertise", req);
} catch (IOException e) {
e.printStackTrace(); // FIXME: Shouldn't happen, should probably complain louder
}
return pub;
}
public <T extends Message> Subscriber<T>
subscribe(String topic, T defaultMessage, SubscriberCallback<T> cb) {
topic = fixTopic(topic);
LOG.info("SUB "+topic);
if (subscriptions.containsKey(topic)) {
throw new RuntimeException("Multiple subscribers for: "+topic);
}
String type = defaultMessage.getDescriptorForType().getFullName();
Subscribe req = Subscribe.newBuilder().setTopic(topic).setMsgType(type)
.setHost(server.host).setPort(server.port).setLatching(false).build();
try {
master.writePacket("subscribe", req);
} catch (IOException e) {
e.printStackTrace(); // FIXME: Shouldn't happen, should probably complain louder
}
Subscriber<T> s = new Subscriber<>(topic, type, cb, defaultMessage,
server.host, server.port);
subscriptions.put(topic, s);
for (PublisherRecord p : publishers.values()) {
if (p.getTopic().equals(topic)) {
s.connect(p);
}
}
return s;
}
@Override
public void run() {
try {
while (true) {
Packet packet = master.read();
if (packet == null) {
LOG.severe("Received null packet, shutting down connection to master.");
master.close();
return;
}
processPacket(packet);
}
} catch (IOException e ) {
LOG.severe("I/O error: " + e);
e.printStackTrace(); // FIXME: Log
}
}
private void initializeConnection() throws IOException {
Packet initData = master.read();
if (!initData.getType().equals("version_init")) {
throw new IOException("Expected 'version_init' packet, got '"+initData.getType()+"'.");
}
GzString.String version = GzString.String.parseFrom(initData.getSerializedData());
LOG.info("Version: "+version.getData()); // TODO: Check version
Packet namespaceData = master.read();
String_V ns = String_V.parseFrom(namespaceData.getSerializedData());
namespaces.addAll(ns.getDataList());
LOG.info(namespaces.toString());
Packet publisherData = master.read();
if (publisherData.getType().equals("publishers_init")) {
Publishers pubs = Publishers.parseFrom(publisherData.getSerializedData());
for (Publish pub : pubs.getPublisherList()) {
PublisherRecord record = new RemotePublisherRecord(pub);
publishers.put(record.getTopic(), record);
}
LOG.info(publishers.toString());
} else {
LOG.severe("No publisher data received.");
}
}
public void processPacket(Packet packet) throws InvalidProtocolBufferException {
if (packet.getType().equals("publisher_add")) {
PublisherRecord pub = new RemotePublisherRecord(Publish.parseFrom(packet.getSerializedData()));
if (pub.getHost().equals(server.host) && pub.getPort() == server.port) {
LOG.info("ACK "+pub.getTopic());
return; // This is us
}
LOG.info("New Publisher: "+pub.getTopic());
publishers.put(pub.getTopic(), pub);
} else if (packet.getType().equals("publisher_subscribe") ||
packet.getType().equals("publisher_advertise")) {
PublisherRecord pub = new RemotePublisherRecord(Publish.parseFrom(packet.getSerializedData()));
if (pub.getHost().equals(server.host) && pub.getPort() == server.port) {
LOG.info("Ignoring subscription request on (local) "+pub.getTopic());
return; // This is us
}
LOG.info("PUBSUB found for "+pub.getTopic());
subscriptions.get(pub.getTopic()).connect(pub);
} else if (packet.getType().equals("topic_namespace_add")) {
namespaces.add(GzString.String.parseFrom(packet.getSerializedData()).getData());
LOG.info("New Namespace: "+namespaces.get(namespaces.size()-1));
} else if (packet.getType().equals("unsubscribe")) {
Subscribe sub = Subscribe.parseFrom(packet.getSerializedData());
LOG.warning("Ignoring unsubscribe: "+sub);
} else {
LOG.warning("Can't handle "+packet.getType());
}
}
@Override
public void handle(Connection conn) throws IOException {
Packet msg = conn.read();
if (msg == null) {
LOG.severe("Read null message.");
return;
}
if (msg.getType().equals("sub")) {
Subscribe sub = Subscribe.parseFrom(msg.getSerializedData());
if (!publishers.containsKey(sub.getTopic())) {
LOG.severe("Subscription for unknown topic: "
+ sub.getTopic());
return;
}
PublisherRecord pub = publishers.get(sub.getTopic());
if (!pub.getMsgType().equals(sub.getMsgType())) {
LOG.severe(String.format("Message type mismatch requested=%d publishing=%s\n",
pub.getMsgType(), sub.getMsgType()));
return;
}
LOG.info("PUB " + sub.getTopic());
pub.connect(conn);
} else {
LOG.warning("Unknown message type: " + msg.getType());
}
}
private String fixTopic(String topic) {
return "/gazebo/" + name + "/" + topic;
}
}

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