test_photo.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2009, Robert Bosch LLC.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the Robert Bosch nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  *********************************************************************/
36 #include <iostream>
37 #include <cstdio>
38 #include <cstring>
39 #include <cstdlib>
40 
41 #include <ros/ros.h>
42 #include <sensor_msgs/Image.h>
43 //#include <opencv_latest/CvBridge.h>
44 //#include <opencv/highgui.h> //for cvLoadImage()
45 
46 #include <photo/photo.h>
47 #include <photo/GetConfig.h>
48 #include <photo/SetConfig.h>
49 #include <photo/Capture.h>
50 
51 using namespace std;
52 
53 int main(int argc, char **argv)
54 {
55  ros::init(argc, argv, "test_photo");
56 
57 // image_msgs::Image image;
58 // image_msgs::CvBridge img_bridge;
59 //
60 // ros::NodeHandle n;
61 // ros::ServiceClient client = n.serviceClient<photo::Capture>("/photo/capture");
62 // photo::Capture srv;
63 // if(client.call(srv))
64 // {
65 // printf("Calling photo/capture service was successful\n");
66 // image = srv.response.image;
67 // if (img_bridge.fromImage(image, "bgr"))
68 // cvSaveImage("test.jpg", img_bridge.toIpl());
69 // }
70 // else
71 // {
72 // printf("Could not query photo/capture service\n");
73 // }
75  ros::ServiceClient client = n.serviceClient<photo::SetConfig>("/photo/set_config");
76  photo::SetConfig srv;
77  srv.request.param = "exptime";
78  srv.request.value = "20";
79  if( !client.call(srv) )
80  {
81  ROS_FATAL("Could not query set_config service");
82  }
83  return 0;
84 }
85 
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
#define ROS_FATAL(...)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
int main(int argc, char **argv)
Definition: test_photo.cpp:53


photo
Author(s): Benjamin Pitzer
autogenerated on Mon Feb 28 2022 23:12:30