def main(): rclpy.init() node = ArucoNode() rclpy.spin(node) node.destroy_node() rclpy.shutdown()
def main(args=None): rclpy.init(args=args) node = AttitudeController() # rclpy.spin(node) while rclpy.ok(): rclpy.spin_once(node) node.destroy_node() rclpy.shutdown()
def main(): ros_core = ros.IProc_Ros2Core() node = TestDisplayNode() rclpy.spin(node) node.destroy_node() rclpy.shutdown()
def main(args=None): rclpy.init(args=args) node = ReliableOdomNode() try: rclpy.spin(node) except KeyboardInterrupt: node.get_logger().info('ctrl-C detected, shutting down') finally: node.destroy_node() rclpy.shutdown()
def main(args=None): if args is not None and len(args) > 0: prefix = args[0] else: prefix = "cs354_final" rclpy.init(args=args) node = VictimListener(prefix) rclpy.spin(node) node.destroy_node() rclpy.shutdown()
def main(args=None): rclpy.init(args=args) node = TestNode() try: rclpy.spin(node) except KeyboardInterrupt: pass node.destroy_node() rclpy.shutdown()
def main(argv=sys.argv): # Init rclpy and adapter rclpy.init(args=argv) adpt.init_rclcpp() print(f"Starting fleet adapter...") # ROS 2 node for the command handle node = rclpy.node.Node('robot_command_handle') node.declare_parameter("config_file", rclpy.Parameter.Type.STRING) node.declare_parameter("nav_graph_file", rclpy.Parameter.Type.STRING) arg_use_sim_time = node.get_parameter( 'use_sim_time').get_parameter_value().bool_value assert arg_use_sim_time is not None arg_config_path = node.get_parameter( 'config_file').get_parameter_value().string_value assert arg_config_path is not None arg_nav_graph_path = node.get_parameter( 'nav_graph_file').get_parameter_value().string_value assert arg_nav_graph_path is not None # Load config and nav graph yamls with open(arg_config_path, "r") as f: config_yaml = yaml.safe_load(f) adapter, fleet_handle, robots = initialize_fleet(config_yaml, arg_nav_graph_path, node, arg_use_sim_time) # Create executor for the command handle node rclpy_executor = rclpy.executors.SingleThreadedExecutor() rclpy_executor.add_node(node) # Start the fleet adapter rclpy_executor.spin() # Shutdown node.destroy_node() rclpy_executor.shutdown() rclpy.shutdown()
class NameMaker(rclpy.node.Node): def __init__(self): super().__init__('original_node_name', namespace='/original/namespace') self._pubs = [] self._pubs.append(self.create_publisher(EmptyMsg, '~/private/name')) self._pubs.append(self.create_publisher(EmptyMsg, 'relative/name')) self._pubs.append(self.create_publisher(EmptyMsg, '/fully/qualified/name')) self._srvs = [] self._srvs.append(self.create_service(EmptySrv, '~/private/name', lambda x: None)) self._srvs.append(self.create_service(EmptySrv, 'relative/name', lambda x: None)) self._srvs.append(self.create_service(EmptySrv, '/fully/qualified/name', lambda x: None)) if __name__ == '__main__': rclpy.init() node = NameMaker() try: rclpy.spin(node) except KeyboardInterrupt: print('Shutting down name_maker.py') finally: node.destroy_node() rclpy.shutdown()