File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Filename: tcp_ros_bridge_with_server.cpp
3
+ * Path: tcp_ros_bridge_with_server
4
+ * Created Date: Saturday, Faburary 27th 2021, 15:14:39
5
+ * Author: zhao wang
6
+ *
7
+ * Copyright (c) 2021 hust-arms
8
+ */
9
+
10
+ #include < cstdio>
11
+ #include < iostream>
12
+ #include " tcp_ros_bridge/tcp_ros_bridge_with_server.h"
13
+
14
+ boost::asio::io_service io_service;
15
+
16
+ void run_service ()
17
+ {
18
+ std::cout << " [tcp_ros_bridge_with_server_test]: run service" << std::endl;
19
+ io_service.run ();
20
+ }
21
+
22
+ int main (int argc, char ** argv)
23
+ {
24
+ ros::init (argc, argv, " tcp_ros_bridge_with_server_test" );
25
+
26
+ if (argc != 3 )
27
+ {
28
+ std::cerr << " [tcp_ros_bridge_with_server_test]: Usage: tcp_ros_bridge_with_server_test <auv_name> <port>" << std::endl;
29
+ return -1 ;
30
+ }
31
+
32
+ tcp::endpoint listen_endpoint (tcp::v4 (), atoi (argv[2 ]));
33
+
34
+ tcp_ros_bridge::server bridge (argv[1 ], io_service, listen_endpoint);
35
+
36
+ boost::thread* io_service_th = new boost::thread (boost::bind (&run_service));
37
+
38
+ ros::spin ();
39
+
40
+ if (io_service_th)
41
+ delete io_service_th;
42
+
43
+ return 0 ;
44
+ }
45
+
You can’t perform that action at this time.
0 commit comments