10 #ifndef _GAZEBO_MODEL_CONTROLLER_HH_
11 #define _GAZEBO_MODEL_CONTROLLER_HH_
15 #include <boost/bind.hpp>
17 #include <gazebo/gazebo.hh>
18 #include <gazebo/physics/physics.hh>
19 #include <gazebo/common/common.hh>
21 #include "collision_message.pb.h"
22 #include "command_message.pb.h"
24 #include "ColorLog.hh"
26 #include "SmoresJoint.hh"
29 #define EXECUTIONERROR 0.08
34 typedef const boost::shared_ptr<const gazebo::msgs::GzString> GzStringPtr;
36 typedef const boost::shared_ptr<const gazebo::msgs::Pose> PosePtr;
38 typedef const boost::shared_ptr<const command_message::msgs::CommandMessage>
81 math::Vector2d end_point);
93 double complement_filter_par,
double *value_history);
119 math::Angle
GetJointAngle(physics::JointPtr current_joint,
int rot_axis);
127 void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
132 void WelcomInfoProcessor(GzStringPtr &msg);
137 void SystemInitialization(physics::ModelPtr parent_model);
139 void OnSystemRunning(
const common::UpdateInfo & );
142 void CollisionPubAndSubInitialization(
void);
145 void CollisionReceivingCallback(GzStringPtr &msg);
150 void CommandDecoding(CommandMessagePtr &msg);
163 void SetJointAngleForce(physics::JointPtr current_joint,
int rot_axis,
171 void JointPIDController(
double angle_desired_radian,
179 void JointPIDController(
double angle_desired_radian,
SmoresJoint *current_joint);
181 void JointAngleUpdateInJointPlus(
void);
189 void SetJointSpeed(physics::JointPtr CurrentJoint,
int RotAxis,
190 double SpeedDesired);
197 void JointAngleTracking(
void);
200 void PositionTracking(
void);
211 void AnglePIDController(math::Angle desired_angle, math::Angle current_angle,
212 math::Vector2d current_speed);
218 void Move2Point(math::Vector2d DesiredPoint, math::Angle DesiredOrientation);
254 physics::JointPtr jointWR;
256 physics::JointPtr jointWL;
258 physics::JointPtr jointWF;
260 physics::JointPtr jointCB;
274 event::ConnectionPtr updateConnection;
280 transport::SubscriberPtr welcomeInfoSub;
282 transport::SubscriberPtr commandSub;
284 transport::PublisherPtr commandPub;
286 transport::SubscriberPtr linkCollisonSub[4];
292 vector<string> nameOfConnectedModels;
306 double jointAngleShouldBe[4];
308 double jointSpeeds[4];
310 math::Pose targetPosition;
312 double lftWheelSpeed;
314 double rgtWheelSpeed;
gazebo name space
Definition: system_gui.cc:41
~ModuleController()
Destructor.
Definition: ModuleController.cc:31
double maxiRotationRate
Maximium rotation rate of each joint, unit: rad/s.
Definition: ModuleController.hh:242
double RevolutionSpeedCal(physics::JointPtr joint, const int axis_index)
Calculates the angular velocity of a revolute joint.
Definition: ModuleController.cc:39
math::Angle GetJointAngle(physics::JointPtr current_joint, int rot_axis)
Returns the angle of the specified joint.
Definition: ModuleController.cc:99
The modelplugin that actually controls the model and provide low level apis.
Definition: ModuleController.hh:47
math::Vector3 jointAngleKPID
Default Joint Angle PID controller parameter.
Definition: ModuleController.hh:233
SmoresJoint & GetJointPlus(int node_ID)
Returns the SmoresJoint structure according to the node ID.
Definition: ModuleController.cc:75
double accelerationRate
Acceleration rate of the planar motion.
Definition: ModuleController.hh:244
math::Vector3 modelAngleKPID
Default Joint Angle PID controller parameter.
Definition: ModuleController.hh:240
transport::PublisherPtr collisionInfoToServer
Publisher of the collision information.
Definition: ModuleController.hh:223
math::Angle AngleCalculation2Points(math::Vector2d start_point, math::Vector2d end_point)
Calculates the anlge of the line connected two points in the world frame.
Definition: ModuleController.cc:52
double planarMotionStopThreshold
Planar motion control threshold.
Definition: ModuleController.hh:246
A struct that has richer features than gazebo joint object.
Definition: SmoresJoint.hh:10
ModuleController()
Constructor.
Definition: ModuleController.cc:10
double ComplementaryFilter(double filtering_value, double complement_filter_par, double *value_history)
Apply a complementary filter a raw sensor value.
Definition: ModuleController.cc:61
double wheelRadius
Radius of the wheels.
Definition: ModuleController.hh:248
physics::ModelPtr model
Current Model Pointer.
Definition: ModuleController.hh:221
math::Pose GetModelCentralCoor(void)
Gets the coordinates and direction of the current model.
Definition: ModuleController.cc:46
int GetJointAxis(int node_ID)
Returns the index of joint axis according to the node ID.
Definition: ModuleController.cc:88