36 #include <sensor_msgs/Joy.h> 37 #include <geometry_msgs/Twist.h> 38 #include <robotnik_msgs/ptz.h> 42 #include <robotnik_msgs/set_mode.h> 43 #include <rb1_base_pad/enable_disable_pad.h> 44 #include <robotnik_msgs/set_digital_output.h> 45 #include <robotnik_msgs/ptz.h> 46 #include <robotnik_msgs/home.h> 49 #include <robotnik_msgs/SetElevator.h> 50 #include <robotnik_msgs/ElevatorAction.h> 52 #define DEFAULT_NUM_OF_BUTTONS 16 53 #define DEFAULT_AXIS_LINEAR_X 1 54 #define DEFAULT_AXIS_LINEAR_Y 0 55 #define DEFAULT_AXIS_ANGULAR 2 56 #define DEFAULT_AXIS_LINEAR_Z 3 57 #define DEFAULT_SCALE_LINEAR 1.0 58 #define DEFAULT_SCALE_ANGULAR 2.0 59 #define DEFAULT_SCALE_LINEAR_Z 1.0 61 #define ITERATIONS_AFTER_DEADMAN 3.0 63 #define JOY_ERROR_TIME 1.0 80 void padCallback(
const sensor_msgs::Joy::ConstPtr& joy);
81 bool EnableDisablePad(rb1_base_pad::enable_disable_pad::Request &req, rb1_base_pad::enable_disable_pad::Response &res );
157 RB1BasePad::RB1BasePad():
206 ROS_INFO(
"bREG %d", i);
270 geometry_msgs::Twist vel;
271 robotnik_msgs::ptz ptz;
272 bool ptzEvent =
false;
273 static int send_iterations_after_dead_man = 0;
279 vel.angular.x = 0.0; vel.angular.y = 0.0; vel.angular.z = 0.0;
280 vel.linear.x = 0.0; vel.linear.y = 0.0; vel.linear.z = 0.0;
294 sprintf(buf,
" %d percent", percent);
309 sprintf(buf,
" %d percent", percent);
327 robotnik_msgs::SetElevator elevator_msg_srv;
329 elevator_msg_srv.request.action.action = robotnik_msgs::ElevatorAction::RAISE;
336 robotnik_msgs::SetElevator elevator_msg_srv;
338 elevator_msg_srv.request.action.action = robotnik_msgs::ElevatorAction::LOWER;
343 vel.angular.x = 0.0; vel.angular.y = 0.0; vel.angular.z = 0.0;
344 vel.linear.x = 0.0; vel.linear.y = 0.0; vel.linear.z = 0.0;
356 if (send_iterations_after_dead_man >0) {
357 send_iterations_after_dead_man--;
365 int main(
int argc,
char** argv)
368 RB1BasePad rb1_base_pad;
374 rb1_base_pad.Update();
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
int main(int argc, char **argv)
int kinematic_mode_
kinematic mode
int pan_increment_
Flag to enable/disable the communication with the publishers topics.
int ptz_tilt_up_
buttons to the pan-tilt-zoom camera
void publish(const boost::shared_ptr< M > &message) const
ros::Subscriber pad_sub_
It will be suscribed to the joystick.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
diagnostic_updater::HeaderlessTopicDiagnostic * pub_command_freq
Diagnostic to control the frequency of the published command velocity topic.
void setHardwareID(const std::string &hwid)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
diagnostic_updater::Updater updater_pad
General status diagnostic updater.
bool call(MReq &req, MRes &res)
#define DEFAULT_SCALE_LINEAR
diagnostic_updater::HeaderlessTopicDiagnostic * sus_joy_freq
Diagnostic to control the reception frequency of the subscribed joy topic.
ros::ServiceClient set_elevator_client_
Service to activate the elevator.
int button_stop_elevator_
int speed_up_button_
Number of the button for increase or decrease the speed max of the joystick.
int num_of_buttons_
Number of buttons of the joystick.
ros::ServiceClient set_digital_outputs_client_
Enables/disables the pad.
std::string cmd_topic_ptz_
Name of the topic where it will be publishing the pant-tilt values.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
#define DEFAULT_NUM_OF_BUTTONS
ros::Publisher vel_pub_
It will publish into command velocity (for the robot) and the ptz_state (for the pantilt) ...
std::string cmd_topic_vel_
Name of the topic where it will be publishing the velocity.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::string elevator_service_name_
Name of the service where to actuate the elevator.
int button_home_
button to start the homing service
bool bRegisteredButtonEvent[DEFAULT_NUM_OF_BUTTONS]
Pointer to a vector for controlling the event when pushing the buttons.
bool check_message_timeout_
If it is True, it will check the timeout message.
std::string cmd_service_io_
Name of the service where it will be modifying the digital outputs.
std::string cmd_home_
Name of the service to do the homing.
int button_raise_elevator_
void padCallback(const sensor_msgs::Joy::ConstPtr &joy)
ros::ServiceClient doHome
Service to start homing.
#define DEFAULT_AXIS_LINEAR_X
#define ITERATIONS_AFTER_DEADMAN
std::string cmd_set_mode_
Name of the service to change the mode.
bool EnableDisablePad(rb1_base_pad::enable_disable_pad::Request &req, rb1_base_pad::enable_disable_pad::Response &res)
#define DEFAULT_SCALE_ANGULAR
#define DEFAULT_AXIS_LINEAR_Z
double min_freq_command
Diagnostics min freq.
#define DEFAULT_AXIS_LINEAR_Y
int button_kinematic_mode_
button to change kinematic mode
ROSCPP_DECL void spinOnce()
#define DEFAULT_SCALE_LINEAR_Z
#define DEFAULT_AXIS_ANGULAR
double max_freq_command
Diagnostics max freq.
ros::ServiceClient setKinematicMode
Service to modify the kinematic mode.
int button_lower_elevator_
int dead_man_button_
Number of the DEADMAN button.