25 if(!ros::isInitialized())
33 "joystick_controller_node",
34 ros::init_options::NoSigintHandler
38 nodeHandle.reset(
new ros::NodeHandle(
"joystick_controller_node"));
94 double t = ros::Time::now().toSec();
96 if(_msg->buttons[
START] == 1)
108 if((_msg->buttons[
TRIANGLE] == 1) && (_msg->buttons[
CROSS] == 0))
116 else if((_msg->buttons[
TRIANGLE] == 0) && (_msg->buttons[
CROSS] == 1))
125 if((_msg->buttons[
SQUARE] == 1) && (_msg->buttons[
CIRCLE] == 0))
133 else if((_msg->buttons[
SQUARE] == 0) && (_msg->buttons[
CIRCLE] == 1))
145 if((_msg->buttons[
L1] == 1) && (_msg->buttons[
R1] == 0))
149 else if((_msg->buttons[
R1] == 1) && (_msg->buttons[
L1] == 0))
158 if(_msg->buttons[
DPAD_UP] == 1)
160 std_srvs::Empty readyToProceedSrv;
161 ros::service::call(
"/my_robot/controller/ready_to_proceed", readyToProceedSrv);
164 if(_msg->buttons[
SELECT] == 1)
166 std_srvs::Empty shutdownSrv;
167 ros::service::call(
"/my_robot/controller/shutdown", shutdownSrv);
168 ros::service::call(
"/my_robot/motor_interface/shutdown", shutdownSrv);
ButtonStatus COUNTER_CLOCKWISE_ROTATION
void keyboardButtonReleasedCallback(const keyboard::KeyConstPtr &_msg)
double rotational_rate_multiplier_max
ButtonStatus LINEAR_SPEED_INCREASE
std::unique_ptr< ros::NodeHandle > nodeHandle
void changeRotationalMultiplier(bool _increase)
geometry_msgs::Twist twist_command_message
@ KEY_COUNTER_CLOCKWISE_ROTATION
@ KEY_ANGULAR_RATE_INCREASE
@ KEY_ANGULAR_RATE_DECREASE
@ KEY_LINEAR_SPEED_DECREASE
@ KEY_LINEAR_SPEED_INCREASE
ButtonStatus CLOCKWISE_ROTATION
ButtonStatus ANGULAR_RATE_INCREASE
ros::Subscriber joystick_subscriber
void keyboardButtonPressedCallback(const keyboard::KeyConstPtr &_msg)
double linear_rate_multiplier_min
bool readyToChangeRotationalMultiplier()
ros::Publisher twist_command_publisher
void joystickCallback(const sensor_msgs::JoyConstPtr &_msg)
ButtonStatus ANGULAR_RATE_DECREASE
double linear_rate_multiplier_step
double minimum_seconds_between_limit_change
double rotational_rate_multiplier_min
double rotational_rate_multiplier
bool readyToChangeLinearMultiplier()
void publishTwistCommand()
void changeLinearMultiplier(bool _increase)
double rotational_rate_multiplier_step
double time_of_last_rotational_limit_change
ros::Subscriber keyboard_button_pressed_subscriber
ButtonStatus LINEAR_SPEED_DECREASE
double linear_rate_multiplier_max
double time_of_last_linear_limit_change
virtual ~JoystickController()
ros::Subscriber keyboard_button_released_subscriber
double linear_rate_multiplier
Eigen::Matrix< double, 6, 1 > Twist