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 
24 #include <gazebo/common/Plugin.hh>
25 #include <gazebo/transport/Node.hh>
26 
27 namespace gazebo
28 {
30  struct KeyInfo
31  {
33  // cppcheck-suppress unusedStructMember
34  int key;
35 
38 
40  std::string type;
41 
44  // cppcheck-suppress unusedStructMember
45  double scale;
46  };
47 
107  {
109  public: KeysToJointsPlugin();
110 
112  public: ~KeysToJointsPlugin();
113 
114  // Documentation inherited
115  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
116 
119  private: void OnKeyPress(ConstAnyPtr &_msg);
120 
122  private: std::vector<KeyInfo> keys;
123 
125  private: physics::ModelPtr model;
126 
128  private: transport::NodePtr node;
129 
131  private: transport::SubscriberPtr keyboardSub;
132  };
133 }
134 #endif
135 
physics::JointPtr joint
Pointer to the joint controlled by this key.
Definition: KeysToJointsPlugin.hh:37
Forward declarations for the common classes.
Definition: Animation.hh:33
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:55
Store information from SDF for each key.
Definition: KeysToJointsPlugin.hh:30
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:108
int key
Key ASCII value (reference: http://ascii.cl/)
Definition: KeysToJointsPlugin.hh:34
std::string type
Possible target types: position, velocity, force.
Definition: KeysToJointsPlugin.hh:40
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:59
Control joints in a model based on keypress messages received.
Definition: KeysToJointsPlugin.hh:106
double scale
Increments for position, absolute values for velocity and force.
Definition: KeysToJointsPlugin.hh:45
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:88
A plugin with access to physics::Model.
Definition: Plugin.hh:245
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59