JointEventSource.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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_EVENTS_JOINTEVENTSOURCE_HH_
19 #define _GAZEBO_PLUGINS_EVENTS_JOINTEVENTSOURCE_HH_
20 
21 #include <string>
22 
24 
25 namespace gazebo
26 {
56  {
59  public: enum Range {
70  };
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
JointEventSource(transport::PublisherPtr _pub, physics::WorldPtr _world)
Constructor.
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
invalid
Definition: JointEventSource.hh:69
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Velocity or angular velocity.
Definition: JointEventSource.hh:65
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
Applied force (or torque, for revolute joints)
Definition: JointEventSource.hh:67
virtual void Load(const sdf::ElementPtr _sdf)
Loads the full name of the model and the triggers from the world file.
Range
The type of data range measured.
Definition: JointEventSource.hh:59
Normalized angle (between -PI and PI)
Definition: JointEventSource.hh:63
void Update()
Called every simulation step.
The base class for emitting SimEvents.
Definition: EventSource.hh:39
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:153
virtual void Init()
Initialize the event.
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
Absolute position (or angle, for revolute joints)
Definition: JointEventSource.hh:61
void Info() const
Prints data about the event source to the log (useful for debug)
The event generator class.
Definition: JointEventSource.hh:55