File tree 1 file changed +10
-0
lines changed
prosilica_camera/src/nodes
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 49
49
#include < sensor_msgs/SetCameraInfo.h>
50
50
51
51
#include < boost/thread.hpp>
52
+ #include < netdb.h>
53
+ #include < arpa/inet.h>
52
54
53
55
#include < prosilica_camera/ProsilicaCameraConfig.h>
54
56
#include " prosilica/prosilica.h"
@@ -253,6 +255,14 @@ class ProsilicaNodelet : public nodelet::Nodelet
253
255
{
254
256
state_info_ = " Trying to load camera with ipaddress: " + ip_address_;
255
257
NODELET_INFO (" %s" , state_info_.c_str ());
258
+ /* Resolve hostname */
259
+ struct hostent *he;
260
+ if ((he = gethostbyname (ip_address_.c_str ())) != NULL )
261
+ {
262
+ ip_address_ = std::string (inet_ntoa (*(struct in_addr *)(he->h_addr )));
263
+ NODELET_INFO (" ip resolved as %s" , ip_address_.c_str ());
264
+ }
265
+
256
266
camera_ = boost::make_shared<prosilica::Camera>(ip_address_.c_str ());
257
267
guid_ = camera_->guid ();
258
268
hw_id_ = boost::lexical_cast<std::string>(guid_);
You can’t perform that action at this time.
0 commit comments