Tetrapod Project
JoystickController Class Reference

#include <joystick_controller.h>

Public Member Functions

 JoystickController ()
 
virtual ~JoystickController ()
 
void initROS ()
 
void initThreads ()
 
void listenerThread ()
 
bool isControllerPaused ()
 
void publishTwistCommand ()
 

Private Types

enum  ButtonStatus { PRESSED = 0 , RELEASED = 1 }
 
enum  KeyboardMapping {
  KEY_UP = 273 , KEY_DOWN = 274 , KEY_LEFT = 276 , KEY_RIGHT = 275 ,
  KEY_COUNTER_CLOCKWISE_ROTATION = 97 , KEY_CLOCKWISE_ROTATION = 100 , KEY_LINEAR_SPEED_INCREASE = 109 , KEY_LINEAR_SPEED_DECREASE = 110 ,
  KEY_ANGULAR_RATE_INCREASE = 120 , KEY_ANGULAR_RATE_DECREASE = 122 , KEY_PAUSE = 32
}
 

Private Member Functions

void joystickCallback (const sensor_msgs::JoyConstPtr &_msg)
 
void keyboardButtonReleasedCallback (const keyboard::KeyConstPtr &_msg)
 
void keyboardButtonPressedCallback (const keyboard::KeyConstPtr &_msg)
 
void changeLinearMultiplier (bool _increase)
 
void changeRotationalMultiplier (bool _increase)
 
bool readyToChangeLinearMultiplier ()
 
bool readyToChangeRotationalMultiplier ()
 

Private Attributes

ros::Subscriber keyboard_button_pressed_subscriber
 
ros::Subscriber keyboard_button_released_subscriber
 
ButtonStatus FORWARD = RELEASED
 
ButtonStatus BACKWARD = RELEASED
 
ButtonStatus LEFT = RELEASED
 
ButtonStatus RIGHT = RELEASED
 
ButtonStatus CLOCKWISE_ROTATION = RELEASED
 
ButtonStatus COUNTER_CLOCKWISE_ROTATION = RELEASED
 
ButtonStatus LINEAR_SPEED_INCREASE = RELEASED
 
ButtonStatus LINEAR_SPEED_DECREASE = RELEASED
 
ButtonStatus ANGULAR_RATE_INCREASE = RELEASED
 
ButtonStatus ANGULAR_RATE_DECREASE = RELEASED
 
ButtonStatus PAUSE = RELEASED
 
std::unique_ptr< ros::NodeHandle > nodeHandle
 
ros::Subscriber joystick_subscriber
 
ros::Publisher twist_command_publisher
 
double linear_rate_multiplier = 0.2
 
double linear_rate_multiplier_step = 0.1
 
double linear_rate_multiplier_min = 0.2
 
double linear_rate_multiplier_max = 0.6
 
double rotational_rate_multiplier = 0.2
 
double rotational_rate_multiplier_step = 0.2
 
double rotational_rate_multiplier_max = 2.6
 
double rotational_rate_multiplier_min = 0.2
 
geometry_msgs::Twist twist_command_message
 
double pause = false
 
double minimum_seconds_between_limit_change = 0.1
 
double time_of_last_linear_limit_change = 0.0
 
double time_of_last_rotational_limit_change = 0.0
 

Detailed Description

Definition at line 46 of file joystick_controller.h.

Member Enumeration Documentation

◆ ButtonStatus

Enumerator
PRESSED 
RELEASED 

Definition at line 48 of file joystick_controller.h.

◆ KeyboardMapping

Enumerator
KEY_UP 
KEY_DOWN 
KEY_LEFT 
KEY_RIGHT 
KEY_COUNTER_CLOCKWISE_ROTATION 
KEY_CLOCKWISE_ROTATION 
KEY_LINEAR_SPEED_INCREASE 
KEY_LINEAR_SPEED_DECREASE 
KEY_ANGULAR_RATE_INCREASE 
KEY_ANGULAR_RATE_DECREASE 
KEY_PAUSE 

Definition at line 50 of file joystick_controller.h.

Constructor & Destructor Documentation

◆ JoystickController()

JoystickController::JoystickController ( )

Definition at line 3 of file joystick_controller.cpp.

◆ ~JoystickController()

JoystickController::~JoystickController ( )
virtual

Definition at line 14 of file joystick_controller.cpp.

Member Function Documentation

◆ initROS()

void JoystickController::initROS ( )

Definition at line 23 of file joystick_controller.cpp.

◆ initThreads()

void JoystickController::initThreads ( )

◆ listenerThread()

void JoystickController::listenerThread ( )

◆ joystickCallback()

void JoystickController::joystickCallback ( const sensor_msgs::JoyConstPtr &  _msg)
private

Definition at line 92 of file joystick_controller.cpp.

◆ keyboardButtonReleasedCallback()

void JoystickController::keyboardButtonReleasedCallback ( const keyboard::KeyConstPtr &  _msg)
private

Definition at line 282 of file joystick_controller.cpp.

◆ keyboardButtonPressedCallback()

void JoystickController::keyboardButtonPressedCallback ( const keyboard::KeyConstPtr &  _msg)
private

Definition at line 172 of file joystick_controller.cpp.

◆ changeLinearMultiplier()

void JoystickController::changeLinearMultiplier ( bool  _increase)
private

Definition at line 315 of file joystick_controller.cpp.

◆ changeRotationalMultiplier()

void JoystickController::changeRotationalMultiplier ( bool  _increase)
private

Definition at line 327 of file joystick_controller.cpp.

◆ isControllerPaused()

bool JoystickController::isControllerPaused ( )
inline

Definition at line 137 of file joystick_controller.h.

◆ publishTwistCommand()

void JoystickController::publishTwistCommand ( )

Definition at line 339 of file joystick_controller.cpp.

◆ readyToChangeLinearMultiplier()

bool JoystickController::readyToChangeLinearMultiplier ( )
private

Definition at line 68 of file joystick_controller.cpp.

◆ readyToChangeRotationalMultiplier()

bool JoystickController::readyToChangeRotationalMultiplier ( )
private

Definition at line 80 of file joystick_controller.cpp.

Member Data Documentation

◆ keyboard_button_pressed_subscriber

ros::Subscriber JoystickController::keyboard_button_pressed_subscriber
private

Definition at line 81 of file joystick_controller.h.

◆ keyboard_button_released_subscriber

ros::Subscriber JoystickController::keyboard_button_released_subscriber
private

Definition at line 83 of file joystick_controller.h.

◆ FORWARD

ButtonStatus JoystickController::FORWARD = RELEASED
private

Definition at line 85 of file joystick_controller.h.

◆ BACKWARD

ButtonStatus JoystickController::BACKWARD = RELEASED
private

Definition at line 87 of file joystick_controller.h.

◆ LEFT

ButtonStatus JoystickController::LEFT = RELEASED
private

Definition at line 89 of file joystick_controller.h.

◆ RIGHT

ButtonStatus JoystickController::RIGHT = RELEASED
private

Definition at line 91 of file joystick_controller.h.

◆ CLOCKWISE_ROTATION

ButtonStatus JoystickController::CLOCKWISE_ROTATION = RELEASED
private

Definition at line 93 of file joystick_controller.h.

◆ COUNTER_CLOCKWISE_ROTATION

ButtonStatus JoystickController::COUNTER_CLOCKWISE_ROTATION = RELEASED
private

Definition at line 95 of file joystick_controller.h.

◆ LINEAR_SPEED_INCREASE

ButtonStatus JoystickController::LINEAR_SPEED_INCREASE = RELEASED
private

Definition at line 97 of file joystick_controller.h.

◆ LINEAR_SPEED_DECREASE

ButtonStatus JoystickController::LINEAR_SPEED_DECREASE = RELEASED
private

Definition at line 99 of file joystick_controller.h.

◆ ANGULAR_RATE_INCREASE

ButtonStatus JoystickController::ANGULAR_RATE_INCREASE = RELEASED
private

Definition at line 101 of file joystick_controller.h.

◆ ANGULAR_RATE_DECREASE

ButtonStatus JoystickController::ANGULAR_RATE_DECREASE = RELEASED
private

Definition at line 103 of file joystick_controller.h.

◆ PAUSE

ButtonStatus JoystickController::PAUSE = RELEASED
private

Definition at line 105 of file joystick_controller.h.

◆ nodeHandle

std::unique_ptr<ros::NodeHandle> JoystickController::nodeHandle
private

Definition at line 111 of file joystick_controller.h.

◆ joystick_subscriber

ros::Subscriber JoystickController::joystick_subscriber
private

Definition at line 113 of file joystick_controller.h.

◆ twist_command_publisher

ros::Publisher JoystickController::twist_command_publisher
private

Definition at line 115 of file joystick_controller.h.

◆ linear_rate_multiplier

double JoystickController::linear_rate_multiplier = 0.2
private

Definition at line 117 of file joystick_controller.h.

◆ linear_rate_multiplier_step

double JoystickController::linear_rate_multiplier_step = 0.1
private

Definition at line 119 of file joystick_controller.h.

◆ linear_rate_multiplier_min

double JoystickController::linear_rate_multiplier_min = 0.2
private

Definition at line 121 of file joystick_controller.h.

◆ linear_rate_multiplier_max

double JoystickController::linear_rate_multiplier_max = 0.6
private

Definition at line 123 of file joystick_controller.h.

◆ rotational_rate_multiplier

double JoystickController::rotational_rate_multiplier = 0.2
private

Definition at line 125 of file joystick_controller.h.

◆ rotational_rate_multiplier_step

double JoystickController::rotational_rate_multiplier_step = 0.2
private

Definition at line 127 of file joystick_controller.h.

◆ rotational_rate_multiplier_max

double JoystickController::rotational_rate_multiplier_max = 2.6
private

Definition at line 129 of file joystick_controller.h.

◆ rotational_rate_multiplier_min

double JoystickController::rotational_rate_multiplier_min = 0.2
private

Definition at line 131 of file joystick_controller.h.

◆ twist_command_message

geometry_msgs::Twist JoystickController::twist_command_message
private

Definition at line 133 of file joystick_controller.h.

◆ pause

double JoystickController::pause = false
private

Definition at line 135 of file joystick_controller.h.

◆ minimum_seconds_between_limit_change

double JoystickController::minimum_seconds_between_limit_change = 0.1
private

Definition at line 145 of file joystick_controller.h.

◆ time_of_last_linear_limit_change

double JoystickController::time_of_last_linear_limit_change = 0.0
private

Definition at line 147 of file joystick_controller.h.

◆ time_of_last_rotational_limit_change

double JoystickController::time_of_last_rotational_limit_change = 0.0
private

Definition at line 149 of file joystick_controller.h.


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