Fawkes API Fawkes Development Version
motor.h
1/***************************************************************************
2 * motor.h - Plugin for controling a model through a simulated motor
3 *
4 * Created: Wed Jan 29 16:08:32 2014
5 * Copyright 2014 Frederik Zwilling
6 ****************************************************************************/
7
8/* This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Library General Public License for more details.
17 *
18 * Read the full text in the LICENSE.GPL file in the doc directory.
19 */
20
21#include <boost/bind/bind.hpp>
22#include <gazebo/common/common.hh>
23#include <gazebo/gazebo.hh>
24#include <gazebo/physics/physics.hh>
25#include <gazebo/transport/transport.hh>
26#include <list>
27#include <stdio.h>
28#include <string.h>
29
30namespace gazebo {
31/** @class Motor
32 * Motor plugin for Gazebo
33 * @author Frederik Zwilling
34 */
35class Motor : public ModelPlugin
36{
37public:
38 ///Constructor
39 Motor();
40
41 ///Destructor
42 ~Motor();
43
44 //Overridden ModelPlugin-Functions
45 virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/);
46 virtual void OnUpdate(const common::UpdateInfo &);
47 virtual void Reset();
48
49private:
50 /// Pointer to the Gazebo model
51 physics::ModelPtr model_;
52 /// Pointer to the update event connection
53 event::ConnectionPtr update_connection_;
54 ///Node for communication to fawkes
55 transport::NodePtr node_;
56 ///name of the motor and the communication channel
57 std::string name_;
58
59 //Motor Stuff:
60 void on_motor_move_msg(ConstVector3dPtr &msg);
61
62 ///Suscriber for MotorMove Interfaces from Fawkes
63 transport::SubscriberPtr motor_move_sub_;
64
65 //current movement commands:
66 float vx_;
67 float vy_;
68 float vomega_;
69};
70} // namespace gazebo
Motor plugin for Gazebo.
Definition: motor.h:36
~Motor()
Destructor.
Definition: motor.cpp:36
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr)
on loading of the plugin
Definition: motor.cpp:45
virtual void Reset()
on Gazebo reset
Definition: motor.cpp:97
virtual void OnUpdate(const common::UpdateInfo &)
Called by the world update start event.
Definition: motor.cpp:78
Motor()
Constructor.
Definition: motor.cpp:32