23 #include <rcll_ros_msgs/SendBeaconSignal.h> 25 #include <geometry_msgs/PoseWithCovarianceStamped.h> 32 void cb_pose(
const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg)
41 ROS_INFO(
"Got service, creating service client");
43 n.
serviceClient<rcll_ros_msgs::SendBeaconSignal>(
"rcll/send_beacon",
true);
49 if (! scl_send_beacon_.
isValid()) {
52 if (! scl_send_beacon_.
isValid()) {
57 rcll_ros_msgs::SendBeaconSignal sbs;
60 sbs.request.header.stamp.sec = now.
sec;
61 sbs.request.header.stamp.nsec = now.
nsec;
64 if (scl_send_beacon_.
call(sbs)) {
65 if (! sbs.response.ok) {
66 ROS_WARN_THROTTLE(30,
"Failed to send beacon: %s", sbs.response.error_msg.c_str());
69 ROS_ERROR(
"Failed to call beacon service");
76 main(
int argc,
char **argv)
78 ros::init(argc, argv,
"rcll_beacon_sender");
87 n.
subscribe<geometry_msgs::PoseWithCovarianceStamped>(
"rcll_sim/amcl_pose", 10,
cb_pose);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
#define ROS_WARN_THROTTLE(rate,...)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::ServiceClient scl_send_beacon_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
void cb_pose(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr &msg)
ROSCPP_DECL void spin(Spinner &spinner)
void cb_timer(const ros::WallTimerEvent &event, ros::NodeHandle &n)
WallTimer createWallTimer(WallDuration period, void(T::*callback)(const WallTimerEvent &), T *obj, bool oneshot=false, bool autostart=true) const
void init_service_client(ros::NodeHandle &n)
geometry_msgs::PoseWithCovarianceStamped last_pose_
int main(int argc, char **argv)
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)