def publish(self, msg: MsgType) -> None: """ Send a message to the topic for the publisher. :param msg: The ROS message to publish. The message must be the same type as the type provided when the publisher was constructed. """ _rclpy.rclpy_publish(self.publisher_handle, msg)
def publish(self, msg: MsgType) -> None: """ Send a message to the topic for the publisher. :param msg: The ROS message to publish. :raises: TypeError if the type of the passed message isn't an instance of the provided type when the publisher was constructed. """ if not isinstance(msg, self.msg_type): raise TypeError() with self.handle as capsule: _rclpy.rclpy_publish(capsule, msg)
def publish(self, msg: Union[MsgType, bytes]) -> None: """ Send a message to the topic for the publisher. :param msg: The ROS message to publish. :raises: TypeError if the type of the passed message isn't an instance of the provided type when the publisher was constructed. """ with self.handle as capsule: if isinstance(msg, self.msg_type): _rclpy.rclpy_publish(capsule, msg) elif isinstance(msg, bytes): _rclpy.rclpy_publish_raw(capsule, msg) else: raise TypeError('Expected {}, got {}'.format(self.msg_type, type(msg)))
def publish(self, msg): _rclpy.rclpy_publish(self.publisher_handle, msg)
def publish(self, msg): _rclpy.rclpy_publish(self.publisher_handle, msg)