##

JointEventSource.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_JOINTEVENTSOURCE_HH_
#define GAZEBO_PLUGINS_JOINTEVENTSOURCE_HH_
#include <string>
#include "plugins/events/EventSource.hh"
namespace gazebo
{
class JointEventSource: public EventSource
{
public: enum Range {
POSITION,
ANGLE,
VELOCITY,
FORCE,
INVALID
};
public: JointEventSource(transport::PublisherPtr _pub,
physics::WorldPtr _world);
public: virtual void Init();
public: void Update();
public: void Info() const;
public: virtual void Load(const sdf::ElementPtr _sdf);
private: bool LookupJoint();
private: std::string RangeAsString() const;
private: void SetRangeFromString(const std::string &_rangeStr);
private: event::ConnectionPtr updateConnection;
private: std::string modelName;
private: std::string jointName;
private: physics::ModelPtr model;
private: physics::JointPtr joint;
private: double min;
private: double max;
private: Range range;
private: bool isTriggered;
};
}
#endif
gazebo::JointEventSource
The event generator class.
Definition: JointEventSource.hh:55
gazebo::JointEventSource::INVALID
invalid
Definition: JointEventSource.hh:69
gazebo::JointEventSource::Load
virtual void Load(const sdf::ElementPtr _sdf)
Loads the full name of the model and the triggers from the world file.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::transport::PublisherPtr
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
gazebo::JointEventSource::VELOCITY
Velocity or angular velocity.
Definition: JointEventSource.hh:65
gazebo::JointEventSource::Range
Range
The type of data range measured.
Definition: JointEventSource.hh:59
gazebo::JointEventSource::FORCE
Applied force (or torque, for revolute joints)
Definition: JointEventSource.hh:67
EventSource.hh
gazebo::JointEventSource::ANGLE
Normalized angle (between -PI and PI)
Definition: JointEventSource.hh:63
gazebo::JointEventSource::Update
void Update()
Called every simulation step.
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::EventSource
The base class for emitting SimEvents.
Definition: EventSource.hh:34
gazebo::JointEventSource::POSITION
Absolute position (or angle, for revolute joints)
Definition: JointEventSource.hh:61
gazebo::physics::JointPtr
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
gazebo::JointEventSource::Init
virtual void Init()
Initialize the event.
gazebo::JointEventSource::Info
void Info() const
Prints data about the event source to the log (useful for debug)
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
gazebo::JointEventSource::JointEventSource
JointEventSource(transport::PublisherPtr _pub, physics::WorldPtr _world)
Constructor.