#include <diff_drive_controller.h>
Classes | |
struct | Commands |
Velocity command related: More... | |
struct | DynamicParams |
Public Member Functions | |
DiffDriveController () | |
bool | init (hardware_interface::VelocityJointInterface *hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh) |
Initialize controller. More... | |
void | starting (const ros::Time &time) |
Starts controller. More... | |
void | stopping (const ros::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... | |
![]() | |
virtual bool | init (T *, ros::NodeHandle &) |
virtual bool | init (T *, ros::NodeHandle &, ros::NodeHandle &) |
![]() | |
virtual void | aborting (const ros::Time &) |
virtual void | aborting (const ros::Time &) |
bool | abortRequest (const ros::Time &time) |
bool | abortRequest (const ros::Time &time) |
ControllerBase ()=default | |
ControllerBase (const ControllerBase &)=delete | |
ControllerBase (ControllerBase &&)=delete | |
bool | isAborted () const |
bool | isAborted () const |
bool | isInitialized () const |
bool | isInitialized () const |
bool | isRunning () const |
bool | isRunning () const |
bool | isStopped () const |
bool | isStopped () const |
bool | isWaiting () const |
bool | isWaiting () const |
ControllerBase & | operator= (const ControllerBase &)=delete |
ControllerBase & | operator= (ControllerBase &&)=delete |
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 void | waiting (const ros::Time &) |
virtual void | waiting (const ros::Time &) |
bool | waitRequest (const ros::Time &time) |
bool | waitRequest (const ros::Time &time) |
virtual | ~ControllerBase ()=default |
Private Types | |
typedef dynamic_reconfigure::Server< DiffDriveControllerConfig > | ReconfigureServer |
Dynamic Reconfigure server. More... | |
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 | getWheelNames (ros::NodeHandle &controller_nh, const std::string &wheel_param, std::vector< std::string > &wheel_names) |
Get the wheel names from a wheel param. More... | |
void | publishWheelData (const ros::Time &time, const ros::Duration &period, Commands &curr_cmd, double wheel_separation, double left_wheel_radius, double right_wheel_radius) |
void | reconfCallback (DiffDriveControllerConfig &config, uint32_t) |
Callback for dynamic_reconfigure server. More... | |
bool | setOdomParamsFromUrdf (ros::NodeHandle &root_nh, const std::string &left_wheel_name, const std::string &right_wheel_name, bool lookup_wheel_separation, bool lookup_wheel_radius) |
Sets odometry parameters from the URDF, i.e. the wheel radius and separation. More... | |
void | setOdomPubFields (ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh) |
Sets the odometry publishing fields. More... | |
void | updateDynamicParams () |
Update the dynamic parameters in the RT loop. More... | |
Additional Inherited Members | |
![]() | |
typedef std::vector< hardware_interface::InterfaceResources > | ClaimedResources |
enum | ControllerState { ControllerState::CONSTRUCTED, ControllerState::INITIALIZED, ControllerState::RUNNING, ControllerState::STOPPED, ControllerState::WAITING, ControllerState::ABORTED } |
![]() | |
ControllerState | state_ |
![]() | |
std::string | getHardwareInterfaceType () const |
bool | initRequest (hardware_interface::RobotHW *robot_hw, ros::NodeHandle &root_nh, ros::NodeHandle &controller_nh, ClaimedResources &claimed_resources) override |
This class makes some assumptions on the model of the robot:
Definition at line 99 of file diff_drive_controller.h.
|
private |
Dynamic Reconfigure server.
Definition at line 299 of file diff_drive_controller.h.
diff_drive_controller::DiffDriveController::DiffDriveController | ( | ) |
Definition at line 147 of file diff_drive_controller.cpp.
|
private |
Brakes the wheels, i.e. sets the velocity to 0.
Definition at line 522 of file diff_drive_controller.cpp.
|
private |
Velocity command callback.
command | Velocity command message (twist) |
Definition at line 532 of file diff_drive_controller.cpp.
|
private |
Get the wheel names from a wheel param.
[in] | controller_nh | Controller node handler |
[in] | wheel_param | Param name |
[out] | wheel_names | Vector with the whel names |
Definition at line 567 of file diff_drive_controller.cpp.
bool diff_drive_controller::DiffDriveController::init | ( | hardware_interface::VelocityJointInterface * | hw, |
ros::NodeHandle & | root_nh, | ||
ros::NodeHandle & | controller_nh | ||
) |
Initialize controller.
hw | Velocity joint interface for the wheels |
root_nh | Node handle at root namespace |
controller_nh | Node handle inside the controller namespace |
Definition at line 166 of file diff_drive_controller.cpp.
|
private |
time | Current time |
period | Time since the last called to update |
curr_cmd | Current velocity command |
wheel_separation | wheel separation with multiplier |
left_wheel_radius | left wheel radius with multiplier |
right_wheel_radius | right wheel radius with multiplier |
Definition at line 765 of file diff_drive_controller.cpp.
|
private |
Callback for dynamic_reconfigure server.
config | The config set from dynamic_reconfigure server |
level | not used at this time. |
Definition at line 736 of file diff_drive_controller.cpp.
|
private |
Sets odometry parameters from the URDF, i.e. the wheel radius and separation.
root_nh | Root node handle |
left_wheel_name | Name of the left wheel joint |
right_wheel_name | Name of the right wheel joint |
Definition at line 620 of file diff_drive_controller.cpp.
|
private |
Sets the odometry publishing fields.
root_nh | Root node handle |
controller_nh | Node handle inside the controller namespace |
Definition at line 689 of file diff_drive_controller.cpp.
|
virtual |
Starts controller.
time | Current time |
Reimplemented from controller_interface::ControllerBase.
Definition at line 506 of file diff_drive_controller.cpp.
|
virtual |
Stops controller.
time | Current time |
Reimplemented from controller_interface::ControllerBase.
Definition at line 517 of file diff_drive_controller.cpp.
|
virtual |
Updates controller, i.e. computes the odometry and sets the new velocity commands.
time | Current time |
period | Time since the last called to update |
Implements controller_interface::ControllerBase.
Definition at line 391 of file diff_drive_controller.cpp.
|
private |
Update the dynamic parameters in the RT loop.
Definition at line 752 of file diff_drive_controller.cpp.
|
private |
Whether to allow multiple publishers on cmd_vel topic or not:
Definition at line 228 of file diff_drive_controller.h.
|
private |
Frame to use for the robot base:
Definition at line 231 of file diff_drive_controller.h.
|
private |
Publish executed commands.
Definition at line 203 of file diff_drive_controller.h.
|
private |
Timeout to consider cmd_vel commands old:
Definition at line 225 of file diff_drive_controller.h.
|
private |
Definition at line 198 of file diff_drive_controller.h.
|
private |
Definition at line 199 of file diff_drive_controller.h.
|
private |
Controller state publisher.
Definition at line 211 of file diff_drive_controller.h.
|
private |
Definition at line 300 of file diff_drive_controller.h.
|
private |
Definition at line 301 of file diff_drive_controller.h.
|
private |
Definition at line 296 of file diff_drive_controller.h.
|
private |
Whether to publish odometry to tf or not:
Definition at line 237 of file diff_drive_controller.h.
|
private |
Definition at line 244 of file diff_drive_controller.h.
|
private |
Speed limiters:
Definition at line 243 of file diff_drive_controller.h.
|
private |
Definition at line 171 of file diff_drive_controller.h.
|
private |
Hardware handles:
Definition at line 175 of file diff_drive_controller.h.
|
private |
Definition at line 221 of file diff_drive_controller.h.
|
private |
Definition at line 246 of file diff_drive_controller.h.
|
private |
Definition at line 245 of file diff_drive_controller.h.
|
private |
Definition at line 167 of file diff_drive_controller.h.
|
private |
Frame to use for odometry and odom tf:
Definition at line 234 of file diff_drive_controller.h.
|
private |
Odometry related:
Definition at line 206 of file diff_drive_controller.h.
|
private |
Definition at line 208 of file diff_drive_controller.h.
|
private |
Definition at line 172 of file diff_drive_controller.h.
|
private |
Publish limited velocity:
Definition at line 249 of file diff_drive_controller.h.
|
private |
Odometry related:
Definition at line 170 of file diff_drive_controller.h.
|
private |
Publish wheel data:
Definition at line 252 of file diff_drive_controller.h.
|
private |
Definition at line 176 of file diff_drive_controller.h.
|
private |
Definition at line 222 of file diff_drive_controller.h.
|
private |
Definition at line 200 of file diff_drive_controller.h.
|
private |
Definition at line 207 of file diff_drive_controller.h.
|
private |
Definition at line 179 of file diff_drive_controller.h.
|
private |
Previous velocities from the encoders:
Definition at line 186 of file diff_drive_controller.h.
|
private |
Previous velocities from the encoders:
Definition at line 182 of file diff_drive_controller.h.
|
private |
Definition at line 187 of file diff_drive_controller.h.
|
private |
Definition at line 183 of file diff_drive_controller.h.
|
private |
Number of wheel joints:
Definition at line 240 of file diff_drive_controller.h.
|
private |
Wheel radius (assuming it's the same for the left and right wheels):
Definition at line 217 of file diff_drive_controller.h.
|
private |
Wheel separation, wrt the midpoint of the wheel width:
Definition at line 214 of file diff_drive_controller.h.
|
private |
Wheel separation and radius calibration multipliers:
Definition at line 220 of file diff_drive_controller.h.