KeysToJointsPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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_KEYSTOJOINTSPLUGIN_HH_
19 #define GAZEBO_PLUGINS_KEYSTOJOINTSPLUGIN_HH_
20 
21 #include <string>
22 #include <vector>
23 #include <ignition/transport/Node.hh>
24 
25 #include <gazebo/common/Plugin.hh>
26 #include <gazebo/transport/Node.hh>
27 
28 namespace gazebo
29 {
31  struct KeyInfo
32  {
34  // cppcheck-suppress unusedStructMember
35  int key;
36 
39 
41  std::string type;
42 
45  // cppcheck-suppress unusedStructMember
46  double scale;
47  };
48 
108  {
110  public: KeysToJointsPlugin();
111 
113  public: ~KeysToJointsPlugin();
114 
115  // Documentation inherited
116  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
117 
120  private: void OnKeyPress(ConstAnyPtr &_msg);
121 
123  private: std::vector<KeyInfo> keys;
124 
126  private: physics::ModelPtr model;
127 
129  private: transport::NodePtr node;
130 
132  private: transport::SubscriberPtr keyboardSub;
133 
134  // Place ignition::transport objects at the end of this file to
135  // guarantee they are destructed first.
136 
138  private: ignition::transport::Node nodeIgn;
139  };
140 }
141 #endif
142 
physics::JointPtr joint
Pointer to the joint controlled by this key.
Definition: KeysToJointsPlugin.hh:38
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
Store information from SDF for each key.
Definition: KeysToJointsPlugin.hh:31
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
int key
Key ASCII value (reference: http://ascii.cl/)
Definition: KeysToJointsPlugin.hh:35
std::string type
Possible target types: position, velocity, force.
Definition: KeysToJointsPlugin.hh:41
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
Control joints in a model based on keypress messages received.
Definition: KeysToJointsPlugin.hh:107
double scale
Increments for position, absolute values for velocity and force.
Definition: KeysToJointsPlugin.hh:46
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
A plugin with access to physics::Model.
Definition: Plugin.hh:305
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59