JointEventSource.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GAZEBO_PLUGINS_JOINTEVENTSOURCE_HH_
19#define GAZEBO_PLUGINS_JOINTEVENTSOURCE_HH_
20
21#include <string>
22
24
25namespace gazebo
26{
56 {
71
72
77 physics::WorldPtr _world);
78
80 public: virtual void Init();
81
83 public: void Update();
84
86 public: void Info() const;
87
91 public: virtual void Load(const sdf::ElementPtr _sdf);
92
95 private: bool LookupJoint();
96
99 private: std::string RangeAsString() const;
100
104 private: void SetRangeFromString(const std::string &_rangeStr);
105
107 private: event::ConnectionPtr updateConnection;
108
110 private: std::string modelName;
111
113 private: std::string jointName;
114
116 private: physics::ModelPtr model;
117
119 private: physics::JointPtr joint;
120
122 private: double min;
123
125 private: double max;
126
128 private: Range range;
129
131 private: bool isTriggered;
132 };
133}
134
135#endif
The base class for emitting SimEvents.
Definition EventSource.hh:35
The event generator class.
Definition JointEventSource.hh:56
Range
The type of data range measured.
Definition JointEventSource.hh:59
@ ANGLE
Normalized angle (between -PI and PI)
Definition JointEventSource.hh:63
@ VELOCITY
Velocity or angular velocity.
Definition JointEventSource.hh:65
@ FORCE
Applied force (or torque, for revolute joints)
Definition JointEventSource.hh:67
@ POSITION
Absolute position (or angle, for revolute joints)
Definition JointEventSource.hh:61
@ INVALID
invalid
Definition JointEventSource.hh:69
virtual void Load(const sdf::ElementPtr _sdf)
Loads the full name of the model and the triggers from the world file.
JointEventSource(transport::PublisherPtr _pub, physics::WorldPtr _world)
Constructor.
virtual void Init()
Initialize the event.
void Info() const
Prints data about the event source to the log (useful for debug)
void Update()
Called every simulation step.
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
boost::shared_ptr< World > WorldPtr
Definition PhysicsTypes.hh:89
boost::shared_ptr< Model > ModelPtr
Definition PhysicsTypes.hh:93
boost::shared_ptr< Joint > JointPtr
Definition PhysicsTypes.hh:117
boost::shared_ptr< Publisher > PublisherPtr
Definition TransportTypes.hh:49
Forward declarations for the common classes.
Definition Animation.hh:27