static_bridge.cpp
Go to the documentation of this file.
1 // Copyright 2018 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <iostream>
16 #include <memory>
17 #include <string>
18 
19 // include ROS
20 #ifdef __clang__
21 # pragma clang diagnostic push
22 # pragma clang diagnostic ignored "-Wunused-parameter"
23 #endif
24 #include <ros/ros.h>
25 #ifdef __clang__
26 # pragma clang diagnostic pop
27 #endif
28 
29 // include Ignition Transport
30 #include <ignition/transport/Node.hh>
31 
32 #include "bridge.hpp"
33 
35 int main(int argc, char * argv[])
36 {
37  // ROS node
38  ros::init(argc, argv, "ros_ign_bridge");
39  ros::NodeHandle ros_node;
40 
41  // Ignition node
42  auto ign_node = std::make_shared<ignition::transport::Node>();
43 
44  // bridge one example topic
45  std::string topic_name = "chatter";
46  std::string ros_type_name = "std_msgs/String";
47  std::string ign_type_name = "ignition.msgs.StringMsg";
48  size_t queue_size = 10;
49 
51  ros_node, ign_node, ros_type_name, ign_type_name, topic_name, queue_size);
52 
53  // ROS asynchronous spinner
54  ros::AsyncSpinner async_spinner(1);
55  async_spinner.start();
56 
57  // Zzzzzz.
58  ignition::transport::waitForShutdown();
59 
60  return 0;
61 }
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
main
int main(int argc, char *argv[])
Definition: static_bridge.cpp:35
ros::AsyncSpinner::start
void start()
ros.h
ros::AsyncSpinner
ros_ign_bridge::create_bidirectional_bridge
BridgeHandles create_bidirectional_bridge(ros::NodeHandle ros_node, std::shared_ptr< ignition::transport::Node > ign_node, const std::string &ros_type_name, const std::string &ign_type_name, const std::string &topic_name, size_t queue_size=10)
Definition: bridge.hpp:100
bridge.hpp
ros::NodeHandle


ros_ign_bridge
Author(s):
autogenerated on Sat Mar 11 2023 04:02:16