ActorPlugin.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_ACTORPLUGIN_HH_
19 #define GAZEBO_PLUGINS_ACTORPLUGIN_HH_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "gazebo/common/Plugin.hh"
25 #include "gazebo/physics/physics.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  class GZ_PLUGIN_VISIBLE ActorPlugin : public ModelPlugin
31  {
33  public: ActorPlugin();
34 
38  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
39 
40  // Documentation Inherited.
41  public: virtual void Reset();
42 
45  private: void OnUpdate(const common::UpdateInfo &_info);
46 
48  private: void ChooseNewTarget();
49 
54  private: void HandleObstacles(ignition::math::Vector3d &_pos);
55 
57  private: physics::ActorPtr actor;
58 
60  private: physics::WorldPtr world;
61 
63  private: sdf::ElementPtr sdf;
64 
66  private: ignition::math::Vector3d velocity;
67 
69  private: std::vector<event::ConnectionPtr> connections;
70 
72  private: ignition::math::Vector3d target;
73 
75  private: double targetWeight = 1.0;
76 
78  private: double obstacleWeight = 1.0;
79 
82  private: double animationFactor = 1.0;
83 
85  private: common::Time lastUpdate;
86 
88  private: std::vector<std::string> ignoreModels;
89 
91  private: physics::TrajectoryInfoPtr trajectoryInfo;
92  };
93 }
94 #endif
boost::shared_ptr< Actor > ActorPtr
Definition: PhysicsTypes.hh:98
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:90
Forward declarations for the common classes.
Definition: Animation.hh:26
std::shared_ptr< TrajectoryInfo > TrajectoryInfoPtr
Definition: PhysicsTypes.hh:102
Information for use in an update event.
Definition: UpdateInfo.hh:30
Definition: ActorPlugin.hh:30
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:94
A plugin with access to physics::Model.
Definition: Plugin.hh:303
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:47