mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Added Omar's changes to the compressor interface Fixes to make C++ plugin compile on linux. Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal. Fixed wpilibJavaSim artifactId to mirror the new convention. Modified the build of the java plugin to pull in the simulation dependencies. Added stacktrace printing. Fixed support for creating projects. Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot. Added support for a "WPILib Simulate" button. Added GearsBot to the built in examples. Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot. Removed unused import. Added file browser for world files. Added support for debugging in simulation. Change simulate icon to be a Gazebo icon. Switched over to the gazebo messaging system. Updated location of default world file. Reverted cmake change. Fixed bug in WPILibJSim, added better logging and cleaned up code. Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies. Added installation to frc_gazebo_plugin Makefile. Fixed running of simulation to actually use frcsim. Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode. Added notes for generating protobuf messages. Import of the debuild process into the main repository. Moved frc_gazebo_plugin under simulation and removed the gazebo folder. Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1]. Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot. Reduced delay between starting frcsim and the users program to 1 second. Updated GearsBot example. Fixed a few minor issues for demoable state. Added simulator support for Victors, Jaguars and Talons. Added NetworkTables, SmartDashboard and LiveWindow to the simulator. Added AnalogPotentiometer for simulation. Added support for simulating encoders. Added simulation support for Gyro. Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup. Added RobotDrive support to simulation. Separated out JavaGazebo so that SimDS will be able to reuse it. Separated out SimDS into its own application.. Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins. Added DriverStation support to WPILibCSim Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim. Cleanup of includes for WPILibCSim Added AnalogPotentiometer to the real WPILibC. Added AnalogPotentiometer to the real WPILibC. Added GearsBot example to C++ eclipse plugin. WPILibCSim fixes to work with launching from the plugin. Package libwpilibsim in a deb file. Added includes to plugin distribution. Added support for external-limit-switches to Gazebo, Java and C++. Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java. Added support for internal limit switches. Updated GearsBot programs to use limit switches + range finders. Added disabling of motors when robot is disabled to more closely mimic the real robot. Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing. Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
This commit is contained in:
committed by
thomasclark
parent
d5a509c7e7
commit
cb56c9a144
65
simulation/frc_gazebo_plugin/src/FRCPlugin.cpp
Normal file
65
simulation/frc_gazebo_plugin/src/FRCPlugin.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
#include "FRCPlugin.h"
|
||||
|
||||
#include <gazebo/physics/Model.hh>
|
||||
#include <gazebo/physics/Link.hh>
|
||||
#include <gazebo/physics/Joint.hh>
|
||||
#include <gazebo/physics/PhysicsEngine.hh>
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
#include <gazebo/transport/transport.hh>
|
||||
#include <gazebo/msgs/msgs.hh>
|
||||
|
||||
#include <string.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "RobotMapParser.h"
|
||||
#include "components/Motor.h"
|
||||
#include "components/Potentiometer.h"
|
||||
#include "components/Encoder.h"
|
||||
|
||||
using namespace gazebo;
|
||||
GZ_REGISTER_MODEL_PLUGIN(FRCPlugin)
|
||||
|
||||
FRCPlugin::FRCPlugin() {}
|
||||
|
||||
FRCPlugin::~FRCPlugin() {}
|
||||
|
||||
|
||||
void FRCPlugin::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) {
|
||||
model = _model;
|
||||
|
||||
// Create robot components from RobotMap
|
||||
if (_sdf->HasElement("robotmap")) {
|
||||
std::string robotmap = common::SystemPaths::Instance()->FindFileURI(_sdf->Get<std::string>("robotmap"));
|
||||
std::cout << "Loading RobotMap: " << robotmap << std::endl;
|
||||
RobotMapParser map("simulator", robotmap, model);
|
||||
map.parse(components);
|
||||
} else {
|
||||
std::cerr << "No RobotMap specified this robot cannnot be controlled." << std::endl;
|
||||
}
|
||||
|
||||
// Connect to Gazebo transport for messaging
|
||||
gzNode = transport::NodePtr(new transport::Node());
|
||||
gzNode->Init("frc");
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
components[i]->connect(gzNode);
|
||||
}
|
||||
enabled = false;
|
||||
sub = gzNode->Subscribe("~/ds/state", &FRCPlugin::dsCallback, this);
|
||||
|
||||
// Connect to the world update event.
|
||||
// This will trigger the Update function every Gazebo iteration
|
||||
updateConn = event::Events::ConnectWorldUpdateBegin(boost::bind(&FRCPlugin::Update, this, _1));
|
||||
}
|
||||
|
||||
// Update all RobotComponents
|
||||
void FRCPlugin::Update(const common::UpdateInfo &_info) {
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
components[i]->update(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FRCPlugin::dsCallback(const msgs::ConstDriverStationPtr &msg) {
|
||||
enabled = msg->enabled();
|
||||
}
|
||||
39
simulation/frc_gazebo_plugin/src/FRCPlugin.h
Normal file
39
simulation/frc_gazebo_plugin/src/FRCPlugin.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef _driveBot_H_
|
||||
#define _driveBot_H_
|
||||
|
||||
#include <gazebo/gazebo.hh>
|
||||
#include <gazebo/physics/PhysicsIface.hh>
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include "msgs/msgs.h"
|
||||
|
||||
using namespace gazebo;
|
||||
|
||||
class FRCPlugin: public ModelPlugin {
|
||||
public:
|
||||
FRCPlugin();
|
||||
~FRCPlugin();
|
||||
//function to load all of the elements
|
||||
void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
|
||||
//function to update all of the elements
|
||||
void Update(const common::UpdateInfo & _info);
|
||||
|
||||
private:
|
||||
//the vector containing all of the robot components.
|
||||
std::vector<RobotComponentPtr> components;
|
||||
|
||||
physics::ModelPtr model;
|
||||
|
||||
physics::LinkPtr frame;
|
||||
|
||||
/// \brief Pointer to the world update function.
|
||||
event::ConnectionPtr updateConn;
|
||||
|
||||
transport::NodePtr gzNode;
|
||||
|
||||
transport::SubscriberPtr sub;
|
||||
volatile bool enabled;
|
||||
void dsCallback(const msgs::ConstDriverStationPtr &msg);
|
||||
};
|
||||
|
||||
#endif
|
||||
273
simulation/frc_gazebo_plugin/src/RobotMapParser.cpp
Normal file
273
simulation/frc_gazebo_plugin/src/RobotMapParser.cpp
Normal file
@@ -0,0 +1,273 @@
|
||||
|
||||
#include "RobotMapParser.h"
|
||||
|
||||
#include "components/Motor.h"
|
||||
#include "components/Potentiometer.h"
|
||||
#include "components/Encoder.h"
|
||||
#include "components/Gyro.h"
|
||||
#include "components/InternalLimitSwitch.h"
|
||||
#include "components/ExternalLimitSwitch.h"
|
||||
#include "components/Rangefinder.h"
|
||||
#include <string.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/pointer_cast.hpp>
|
||||
#include <sdf/sdf.hh>
|
||||
|
||||
RobotMapParser::RobotMapParser(std::string robot, std::string filename, physics::ModelPtr model) {
|
||||
this->robot = robot;
|
||||
this->filename = filename;
|
||||
this->model = model;
|
||||
this->world = model->GetWorld();
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the file and return a list of robot components for the robot
|
||||
*/
|
||||
void RobotMapParser::parse(std::vector<RobotComponentPtr> &components) {
|
||||
// Load an xml document with <robotmap> root tag
|
||||
XMLDocument doc;
|
||||
doc.LoadFile(filename.c_str());
|
||||
|
||||
// Iterate over all of the child tags and parse them accordingly.
|
||||
for (XMLNode *current = doc.FirstChildElement("robotmap")->FirstChild();
|
||||
current != NULL; current = current->NextSibling()) {
|
||||
if (current->ToElement() == NULL) {
|
||||
// We don't care about comments and other non-element types
|
||||
} else if (strcmp(current->Value(), "motor") == 0) {
|
||||
components.push_back(parseMotor(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "potentiometer") == 0) {
|
||||
components.push_back(parsePotentiometer(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "encoder") == 0) {
|
||||
components.push_back(parseEncoder(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "gyro") == 0) {
|
||||
components.push_back(parseGyro(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "internal-limit-switch") == 0) {
|
||||
components.push_back(parseInternalLimitSwitch(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "external-limit-switch") == 0) {
|
||||
components.push_back(parseExternalLimitSwitch(current->ToElement()));
|
||||
} else if (strcmp(current->Value(), "rangefinder") == 0) {
|
||||
components.push_back(parseRangefinder(current->ToElement()));
|
||||
} else {
|
||||
std::cerr << "Unknown element: " << current->Value() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a motor tag. Motor tags have a joint the act on, a location
|
||||
* they're "plugged into" and parameters that control their
|
||||
* behavior. The template of a motor tag is as follows:
|
||||
*
|
||||
* <motor>
|
||||
* <joint>{{ joint name (string) }}</joint>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* <parameters>
|
||||
* <multiplier>{{ torque multiplication factor (number) }}</multiplier>
|
||||
* </parameters>
|
||||
* </motor>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseMotor(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
physics::JointPtr joint = getJoint(node);
|
||||
double multiplier = boost::lexical_cast<double>(getTagValue(
|
||||
node->FirstChildElement("parameters"), "multiplier").c_str());
|
||||
return new Motor(location, joint, multiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a potentiometer tag. Potentiometer tags have a joint they measure, a
|
||||
* location they're "plugged into" and one of three types (linear,
|
||||
* degrees or radians). The template of a potentiometer tag is as
|
||||
* follows:
|
||||
*
|
||||
* <potentiometer>
|
||||
* <joint>{{ joint name (string) }}</joint>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* <type>{{ one of linear, degrees, radians }}</type>
|
||||
* </potentiometer>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parsePotentiometer(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
physics::JointPtr joint = getJoint(node);
|
||||
|
||||
std::string radians_str = getTagValue(node, "type", "degrees");
|
||||
bool radians;
|
||||
if (radians_str == "linear" || radians_str == "radians") {
|
||||
radians = true;
|
||||
} else {
|
||||
radians = false;
|
||||
}
|
||||
|
||||
return new Potentiometer(location, joint, radians);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an encoder tag. Encoder tags have a joint they measure, a
|
||||
* location they're "plugged into". The template of an encoder tag
|
||||
* is as follows:
|
||||
*
|
||||
* <encoder>
|
||||
* <joint>{{ joint name (string) }}</joint>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* </encoder>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseEncoder(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
physics::JointPtr joint = getJoint(node);
|
||||
return new Encoder(location, joint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a gyro tag. Gyro tags have a joint they measure, a location
|
||||
* they're "plugged into" and one of three axes (roll, pitch,
|
||||
* yaw). The template of a gyro tag is as follows:
|
||||
*
|
||||
* <gyro>
|
||||
* <link>{{ link name (string) }}</link>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* <axis>{{ one of yaw, pitch, roll }}</axis>
|
||||
* </gyro>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseGyro(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
physics::LinkPtr link = getLink(node);
|
||||
ROTATION axis;
|
||||
std::string axisString = getTagValue(node, "axis");
|
||||
if (axisString == "roll") axis = Roll;
|
||||
if (axisString == "pitch") axis = Pitch;
|
||||
if (axisString == "yaw") axis = Yaw;
|
||||
return new Gyro(location, link, axis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a InternalLimitSwitch tag. InternalLimitSwitch tags have a
|
||||
* joint they measure and a location they're "plugged into". The
|
||||
* template of an InteranlLimitSwitch tag is as follows:
|
||||
*
|
||||
* <internal-limit-switch>
|
||||
* <joint>{{ joint name (string) }}</joint>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* <type>{{ one of linear, degrees, radians }}</type>
|
||||
* <min>{{ min (number) }}</min>
|
||||
* <max>{{ max (number }}</max>
|
||||
* </internal-limit-switch>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseInternalLimitSwitch(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
physics::JointPtr joint = getJoint(node);
|
||||
|
||||
double min = boost::lexical_cast<double>(getTagValue(node, "min", "0"));
|
||||
double max = boost::lexical_cast<double>(getTagValue(node, "max", "1"));
|
||||
|
||||
std::string radians_str = getTagValue(node, "type", "degrees");
|
||||
bool radians;
|
||||
if (radians_str == "linear" || radians_str == "radians") {
|
||||
radians = true;
|
||||
} else {
|
||||
radians = false;
|
||||
}
|
||||
return new InternalLimitSwitch(location, joint, min, max, radians);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a ExternalLimitSwitch tag. ExternalLimitSwitch tags have a
|
||||
* joint they measure and a location they're "plugged into". The
|
||||
* template of an ExternalLimitSwitch tag is as follows:
|
||||
*
|
||||
* <external-limit-switch>
|
||||
* <sensor>{{ sensor name (string) }}</sensor>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* </external-limit-switch>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseExternalLimitSwitch(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
sensors::ContactSensorPtr sensor =
|
||||
boost::dynamic_pointer_cast<sensors::ContactSensor>(getSensor(node));
|
||||
return new ExternalLimitSwitch(location, sensor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a rangefinder tag. Rangefinder tags have a joint they measure
|
||||
* and a location they're "plugged into". The template of a rangfinder
|
||||
* tag is as follows:
|
||||
*
|
||||
* <rangefinder>
|
||||
* <sensor>{{ sensor name (string) }}</sensor>
|
||||
* <location>{{ location (see below for formats }}</location>
|
||||
* </rangefinder>
|
||||
*/
|
||||
RobotComponentPtr RobotMapParser::parseRangefinder(XMLElement *node) {
|
||||
std::string location = locationToPath(node->FirstChildElement("location"));
|
||||
sensors::SonarSensorPtr sensor =
|
||||
boost::dynamic_pointer_cast<sensors::SonarSensor>(getSensor(node));
|
||||
return new Rangefinder(location, sensor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the location tag to a topic name to subscribe/publish
|
||||
* to. Currently, there are two supported location styles: double_port
|
||||
* and single port.
|
||||
*/
|
||||
std::string RobotMapParser::locationToPath(XMLElement *location) {
|
||||
if (location == NULL)
|
||||
return "";
|
||||
else if (location->Attribute("style", "double_port"))
|
||||
return doublePortLocationToPath(location);
|
||||
else
|
||||
return portLocationToPath(location);
|
||||
}
|
||||
|
||||
std::string RobotMapParser::portLocationToPath(XMLElement *location) {
|
||||
std::string type = getTagValue(location, "type");
|
||||
std::string module = getTagValue(location, "module");
|
||||
std::string pin = getTagValue(location, "pin");
|
||||
return "~/" + robot + "/" + type + "/" + module + "/" + pin;
|
||||
}
|
||||
|
||||
|
||||
std::string RobotMapParser::doublePortLocationToPath(XMLElement *location) {
|
||||
std::string type = getTagValue(location, "type");
|
||||
std::string module1 = getTagValue(location, "module1");
|
||||
std::string pin1 = getTagValue(location, "pin1");
|
||||
std::string module2 = getTagValue(location, "module2");
|
||||
std::string pin2 = getTagValue(location, "pin2");
|
||||
// Swap pins if needed, to maintain consistent ordering
|
||||
if ((module2 < module1) || ((module2 == module1) && (pin2 < pin1))) {
|
||||
std::string module = module2;
|
||||
std::string pin = pin2;
|
||||
module2 = module1;
|
||||
pin2 = pin1;
|
||||
module1 = module;
|
||||
pin1 = pin;
|
||||
}
|
||||
return "~/" + robot + "/" + type + "/" + module1 + "/" + pin1 + "/" + module2 + "/" + pin2;
|
||||
}
|
||||
|
||||
std::string RobotMapParser::getTagValue(XMLElement *node, std::string tag, std::string default_value) {
|
||||
if (node->FirstChildElement(tag.c_str()) != NULL) {
|
||||
return node->FirstChildElement(tag.c_str())->FirstChild()->Value();
|
||||
} else {
|
||||
return default_value;
|
||||
}
|
||||
}
|
||||
|
||||
physics::JointPtr RobotMapParser::getJoint(XMLElement *node) {
|
||||
std::string joint_name = node->FirstChildElement("joint")->FirstChild()->Value();
|
||||
physics::JointPtr joint = model->GetJoint(joint_name);
|
||||
if (joint == NULL) std::cerr << "Joint doesn't exist: " << joint_name << std::endl;
|
||||
return joint;
|
||||
}
|
||||
|
||||
physics::LinkPtr RobotMapParser::getLink(XMLElement *node) {
|
||||
std::string link_name = node->FirstChildElement("link")->FirstChild()->Value();
|
||||
physics::LinkPtr link = model->GetLink(link_name);
|
||||
if (link == NULL) std::cerr << "Link doesn't exist: " << link_name << std::endl;
|
||||
return link;
|
||||
}
|
||||
|
||||
sensors::SensorPtr RobotMapParser::getSensor(XMLElement *node) {
|
||||
std::string sensor_name = node->FirstChildElement("sensor")->FirstChild()->Value();
|
||||
sensors::SensorPtr sensor = sensors::get_sensor(sensor_name);
|
||||
if (sensor == NULL) std::cerr << "Sensor doesn't exist: " << sensor_name << std::endl;
|
||||
return sensor;
|
||||
}
|
||||
42
simulation/frc_gazebo_plugin/src/RobotMapParser.h
Normal file
42
simulation/frc_gazebo_plugin/src/RobotMapParser.h
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
#include <gazebo/physics/Model.hh>
|
||||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#ifndef _ROBOTMAPPARSER_H_
|
||||
#define _ROBOTMAPPARSER_H_
|
||||
|
||||
using namespace tinyxml2;
|
||||
using namespace gazebo;
|
||||
|
||||
class RobotMapParser {
|
||||
public:
|
||||
RobotMapParser(std::string robot, std::string filename, physics::ModelPtr model);
|
||||
void parse(std::vector<RobotComponentPtr> &components);
|
||||
|
||||
private:
|
||||
std::string robot, filename;
|
||||
physics::ModelPtr model;
|
||||
physics::WorldPtr world;
|
||||
|
||||
RobotComponentPtr parseMotor(XMLElement *node);
|
||||
RobotComponentPtr parsePotentiometer(XMLElement *node);
|
||||
RobotComponentPtr parseEncoder(XMLElement *node);
|
||||
RobotComponentPtr parseGyro(XMLElement *node);
|
||||
RobotComponentPtr parseInternalLimitSwitch(XMLElement *node);
|
||||
RobotComponentPtr parseExternalLimitSwitch(XMLElement *node);
|
||||
RobotComponentPtr parseRangefinder(XMLElement *node);
|
||||
|
||||
std::string locationToPath(XMLElement *location);
|
||||
std::string portLocationToPath(XMLElement *location);
|
||||
std::string doublePortLocationToPath(XMLElement *location);
|
||||
|
||||
std::string getTagValue(XMLElement *node, std::string tag, std::string default_value="");
|
||||
physics::JointPtr getJoint(XMLElement *node);
|
||||
physics::LinkPtr getLink(XMLElement *node);
|
||||
sensors::SensorPtr getSensor(XMLElement *node);
|
||||
};
|
||||
|
||||
#endif /* _ROBOTMAPPARSER_H_ */
|
||||
52
simulation/frc_gazebo_plugin/src/components/Encoder.cpp
Normal file
52
simulation/frc_gazebo_plugin/src/components/Encoder.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
#include "components/Encoder.h"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
Encoder::Encoder(std::string topic, physics::JointPtr joint) {
|
||||
std::cout << "Initializing encoder: " << topic << std::endl;
|
||||
this->topic = topic;
|
||||
this->joint = joint;
|
||||
}
|
||||
|
||||
Encoder::~Encoder() {
|
||||
|
||||
}
|
||||
|
||||
void Encoder::connect(transport::NodePtr node) {
|
||||
command_sub = node->Subscribe(topic+"/control", &Encoder::callback, this);
|
||||
pos_pub = node->Advertise<msgs::Float64>(topic+"/position");
|
||||
vel_pub = node->Advertise<msgs::Float64>(topic+"/velocity");
|
||||
zero = joint->GetAngle(0).Degree();
|
||||
stopped = true;
|
||||
stop_value = 0;
|
||||
}
|
||||
|
||||
void Encoder::callback(const msgs::ConstStringPtr &msg) {
|
||||
std::string command = msg->data();
|
||||
if (command == "reset") {
|
||||
zero = joint->GetAngle(0).Degree();
|
||||
} else if (command == "start") {
|
||||
stopped = false;
|
||||
zero = (joint->GetAngle(0).Degree() - stop_value);
|
||||
} else if (command == "stop") {
|
||||
stopped = true;
|
||||
stop_value = joint->GetAngle(0).Degree();
|
||||
} else {
|
||||
std::cout << "WARNING: Encoder got unknown command '" << command << "'." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Encoder::update(bool enabled) {
|
||||
if (stopped) {
|
||||
pos_msg.set_data(stop_value);
|
||||
pos_pub->Publish(pos_msg);
|
||||
vel_msg.set_data(0);
|
||||
vel_pub->Publish(vel_msg);
|
||||
} else {
|
||||
pos_msg.set_data(joint->GetAngle(0).Degree() - zero);
|
||||
pos_pub->Publish(pos_msg);
|
||||
vel_msg.set_data(joint->GetVelocity(0) * (180.0 / M_PI));
|
||||
vel_pub->Publish(vel_msg);
|
||||
}
|
||||
}
|
||||
28
simulation/frc_gazebo_plugin/src/components/Encoder.h
Normal file
28
simulation/frc_gazebo_plugin/src/components/Encoder.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
|
||||
#include <gazebo/physics/Joint.hh>
|
||||
|
||||
#ifndef _COMPONENTS_ENCODER_H_
|
||||
#define _COMPONENTS_ENCODER_H_
|
||||
|
||||
class Encoder : public RobotComponent {
|
||||
public:
|
||||
Encoder(std::string topic, physics::JointPtr joint);
|
||||
virtual ~Encoder();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
private:
|
||||
std::string topic;
|
||||
bool stopped;
|
||||
double zero, stop_value;
|
||||
transport::SubscriberPtr command_sub;
|
||||
transport::PublisherPtr pos_pub, vel_pub;
|
||||
msgs::Float64 pos_msg, vel_msg;
|
||||
physics::JointPtr joint;
|
||||
|
||||
void callback(const msgs::ConstStringPtr &msg);
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_ENCODER_H_ */
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
#include "components/ExternalLimitSwitch.h"
|
||||
|
||||
ExternalLimitSwitch::ExternalLimitSwitch(std::string topic, sensors::ContactSensorPtr sensor) {
|
||||
std::cout << "Initializing external limit switch: " << topic << std::endl;
|
||||
this->topic = topic;
|
||||
this->sensor = sensor;
|
||||
}
|
||||
|
||||
ExternalLimitSwitch::~ExternalLimitSwitch() {
|
||||
|
||||
}
|
||||
|
||||
void ExternalLimitSwitch::connect(transport::NodePtr node) {
|
||||
pub = node->Advertise<msgs::Bool>(topic);
|
||||
}
|
||||
|
||||
void ExternalLimitSwitch::update(bool enabled) {
|
||||
msg.set_data(sensor->GetContacts().contact().size() > 0);
|
||||
pub->Publish(msg);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include "msgs/bool.pb.h"
|
||||
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
|
||||
#ifndef _COMPONENTS_EXTERNAL_LIMIT_SWITCH_H_
|
||||
#define _COMPONENTS_EXTERNAL_LIMIT_SWITCH_H_
|
||||
|
||||
class ExternalLimitSwitch : public RobotComponent {
|
||||
public:
|
||||
ExternalLimitSwitch(std::string topic, sensors::ContactSensorPtr sensor);
|
||||
virtual ~ExternalLimitSwitch();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
|
||||
private:
|
||||
std::string topic;
|
||||
transport::PublisherPtr pub;
|
||||
msgs::Bool msg;
|
||||
sensors::ContactSensorPtr sensor;
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_EXTERNAL_LIMIT_SWITCH_H_ */
|
||||
42
simulation/frc_gazebo_plugin/src/components/Gyro.cpp
Normal file
42
simulation/frc_gazebo_plugin/src/components/Gyro.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
#include "components/Gyro.h"
|
||||
|
||||
#include <gazebo/math/gzmath.hh>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
Gyro::Gyro(std::string topic, physics::LinkPtr link, ROTATION axis) {
|
||||
std::cout << "Initializing gyro: " << topic << " axis=" << axis << std::endl;
|
||||
this->topic = topic;
|
||||
this->link = link;
|
||||
this->axis = axis;
|
||||
}
|
||||
|
||||
Gyro::~Gyro() {
|
||||
|
||||
}
|
||||
|
||||
void Gyro::connect(transport::NodePtr node) {
|
||||
command_sub = node->Subscribe(topic+"/control", &Gyro::callback, this);
|
||||
pos_pub = node->Advertise<msgs::Float64>(topic+"/position");
|
||||
vel_pub = node->Advertise<msgs::Float64>(topic+"/velocity");
|
||||
}
|
||||
|
||||
void Gyro::callback(const msgs::ConstStringPtr &msg) {
|
||||
std::string command = msg->data();
|
||||
if (command == "reset") {
|
||||
zero = link->GetWorldCoGPose().rot.GetAsEuler()[axis];
|
||||
} else {
|
||||
std::cout << "WARNING: Encoder got unknown command '" << command << "'." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Gyro::update(bool enabled) {
|
||||
math::Vector3 rot;
|
||||
pos_msg.set_data((link->GetWorldCoGPose().rot.GetAsEuler()[axis] - zero) * (180.0 / M_PI));
|
||||
if (pos_msg.data() < -180) pos_msg.set_data(pos_msg.data() + 360);
|
||||
else if (pos_msg.data() > 180) pos_msg.set_data(pos_msg.data() - 360);
|
||||
pos_pub->Publish(pos_msg);
|
||||
vel_msg.set_data(link->GetRelativeAngularVel()[axis] * (180.0 / M_PI));
|
||||
vel_pub->Publish(vel_msg);
|
||||
}
|
||||
30
simulation/frc_gazebo_plugin/src/components/Gyro.h
Normal file
30
simulation/frc_gazebo_plugin/src/components/Gyro.h
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
|
||||
#include <gazebo/physics/Link.hh>
|
||||
|
||||
#ifndef _COMPONENTS_GYRO_H_
|
||||
#define _COMPONENTS_GYRO_H_
|
||||
|
||||
typedef enum {Roll, Pitch, Yaw} ROTATION;
|
||||
|
||||
class Gyro : public RobotComponent {
|
||||
public:
|
||||
Gyro(std::string topic, physics::LinkPtr link, ROTATION axis);
|
||||
virtual ~Gyro();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
private:
|
||||
ROTATION axis;
|
||||
std::string topic;
|
||||
double zero;
|
||||
transport::SubscriberPtr command_sub;
|
||||
transport::PublisherPtr pos_pub, vel_pub;
|
||||
msgs::Float64 pos_msg, vel_msg;
|
||||
physics::LinkPtr link;
|
||||
|
||||
void callback(const msgs::ConstStringPtr &msg);
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_GYRO_H_ */
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#include "components/InternalLimitSwitch.h"
|
||||
|
||||
InternalLimitSwitch::InternalLimitSwitch(std::string topic, physics::JointPtr joint,
|
||||
double min, double max, bool radians) {
|
||||
std::cout << "Initializing external limit switch: " << topic << std::endl;
|
||||
this->topic = topic;
|
||||
this->joint = joint;
|
||||
this->min = min;
|
||||
this->max = max;
|
||||
this->radians = radians;
|
||||
}
|
||||
|
||||
InternalLimitSwitch::~InternalLimitSwitch() {
|
||||
|
||||
}
|
||||
|
||||
void InternalLimitSwitch::connect(transport::NodePtr node) {
|
||||
pub = node->Advertise<msgs::Bool>(topic);
|
||||
}
|
||||
|
||||
void InternalLimitSwitch::update(bool enabled) {
|
||||
double value;
|
||||
joint->GetAngle(0).Normalize();
|
||||
if (radians) {
|
||||
value = joint->GetAngle(0).Radian();
|
||||
} else {
|
||||
value = joint->GetAngle(0).Degree();
|
||||
}
|
||||
msg.set_data(value >= min && value <= max);
|
||||
pub->Publish(msg);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include "msgs/bool.pb.h"
|
||||
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
|
||||
#ifndef _COMPONENTS_INTERNAL_LIMIT_SWITCH_H_
|
||||
#define _COMPONENTS_INTERNAL_LIMIT_SWITCH_H_
|
||||
|
||||
class InternalLimitSwitch : public RobotComponent {
|
||||
public:
|
||||
InternalLimitSwitch(std::string topic, physics::JointPtr joint,
|
||||
double min, double max, bool radians);
|
||||
virtual ~InternalLimitSwitch();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
|
||||
private:
|
||||
std::string topic;
|
||||
transport::PublisherPtr pub;
|
||||
msgs::Bool msg;
|
||||
physics::JointPtr joint;
|
||||
double min, max;
|
||||
bool radians;
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_EXTERNAL_LIMIT_SWITCH_H_ */
|
||||
32
simulation/frc_gazebo_plugin/src/components/Motor.cpp
Normal file
32
simulation/frc_gazebo_plugin/src/components/Motor.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#include "components/Motor.h"
|
||||
|
||||
Motor::Motor(std::string topic, physics::JointPtr joint, double multiplier) {
|
||||
std::cout << "Initializing motor: " << topic << " -- " << multiplier << std::endl;
|
||||
this->topic = topic;
|
||||
this->multiplier = multiplier;
|
||||
this->joint = joint;
|
||||
signal = 0;
|
||||
}
|
||||
|
||||
Motor::~Motor() {
|
||||
|
||||
}
|
||||
|
||||
void Motor::connect(transport::NodePtr node) {
|
||||
sub = node->Subscribe(topic, &Motor::callback, this);
|
||||
}
|
||||
|
||||
void Motor::callback(const msgs::ConstFloat64Ptr &msg) {
|
||||
signal = msg->data();
|
||||
if (signal < -1) { signal = -1; }
|
||||
else if (signal > 1) { signal = 1; }
|
||||
}
|
||||
|
||||
void Motor::update(bool enabled) {
|
||||
if (enabled) {
|
||||
joint->SetForce(0, signal*multiplier);
|
||||
} else {
|
||||
joint->SetForce(0, 0);
|
||||
}
|
||||
}
|
||||
25
simulation/frc_gazebo_plugin/src/components/Motor.h
Normal file
25
simulation/frc_gazebo_plugin/src/components/Motor.h
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
|
||||
#include <gazebo/physics/Joint.hh>
|
||||
|
||||
#ifndef _COMPONENTS_MOTOR_H_
|
||||
#define _COMPONENTS_MOTOR_H_
|
||||
|
||||
class Motor : public RobotComponent {
|
||||
public:
|
||||
Motor(std::string topic, physics::JointPtr joint, double multiplier);
|
||||
virtual ~Motor();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
private:
|
||||
std::string topic;
|
||||
double signal, multiplier;
|
||||
transport::SubscriberPtr sub;
|
||||
physics::JointPtr joint;
|
||||
|
||||
void callback(const msgs::ConstFloat64Ptr &msg);
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_MOTOR_H_ */
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
#include "components/Potentiometer.h"
|
||||
|
||||
Potentiometer::Potentiometer(std::string topic, physics::JointPtr joint, bool radians) {
|
||||
std::cout << "Initializing potentiometer: " << topic << std::endl;
|
||||
this->topic = topic;
|
||||
this->joint = joint;
|
||||
this->radians = radians;
|
||||
}
|
||||
|
||||
Potentiometer::~Potentiometer() {
|
||||
|
||||
}
|
||||
|
||||
void Potentiometer::connect(transport::NodePtr node) {
|
||||
pub = node->Advertise<msgs::Float64>(topic);
|
||||
}
|
||||
|
||||
void Potentiometer::update(bool enabled) {
|
||||
joint->GetAngle(0).Normalize();
|
||||
if (radians) {
|
||||
msg.set_data(joint->GetAngle(0).Radian());
|
||||
} else {
|
||||
msg.set_data(joint->GetAngle(0).Degree());
|
||||
}
|
||||
pub->Publish(msg);
|
||||
}
|
||||
26
simulation/frc_gazebo_plugin/src/components/Potentiometer.h
Normal file
26
simulation/frc_gazebo_plugin/src/components/Potentiometer.h
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include "msgs/float64.pb.h"
|
||||
|
||||
#include <gazebo/physics/Joint.hh>
|
||||
|
||||
#ifndef _COMPONENTS_POTENTIOMETER_H_
|
||||
#define _COMPONENTS_POTENTIOMETER_H_
|
||||
|
||||
class Potentiometer : public RobotComponent {
|
||||
public:
|
||||
Potentiometer(std::string topic, physics::JointPtr joint, bool radians);
|
||||
virtual ~Potentiometer();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
|
||||
private:
|
||||
std::string topic;
|
||||
transport::PublisherPtr pub;
|
||||
msgs::Float64 msg;
|
||||
physics::JointPtr joint;
|
||||
bool radians;
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_POTENTIOMETER_H_ */
|
||||
21
simulation/frc_gazebo_plugin/src/components/Rangefinder.cpp
Normal file
21
simulation/frc_gazebo_plugin/src/components/Rangefinder.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
#include "components/Rangefinder.h"
|
||||
|
||||
Rangefinder::Rangefinder(std::string topic, sensors::SonarSensorPtr sensor) {
|
||||
std::cout << "Initializing rangefinder: " << topic << std::endl;
|
||||
this->topic = topic;
|
||||
this->sensor = sensor;
|
||||
}
|
||||
|
||||
Rangefinder::~Rangefinder() {
|
||||
|
||||
}
|
||||
|
||||
void Rangefinder::connect(transport::NodePtr node) {
|
||||
pub = node->Advertise<msgs::Float64>(topic);
|
||||
}
|
||||
|
||||
void Rangefinder::update(bool enabled) {
|
||||
msg.set_data(sensor->GetRange());
|
||||
pub->Publish(msg);
|
||||
}
|
||||
26
simulation/frc_gazebo_plugin/src/components/Rangefinder.h
Normal file
26
simulation/frc_gazebo_plugin/src/components/Rangefinder.h
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include "components/RobotComponent.h"
|
||||
#include "msgs/float64.pb.h"
|
||||
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
|
||||
#ifndef _COMPONENTS_RANGEFINDER_H_
|
||||
#define _COMPONENTS_RANGEFINDER_H_
|
||||
|
||||
class Rangefinder : public RobotComponent {
|
||||
public:
|
||||
Rangefinder(std::string topic, sensors::SonarSensorPtr sensor);
|
||||
virtual ~Rangefinder();
|
||||
|
||||
void connect(transport::NodePtr node);
|
||||
void update(bool enabled);
|
||||
|
||||
private:
|
||||
std::string topic;
|
||||
transport::PublisherPtr pub;
|
||||
msgs::Float64 msg;
|
||||
physics::LinkPtr link;
|
||||
sensors::SonarSensorPtr sensor;
|
||||
};
|
||||
|
||||
#endif /* _COMPONENTS_RANGEFINDER_H_ */
|
||||
25
simulation/frc_gazebo_plugin/src/components/RobotComponent.h
Normal file
25
simulation/frc_gazebo_plugin/src/components/RobotComponent.h
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "msgs/msgs.h"
|
||||
|
||||
#include <gazebo/transport/transport.hh>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#ifndef _ROBOTCOMPONENT_H_
|
||||
#define _ROBOTCOMPONENT_H_
|
||||
|
||||
#define MSG_BUFFER_SIZE 1000
|
||||
|
||||
using namespace gazebo;
|
||||
|
||||
class RobotComponent {
|
||||
public:
|
||||
RobotComponent() {}
|
||||
virtual ~RobotComponent() {}
|
||||
|
||||
virtual void connect(transport::NodePtr node) {};
|
||||
virtual void update(bool enabled) {};
|
||||
};
|
||||
|
||||
typedef RobotComponent *RobotComponentPtr;
|
||||
|
||||
#endif /* _ROBOTCOMPONENT_H_ */
|
||||
310
simulation/frc_gazebo_plugin/src/msgs/bool.pb.cc
Normal file
310
simulation/frc_gazebo_plugin/src/msgs/bool.pb.cc
Normal file
@@ -0,0 +1,310 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/bool.proto
|
||||
|
||||
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
|
||||
#include "msgs/bool.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/stubs/once.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/wire_format_lite_inl.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
namespace {
|
||||
|
||||
const ::google::protobuf::Descriptor* Bool_descriptor_ = NULL;
|
||||
const ::google::protobuf::internal::GeneratedMessageReflection*
|
||||
Bool_reflection_ = NULL;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
void protobuf_AssignDesc_msgs_2fbool_2eproto() {
|
||||
protobuf_AddDesc_msgs_2fbool_2eproto();
|
||||
const ::google::protobuf::FileDescriptor* file =
|
||||
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
|
||||
"msgs/bool.proto");
|
||||
GOOGLE_CHECK(file != NULL);
|
||||
Bool_descriptor_ = file->message_type(0);
|
||||
static const int Bool_offsets_[1] = {
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bool, data_),
|
||||
};
|
||||
Bool_reflection_ =
|
||||
new ::google::protobuf::internal::GeneratedMessageReflection(
|
||||
Bool_descriptor_,
|
||||
Bool::default_instance_,
|
||||
Bool_offsets_,
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bool, _has_bits_[0]),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bool, _unknown_fields_),
|
||||
-1,
|
||||
::google::protobuf::DescriptorPool::generated_pool(),
|
||||
::google::protobuf::MessageFactory::generated_factory(),
|
||||
sizeof(Bool));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
|
||||
inline void protobuf_AssignDescriptorsOnce() {
|
||||
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
|
||||
&protobuf_AssignDesc_msgs_2fbool_2eproto);
|
||||
}
|
||||
|
||||
void protobuf_RegisterTypes(const ::std::string&) {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
||||
Bool_descriptor_, &Bool::default_instance());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void protobuf_ShutdownFile_msgs_2fbool_2eproto() {
|
||||
delete Bool::default_instance_;
|
||||
delete Bool_reflection_;
|
||||
}
|
||||
|
||||
void protobuf_AddDesc_msgs_2fbool_2eproto() {
|
||||
static bool already_here = false;
|
||||
if (already_here) return;
|
||||
already_here = true;
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||
"\n\017msgs/bool.proto\022\013gazebo.msgs\"\024\n\004Bool\022\014"
|
||||
"\n\004data\030\001 \002(\010B\010B\006GzBool", 62);
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||
"msgs/bool.proto", &protobuf_RegisterTypes);
|
||||
Bool::default_instance_ = new Bool();
|
||||
Bool::default_instance_->InitAsDefaultInstance();
|
||||
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_msgs_2fbool_2eproto);
|
||||
}
|
||||
|
||||
// Force AddDescriptors() to be called at static initialization time.
|
||||
struct StaticDescriptorInitializer_msgs_2fbool_2eproto {
|
||||
StaticDescriptorInitializer_msgs_2fbool_2eproto() {
|
||||
protobuf_AddDesc_msgs_2fbool_2eproto();
|
||||
}
|
||||
} static_descriptor_initializer_msgs_2fbool_2eproto_;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const int Bool::kDataFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
Bool::Bool()
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
}
|
||||
|
||||
void Bool::InitAsDefaultInstance() {
|
||||
}
|
||||
|
||||
Bool::Bool(const Bool& from)
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void Bool::SharedCtor() {
|
||||
_cached_size_ = 0;
|
||||
data_ = false;
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
|
||||
Bool::~Bool() {
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
void Bool::SharedDtor() {
|
||||
if (this != default_instance_) {
|
||||
}
|
||||
}
|
||||
|
||||
void Bool::SetCachedSize(int size) const {
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
}
|
||||
const ::google::protobuf::Descriptor* Bool::descriptor() {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
return Bool_descriptor_;
|
||||
}
|
||||
|
||||
const Bool& Bool::default_instance() {
|
||||
if (default_instance_ == NULL) protobuf_AddDesc_msgs_2fbool_2eproto();
|
||||
return *default_instance_;
|
||||
}
|
||||
|
||||
Bool* Bool::default_instance_ = NULL;
|
||||
|
||||
Bool* Bool::New() const {
|
||||
return new Bool;
|
||||
}
|
||||
|
||||
void Bool::Clear() {
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
data_ = false;
|
||||
}
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
mutable_unknown_fields()->Clear();
|
||||
}
|
||||
|
||||
bool Bool::MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input) {
|
||||
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
|
||||
::google::protobuf::uint32 tag;
|
||||
while ((tag = input->ReadTag()) != 0) {
|
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
||||
// required bool data = 1;
|
||||
case 1: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
|
||||
input, &data_)));
|
||||
set_has_data();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectAtEnd()) return true;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
handle_uninterpreted:
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
||||
return true;
|
||||
}
|
||||
DO_(::google::protobuf::internal::WireFormat::SkipField(
|
||||
input, tag, mutable_unknown_fields()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
#undef DO_
|
||||
}
|
||||
|
||||
void Bool::SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const {
|
||||
// required bool data = 1;
|
||||
if (has_data()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->data(), output);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
|
||||
unknown_fields(), output);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::uint8* Bool::SerializeWithCachedSizesToArray(
|
||||
::google::protobuf::uint8* target) const {
|
||||
// required bool data = 1;
|
||||
if (has_data()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->data(), target);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
|
||||
unknown_fields(), target);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
int Bool::ByteSize() const {
|
||||
int total_size = 0;
|
||||
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
// required bool data = 1;
|
||||
if (has_data()) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (!unknown_fields().empty()) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
|
||||
unknown_fields());
|
||||
}
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = total_size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void Bool::MergeFrom(const ::google::protobuf::Message& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
const Bool* source =
|
||||
::google::protobuf::internal::dynamic_cast_if_available<const Bool*>(
|
||||
&from);
|
||||
if (source == NULL) {
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this);
|
||||
} else {
|
||||
MergeFrom(*source);
|
||||
}
|
||||
}
|
||||
|
||||
void Bool::MergeFrom(const Bool& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
if (from.has_data()) {
|
||||
set_data(from.data());
|
||||
}
|
||||
}
|
||||
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
|
||||
}
|
||||
|
||||
void Bool::CopyFrom(const ::google::protobuf::Message& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void Bool::CopyFrom(const Bool& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool Bool::IsInitialized() const {
|
||||
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Bool::Swap(Bool* other) {
|
||||
if (other != this) {
|
||||
std::swap(data_, other->data_);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
_unknown_fields_.Swap(&other->_unknown_fields_);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata Bool::GetMetadata() const {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::Metadata metadata;
|
||||
metadata.descriptor = Bool_descriptor_;
|
||||
metadata.reflection = Bool_reflection_;
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
167
simulation/frc_gazebo_plugin/src/msgs/bool.pb.h
Normal file
167
simulation/frc_gazebo_plugin/src/msgs/bool.pb.h
Normal file
@@ -0,0 +1,167 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/bool.proto
|
||||
|
||||
#ifndef PROTOBUF_msgs_2fbool_2eproto__INCLUDED
|
||||
#define PROTOBUF_msgs_2fbool_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 2005000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
// Internal implementation detail -- do not call these.
|
||||
void protobuf_AddDesc_msgs_2fbool_2eproto();
|
||||
void protobuf_AssignDesc_msgs_2fbool_2eproto();
|
||||
void protobuf_ShutdownFile_msgs_2fbool_2eproto();
|
||||
|
||||
class Bool;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Bool : public ::google::protobuf::Message {
|
||||
public:
|
||||
Bool();
|
||||
virtual ~Bool();
|
||||
|
||||
Bool(const Bool& from);
|
||||
|
||||
inline Bool& operator=(const Bool& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
|
||||
return _unknown_fields_;
|
||||
}
|
||||
|
||||
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
|
||||
return &_unknown_fields_;
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* descriptor();
|
||||
static const Bool& default_instance();
|
||||
|
||||
void Swap(Bool* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
Bool* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const Bool& from);
|
||||
void MergeFrom(const Bool& from);
|
||||
void Clear();
|
||||
bool IsInitialized() const;
|
||||
|
||||
int ByteSize() const;
|
||||
bool MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input);
|
||||
void SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const;
|
||||
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
|
||||
int GetCachedSize() const { return _cached_size_; }
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
public:
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required bool data = 1;
|
||||
inline bool has_data() const;
|
||||
inline void clear_data();
|
||||
static const int kDataFieldNumber = 1;
|
||||
inline bool data() const;
|
||||
inline void set_data(bool value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:gazebo.msgs.Bool)
|
||||
private:
|
||||
inline void set_has_data();
|
||||
inline void clear_has_data();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
bool data_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_msgs_2fbool_2eproto();
|
||||
friend void protobuf_AssignDesc_msgs_2fbool_2eproto();
|
||||
friend void protobuf_ShutdownFile_msgs_2fbool_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static Bool* default_instance_;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// Bool
|
||||
|
||||
// required bool data = 1;
|
||||
inline bool Bool::has_data() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void Bool::set_has_data() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void Bool::clear_has_data() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void Bool::clear_data() {
|
||||
data_ = false;
|
||||
clear_has_data();
|
||||
}
|
||||
inline bool Bool::data() const {
|
||||
return data_;
|
||||
}
|
||||
inline void Bool::set_data(bool value) {
|
||||
set_has_data();
|
||||
data_ = value;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
#ifndef SWIG
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
|
||||
} // namespace google
|
||||
} // namespace protobuf
|
||||
#endif // SWIG
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_msgs_2fbool_2eproto__INCLUDED
|
||||
385
simulation/frc_gazebo_plugin/src/msgs/driver-station.pb.cc
Normal file
385
simulation/frc_gazebo_plugin/src/msgs/driver-station.pb.cc
Normal file
@@ -0,0 +1,385 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/driver-station.proto
|
||||
|
||||
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
|
||||
#include "msgs/driver-station.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/stubs/once.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/wire_format_lite_inl.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
namespace {
|
||||
|
||||
const ::google::protobuf::Descriptor* DriverStation_descriptor_ = NULL;
|
||||
const ::google::protobuf::internal::GeneratedMessageReflection*
|
||||
DriverStation_reflection_ = NULL;
|
||||
const ::google::protobuf::EnumDescriptor* DriverStation_State_descriptor_ = NULL;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
void protobuf_AssignDesc_msgs_2fdriver_2dstation_2eproto() {
|
||||
protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
const ::google::protobuf::FileDescriptor* file =
|
||||
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
|
||||
"msgs/driver-station.proto");
|
||||
GOOGLE_CHECK(file != NULL);
|
||||
DriverStation_descriptor_ = file->message_type(0);
|
||||
static const int DriverStation_offsets_[2] = {
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DriverStation, enabled_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DriverStation, state_),
|
||||
};
|
||||
DriverStation_reflection_ =
|
||||
new ::google::protobuf::internal::GeneratedMessageReflection(
|
||||
DriverStation_descriptor_,
|
||||
DriverStation::default_instance_,
|
||||
DriverStation_offsets_,
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DriverStation, _has_bits_[0]),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DriverStation, _unknown_fields_),
|
||||
-1,
|
||||
::google::protobuf::DescriptorPool::generated_pool(),
|
||||
::google::protobuf::MessageFactory::generated_factory(),
|
||||
sizeof(DriverStation));
|
||||
DriverStation_State_descriptor_ = DriverStation_descriptor_->enum_type(0);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
|
||||
inline void protobuf_AssignDescriptorsOnce() {
|
||||
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
|
||||
&protobuf_AssignDesc_msgs_2fdriver_2dstation_2eproto);
|
||||
}
|
||||
|
||||
void protobuf_RegisterTypes(const ::std::string&) {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
||||
DriverStation_descriptor_, &DriverStation::default_instance());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void protobuf_ShutdownFile_msgs_2fdriver_2dstation_2eproto() {
|
||||
delete DriverStation::default_instance_;
|
||||
delete DriverStation_reflection_;
|
||||
}
|
||||
|
||||
void protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto() {
|
||||
static bool already_here = false;
|
||||
if (already_here) return;
|
||||
already_here = true;
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||
"\n\031msgs/driver-station.proto\022\013gazebo.msgs"
|
||||
"\"z\n\rDriverStation\022\017\n\007enabled\030\001 \002(\010\022/\n\005st"
|
||||
"ate\030\002 \002(\0162 .gazebo.msgs.DriverStation.St"
|
||||
"ate\"\'\n\005State\022\010\n\004AUTO\020\000\022\n\n\006TELEOP\020\001\022\010\n\004TE"
|
||||
"ST\020\002B\021B\017GzDriverStation", 183);
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||
"msgs/driver-station.proto", &protobuf_RegisterTypes);
|
||||
DriverStation::default_instance_ = new DriverStation();
|
||||
DriverStation::default_instance_->InitAsDefaultInstance();
|
||||
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_msgs_2fdriver_2dstation_2eproto);
|
||||
}
|
||||
|
||||
// Force AddDescriptors() to be called at static initialization time.
|
||||
struct StaticDescriptorInitializer_msgs_2fdriver_2dstation_2eproto {
|
||||
StaticDescriptorInitializer_msgs_2fdriver_2dstation_2eproto() {
|
||||
protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
}
|
||||
} static_descriptor_initializer_msgs_2fdriver_2dstation_2eproto_;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* DriverStation_State_descriptor() {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
return DriverStation_State_descriptor_;
|
||||
}
|
||||
bool DriverStation_State_IsValid(int value) {
|
||||
switch(value) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const DriverStation_State DriverStation::AUTO;
|
||||
const DriverStation_State DriverStation::TELEOP;
|
||||
const DriverStation_State DriverStation::TEST;
|
||||
const DriverStation_State DriverStation::State_MIN;
|
||||
const DriverStation_State DriverStation::State_MAX;
|
||||
const int DriverStation::State_ARRAYSIZE;
|
||||
#endif // _MSC_VER
|
||||
#ifndef _MSC_VER
|
||||
const int DriverStation::kEnabledFieldNumber;
|
||||
const int DriverStation::kStateFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
DriverStation::DriverStation()
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
}
|
||||
|
||||
void DriverStation::InitAsDefaultInstance() {
|
||||
}
|
||||
|
||||
DriverStation::DriverStation(const DriverStation& from)
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void DriverStation::SharedCtor() {
|
||||
_cached_size_ = 0;
|
||||
enabled_ = false;
|
||||
state_ = 0;
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
|
||||
DriverStation::~DriverStation() {
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
void DriverStation::SharedDtor() {
|
||||
if (this != default_instance_) {
|
||||
}
|
||||
}
|
||||
|
||||
void DriverStation::SetCachedSize(int size) const {
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
}
|
||||
const ::google::protobuf::Descriptor* DriverStation::descriptor() {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
return DriverStation_descriptor_;
|
||||
}
|
||||
|
||||
const DriverStation& DriverStation::default_instance() {
|
||||
if (default_instance_ == NULL) protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
return *default_instance_;
|
||||
}
|
||||
|
||||
DriverStation* DriverStation::default_instance_ = NULL;
|
||||
|
||||
DriverStation* DriverStation::New() const {
|
||||
return new DriverStation;
|
||||
}
|
||||
|
||||
void DriverStation::Clear() {
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
enabled_ = false;
|
||||
state_ = 0;
|
||||
}
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
mutable_unknown_fields()->Clear();
|
||||
}
|
||||
|
||||
bool DriverStation::MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input) {
|
||||
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
|
||||
::google::protobuf::uint32 tag;
|
||||
while ((tag = input->ReadTag()) != 0) {
|
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
||||
// required bool enabled = 1;
|
||||
case 1: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
|
||||
input, &enabled_)));
|
||||
set_has_enabled();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectTag(16)) goto parse_state;
|
||||
break;
|
||||
}
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
case 2: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
parse_state:
|
||||
int value;
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
|
||||
input, &value)));
|
||||
if (::gazebo::msgs::DriverStation_State_IsValid(value)) {
|
||||
set_state(static_cast< ::gazebo::msgs::DriverStation_State >(value));
|
||||
} else {
|
||||
mutable_unknown_fields()->AddVarint(2, value);
|
||||
}
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectAtEnd()) return true;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
handle_uninterpreted:
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
||||
return true;
|
||||
}
|
||||
DO_(::google::protobuf::internal::WireFormat::SkipField(
|
||||
input, tag, mutable_unknown_fields()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
#undef DO_
|
||||
}
|
||||
|
||||
void DriverStation::SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const {
|
||||
// required bool enabled = 1;
|
||||
if (has_enabled()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->enabled(), output);
|
||||
}
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
if (has_state()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteEnum(
|
||||
2, this->state(), output);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
|
||||
unknown_fields(), output);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::uint8* DriverStation::SerializeWithCachedSizesToArray(
|
||||
::google::protobuf::uint8* target) const {
|
||||
// required bool enabled = 1;
|
||||
if (has_enabled()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->enabled(), target);
|
||||
}
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
if (has_state()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
|
||||
2, this->state(), target);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
|
||||
unknown_fields(), target);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
int DriverStation::ByteSize() const {
|
||||
int total_size = 0;
|
||||
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
// required bool enabled = 1;
|
||||
if (has_enabled()) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
if (has_state()) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
|
||||
}
|
||||
|
||||
}
|
||||
if (!unknown_fields().empty()) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
|
||||
unknown_fields());
|
||||
}
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = total_size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void DriverStation::MergeFrom(const ::google::protobuf::Message& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
const DriverStation* source =
|
||||
::google::protobuf::internal::dynamic_cast_if_available<const DriverStation*>(
|
||||
&from);
|
||||
if (source == NULL) {
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this);
|
||||
} else {
|
||||
MergeFrom(*source);
|
||||
}
|
||||
}
|
||||
|
||||
void DriverStation::MergeFrom(const DriverStation& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
if (from.has_enabled()) {
|
||||
set_enabled(from.enabled());
|
||||
}
|
||||
if (from.has_state()) {
|
||||
set_state(from.state());
|
||||
}
|
||||
}
|
||||
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
|
||||
}
|
||||
|
||||
void DriverStation::CopyFrom(const ::google::protobuf::Message& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void DriverStation::CopyFrom(const DriverStation& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool DriverStation::IsInitialized() const {
|
||||
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DriverStation::Swap(DriverStation* other) {
|
||||
if (other != this) {
|
||||
std::swap(enabled_, other->enabled_);
|
||||
std::swap(state_, other->state_);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
_unknown_fields_.Swap(&other->_unknown_fields_);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata DriverStation::GetMetadata() const {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::Metadata metadata;
|
||||
metadata.descriptor = DriverStation_descriptor_;
|
||||
metadata.reflection = DriverStation_reflection_;
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
250
simulation/frc_gazebo_plugin/src/msgs/driver-station.pb.h
Normal file
250
simulation/frc_gazebo_plugin/src/msgs/driver-station.pb.h
Normal file
@@ -0,0 +1,250 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/driver-station.proto
|
||||
|
||||
#ifndef PROTOBUF_msgs_2fdriver_2dstation_2eproto__INCLUDED
|
||||
#define PROTOBUF_msgs_2fdriver_2dstation_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 2005000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/generated_enum_reflection.h>
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
// Internal implementation detail -- do not call these.
|
||||
void protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
void protobuf_AssignDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
void protobuf_ShutdownFile_msgs_2fdriver_2dstation_2eproto();
|
||||
|
||||
class DriverStation;
|
||||
|
||||
enum DriverStation_State {
|
||||
DriverStation_State_AUTO = 0,
|
||||
DriverStation_State_TELEOP = 1,
|
||||
DriverStation_State_TEST = 2
|
||||
};
|
||||
bool DriverStation_State_IsValid(int value);
|
||||
const DriverStation_State DriverStation_State_State_MIN = DriverStation_State_AUTO;
|
||||
const DriverStation_State DriverStation_State_State_MAX = DriverStation_State_TEST;
|
||||
const int DriverStation_State_State_ARRAYSIZE = DriverStation_State_State_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* DriverStation_State_descriptor();
|
||||
inline const ::std::string& DriverStation_State_Name(DriverStation_State value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
DriverStation_State_descriptor(), value);
|
||||
}
|
||||
inline bool DriverStation_State_Parse(
|
||||
const ::std::string& name, DriverStation_State* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<DriverStation_State>(
|
||||
DriverStation_State_descriptor(), name, value);
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
class DriverStation : public ::google::protobuf::Message {
|
||||
public:
|
||||
DriverStation();
|
||||
virtual ~DriverStation();
|
||||
|
||||
DriverStation(const DriverStation& from);
|
||||
|
||||
inline DriverStation& operator=(const DriverStation& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
|
||||
return _unknown_fields_;
|
||||
}
|
||||
|
||||
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
|
||||
return &_unknown_fields_;
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* descriptor();
|
||||
static const DriverStation& default_instance();
|
||||
|
||||
void Swap(DriverStation* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
DriverStation* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const DriverStation& from);
|
||||
void MergeFrom(const DriverStation& from);
|
||||
void Clear();
|
||||
bool IsInitialized() const;
|
||||
|
||||
int ByteSize() const;
|
||||
bool MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input);
|
||||
void SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const;
|
||||
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
|
||||
int GetCachedSize() const { return _cached_size_; }
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
public:
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
typedef DriverStation_State State;
|
||||
static const State AUTO = DriverStation_State_AUTO;
|
||||
static const State TELEOP = DriverStation_State_TELEOP;
|
||||
static const State TEST = DriverStation_State_TEST;
|
||||
static inline bool State_IsValid(int value) {
|
||||
return DriverStation_State_IsValid(value);
|
||||
}
|
||||
static const State State_MIN =
|
||||
DriverStation_State_State_MIN;
|
||||
static const State State_MAX =
|
||||
DriverStation_State_State_MAX;
|
||||
static const int State_ARRAYSIZE =
|
||||
DriverStation_State_State_ARRAYSIZE;
|
||||
static inline const ::google::protobuf::EnumDescriptor*
|
||||
State_descriptor() {
|
||||
return DriverStation_State_descriptor();
|
||||
}
|
||||
static inline const ::std::string& State_Name(State value) {
|
||||
return DriverStation_State_Name(value);
|
||||
}
|
||||
static inline bool State_Parse(const ::std::string& name,
|
||||
State* value) {
|
||||
return DriverStation_State_Parse(name, value);
|
||||
}
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required bool enabled = 1;
|
||||
inline bool has_enabled() const;
|
||||
inline void clear_enabled();
|
||||
static const int kEnabledFieldNumber = 1;
|
||||
inline bool enabled() const;
|
||||
inline void set_enabled(bool value);
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
inline bool has_state() const;
|
||||
inline void clear_state();
|
||||
static const int kStateFieldNumber = 2;
|
||||
inline ::gazebo::msgs::DriverStation_State state() const;
|
||||
inline void set_state(::gazebo::msgs::DriverStation_State value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:gazebo.msgs.DriverStation)
|
||||
private:
|
||||
inline void set_has_enabled();
|
||||
inline void clear_has_enabled();
|
||||
inline void set_has_state();
|
||||
inline void clear_has_state();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
bool enabled_;
|
||||
int state_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
friend void protobuf_AssignDesc_msgs_2fdriver_2dstation_2eproto();
|
||||
friend void protobuf_ShutdownFile_msgs_2fdriver_2dstation_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static DriverStation* default_instance_;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// DriverStation
|
||||
|
||||
// required bool enabled = 1;
|
||||
inline bool DriverStation::has_enabled() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void DriverStation::set_has_enabled() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void DriverStation::clear_has_enabled() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void DriverStation::clear_enabled() {
|
||||
enabled_ = false;
|
||||
clear_has_enabled();
|
||||
}
|
||||
inline bool DriverStation::enabled() const {
|
||||
return enabled_;
|
||||
}
|
||||
inline void DriverStation::set_enabled(bool value) {
|
||||
set_has_enabled();
|
||||
enabled_ = value;
|
||||
}
|
||||
|
||||
// required .gazebo.msgs.DriverStation.State state = 2;
|
||||
inline bool DriverStation::has_state() const {
|
||||
return (_has_bits_[0] & 0x00000002u) != 0;
|
||||
}
|
||||
inline void DriverStation::set_has_state() {
|
||||
_has_bits_[0] |= 0x00000002u;
|
||||
}
|
||||
inline void DriverStation::clear_has_state() {
|
||||
_has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
inline void DriverStation::clear_state() {
|
||||
state_ = 0;
|
||||
clear_has_state();
|
||||
}
|
||||
inline ::gazebo::msgs::DriverStation_State DriverStation::state() const {
|
||||
return static_cast< ::gazebo::msgs::DriverStation_State >(state_);
|
||||
}
|
||||
inline void DriverStation::set_state(::gazebo::msgs::DriverStation_State value) {
|
||||
assert(::gazebo::msgs::DriverStation_State_IsValid(value));
|
||||
set_has_state();
|
||||
state_ = value;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
#ifndef SWIG
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< ::gazebo::msgs::DriverStation_State>() {
|
||||
return ::gazebo::msgs::DriverStation_State_descriptor();
|
||||
}
|
||||
|
||||
} // namespace google
|
||||
} // namespace protobuf
|
||||
#endif // SWIG
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_msgs_2fdriver_2dstation_2eproto__INCLUDED
|
||||
310
simulation/frc_gazebo_plugin/src/msgs/float64.pb.cc
Normal file
310
simulation/frc_gazebo_plugin/src/msgs/float64.pb.cc
Normal file
@@ -0,0 +1,310 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/float64.proto
|
||||
|
||||
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
|
||||
#include "msgs/float64.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/stubs/once.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/wire_format_lite_inl.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
namespace {
|
||||
|
||||
const ::google::protobuf::Descriptor* Float64_descriptor_ = NULL;
|
||||
const ::google::protobuf::internal::GeneratedMessageReflection*
|
||||
Float64_reflection_ = NULL;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
void protobuf_AssignDesc_msgs_2ffloat64_2eproto() {
|
||||
protobuf_AddDesc_msgs_2ffloat64_2eproto();
|
||||
const ::google::protobuf::FileDescriptor* file =
|
||||
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
|
||||
"msgs/float64.proto");
|
||||
GOOGLE_CHECK(file != NULL);
|
||||
Float64_descriptor_ = file->message_type(0);
|
||||
static const int Float64_offsets_[1] = {
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Float64, data_),
|
||||
};
|
||||
Float64_reflection_ =
|
||||
new ::google::protobuf::internal::GeneratedMessageReflection(
|
||||
Float64_descriptor_,
|
||||
Float64::default_instance_,
|
||||
Float64_offsets_,
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Float64, _has_bits_[0]),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Float64, _unknown_fields_),
|
||||
-1,
|
||||
::google::protobuf::DescriptorPool::generated_pool(),
|
||||
::google::protobuf::MessageFactory::generated_factory(),
|
||||
sizeof(Float64));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
|
||||
inline void protobuf_AssignDescriptorsOnce() {
|
||||
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
|
||||
&protobuf_AssignDesc_msgs_2ffloat64_2eproto);
|
||||
}
|
||||
|
||||
void protobuf_RegisterTypes(const ::std::string&) {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
|
||||
Float64_descriptor_, &Float64::default_instance());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void protobuf_ShutdownFile_msgs_2ffloat64_2eproto() {
|
||||
delete Float64::default_instance_;
|
||||
delete Float64_reflection_;
|
||||
}
|
||||
|
||||
void protobuf_AddDesc_msgs_2ffloat64_2eproto() {
|
||||
static bool already_here = false;
|
||||
if (already_here) return;
|
||||
already_here = true;
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
|
||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||
"\n\022msgs/float64.proto\022\013gazebo.msgs\"\027\n\007Flo"
|
||||
"at64\022\014\n\004data\030\001 \002(\001B\013B\tGzFloat64", 71);
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||
"msgs/float64.proto", &protobuf_RegisterTypes);
|
||||
Float64::default_instance_ = new Float64();
|
||||
Float64::default_instance_->InitAsDefaultInstance();
|
||||
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_msgs_2ffloat64_2eproto);
|
||||
}
|
||||
|
||||
// Force AddDescriptors() to be called at static initialization time.
|
||||
struct StaticDescriptorInitializer_msgs_2ffloat64_2eproto {
|
||||
StaticDescriptorInitializer_msgs_2ffloat64_2eproto() {
|
||||
protobuf_AddDesc_msgs_2ffloat64_2eproto();
|
||||
}
|
||||
} static_descriptor_initializer_msgs_2ffloat64_2eproto_;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const int Float64::kDataFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
Float64::Float64()
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
}
|
||||
|
||||
void Float64::InitAsDefaultInstance() {
|
||||
}
|
||||
|
||||
Float64::Float64(const Float64& from)
|
||||
: ::google::protobuf::Message() {
|
||||
SharedCtor();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void Float64::SharedCtor() {
|
||||
_cached_size_ = 0;
|
||||
data_ = 0;
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
|
||||
Float64::~Float64() {
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
void Float64::SharedDtor() {
|
||||
if (this != default_instance_) {
|
||||
}
|
||||
}
|
||||
|
||||
void Float64::SetCachedSize(int size) const {
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
}
|
||||
const ::google::protobuf::Descriptor* Float64::descriptor() {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
return Float64_descriptor_;
|
||||
}
|
||||
|
||||
const Float64& Float64::default_instance() {
|
||||
if (default_instance_ == NULL) protobuf_AddDesc_msgs_2ffloat64_2eproto();
|
||||
return *default_instance_;
|
||||
}
|
||||
|
||||
Float64* Float64::default_instance_ = NULL;
|
||||
|
||||
Float64* Float64::New() const {
|
||||
return new Float64;
|
||||
}
|
||||
|
||||
void Float64::Clear() {
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
data_ = 0;
|
||||
}
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
mutable_unknown_fields()->Clear();
|
||||
}
|
||||
|
||||
bool Float64::MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input) {
|
||||
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
|
||||
::google::protobuf::uint32 tag;
|
||||
while ((tag = input->ReadTag()) != 0) {
|
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
||||
// required double data = 1;
|
||||
case 1: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
|
||||
input, &data_)));
|
||||
set_has_data();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectAtEnd()) return true;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
handle_uninterpreted:
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
||||
return true;
|
||||
}
|
||||
DO_(::google::protobuf::internal::WireFormat::SkipField(
|
||||
input, tag, mutable_unknown_fields()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
#undef DO_
|
||||
}
|
||||
|
||||
void Float64::SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const {
|
||||
// required double data = 1;
|
||||
if (has_data()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->data(), output);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
|
||||
unknown_fields(), output);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::uint8* Float64::SerializeWithCachedSizesToArray(
|
||||
::google::protobuf::uint8* target) const {
|
||||
// required double data = 1;
|
||||
if (has_data()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->data(), target);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
|
||||
unknown_fields(), target);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
int Float64::ByteSize() const {
|
||||
int total_size = 0;
|
||||
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
// required double data = 1;
|
||||
if (has_data()) {
|
||||
total_size += 1 + 8;
|
||||
}
|
||||
|
||||
}
|
||||
if (!unknown_fields().empty()) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
|
||||
unknown_fields());
|
||||
}
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
||||
_cached_size_ = total_size;
|
||||
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void Float64::MergeFrom(const ::google::protobuf::Message& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
const Float64* source =
|
||||
::google::protobuf::internal::dynamic_cast_if_available<const Float64*>(
|
||||
&from);
|
||||
if (source == NULL) {
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this);
|
||||
} else {
|
||||
MergeFrom(*source);
|
||||
}
|
||||
}
|
||||
|
||||
void Float64::MergeFrom(const Float64& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
if (from.has_data()) {
|
||||
set_data(from.data());
|
||||
}
|
||||
}
|
||||
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
|
||||
}
|
||||
|
||||
void Float64::CopyFrom(const ::google::protobuf::Message& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
void Float64::CopyFrom(const Float64& from) {
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool Float64::IsInitialized() const {
|
||||
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Float64::Swap(Float64* other) {
|
||||
if (other != this) {
|
||||
std::swap(data_, other->data_);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
_unknown_fields_.Swap(&other->_unknown_fields_);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
}
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata Float64::GetMetadata() const {
|
||||
protobuf_AssignDescriptorsOnce();
|
||||
::google::protobuf::Metadata metadata;
|
||||
metadata.descriptor = Float64_descriptor_;
|
||||
metadata.reflection = Float64_reflection_;
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
167
simulation/frc_gazebo_plugin/src/msgs/float64.pb.h
Normal file
167
simulation/frc_gazebo_plugin/src/msgs/float64.pb.h
Normal file
@@ -0,0 +1,167 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: msgs/float64.proto
|
||||
|
||||
#ifndef PROTOBUF_msgs_2ffloat64_2eproto__INCLUDED
|
||||
#define PROTOBUF_msgs_2ffloat64_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 2005000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
// Internal implementation detail -- do not call these.
|
||||
void protobuf_AddDesc_msgs_2ffloat64_2eproto();
|
||||
void protobuf_AssignDesc_msgs_2ffloat64_2eproto();
|
||||
void protobuf_ShutdownFile_msgs_2ffloat64_2eproto();
|
||||
|
||||
class Float64;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Float64 : public ::google::protobuf::Message {
|
||||
public:
|
||||
Float64();
|
||||
virtual ~Float64();
|
||||
|
||||
Float64(const Float64& from);
|
||||
|
||||
inline Float64& operator=(const Float64& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
|
||||
return _unknown_fields_;
|
||||
}
|
||||
|
||||
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
|
||||
return &_unknown_fields_;
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* descriptor();
|
||||
static const Float64& default_instance();
|
||||
|
||||
void Swap(Float64* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
Float64* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const Float64& from);
|
||||
void MergeFrom(const Float64& from);
|
||||
void Clear();
|
||||
bool IsInitialized() const;
|
||||
|
||||
int ByteSize() const;
|
||||
bool MergePartialFromCodedStream(
|
||||
::google::protobuf::io::CodedInputStream* input);
|
||||
void SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const;
|
||||
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
|
||||
int GetCachedSize() const { return _cached_size_; }
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
public:
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required double data = 1;
|
||||
inline bool has_data() const;
|
||||
inline void clear_data();
|
||||
static const int kDataFieldNumber = 1;
|
||||
inline double data() const;
|
||||
inline void set_data(double value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:gazebo.msgs.Float64)
|
||||
private:
|
||||
inline void set_has_data();
|
||||
inline void clear_has_data();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
double data_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_msgs_2ffloat64_2eproto();
|
||||
friend void protobuf_AssignDesc_msgs_2ffloat64_2eproto();
|
||||
friend void protobuf_ShutdownFile_msgs_2ffloat64_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static Float64* default_instance_;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// Float64
|
||||
|
||||
// required double data = 1;
|
||||
inline bool Float64::has_data() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void Float64::set_has_data() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void Float64::clear_has_data() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void Float64::clear_data() {
|
||||
data_ = 0;
|
||||
clear_has_data();
|
||||
}
|
||||
inline double Float64::data() const {
|
||||
return data_;
|
||||
}
|
||||
inline void Float64::set_data(double value) {
|
||||
set_has_data();
|
||||
data_ = value;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace msgs
|
||||
} // namespace gazebo
|
||||
|
||||
#ifndef SWIG
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
|
||||
} // namespace google
|
||||
} // namespace protobuf
|
||||
#endif // SWIG
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_msgs_2ffloat64_2eproto__INCLUDED
|
||||
30
simulation/frc_gazebo_plugin/src/msgs/msgs.h
Normal file
30
simulation/frc_gazebo_plugin/src/msgs/msgs.h
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
#include "msgs/float64.pb.h"
|
||||
#include "msgs/bool.pb.h"
|
||||
#include "msgs/driver-station.pb.h"
|
||||
|
||||
#include <gazebo/msgs/msgs.hh>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#ifndef _FRC_MSGS_H_
|
||||
#define _FRC_MSGS_H_
|
||||
|
||||
namespace gazebo {
|
||||
namespace msgs {
|
||||
|
||||
typedef GzString String;
|
||||
typedef boost::shared_ptr< gazebo::msgs::String > StringPtr;
|
||||
typedef const boost::shared_ptr< const gazebo::msgs::String > ConstStringPtr;
|
||||
|
||||
typedef boost::shared_ptr< msgs::Float64 > Float64Ptr;
|
||||
typedef const boost::shared_ptr< const msgs::Float64 > ConstFloat64Ptr;
|
||||
|
||||
typedef boost::shared_ptr< msgs::Bool > BoolPtr;
|
||||
typedef const boost::shared_ptr< const msgs::Bool > ConstBoolPtr;
|
||||
|
||||
typedef boost::shared_ptr< msgs::DriverStation > DriverStationPtr;
|
||||
typedef const boost::shared_ptr< const msgs::DriverStation > ConstDriverStationPtr;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _FRC_MSGS_H_ */
|
||||
Reference in New Issue
Block a user