mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Cleanup of gazebo plugins (#46)
* Upgraded plugins for gazebo 7 * Fixed documentation on sensors
This commit is contained in:
committed by
Peter Johnson
parent
6d9b3b0aaa
commit
e3eae023da
@@ -7,7 +7,7 @@ before_install:
|
||||
- wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
|
||||
- sudo add-apt-repository ppa:wpilib/toolchain -y
|
||||
- sudo apt-get update -q || true
|
||||
- sudo apt-get install frc-toolchain libgazebo6-dev protobuf-compiler libprotobuf-dev -y
|
||||
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev -y
|
||||
|
||||
|
||||
before_cache:
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace gazebo;
|
||||
* To add a clock to your robot, add the following XML to your robot
|
||||
* model:
|
||||
*
|
||||
* <plugin name="my_clock" filename="libgz_clock.so">
|
||||
* <plugin name="my_clock" filename="libclock.so">
|
||||
* <topic>~/my/topic</topic>
|
||||
* </plugin>
|
||||
*
|
||||
|
||||
@@ -25,7 +25,7 @@ using namespace gazebo;
|
||||
* To add a DC motor to your robot, add the following XML to your
|
||||
* robot model:
|
||||
*
|
||||
* <plugin name="my_motor" filename="libgz_dc_motor.so">
|
||||
* <plugin name="my_motor" filename="libdc_motor.so">
|
||||
* <joint>Joint Name</joint>
|
||||
* <topic>~/my/topic</topic>
|
||||
* <multiplier>Number</multiplier>
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace gazebo;
|
||||
* To add a encoder to your robot, add the following XML to your
|
||||
* robot model:
|
||||
*
|
||||
* <plugin name="my_encoder" filename="libgz_encoder.so">
|
||||
* <plugin name="my_encoder" filename="libencoder.so">
|
||||
* <joint>Joint Name</joint>
|
||||
* <topic>~/my/topic</topic>
|
||||
* <units>{degrees, radians}</units>
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef enum { Roll /*X*/, Pitch /*Y*/, Yaw /*Z*/ } ROTATION;
|
||||
* To add a gyro to your robot, add the following XML to your robot
|
||||
* model:
|
||||
*
|
||||
* <plugin name="my_gyro" filename="libgz_gyro.so">
|
||||
* <plugin name="my_gyro" filename="libgyro.so">
|
||||
* <link>Joint Name</link>
|
||||
* <topic>~/my/topic</topic>
|
||||
* <units>{degrees, radians}</units>
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
#include "external_limit_switch.h"
|
||||
|
||||
ExternalLimitSwitch::ExternalLimitSwitch(sdf::ElementPtr sdf) {
|
||||
sensor = boost::dynamic_pointer_cast<sensors::ContactSensor>(
|
||||
sensor = std::dynamic_pointer_cast<sensors::ContactSensor>(
|
||||
sensors::get_sensor(sdf->Get<std::string>("sensor")));
|
||||
|
||||
gzmsg << "\texternal limit switch: "
|
||||
<< " sensor=" << sensor->GetName() << std::endl;
|
||||
<< " sensor=" << sensor->Name() << std::endl;
|
||||
}
|
||||
|
||||
ExternalLimitSwitch::~ExternalLimitSwitch() {}
|
||||
|
||||
bool ExternalLimitSwitch::Get() {
|
||||
return sensor->GetContacts().contact().size() > 0;
|
||||
return sensor->Contacts().contact().size() > 0;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ using namespace gazebo;
|
||||
*
|
||||
* Internal:
|
||||
*
|
||||
* <plugin name="my_limit_switch" filename="libgz_limit_switch.so">
|
||||
* <plugin name="my_limit_switch" filename="liblimit_switch.so">
|
||||
* <topic>~/my/topic</topic>
|
||||
* <type>internal</type>
|
||||
* <joint>Joint Name</joint>
|
||||
@@ -47,7 +47,7 @@ using namespace gazebo;
|
||||
*
|
||||
* External:
|
||||
*
|
||||
* <plugin name="my_limit_switch" filename="libgz_limit_switch.so">
|
||||
* <plugin name="my_limit_switch" filename="liblimit_switch.so">
|
||||
* <topic>~/my/topic</topic>
|
||||
* <type>external</type>
|
||||
* <sensor>Sensor Name</sensor>
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace gazebo;
|
||||
* To add a pneumatic piston to your robot, add the following XML to
|
||||
* your robot model:
|
||||
*
|
||||
* <plugin name="my_piston" filename="libgz_pneumatic_piston.so">
|
||||
* <plugin name="my_piston" filename="libpneumatic_piston.so">
|
||||
* <joint>Joint Name</joint>
|
||||
* <topic>~/my/topic</topic>
|
||||
* <direction>{forward, reversed}</direction>
|
||||
|
||||
@@ -22,7 +22,7 @@ using namespace gazebo;
|
||||
* To add a potentiometer to your robot, add the following XML to your
|
||||
* robot model:
|
||||
*
|
||||
* <plugin name="my_pot" filename="libgz_potentiometer.so">
|
||||
* <plugin name="my_pot" filename="libpotentiometer.so">
|
||||
* <joint>Joint Name</joint>
|
||||
* <topic>~/my/topic</topic>
|
||||
* <units>{degrees, radians}</units>
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#include <gazebo/sensors/sensors.hh>
|
||||
#include <gazebo/transport/transport.hh>
|
||||
|
||||
#include <boost/pointer_cast.hpp>
|
||||
|
||||
GZ_REGISTER_MODEL_PLUGIN(Rangefinder)
|
||||
|
||||
Rangefinder::Rangefinder() {}
|
||||
@@ -29,7 +27,7 @@ void Rangefinder::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
|
||||
this->model = model;
|
||||
|
||||
// Parse SDF properties
|
||||
sensor = boost::dynamic_pointer_cast<sensors::SonarSensor>(
|
||||
sensor = std::dynamic_pointer_cast<sensors::SonarSensor>(
|
||||
sensors::get_sensor(sdf->Get<std::string>("sensor")));
|
||||
if (sdf->HasElement("topic")) {
|
||||
topic = sdf->Get<std::string>("topic");
|
||||
@@ -37,8 +35,8 @@ void Rangefinder::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
|
||||
topic = "~/" + sdf->GetAttribute("name")->GetAsString();
|
||||
}
|
||||
|
||||
gzmsg << "Initializing rangefinder: " << topic
|
||||
<< " sensor=" << sensor->GetName() << std::endl;
|
||||
gzmsg << "Initializing rangefinder: " << topic << " sensor=" << sensor->Name()
|
||||
<< std::endl;
|
||||
|
||||
// Connect to Gazebo transport for messaging
|
||||
std::string scoped_name =
|
||||
@@ -56,6 +54,6 @@ void Rangefinder::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
|
||||
|
||||
void Rangefinder::Update(const common::UpdateInfo& info) {
|
||||
msgs::Float64 msg;
|
||||
msg.set_data(sensor->GetRange());
|
||||
msg.set_data(sensor->Range());
|
||||
pub->Publish(msg);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ using namespace gazebo;
|
||||
* To add a rangefinder to your robot, add the following XML to your
|
||||
* robot model:
|
||||
*
|
||||
* <plugin name="my_rangefinder" filename="libgz_rangefinder.so">
|
||||
* <plugin name="my_rangefinder" filename="librangefinder.so">
|
||||
* <sensor>Sensor Name</sensor>
|
||||
* <topic>~/my/topic</topic>
|
||||
* </plugin>
|
||||
|
||||
@@ -40,8 +40,8 @@ void Servo::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
|
||||
torque = 5;
|
||||
}
|
||||
|
||||
gzmsg << "initializing awesome servo: " << topic
|
||||
<< " joint=" << joint->GetName() << " torque=" << torque << std::endl;
|
||||
gzmsg << "initializing servo: " << topic << " joint=" << joint->GetName()
|
||||
<< " torque=" << torque << std::endl;
|
||||
|
||||
// Connect to Gazebo transport for messaging
|
||||
std::string scoped_name =
|
||||
|
||||
@@ -23,9 +23,10 @@ using namespace gazebo;
|
||||
* To add a servo to your robot, add the following XML to your robot
|
||||
* model:
|
||||
*
|
||||
* <plugin name="my_servo" filename="libgz_servo.so">
|
||||
* <plugin name="my_servo" filename="libservo.so">
|
||||
* <joint>Joint Name</joint>
|
||||
* <topic>/gzebo/frc/simulator/pwm/1</topic>
|
||||
* <zero_position>0</zero_position>
|
||||
* </plugin>
|
||||
*
|
||||
* - `link`: Name of the link the servo is attached to.
|
||||
|
||||
Reference in New Issue
Block a user