Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
mecanum_drive_controller::MecanumDriveController Class Reference

#include <mecanum_drive_controller.h>

Inheritance diagram for mecanum_drive_controller::MecanumDriveController:
Inheritance graph
[legend]

Classes

struct  Commands
 Velocity command related: More...
 

Public Member Functions

bool init (hardware_interface::VelocityJointInterface *hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh)
 Initialize controller. More...
 
 MecanumDriveController ()
 
void starting (const ros::Time &time)
 Starts controller. More...
 
void stopping (const ros::Time &time)
 Stops controller. More...
 
void update (const ros::Time &time, const ros::Duration &period)
 Updates controller, i.e. computes the odometry and sets the new velocity commands. More...
 
- Public Member Functions inherited from controller_interface::Controller< hardware_interface::VelocityJointInterface >
 Controller ()
 
virtual bool init (hardware_interface::VelocityJointInterface *, ros::NodeHandle &)
 
virtual ~Controller ()
 
- Public Member Functions inherited from controller_interface::ControllerBase
 ControllerBase ()
 
bool isRunning ()
 
bool isRunning ()
 
bool startRequest (const ros::Time &time)
 
bool startRequest (const ros::Time &time)
 
bool stopRequest (const ros::Time &time)
 
bool stopRequest (const ros::Time &time)
 
void updateRequest (const ros::Time &time, const ros::Duration &period)
 
void updateRequest (const ros::Time &time, const ros::Duration &period)
 
virtual ~ControllerBase ()
 

Private Member Functions

void brake ()
 Brakes the wheels, i.e. sets the velocity to 0. More...
 
void cmdVelCallback (const geometry_msgs::Twist &command)
 Velocity command callback. More...
 
bool getWheelRadius (const urdf::ModelInterfaceSharedPtr model, const urdf::LinkConstSharedPtr &wheel_link, double &wheel_radius)
 Get the radius of a given wheel. More...
 
void setupRtPublishersMsg (ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh)
 Sets the odometry publishing fields. More...
 
bool setWheelParamsFromUrdf (ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh, const std::string &wheel0_name, const std::string &wheel1_name, const std::string &wheel2_name, const std::string &wheel3_name)
 Sets odometry parameters from the URDF, i.e. the wheel radius and separation. More...
 

Private Attributes

std::string base_frame_id_
 Frame to use for the robot base: More...
 
double cmd_vel_timeout_
 Timeout to consider cmd_vel commands old: More...
 
realtime_tools::RealtimeBuffer< Commandscommand_
 
Commands command_struct_
 
bool enable_odom_tf_
 Whether to publish odometry to tf or not: More...
 
Commands last_cmd_
 
ros::Time last_state_publish_time_
 
SpeedLimiter limiter_ang_
 
SpeedLimiter limiter_linX_
 
SpeedLimiter limiter_linY_
 
std::string name_
 
geometry_msgs::TransformStamped odom_frame_
 
std::string odom_frame_id_
 
boost::shared_ptr< realtime_tools::RealtimePublisher< nav_msgs::Odometry > > odom_pub_
 Odometry related: More...
 
Odometry odometry_
 
bool open_loop_
 
ros::Duration publish_period_
 Odometry related: More...
 
ros::Subscriber sub_command_
 
boost::shared_ptr< realtime_tools::RealtimePublisher< tf::tfMessage > > tf_odom_pub_
 
bool use_realigned_roller_joints_
 Wheel radius (assuming it's the same for the left and right wheels): More...
 
hardware_interface::JointHandle wheel0_jointHandle_
 Hardware handles: More...
 
hardware_interface::JointHandle wheel1_jointHandle_
 
hardware_interface::JointHandle wheel2_jointHandle_
 
hardware_interface::JointHandle wheel3_jointHandle_
 
size_t wheel_joints_size_
 Number of wheel joints: More...
 
double wheel_separation_x_
 
double wheel_separation_y_
 
double wheels_k_
 
double wheels_radius_
 

Additional Inherited Members

- Public Types inherited from controller_interface::ControllerBase
typedef std::vector< hardware_interface::InterfaceResourcesClaimedResources
 
- Public Attributes inherited from controller_interface::ControllerBase
 CONSTRUCTED
 
 INITIALIZED
 
 RUNNING
 
enum controller_interface::ControllerBase:: { ... }  state_
 
- Protected Member Functions inherited from controller_interface::Controller< hardware_interface::VelocityJointInterface >
std::string getHardwareInterfaceType () const
 
virtual bool initRequest (hardware_interface::RobotHW *robot_hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh, ClaimedResources &claimed_resources)
 

Detailed Description

This class makes some assumptions on the model of the robot:

Definition at line 64 of file mecanum_drive_controller.h.

Constructor & Destructor Documentation

mecanum_drive_controller::MecanumDriveController::MecanumDriveController ( )

Definition at line 81 of file mecanum_drive_controller.cpp.

Member Function Documentation

void mecanum_drive_controller::MecanumDriveController::brake ( )
private

Brakes the wheels, i.e. sets the velocity to 0.

Definition at line 296 of file mecanum_drive_controller.cpp.

void mecanum_drive_controller::MecanumDriveController::cmdVelCallback ( const geometry_msgs::Twist &  command)
private

Velocity command callback.

Parameters
commandVelocity command message (twist)

Definition at line 305 of file mecanum_drive_controller.cpp.

bool mecanum_drive_controller::MecanumDriveController::getWheelRadius ( const urdf::ModelInterfaceSharedPtr  model,
const urdf::LinkConstSharedPtr &  wheel_link,
double &  wheel_radius 
)
private

Get the radius of a given wheel.

Parameters
modelurdf model used
wheel_linklink of the wheel from which to get the radius
[out]wheels_radiusradius of the wheel read from the urdf

Definition at line 468 of file mecanum_drive_controller.cpp.

bool mecanum_drive_controller::MecanumDriveController::init ( hardware_interface::VelocityJointInterface hw,
ros::NodeHandle root_nh,
ros::NodeHandle controller_nh 
)
virtual

Initialize controller.

Parameters
hwVelocity joint interface for the wheels
root_nhNode handle at root namespace
controller_nhNode handle inside the controller namespace

Reimplemented from controller_interface::Controller< hardware_interface::VelocityJointInterface >.

Definition at line 97 of file mecanum_drive_controller.cpp.

void mecanum_drive_controller::MecanumDriveController::setupRtPublishersMsg ( ros::NodeHandle root_nh,
ros::NodeHandle controller_nh 
)
private

Sets the odometry publishing fields.

Parameters
root_nhRoot node handle
controller_nhNode handle inside the controller namespace

Definition at line 508 of file mecanum_drive_controller.cpp.

bool mecanum_drive_controller::MecanumDriveController::setWheelParamsFromUrdf ( ros::NodeHandle root_nh,
ros::NodeHandle controller_nh,
const std::string &  wheel0_name,
const std::string &  wheel1_name,
const std::string &  wheel2_name,
const std::string &  wheel3_name 
)
private

Sets odometry parameters from the URDF, i.e. the wheel radius and separation.

Parameters
root_nhRoot node handle
wheel0_nameName of wheel0 joint
wheel1_nameName of wheel1 joint
wheel2_nameName of wheel2 joint
wheel3_nameName of wheel3 joint

Definition at line 328 of file mecanum_drive_controller.cpp.

void mecanum_drive_controller::MecanumDriveController::starting ( const ros::Time time)
virtual

Starts controller.

Parameters
timeCurrent time

Reimplemented from controller_interface::ControllerBase.

Definition at line 279 of file mecanum_drive_controller.cpp.

void mecanum_drive_controller::MecanumDriveController::stopping ( const ros::Time time)
virtual

Stops controller.

Parameters
timeCurrent time

Reimplemented from controller_interface::ControllerBase.

Definition at line 290 of file mecanum_drive_controller.cpp.

void mecanum_drive_controller::MecanumDriveController::update ( const ros::Time time,
const ros::Duration period 
)
virtual

Updates controller, i.e. computes the odometry and sets the new velocity commands.

Parameters
timeCurrent time
periodTime since the last called to update

Implements controller_interface::ControllerBase.

Definition at line 190 of file mecanum_drive_controller.cpp.

Member Data Documentation

std::string mecanum_drive_controller::MecanumDriveController::base_frame_id_
private

Frame to use for the robot base:

Definition at line 144 of file mecanum_drive_controller.h.

double mecanum_drive_controller::MecanumDriveController::cmd_vel_timeout_
private

Timeout to consider cmd_vel commands old:

Definition at line 141 of file mecanum_drive_controller.h.

realtime_tools::RealtimeBuffer<Commands> mecanum_drive_controller::MecanumDriveController::command_
private

Definition at line 123 of file mecanum_drive_controller.h.

Commands mecanum_drive_controller::MecanumDriveController::command_struct_
private

Definition at line 124 of file mecanum_drive_controller.h.

bool mecanum_drive_controller::MecanumDriveController::enable_odom_tf_
private

Whether to publish odometry to tf or not:

Definition at line 148 of file mecanum_drive_controller.h.

Commands mecanum_drive_controller::MecanumDriveController::last_cmd_
private

Definition at line 154 of file mecanum_drive_controller.h.

ros::Time mecanum_drive_controller::MecanumDriveController::last_state_publish_time_
private

Definition at line 104 of file mecanum_drive_controller.h.

SpeedLimiter mecanum_drive_controller::MecanumDriveController::limiter_ang_
private

Definition at line 157 of file mecanum_drive_controller.h.

SpeedLimiter mecanum_drive_controller::MecanumDriveController::limiter_linX_
private

Definition at line 155 of file mecanum_drive_controller.h.

SpeedLimiter mecanum_drive_controller::MecanumDriveController::limiter_linY_
private

Definition at line 156 of file mecanum_drive_controller.h.

std::string mecanum_drive_controller::MecanumDriveController::name_
private

Definition at line 100 of file mecanum_drive_controller.h.

geometry_msgs::TransformStamped mecanum_drive_controller::MecanumDriveController::odom_frame_
private

Definition at line 131 of file mecanum_drive_controller.h.

std::string mecanum_drive_controller::MecanumDriveController::odom_frame_id_
private

Definition at line 145 of file mecanum_drive_controller.h.

boost::shared_ptr<realtime_tools::RealtimePublisher<nav_msgs::Odometry> > mecanum_drive_controller::MecanumDriveController::odom_pub_
private

Odometry related:

Definition at line 128 of file mecanum_drive_controller.h.

Odometry mecanum_drive_controller::MecanumDriveController::odometry_
private

Definition at line 130 of file mecanum_drive_controller.h.

bool mecanum_drive_controller::MecanumDriveController::open_loop_
private

Definition at line 105 of file mecanum_drive_controller.h.

ros::Duration mecanum_drive_controller::MecanumDriveController::publish_period_
private

Odometry related:

Definition at line 103 of file mecanum_drive_controller.h.

ros::Subscriber mecanum_drive_controller::MecanumDriveController::sub_command_
private

Definition at line 125 of file mecanum_drive_controller.h.

boost::shared_ptr<realtime_tools::RealtimePublisher<tf::tfMessage> > mecanum_drive_controller::MecanumDriveController::tf_odom_pub_
private

Definition at line 129 of file mecanum_drive_controller.h.

bool mecanum_drive_controller::MecanumDriveController::use_realigned_roller_joints_
private

Wheel radius (assuming it's the same for the left and right wheels):

Definition at line 134 of file mecanum_drive_controller.h.

hardware_interface::JointHandle mecanum_drive_controller::MecanumDriveController::wheel0_jointHandle_
private

Hardware handles:

Definition at line 108 of file mecanum_drive_controller.h.

hardware_interface::JointHandle mecanum_drive_controller::MecanumDriveController::wheel1_jointHandle_
private

Definition at line 109 of file mecanum_drive_controller.h.

hardware_interface::JointHandle mecanum_drive_controller::MecanumDriveController::wheel2_jointHandle_
private

Definition at line 110 of file mecanum_drive_controller.h.

hardware_interface::JointHandle mecanum_drive_controller::MecanumDriveController::wheel3_jointHandle_
private

Definition at line 111 of file mecanum_drive_controller.h.

size_t mecanum_drive_controller::MecanumDriveController::wheel_joints_size_
private

Number of wheel joints:

Definition at line 151 of file mecanum_drive_controller.h.

double mecanum_drive_controller::MecanumDriveController::wheel_separation_x_
private

Definition at line 137 of file mecanum_drive_controller.h.

double mecanum_drive_controller::MecanumDriveController::wheel_separation_y_
private

Definition at line 138 of file mecanum_drive_controller.h.

double mecanum_drive_controller::MecanumDriveController::wheels_k_
private

Definition at line 135 of file mecanum_drive_controller.h.

double mecanum_drive_controller::MecanumDriveController::wheels_radius_
private

Definition at line 136 of file mecanum_drive_controller.h.


The documentation for this class was generated from the following files:


ridgeback_control
Author(s): Mike Purvis
autogenerated on Thu Mar 5 2020 03:31:54