ts_request_adc_dump_node.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
2 
3 #include "toposens_echo_driver/RequestAdcDump.h"
4 
5 auto main(int argc, char** argv) -> int
6 {
7  ros::init(argc, argv, "toposens_request_adc_dump_node");
8  if (argc != 3)
9  {
10  ROS_ERROR("usage: toposens_request_adc_dump_node <SENSOR_ID> <DUMP_FILE_PATH>");
11  return 1;
12  }
13 
14  const auto* const srv_name = "request_adc_dump";
15 
16  ros::NodeHandle nh;
17  ros::ServiceClient client = nh.serviceClient<toposens_echo_driver::RequestAdcDump>(srv_name);
18 
19  toposens_echo_driver::RequestAdcDump srv;
20  srv.request.sensor_id = atoll(argv[1]);
21  srv.request.file_path = argv[2];
22 
23  if (client.call(srv))
24  {
25  ROS_INFO("Response: [success=%d]", srv.response.success);
26  }
27  else
28  {
29  ROS_ERROR("Failed to call service %s. [success=%d]", srv_name, srv.response.success);
30  return 1;
31  }
32 
33  return 0;
34 }
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
ros::NodeHandle::serviceClient
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ros::ServiceClient
ROS_ERROR
#define ROS_ERROR(...)
ros::ServiceClient::call
bool call(const MReq &req, MRes &resp, const std::string &service_md5sum)
main
auto main(int argc, char **argv) -> int
Definition: ts_request_adc_dump_node.cpp:5
ROS_INFO
#define ROS_INFO(...)
ros::NodeHandle


toposens_echo_driver
Author(s): Tobias Roth , Dennis Maier , Baris Yazici
autogenerated on Wed Mar 2 2022 01:12:32