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 <robotnik_msgs/set_digital_output.h> 44 #include <std_srvs/SetBool.h> 45 #include <robotnik_msgs/ptz.h> 46 #include <robotnik_msgs/home.h> 50 #define DEFAULT_NUM_OF_BUTTONS 16 51 #define DEFAULT_AXIS_LINEAR_X 1 52 #define DEFAULT_AXIS_LINEAR_Y 0 53 #define DEFAULT_AXIS_ANGULAR 2 54 #define DEFAULT_AXIS_LINEAR_Z 3 55 #define DEFAULT_SCALE_LINEAR 1.0 56 #define DEFAULT_SCALE_ANGULAR 2.0 57 #define DEFAULT_SCALE_LINEAR_Z 1.0 59 #define ITERATIONS_WRITE_MODBUS 2 62 #define AXIS_PTZ_TILT_UP 0 63 #define AXIS_PTZ_TILT_DOWN 1 64 #define AXIS_PTZ_PAN_LEFT 2 65 #define AXIS_PTZ_PAN_RIGHT 3 82 void padCallback(
const sensor_msgs::Joy::ConstPtr& joy);
226 for(
int i = 0; i < 3; i++){
282 if(pad_type_==
"ps4" || pad_type_==
"logitechf710")
301 geometry_msgs::Twist vel;
302 robotnik_msgs::ptz ptz;
303 bool ptzEvent =
false;
353 sprintf(buf,
" %d percent", percent);
368 sprintf(buf,
" %d percent", percent);
381 else vel.linear.y = 0.0;
432 robotnik_msgs::set_digital_output write_do_srv;
435 write_do_srv.request.value =
bOutput1;
449 robotnik_msgs::set_digital_output write_do_srv;
452 write_do_srv.request.value =
bOutput2;
468 robotnik_msgs::home home_srv;
469 home_srv.request.request =
true;
471 ROS_INFO(
"SummitXLPad::padCallback - Home");
490 ptz.pan = ptz.tilt = ptz.zoom = 0.0;
616 robotnik_msgs::set_mode set_mode_srv;
646 vel.angular.x = 0.0; vel.angular.y = 0.0; vel.angular.z = 0.0;
647 vel.linear.x = 0.0; vel.linear.y = 0.0; vel.linear.z = 0.0;
665 vel.angular.x = 0.0; vel.angular.y = 0.0; vel.angular.z = 0.0;
666 vel.linear.x = 0.0; vel.linear.y = 0.0; vel.linear.z = 0.0;
674 std_srvs::SetBool set_bool_msg;
676 set_bool_msg.request.data = value;
683 std_srvs::SetBool set_bool_msg;
685 set_bool_msg.request.data = value;
691 int main(
int argc,
char** argv)
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
diagnostic_updater::HeaderlessTopicDiagnostic * sus_joy_freq
Diagnostic to control the reception frequency of the subscribed joy topic.
ros::ServiceClient doHome
Service to start homing.
#define AXIS_PTZ_PAN_RIGHT
int setManualRelease(bool value)
#define DEFAULT_SCALE_ANGULAR
bool bEnable
Flag to enable/disable the communication with the publishers topics.
std::string cmd_topic_vel_
Name of the topic where it will be publishing the velocity.
int manual_release_false_number_
int speed_up_button_
Number of the button for increase or decrease the speed max of the joystick.
#define DEFAULT_AXIS_ANGULAR
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
int button_kinematic_mode_
button to change kinematic mode
int ptz_tilt_up_
buttons to the pan-tilt-zoom camera
int bumper_override_false_number_
std::string cmd_topic_ptz_
Name of the topic where it will be publishing the pant-tilt values.
void setHardwareID(const std::string &hwid)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
#define DEFAULT_AXIS_LINEAR_Z
#define DEFAULT_NUM_OF_BUTTONS
double pan_increment_
Client of the sound play service.
int kinematic_mode_
kinematic mode
int button_home_
button to start the homing service
int bumper_override_button_
bool last_command_
Flag to track the first reading without the deadman's button pressed.
ros::Publisher vel_pub_
It will publish into command velocity (for the robot) and the ptz_state (for the pantilt) ...
std::string cmd_home_
Name of the service to do the homing.
int num_of_buttons_
Number of buttons of the joystick.
int zoom_increment_
Zoom increment (steps)
int bumper_override_true_number_
diagnostic_updater::HeaderlessTopicDiagnostic * pub_command_freq
Diagnostic to control the frequency of the published command velocity topic.
#define DEFAULT_AXIS_LINEAR_X
#define AXIS_PTZ_PAN_LEFT
#define ITERATIONS_WRITE_MODBUS
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
double min_freq_command
Diagnostics min freq.
bool bRegisteredButtonEvent[DEFAULT_NUM_OF_BUTTONS]
Pointer to a vector for controlling the event when pushing the buttons.
bool ptz_control_by_axes_
Flag to enable the ptz control via axes.
double max_freq_command
Diagnostics max freq.
void padCallback(const sensor_msgs::Joy::ConstPtr &joy)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
ros::ServiceClient set_bumper_override_client_
int manual_release_true_number_
int dead_man_button_
Number of the DEADMAN button.
int setBumperOverride(bool value)
bool bRegisteredDirectionalArrows[4]
Pointer to a vector for controlling the event when pushing directional arrows (UNDER AXES ON PX4!) ...
#define AXIS_PTZ_TILT_DOWN
diagnostic_updater::Updater updater_pad
General status diagnostic updater.
ros::Subscriber pad_sub_
It will be suscribed to the joystick.
std::string cmd_set_mode_
Name of the service to change the mode.
#define DEFAULT_AXIS_LINEAR_Y
#define DEFAULT_SCALE_LINEAR_Z
std::string joystick_dead_zone_
Add a dead zone to the joystick that controls scissor and robot rotation (only useful for xWam) ...
std::string cmd_service_io_
Name of the service where it will be modifying the digital outputs.
ROSCPP_DECL void spinOnce()
ros::ServiceClient set_manual_release_client_
Service to safety module.
std::string pad_type_
Pad type.
#define DEFAULT_SCALE_LINEAR
ros::ServiceClient set_digital_outputs_client_
Service to modify the digital outputs.
ros::ServiceClient setKinematicMode
Service to modify the kinematic mode.