22 #ifndef MOTION_CONTROLLER_BASE_H 23 #define MOTION_CONTROLLER_BASE_H 27 #include <geometry_msgs/Twist.h> 28 #include <geometry_msgs/Pose2D.h> 29 #include <stdr_msgs/KinematicMsg.h> 142 inline void setPose(geometry_msgs::Pose2D new_pose)
144 _pose.x = new_pose.x;
145 _pose.y = new_pose.y;
146 _pose.theta = new_pose.theta;
173 for (
unsigned int i = 0 ; i < 12 ; i++)
175 float sample = (rand() % 100000) / 50000.0 - 1.0;
176 tmp += sample * sigma;
192 const geometry_msgs::Pose2D& pose,
194 const std::string& name,
196 const stdr_msgs::KinematicMsg params
virtual void sampleVelocities(void)
Virtual function - Add noise to velocity commands.
ros::Duration _freq
ROS timer for generating motion calculation events.
ros::Timer _calcTimer
Broadcaster of the robot tf transform.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
The main namespace for STDR Robot.
boost::shared_ptr< MotionController > MotionControllerPtr
geometry_msgs::Pose2D _pose
Current motion command.
virtual void velocityCallback(const geometry_msgs::Twist &msg)
Virtual function - Callback for velocity commands.
ros::Subscriber _velocitySubscrider
Frequency of motion calculation.
float sampleNormal(float sigma)
Approaches a normal distribution sampling.
geometry_msgs::Pose2D getPose(void)
Returns the pose calculated by the motion controller.
virtual ~MotionController(void)
Default desctructor.
geometry_msgs::Twist getVelocity()
Get the current velocity of the motion controller.
geometry_msgs::Twist _currentTwist
The kinematic model parameters.
stdr_msgs::KinematicMsg _motion_parameters
virtual void stop(void)
Virtual function - Stops the robot.
Abstract class that provides motion controller abstraction.
TFSIMD_FORCE_INLINE const tfScalar & w() const
MotionController(const geometry_msgs::Pose2D &pose, tf::TransformBroadcaster &tf, const std::string &name, ros::NodeHandle &n, const stdr_msgs::KinematicMsg params)
Default constructor.
const std::string & _namespace
< The base of the frame_id
tf::TransformBroadcaster & _tfBroadcaster
Robot pose message.
void setPose(geometry_msgs::Pose2D new_pose)
Sets the initial pose of the motion controller.
virtual void calculateMotion(const ros::TimerEvent &event)=0
Pure virtual function - Calculates the motion - updates the robot pose.