diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..b3bfceddd --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +from building_control_py_pkg_interfaces.msg import TempUnit +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import FanCmd + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = TempUnit() + typedValue.data = value + match (typedValue.temp_unit): + case TempUnit.TEMP_UNIT_FAHRENHEIT: + return "TempUnit Fahrenheit" + case TempUnit.TEMP_UNIT_CELSIUS: + return "TempUnit Celsius" + case TempUnit.TEMP_UNIT_KELVIN: + return "TempUnit Kelvin" + case default: + return "Unknown value for TempUnit" + +def enumToString(value): + typedValue = FanAck() + typedValue.data = value + match (typedValue.fan_ack): + case FanAck.FAN_ACK_OK: + return "FanAck Ok" + case FanAck.FAN_ACK_ERROR: + return "FanAck Error" + case default: + return "Unknown value for FanAck" + +def enumToString(value): + typedValue = FanCmd() + typedValue.data = value + match (typedValue.fan_cmd): + case FanCmd.FAN_CMD_ON: + return "FanCmd On" + case FanCmd.FAN_CMD_OFF: + return "FanCmd Off" + case default: + return "Unknown value for FanCmd" + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py new file mode 100644 index 000000000..263e46537 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from building_control_py_pkg.user_code.tcp_fan_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_fan_base(Node): + def __init__(self): + super().__init__("tcp_fan") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_fan_fanCmd_subscription_ = self.create_subscription( + FanCmd, + "tcp_fan_fanCmd", + self.handle_fanCmd, + 1, + callback_group=self.cb_group_) + + self.tcp_fan_fanAck_publisher_ = self.create_publisher( + FanAck, + "tcp_tempControl_fanAck", + 1) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_fanAck(self, msg): + self.tcp_fan_fanAck_publisher_.publish(msg) + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanCmd(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py new file mode 100644 index 000000000..5738d46c9 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_fan_src import tcp_fan +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_fan() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py new file mode 100644 index 000000000..89c31a9c9 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from building_control_py_pkg.user_code.tcp_tempControl_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempControl_base(Node): + def __init__(self): + super().__init__("tcp_tempControl") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_tempControl_currentTemp_subscription_ = self.create_subscription( + Temperatureimpl, + "tcp_tempControl_currentTemp", + self.handle_currentTemp, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanAck_subscription_ = self.create_subscription( + FanAck, + "tcp_tempControl_fanAck", + self.handle_fanAck, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_setPoint_subscription_ = self.create_subscription( + SetPointimpl, + "tcp_tempControl_setPoint", + self.handle_setPoint, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_tempChanged_subscription_ = self.create_subscription( + Empty, + "tcp_tempControl_tempChanged", + self.event_handle_tempChanged, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanCmd_publisher_ = self.create_publisher( + FanCmd, + "tcp_fan_fanCmd", + 1) + + self.currentTemp_msg_holder = None + + def init_currentTemp(self, val): + self.currentTemp_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_currentTemp(self, msg): + self.currentTemp_msg_holder = msg + + def get_currentTemp(self): + return self.currentTemp_msg_holder + + def event_handle_tempChanged(self, msg): + self.handle_tempChanged() + + def put_fanCmd(self, msg): + self.tcp_tempControl_fanCmd_publisher_.publish(msg) + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanAck(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_setPoint(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_tempChanged(self): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py new file mode 100644 index 000000000..304e92f82 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempControl_src import tcp_tempControl +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempControl() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py new file mode 100644 index 000000000..8acfd3afa --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempSensor_base(Node): + def __init__(self): + super().__init__("tcp_tempSensor") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_tempSensor_currentTemp_publisher_ = self.create_publisher( + Temperatureimpl, + "tcp_tempControl_currentTemp", + 1) + + self.tcp_tempSensor_tempChanged_publisher_ = self.create_publisher( + Empty, + "tcp_tempControl_tempChanged", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_currentTemp(self, msg): + self.tcp_tempSensor_currentTemp_publisher_.publish(msg) + + def put_tempChanged(self): + msg = Empty() + self.tcp_tempSensor_tempChanged_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py new file mode 100644 index 000000000..c295dea30 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempSensor_src import tcp_tempSensor +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempSensor() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py new file mode 100644 index 000000000..6a7db8dc2 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_fan(tcp_fan_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_fan infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanCmd(self, msg): + # Handle fanCmd msg + self.get_logger().info(f"Received fanCmd: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py new file mode 100644 index 000000000..ee16abc55 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempControl(tcp_tempControl_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempControl infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + currentTemp = Temperatureimpl() + self.init_currentTemp(currentTemp) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanAck(self, msg): + # Handle fanAck msg + self.get_logger().info(f"Received fanAck: {self.message_to_string(msg)}") + + + # Example receiving messages on data ports + currentTemp = get_currentTemp() + self.get_logger().info(f"Received currentTemp: {self.message_to_string(currentTemp)}") + + def handle_setPoint(self, msg): + # Handle setPoint msg + self.get_logger().info(f"Received setPoint: {self.message_to_string(msg)}") + + def handle_tempChanged(self): + # Handle tempChanged event + self.get_logger().info("Received tempChanged") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py new file mode 100644 index 000000000..d5aa325cc --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempSensor(tcp_tempSensor_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempSensor infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + currentTemp = Temperatureimpl() + self.put_currentTemp(currentTemp) + + self.put_tempChanged() + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/package.xml new file mode 100644 index 000000000..9630cba33 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + building_control_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + building_control_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/resource/building_control_py_pkg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/resource/building_control_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/resource/building_control_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.cfg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.cfg new file mode 100644 index 000000000..30d496dc5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/building_control_py_pkg +[develop] +script_dir=$base/lib/building_control_py_pkg +[install] +install_scripts=$base/lib/building_control_py_pkg diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.py new file mode 100644 index 000000000..3823f03b5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/setup.py @@ -0,0 +1,30 @@ +# setup.py in src/building_control_py_pkg + +from setuptools import find_packages, setup + +package_name = 'building_control_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "tcp_tempSensor_exe = building_control_py_pkg.base_code.tcp_tempSensor_runner:main", + "tcp_tempControl_exe = building_control_py_pkg.base_code.tcp_tempControl_runner:main", + "tcp_fan_exe = building_control_py_pkg.base_code.tcp_fan_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..f8c13e1c6 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py new file mode 100644 index 000000000..7638aec86 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + tcp_tempSensor_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempSensor_exe" + ) + + tcp_tempControl_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempControl_exe" + ) + + tcp_fan_node = Node( + package = "building_control_py_pkg", + executable = "tcp_fan_exe" + ) + + ld.add_action(tcp_tempSensor_node) + ld.add_action(tcp_tempControl_node) + ld.add_action(tcp_fan_node) + + return ld diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/package.xml new file mode 100644 index 000000000..2ec33ca35 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + building_control_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + building_control_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f53a7ca29 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Float32.msg + msg/TempUnit.msg + msg/Temperatureimpl.msg + msg/SetPointimpl.msg + msg/FanAck.msg + msg/FanCmd.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg new file mode 100644 index 000000000..58b717c1c --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg @@ -0,0 +1,3 @@ +uint8 fan_ack +uint8 FAN_ACK_OK=0 +uint8 FAN_ACK_ERROR=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg new file mode 100644 index 000000000..184c27a3e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg @@ -0,0 +1,3 @@ +uint8 fan_cmd +uint8 FAN_CMD_ON=0 +uint8 FAN_CMD_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg new file mode 100644 index 000000000..252c10fc1 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg @@ -0,0 +1,2 @@ +Temperatureimpl low +Temperatureimpl high \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg new file mode 100644 index 000000000..c56c0d942 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg @@ -0,0 +1,4 @@ +uint8 temp_unit +uint8 TEMP_UNIT_FAHRENHEIT=0 +uint8 TEMP_UNIT_CELSIUS=1 +uint8 TEMP_UNIT_KELVIN=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg new file mode 100644 index 000000000..9f0216444 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg @@ -0,0 +1,2 @@ +Float32 degrees +TempUnit unit \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..0fc417aaa --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + building_control_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..b3bfceddd --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +from building_control_py_pkg_interfaces.msg import TempUnit +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import FanCmd + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = TempUnit() + typedValue.data = value + match (typedValue.temp_unit): + case TempUnit.TEMP_UNIT_FAHRENHEIT: + return "TempUnit Fahrenheit" + case TempUnit.TEMP_UNIT_CELSIUS: + return "TempUnit Celsius" + case TempUnit.TEMP_UNIT_KELVIN: + return "TempUnit Kelvin" + case default: + return "Unknown value for TempUnit" + +def enumToString(value): + typedValue = FanAck() + typedValue.data = value + match (typedValue.fan_ack): + case FanAck.FAN_ACK_OK: + return "FanAck Ok" + case FanAck.FAN_ACK_ERROR: + return "FanAck Error" + case default: + return "Unknown value for FanAck" + +def enumToString(value): + typedValue = FanCmd() + typedValue.data = value + match (typedValue.fan_cmd): + case FanCmd.FAN_CMD_ON: + return "FanCmd On" + case FanCmd.FAN_CMD_OFF: + return "FanCmd Off" + case default: + return "Unknown value for FanCmd" + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py new file mode 100644 index 000000000..c2c7b65ae --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_fan_base(Node): + def __init__(self): + super().__init__("tcp_fan") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_fan_fanCmd_subscription_ = self.create_subscription( + FanCmd, + "tcp_fan_fanCmd", + self.accept_fanCmd, + 1, + callback_group=self.cb_group_) + + self.tcp_fan_fanAck_publisher_ = self.create_publisher( + FanAck, + "tcp_tempControl_fanAck", + 1) + + self.infrastructureIn_fanCmd = deque() + self.applicationIn_fanCmd = deque() + + self.infrastructureOut_fanAck = deque() + self.applicationOut_fanAck = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_fanAck, self.infrastructureOut_fanAck, self.sendOut_fanAck] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def fanCmd_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_fanCmd, self.applicationIn_fanCmd) + if len(self.applicationIn_fanCmd) == 0: return + self.handle_fanCmd_base(self.applicationIn_fanCmd[0]) + self.applicationIn_fanCmd.pop() + self.sendOutputs() + + def accept_fanCmd(self, msg): + self.enqueue(self.infrastructureIn_fanCmd, msg) + thread = threading.Thread(target=self.fanCmd_thread) + thread.daemon = True + thread.start() + + + def sendOut_fanAck(self, msg): + if type(msg) is FanAck: + self.tcp_fan_fanAck_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port fanAck.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_fanAck(self, msg): + self.enqueue(self.applicationOut_fanAck, msg) + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanCmd(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_fanCmd_base(self, msg): + if type(msg) is FanCmd: + self.handle_fanCmd(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port fanCmd.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py new file mode 100644 index 000000000..5738d46c9 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_fan_src import tcp_fan +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_fan() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py new file mode 100644 index 000000000..68b69dc68 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempControl_base(Node): + def __init__(self): + super().__init__("tcp_tempControl") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_tempControl_currentTemp_subscription_ = self.create_subscription( + Temperatureimpl, + "tcp_tempControl_currentTemp", + self.accept_currentTemp, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanAck_subscription_ = self.create_subscription( + FanAck, + "tcp_tempControl_fanAck", + self.accept_fanAck, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_setPoint_subscription_ = self.create_subscription( + SetPointimpl, + "tcp_tempControl_setPoint", + self.accept_setPoint, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_tempChanged_subscription_ = self.create_subscription( + Empty, + "tcp_tempControl_tempChanged", + self.accept_tempChanged, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanCmd_publisher_ = self.create_publisher( + FanCmd, + "tcp_fan_fanCmd", + 1) + + self.infrastructureIn_currentTemp = deque() + self.applicationIn_currentTemp = deque() + self.infrastructureIn_fanAck = deque() + self.applicationIn_fanAck = deque() + self.infrastructureIn_setPoint = deque() + self.applicationIn_setPoint = deque() + self.infrastructureIn_tempChanged = deque() + self.applicationIn_tempChanged = deque() + + self.infrastructureOut_fanCmd = deque() + self.applicationOut_fanCmd = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_currentTemp, self.applicationIn_currentTemp] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_fanCmd, self.infrastructureOut_fanCmd, self.sendOut_fanCmd] + ] + + def init_currentTemp(self, val): + self.enqueue(self.infrastructureIn_currentTemp, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_currentTemp(self, msg): + self.enqueue(self.infrastructureIn_currentTemp, msg) + + def fanAck_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_fanAck, self.applicationIn_fanAck) + if len(self.applicationIn_fanAck) == 0: return + self.handle_fanAck_base(self.applicationIn_fanAck[0]) + self.applicationIn_fanAck.pop() + self.sendOutputs() + + def accept_fanAck(self, msg): + self.enqueue(self.infrastructureIn_fanAck, msg) + thread = threading.Thread(target=self.fanAck_thread) + thread.daemon = True + thread.start() + + + def setPoint_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_setPoint, self.applicationIn_setPoint) + if len(self.applicationIn_setPoint) == 0: return + self.handle_setPoint_base(self.applicationIn_setPoint[0]) + self.applicationIn_setPoint.pop() + self.sendOutputs() + + def accept_setPoint(self, msg): + self.enqueue(self.infrastructureIn_setPoint, msg) + thread = threading.Thread(target=self.setPoint_thread) + thread.daemon = True + thread.start() + + + def tempChanged_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_tempChanged, self.applicationIn_tempChanged) + if len(self.applicationIn_tempChanged) == 0: return + self.handle_tempChanged_base(self.applicationIn_tempChanged[0]) + self.applicationIn_tempChanged.pop() + self.sendOutputs() + + def accept_tempChanged(self, msg): + self.enqueue(self.infrastructureIn_tempChanged, msg) + thread = threading.Thread(target=self.tempChanged_thread) + thread.daemon = True + thread.start() + + + def get_currentTemp(self): + msg = self.applicationIn_currentTemp[0] + return msg + + def sendOut_fanCmd(self, msg): + if type(msg) is FanCmd: + self.tcp_tempControl_fanCmd_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port fanCmd.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_fanCmd(self, msg): + self.enqueue(self.applicationOut_fanCmd, msg) + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanAck(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_fanAck_base(self, msg): + if type(msg) is FanAck: + self.handle_fanAck(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port fanAck.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_setPoint(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_setPoint_base(self, msg): + if type(msg) is SetPointimpl: + self.handle_setPoint(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port setPoint.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_tempChanged(self): + raise NotImplementedError("Subclasses must implement this method") + + def handle_tempChanged_base(self, msg): + self.handle_tempChanged() + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py new file mode 100644 index 000000000..304e92f82 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempControl_src import tcp_tempControl +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempControl() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py new file mode 100644 index 000000000..546374245 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempSensor_base(Node): + def __init__(self): + super().__init__("tcp_tempSensor") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_tempSensor_currentTemp_publisher_ = self.create_publisher( + Temperatureimpl, + "tcp_tempControl_currentTemp", + 1) + + self.tcp_tempSensor_tempChanged_publisher_ = self.create_publisher( + Empty, + "tcp_tempControl_tempChanged", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_currentTemp = deque() + self.applicationOut_currentTemp = deque() + self.infrastructureOut_tempChanged = deque() + self.applicationOut_tempChanged = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_currentTemp, self.infrastructureOut_currentTemp, self.sendOut_currentTemp], + [self.applicationOut_tempChanged, self.infrastructureOut_tempChanged, self.sendOut_tempChanged] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_currentTemp(self, msg): + if type(msg) is Temperatureimpl: + self.tcp_tempSensor_currentTemp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port currentTemp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_tempChanged(self, msg): + if type(msg) is Empty: + self.tcp_tempSensor_tempChanged_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port tempChanged.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_currentTemp(self, msg): + self.enqueue(self.applicationOut_currentTemp, msg) + + def put_tempChanged(self): + self.enqueue(self.applicationOut_tempChanged, Empty()) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py new file mode 100644 index 000000000..c295dea30 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempSensor_src import tcp_tempSensor +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempSensor() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py new file mode 100644 index 000000000..6a7db8dc2 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_fan(tcp_fan_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_fan infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanCmd(self, msg): + # Handle fanCmd msg + self.get_logger().info(f"Received fanCmd: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py new file mode 100644 index 000000000..606ec09df --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempControl(tcp_tempControl_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempControl infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + currentTemp = Temperatureimpl() + self.init_currentTemp(currentTemp) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanAck(self, msg): + # Handle fanAck msg + self.get_logger().info(f"Received fanAck: {self.message_to_string(msg)}") + + + # Example receiving messages on data ports + currentTemp = self.get_currentTemp() + self.get_logger().info(f"Received currentTemp: {self.message_to_string(currentTemp)}") + + def handle_setPoint(self, msg): + # Handle setPoint msg + self.get_logger().info(f"Received setPoint: {self.message_to_string(msg)}") + + def handle_tempChanged(self): + # Handle tempChanged event + self.get_logger().info("Received tempChanged") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py new file mode 100644 index 000000000..d5aa325cc --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempSensor(tcp_tempSensor_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempSensor infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + currentTemp = Temperatureimpl() + self.put_currentTemp(currentTemp) + + self.put_tempChanged() + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/package.xml new file mode 100644 index 000000000..9630cba33 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + building_control_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + building_control_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/resource/building_control_py_pkg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/resource/building_control_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/resource/building_control_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.cfg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.cfg new file mode 100644 index 000000000..30d496dc5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/building_control_py_pkg +[develop] +script_dir=$base/lib/building_control_py_pkg +[install] +install_scripts=$base/lib/building_control_py_pkg diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.py new file mode 100644 index 000000000..3823f03b5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/setup.py @@ -0,0 +1,30 @@ +# setup.py in src/building_control_py_pkg + +from setuptools import find_packages, setup + +package_name = 'building_control_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "tcp_tempSensor_exe = building_control_py_pkg.base_code.tcp_tempSensor_runner:main", + "tcp_tempControl_exe = building_control_py_pkg.base_code.tcp_tempControl_runner:main", + "tcp_fan_exe = building_control_py_pkg.base_code.tcp_fan_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..f8c13e1c6 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py new file mode 100644 index 000000000..7638aec86 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + tcp_tempSensor_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempSensor_exe" + ) + + tcp_tempControl_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempControl_exe" + ) + + tcp_fan_node = Node( + package = "building_control_py_pkg", + executable = "tcp_fan_exe" + ) + + ld.add_action(tcp_tempSensor_node) + ld.add_action(tcp_tempControl_node) + ld.add_action(tcp_fan_node) + + return ld diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/package.xml new file mode 100644 index 000000000..2ec33ca35 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + building_control_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + building_control_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f53a7ca29 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Float32.msg + msg/TempUnit.msg + msg/Temperatureimpl.msg + msg/SetPointimpl.msg + msg/FanAck.msg + msg/FanCmd.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg new file mode 100644 index 000000000..58b717c1c --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg @@ -0,0 +1,3 @@ +uint8 fan_ack +uint8 FAN_ACK_OK=0 +uint8 FAN_ACK_ERROR=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg new file mode 100644 index 000000000..184c27a3e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg @@ -0,0 +1,3 @@ +uint8 fan_cmd +uint8 FAN_CMD_ON=0 +uint8 FAN_CMD_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg new file mode 100644 index 000000000..252c10fc1 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg @@ -0,0 +1,2 @@ +Temperatureimpl low +Temperatureimpl high \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg new file mode 100644 index 000000000..c56c0d942 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg @@ -0,0 +1,4 @@ +uint8 temp_unit +uint8 TEMP_UNIT_FAHRENHEIT=0 +uint8 TEMP_UNIT_CELSIUS=1 +uint8 TEMP_UNIT_KELVIN=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg new file mode 100644 index 000000000..9f0216444 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg @@ -0,0 +1,2 @@ +Float32 degrees +TempUnit unit \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..0fc417aaa --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed/strict/src/building_control_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + building_control_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..b3bfceddd --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +from building_control_py_pkg_interfaces.msg import TempUnit +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import FanCmd + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = TempUnit() + typedValue.data = value + match (typedValue.temp_unit): + case TempUnit.TEMP_UNIT_FAHRENHEIT: + return "TempUnit Fahrenheit" + case TempUnit.TEMP_UNIT_CELSIUS: + return "TempUnit Celsius" + case TempUnit.TEMP_UNIT_KELVIN: + return "TempUnit Kelvin" + case default: + return "Unknown value for TempUnit" + +def enumToString(value): + typedValue = FanAck() + typedValue.data = value + match (typedValue.fan_ack): + case FanAck.FAN_ACK_OK: + return "FanAck Ok" + case FanAck.FAN_ACK_ERROR: + return "FanAck Error" + case default: + return "Unknown value for FanAck" + +def enumToString(value): + typedValue = FanCmd() + typedValue.data = value + match (typedValue.fan_cmd): + case FanCmd.FAN_CMD_ON: + return "FanCmd On" + case FanCmd.FAN_CMD_OFF: + return "FanCmd Off" + case default: + return "Unknown value for FanCmd" + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py new file mode 100644 index 000000000..66c0b00d7 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from building_control_py_pkg.user_code.tcp_fan_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_fan_base(Node): + def __init__(self): + super().__init__("tcp_fan") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_fan_fanCmd_subscription_ = self.create_subscription( + FanCmd, + "tcp_tempControl_fanCmd", + self.handle_fanCmd, + 1, + callback_group=self.cb_group_) + + self.tcp_fan_fanAck_publisher_ = self.create_publisher( + FanAck, + "tcp_fan_fanAck", + 1) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_fanAck(self, msg): + self.tcp_fan_fanAck_publisher_.publish(msg) + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanCmd(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py new file mode 100644 index 000000000..5738d46c9 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_fan_src import tcp_fan +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_fan() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py new file mode 100644 index 000000000..a5eca58e2 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from building_control_py_pkg.user_code.tcp_tempControl_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempControl_base(Node): + def __init__(self): + super().__init__("tcp_tempControl") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_tempControl_currentTemp_subscription_ = self.create_subscription( + Temperatureimpl, + "tcp_tempSensor_currentTemp", + self.handle_currentTemp, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanAck_subscription_ = self.create_subscription( + FanAck, + "tcp_fan_fanAck", + self.handle_fanAck, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_setPoint_subscription_ = self.create_subscription( + SetPointimpl, + "tcp_tempControl_setPoint", + self.handle_setPoint, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_tempChanged_subscription_ = self.create_subscription( + Empty, + "tcp_tempSensor_tempChanged", + self.event_handle_tempChanged, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanCmd_publisher_ = self.create_publisher( + FanCmd, + "tcp_tempControl_fanCmd", + 1) + + self.currentTemp_msg_holder = None + + def init_currentTemp(self, val): + self.currentTemp_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_currentTemp(self, msg): + self.currentTemp_msg_holder = msg + + def get_currentTemp(self): + return self.currentTemp_msg_holder + + def event_handle_tempChanged(self, msg): + self.handle_tempChanged() + + def put_fanCmd(self, msg): + self.tcp_tempControl_fanCmd_publisher_.publish(msg) + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanAck(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_setPoint(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_tempChanged(self): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py new file mode 100644 index 000000000..304e92f82 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempControl_src import tcp_tempControl +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempControl() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py new file mode 100644 index 000000000..b29442443 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempSensor_base(Node): + def __init__(self): + super().__init__("tcp_tempSensor") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.tcp_tempSensor_currentTemp_publisher_ = self.create_publisher( + Temperatureimpl, + "tcp_tempSensor_currentTemp", + 1) + + self.tcp_tempSensor_tempChanged_publisher_ = self.create_publisher( + Empty, + "tcp_tempSensor_tempChanged", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_currentTemp(self, msg): + self.tcp_tempSensor_currentTemp_publisher_.publish(msg) + + def put_tempChanged(self): + msg = Empty() + self.tcp_tempSensor_tempChanged_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py new file mode 100644 index 000000000..c295dea30 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempSensor_src import tcp_tempSensor +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempSensor() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py new file mode 100644 index 000000000..6a7db8dc2 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_fan(tcp_fan_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_fan infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanCmd(self, msg): + # Handle fanCmd msg + self.get_logger().info(f"Received fanCmd: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py new file mode 100644 index 000000000..ee16abc55 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempControl(tcp_tempControl_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempControl infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + currentTemp = Temperatureimpl() + self.init_currentTemp(currentTemp) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanAck(self, msg): + # Handle fanAck msg + self.get_logger().info(f"Received fanAck: {self.message_to_string(msg)}") + + + # Example receiving messages on data ports + currentTemp = get_currentTemp() + self.get_logger().info(f"Received currentTemp: {self.message_to_string(currentTemp)}") + + def handle_setPoint(self, msg): + # Handle setPoint msg + self.get_logger().info(f"Received setPoint: {self.message_to_string(msg)}") + + def handle_tempChanged(self): + # Handle tempChanged event + self.get_logger().info("Received tempChanged") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py new file mode 100644 index 000000000..d5aa325cc --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempSensor(tcp_tempSensor_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempSensor infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + currentTemp = Temperatureimpl() + self.put_currentTemp(currentTemp) + + self.put_tempChanged() + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/package.xml new file mode 100644 index 000000000..9630cba33 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + building_control_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + building_control_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/resource/building_control_py_pkg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/resource/building_control_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/resource/building_control_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.cfg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.cfg new file mode 100644 index 000000000..30d496dc5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/building_control_py_pkg +[develop] +script_dir=$base/lib/building_control_py_pkg +[install] +install_scripts=$base/lib/building_control_py_pkg diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.py new file mode 100644 index 000000000..3823f03b5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/setup.py @@ -0,0 +1,30 @@ +# setup.py in src/building_control_py_pkg + +from setuptools import find_packages, setup + +package_name = 'building_control_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "tcp_tempSensor_exe = building_control_py_pkg.base_code.tcp_tempSensor_runner:main", + "tcp_tempControl_exe = building_control_py_pkg.base_code.tcp_tempControl_runner:main", + "tcp_fan_exe = building_control_py_pkg.base_code.tcp_fan_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..f8c13e1c6 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py new file mode 100644 index 000000000..7638aec86 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + tcp_tempSensor_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempSensor_exe" + ) + + tcp_tempControl_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempControl_exe" + ) + + tcp_fan_node = Node( + package = "building_control_py_pkg", + executable = "tcp_fan_exe" + ) + + ld.add_action(tcp_tempSensor_node) + ld.add_action(tcp_tempControl_node) + ld.add_action(tcp_fan_node) + + return ld diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/package.xml new file mode 100644 index 000000000..2ec33ca35 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + building_control_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + building_control_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f53a7ca29 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Float32.msg + msg/TempUnit.msg + msg/Temperatureimpl.msg + msg/SetPointimpl.msg + msg/FanAck.msg + msg/FanCmd.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg new file mode 100644 index 000000000..58b717c1c --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanAck.msg @@ -0,0 +1,3 @@ +uint8 fan_ack +uint8 FAN_ACK_OK=0 +uint8 FAN_ACK_ERROR=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg new file mode 100644 index 000000000..184c27a3e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/FanCmd.msg @@ -0,0 +1,3 @@ +uint8 fan_cmd +uint8 FAN_CMD_ON=0 +uint8 FAN_CMD_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg new file mode 100644 index 000000000..252c10fc1 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg @@ -0,0 +1,2 @@ +Temperatureimpl low +Temperatureimpl high \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg new file mode 100644 index 000000000..c56c0d942 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/TempUnit.msg @@ -0,0 +1,4 @@ +uint8 temp_unit +uint8 TEMP_UNIT_FAHRENHEIT=0 +uint8 TEMP_UNIT_CELSIUS=1 +uint8 TEMP_UNIT_KELVIN=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg new file mode 100644 index 000000000..9f0216444 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg @@ -0,0 +1,2 @@ +Float32 degrees +TempUnit unit \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..0fc417aaa --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/lax/src/building_control_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + building_control_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..b3bfceddd --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/enum_converter.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +from building_control_py_pkg_interfaces.msg import TempUnit +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import FanCmd + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = TempUnit() + typedValue.data = value + match (typedValue.temp_unit): + case TempUnit.TEMP_UNIT_FAHRENHEIT: + return "TempUnit Fahrenheit" + case TempUnit.TEMP_UNIT_CELSIUS: + return "TempUnit Celsius" + case TempUnit.TEMP_UNIT_KELVIN: + return "TempUnit Kelvin" + case default: + return "Unknown value for TempUnit" + +def enumToString(value): + typedValue = FanAck() + typedValue.data = value + match (typedValue.fan_ack): + case FanAck.FAN_ACK_OK: + return "FanAck Ok" + case FanAck.FAN_ACK_ERROR: + return "FanAck Error" + case default: + return "Unknown value for FanAck" + +def enumToString(value): + typedValue = FanCmd() + typedValue.data = value + match (typedValue.fan_cmd): + case FanCmd.FAN_CMD_ON: + return "FanCmd On" + case FanCmd.FAN_CMD_OFF: + return "FanCmd Off" + case default: + return "Unknown value for FanCmd" + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py new file mode 100644 index 000000000..5c9209d44 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_base_src.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_fan_base(Node): + def __init__(self): + super().__init__("tcp_fan") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_fan_fanCmd_subscription_ = self.create_subscription( + FanCmd, + "tcp_tempControl_fanCmd", + self.accept_fanCmd, + 1, + callback_group=self.cb_group_) + + self.tcp_fan_fanAck_publisher_ = self.create_publisher( + FanAck, + "tcp_fan_fanAck", + 1) + + self.infrastructureIn_fanCmd = deque() + self.applicationIn_fanCmd = deque() + + self.infrastructureOut_fanAck = deque() + self.applicationOut_fanAck = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_fanAck, self.infrastructureOut_fanAck, self.sendOut_fanAck] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def fanCmd_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_fanCmd, self.applicationIn_fanCmd) + if len(self.applicationIn_fanCmd) == 0: return + self.handle_fanCmd_base(self.applicationIn_fanCmd[0]) + self.applicationIn_fanCmd.pop() + self.sendOutputs() + + def accept_fanCmd(self, msg): + self.enqueue(self.infrastructureIn_fanCmd, msg) + thread = threading.Thread(target=self.fanCmd_thread) + thread.daemon = True + thread.start() + + + def sendOut_fanAck(self, msg): + if type(msg) is FanAck: + self.tcp_fan_fanAck_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port fanAck.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_fanAck(self, msg): + self.enqueue(self.applicationOut_fanAck, msg) + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanCmd(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_fanCmd_base(self, msg): + if type(msg) is FanCmd: + self.handle_fanCmd(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port fanCmd.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py new file mode 100644 index 000000000..5738d46c9 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_fan_src import tcp_fan +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_fan() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py new file mode 100644 index 000000000..99b4d3d10 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_base_src.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempControl_base(Node): + def __init__(self): + super().__init__("tcp_tempControl") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_tempControl_currentTemp_subscription_ = self.create_subscription( + Temperatureimpl, + "tcp_tempSensor_currentTemp", + self.accept_currentTemp, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanAck_subscription_ = self.create_subscription( + FanAck, + "tcp_fan_fanAck", + self.accept_fanAck, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_setPoint_subscription_ = self.create_subscription( + SetPointimpl, + "tcp_tempControl_setPoint", + self.accept_setPoint, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_tempChanged_subscription_ = self.create_subscription( + Empty, + "tcp_tempSensor_tempChanged", + self.accept_tempChanged, + 1, + callback_group=self.cb_group_) + + self.tcp_tempControl_fanCmd_publisher_ = self.create_publisher( + FanCmd, + "tcp_tempControl_fanCmd", + 1) + + self.infrastructureIn_currentTemp = deque() + self.applicationIn_currentTemp = deque() + self.infrastructureIn_fanAck = deque() + self.applicationIn_fanAck = deque() + self.infrastructureIn_setPoint = deque() + self.applicationIn_setPoint = deque() + self.infrastructureIn_tempChanged = deque() + self.applicationIn_tempChanged = deque() + + self.infrastructureOut_fanCmd = deque() + self.applicationOut_fanCmd = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_currentTemp, self.applicationIn_currentTemp] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_fanCmd, self.infrastructureOut_fanCmd, self.sendOut_fanCmd] + ] + + def init_currentTemp(self, val): + self.enqueue(self.infrastructureIn_currentTemp, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_currentTemp(self, msg): + self.enqueue(self.infrastructureIn_currentTemp, msg) + + def fanAck_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_fanAck, self.applicationIn_fanAck) + if len(self.applicationIn_fanAck) == 0: return + self.handle_fanAck_base(self.applicationIn_fanAck[0]) + self.applicationIn_fanAck.pop() + self.sendOutputs() + + def accept_fanAck(self, msg): + self.enqueue(self.infrastructureIn_fanAck, msg) + thread = threading.Thread(target=self.fanAck_thread) + thread.daemon = True + thread.start() + + + def setPoint_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_setPoint, self.applicationIn_setPoint) + if len(self.applicationIn_setPoint) == 0: return + self.handle_setPoint_base(self.applicationIn_setPoint[0]) + self.applicationIn_setPoint.pop() + self.sendOutputs() + + def accept_setPoint(self, msg): + self.enqueue(self.infrastructureIn_setPoint, msg) + thread = threading.Thread(target=self.setPoint_thread) + thread.daemon = True + thread.start() + + + def tempChanged_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_tempChanged, self.applicationIn_tempChanged) + if len(self.applicationIn_tempChanged) == 0: return + self.handle_tempChanged_base(self.applicationIn_tempChanged[0]) + self.applicationIn_tempChanged.pop() + self.sendOutputs() + + def accept_tempChanged(self, msg): + self.enqueue(self.infrastructureIn_tempChanged, msg) + thread = threading.Thread(target=self.tempChanged_thread) + thread.daemon = True + thread.start() + + + def get_currentTemp(self): + msg = self.applicationIn_currentTemp[0] + return msg + + def sendOut_fanCmd(self, msg): + if type(msg) is FanCmd: + self.tcp_tempControl_fanCmd_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port fanCmd.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_fanCmd(self, msg): + self.enqueue(self.applicationOut_fanCmd, msg) + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_fanAck(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_fanAck_base(self, msg): + if type(msg) is FanAck: + self.handle_fanAck(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port fanAck.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_setPoint(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_setPoint_base(self, msg): + if type(msg) is SetPointimpl: + self.handle_setPoint(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port setPoint.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_tempChanged(self): + raise NotImplementedError("Subclasses must implement this method") + + def handle_tempChanged_base(self, msg): + self.handle_tempChanged() + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py new file mode 100644 index 000000000..304e92f82 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempControl_src import tcp_tempControl +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempControl() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py new file mode 100644 index 000000000..ccd9123c6 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_base_src.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class tcp_tempSensor_base(Node): + def __init__(self): + super().__init__("tcp_tempSensor") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.tcp_tempSensor_currentTemp_publisher_ = self.create_publisher( + Temperatureimpl, + "tcp_tempSensor_currentTemp", + 1) + + self.tcp_tempSensor_tempChanged_publisher_ = self.create_publisher( + Empty, + "tcp_tempSensor_tempChanged", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_currentTemp = deque() + self.applicationOut_currentTemp = deque() + self.infrastructureOut_tempChanged = deque() + self.applicationOut_tempChanged = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_currentTemp, self.infrastructureOut_currentTemp, self.sendOut_currentTemp], + [self.applicationOut_tempChanged, self.infrastructureOut_tempChanged, self.sendOut_tempChanged] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_currentTemp(self, msg): + if type(msg) is Temperatureimpl: + self.tcp_tempSensor_currentTemp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port currentTemp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_tempChanged(self, msg): + if type(msg) is Empty: + self.tcp_tempSensor_tempChanged_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port tempChanged.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_currentTemp(self, msg): + self.enqueue(self.applicationOut_currentTemp, msg) + + def put_tempChanged(self): + self.enqueue(self.applicationOut_tempChanged, Empty()) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py new file mode 100644 index 000000000..c295dea30 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from building_control_py_pkg.user_code.tcp_tempSensor_src import tcp_tempSensor +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = tcp_tempSensor() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py new file mode 100644 index 000000000..6a7db8dc2 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_fan(tcp_fan_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_fan infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanCmd(self, msg): + # Handle fanCmd msg + self.get_logger().info(f"Received fanCmd: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py new file mode 100644 index 000000000..606ec09df --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import FanAck +from building_control_py_pkg_interfaces.msg import SetPointimpl +from building_control_py_pkg_interfaces.msg import FanCmd +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempControl(tcp_tempControl_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempControl infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + currentTemp = Temperatureimpl() + self.init_currentTemp(currentTemp) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_fanAck(self, msg): + # Handle fanAck msg + self.get_logger().info(f"Received fanAck: {self.message_to_string(msg)}") + + + # Example receiving messages on data ports + currentTemp = self.get_currentTemp() + self.get_logger().info(f"Received currentTemp: {self.message_to_string(currentTemp)}") + + def handle_setPoint(self, msg): + # Handle setPoint msg + self.get_logger().info(f"Received setPoint: {self.message_to_string(msg)}") + + def handle_tempChanged(self): + # Handle tempChanged event + self.get_logger().info("Received tempChanged") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py new file mode 100644 index 000000000..d5aa325cc --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base +from building_control_py_pkg_interfaces.msg import Temperatureimpl +from building_control_py_pkg_interfaces.msg import Empty +from building_control_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class tcp_tempSensor(tcp_tempSensor_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("tcp_tempSensor infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + currentTemp = Temperatureimpl() + self.put_currentTemp(currentTemp) + + self.put_tempChanged() + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/package.xml new file mode 100644 index 000000000..9630cba33 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + building_control_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + building_control_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/resource/building_control_py_pkg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/resource/building_control_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/resource/building_control_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.cfg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.cfg new file mode 100644 index 000000000..30d496dc5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/building_control_py_pkg +[develop] +script_dir=$base/lib/building_control_py_pkg +[install] +install_scripts=$base/lib/building_control_py_pkg diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.py new file mode 100644 index 000000000..3823f03b5 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/setup.py @@ -0,0 +1,30 @@ +# setup.py in src/building_control_py_pkg + +from setuptools import find_packages, setup + +package_name = 'building_control_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "tcp_tempSensor_exe = building_control_py_pkg.base_code.tcp_tempSensor_runner:main", + "tcp_tempControl_exe = building_control_py_pkg.base_code.tcp_tempControl_runner:main", + "tcp_fan_exe = building_control_py_pkg.base_code.tcp_fan_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..f8c13e1c6 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py new file mode 100644 index 000000000..7638aec86 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/launch/BuildingControlDemo_i_Instance.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + tcp_tempSensor_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempSensor_exe" + ) + + tcp_tempControl_node = Node( + package = "building_control_py_pkg", + executable = "tcp_tempControl_exe" + ) + + tcp_fan_node = Node( + package = "building_control_py_pkg", + executable = "tcp_fan_exe" + ) + + ld.add_action(tcp_tempSensor_node) + ld.add_action(tcp_tempControl_node) + ld.add_action(tcp_fan_node) + + return ld diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/package.xml new file mode 100644 index 000000000..2ec33ca35 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + building_control_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + building_control_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f53a7ca29 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.8) +project(building_control_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Float32.msg + msg/TempUnit.msg + msg/Temperatureimpl.msg + msg/SetPointimpl.msg + msg/FanAck.msg + msg/FanCmd.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg new file mode 100644 index 000000000..58b717c1c --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanAck.msg @@ -0,0 +1,3 @@ +uint8 fan_ack +uint8 FAN_ACK_OK=0 +uint8 FAN_ACK_ERROR=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg new file mode 100644 index 000000000..184c27a3e --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/FanCmd.msg @@ -0,0 +1,3 @@ +uint8 fan_cmd +uint8 FAN_CMD_ON=0 +uint8 FAN_CMD_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg new file mode 100644 index 000000000..252c10fc1 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/SetPointimpl.msg @@ -0,0 +1,2 @@ +Temperatureimpl low +Temperatureimpl high \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg new file mode 100644 index 000000000..c56c0d942 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/TempUnit.msg @@ -0,0 +1,4 @@ +uint8 temp_unit +uint8 TEMP_UNIT_FAHRENHEIT=0 +uint8 TEMP_UNIT_CELSIUS=1 +uint8 TEMP_UNIT_KELVIN=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg new file mode 100644 index 000000000..9f0216444 --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/msg/Temperatureimpl.msg @@ -0,0 +1,2 @@ +Float32 degrees +TempUnit unit \ No newline at end of file diff --git a/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..0fc417aaa --- /dev/null +++ b/resources/expected/ros2/python-building_control_gen_mixed_inverted_topics/strict/src/building_control_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + building_control_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py new file mode 100644 index 000000000..b94e55bbb --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py @@ -0,0 +1,231 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from datatypes_system_py_pkg.user_code.consumer_consumer_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class consumer_consumer_base(Node): + def __init__(self): + super().__init__("consumer_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.consumer_consumer_myBoolean_subscription_ = self.create_subscription( + Boolean, + "consumer_consumer_myBoolean", + self.handle_myBoolean, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInteger_subscription_ = self.create_subscription( + Integer64, + "consumer_consumer_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat_subscription_ = self.create_subscription( + Float64, + "consumer_consumer_myFloat", + self.handle_myFloat, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myCharacter_subscription_ = self.create_subscription( + Character, + "consumer_consumer_myCharacter", + self.handle_myCharacter, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myString_subscription_ = self.create_subscription( + String, + "consumer_consumer_myString", + self.handle_myString, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt8_subscription_ = self.create_subscription( + Integer8, + "consumer_consumer_myInt8", + self.handle_myInt8, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt16_subscription_ = self.create_subscription( + Integer16, + "consumer_consumer_myInt16", + self.handle_myInt16, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt32_subscription_ = self.create_subscription( + Integer32, + "consumer_consumer_myInt32", + self.handle_myInt32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt64_subscription_ = self.create_subscription( + Integer64, + "consumer_consumer_myInt64", + self.handle_myInt64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt8_subscription_ = self.create_subscription( + Unsigned8, + "consumer_consumer_myUInt8", + self.handle_myUInt8, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt16_subscription_ = self.create_subscription( + Unsigned16, + "consumer_consumer_myUInt16", + self.handle_myUInt16, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt32_subscription_ = self.create_subscription( + Unsigned32, + "consumer_consumer_myUInt32", + self.handle_myUInt32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt64_subscription_ = self.create_subscription( + Unsigned64, + "consumer_consumer_myUInt64", + self.handle_myUInt64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat32_subscription_ = self.create_subscription( + Float32, + "consumer_consumer_myFloat32", + self.handle_myFloat32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat64_subscription_ = self.create_subscription( + Float64, + "consumer_consumer_myFloat64", + self.handle_myFloat64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myEnum_subscription_ = self.create_subscription( + MyEnum, + "consumer_consumer_myEnum", + self.handle_myEnum, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myStruct_subscription_ = self.create_subscription( + MyStructi, + "consumer_consumer_myStruct", + self.handle_myStruct, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myArray1_subscription_ = self.create_subscription( + MyArrayOneDim, + "consumer_consumer_myArray1", + self.handle_myArray1, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myArray2_subscription_ = self.create_subscription( + MyArrayUnbounded, + "consumer_consumer_myArray2", + self.handle_myArray2, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myBoolean(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myCharacter(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myString(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt8(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt16(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt8(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt16(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myEnum(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myStruct(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myArray1(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myArray2(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py new file mode 100644 index 000000000..51b0efb40 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from datatypes_system_py_pkg.user_code.consumer_consumer_src import consumer_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = consumer_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..0064b50fa --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +from datatypes_system_py_pkg_interfaces.msg import MyEnum + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = MyEnum() + typedValue.data = value + match (typedValue.my_enum): + case MyEnum.MY_ENUM_ON: + return "MyEnum On" + case MyEnum.MY_ENUM_OFF: + return "MyEnum Off" + case default: + return "Unknown value for MyEnum" + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py new file mode 100644 index 000000000..3b452ce7a --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py @@ -0,0 +1,196 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class producer_producer_base(Node): + def __init__(self): + super().__init__("producer_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.producer_producer_myBoolean_publisher_ = self.create_publisher( + Boolean, + "consumer_consumer_myBoolean", + 1) + + self.producer_producer_myInteger_publisher_ = self.create_publisher( + Integer64, + "consumer_consumer_myInteger", + 1) + + self.producer_producer_myFloat_publisher_ = self.create_publisher( + Float64, + "consumer_consumer_myFloat", + 1) + + self.producer_producer_myCharacter_publisher_ = self.create_publisher( + Character, + "consumer_consumer_myCharacter", + 1) + + self.producer_producer_myString_publisher_ = self.create_publisher( + String, + "consumer_consumer_myString", + 1) + + self.producer_producer_myInt8_publisher_ = self.create_publisher( + Integer8, + "consumer_consumer_myInt8", + 1) + + self.producer_producer_myInt16_publisher_ = self.create_publisher( + Integer16, + "consumer_consumer_myInt16", + 1) + + self.producer_producer_myInt32_publisher_ = self.create_publisher( + Integer32, + "consumer_consumer_myInt32", + 1) + + self.producer_producer_myInt64_publisher_ = self.create_publisher( + Integer64, + "consumer_consumer_myInt64", + 1) + + self.producer_producer_myUInt8_publisher_ = self.create_publisher( + Unsigned8, + "consumer_consumer_myUInt8", + 1) + + self.producer_producer_myUInt16_publisher_ = self.create_publisher( + Unsigned16, + "consumer_consumer_myUInt16", + 1) + + self.producer_producer_myUInt32_publisher_ = self.create_publisher( + Unsigned32, + "consumer_consumer_myUInt32", + 1) + + self.producer_producer_myUInt64_publisher_ = self.create_publisher( + Unsigned64, + "consumer_consumer_myUInt64", + 1) + + self.producer_producer_myFloat32_publisher_ = self.create_publisher( + Float32, + "consumer_consumer_myFloat32", + 1) + + self.producer_producer_myFloat64_publisher_ = self.create_publisher( + Float64, + "consumer_consumer_myFloat64", + 1) + + self.producer_producer_myEnum_publisher_ = self.create_publisher( + MyEnum, + "consumer_consumer_myEnum", + 1) + + self.producer_producer_myStruct_publisher_ = self.create_publisher( + MyStructi, + "consumer_consumer_myStruct", + 1) + + self.producer_producer_myArray1_publisher_ = self.create_publisher( + MyArrayOneDim, + "consumer_consumer_myArray1", + 1) + + self.producer_producer_myArray2_publisher_ = self.create_publisher( + MyArrayUnbounded, + "consumer_consumer_myArray2", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myBoolean(self, msg): + self.producer_producer_myBoolean_publisher_.publish(msg) + + def put_myInteger(self, msg): + self.producer_producer_myInteger_publisher_.publish(msg) + + def put_myFloat(self, msg): + self.producer_producer_myFloat_publisher_.publish(msg) + + def put_myCharacter(self, msg): + self.producer_producer_myCharacter_publisher_.publish(msg) + + def put_myString(self, msg): + self.producer_producer_myString_publisher_.publish(msg) + + def put_myInt8(self, msg): + self.producer_producer_myInt8_publisher_.publish(msg) + + def put_myInt16(self, msg): + self.producer_producer_myInt16_publisher_.publish(msg) + + def put_myInt32(self, msg): + self.producer_producer_myInt32_publisher_.publish(msg) + + def put_myInt64(self, msg): + self.producer_producer_myInt64_publisher_.publish(msg) + + def put_myUInt8(self, msg): + self.producer_producer_myUInt8_publisher_.publish(msg) + + def put_myUInt16(self, msg): + self.producer_producer_myUInt16_publisher_.publish(msg) + + def put_myUInt32(self, msg): + self.producer_producer_myUInt32_publisher_.publish(msg) + + def put_myUInt64(self, msg): + self.producer_producer_myUInt64_publisher_.publish(msg) + + def put_myFloat32(self, msg): + self.producer_producer_myFloat32_publisher_.publish(msg) + + def put_myFloat64(self, msg): + self.producer_producer_myFloat64_publisher_.publish(msg) + + def put_myEnum(self, msg): + self.producer_producer_myEnum_publisher_.publish(msg) + + def put_myStruct(self, msg): + self.producer_producer_myStruct_publisher_.publish(msg) + + def put_myArray1(self, msg): + self.producer_producer_myArray1_publisher_.publish(msg) + + def put_myArray2(self, msg): + self.producer_producer_myArray2_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py new file mode 100644 index 000000000..e7da22227 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from datatypes_system_py_pkg.user_code.producer_producer_src import producer_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = producer_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py new file mode 100644 index 000000000..b8c55446e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from datatypes_system_py_pkg.base_code.consumer_consumer_base_src import consumer_consumer_base +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded +from datatypes_system_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class consumer_consumer(consumer_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("consumer_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myBoolean(self, msg): + # Handle myBoolean msg + self.get_logger().info(f"Received myBoolean: {self.message_to_string(msg)}") + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + def handle_myFloat(self, msg): + # Handle myFloat msg + self.get_logger().info(f"Received myFloat: {self.message_to_string(msg)}") + + def handle_myCharacter(self, msg): + # Handle myCharacter msg + self.get_logger().info(f"Received myCharacter: {self.message_to_string(msg)}") + + def handle_myString(self, msg): + # Handle myString msg + self.get_logger().info(f"Received myString: {self.message_to_string(msg)}") + + def handle_myInt8(self, msg): + # Handle myInt8 msg + self.get_logger().info(f"Received myInt8: {self.message_to_string(msg)}") + + def handle_myInt16(self, msg): + # Handle myInt16 msg + self.get_logger().info(f"Received myInt16: {self.message_to_string(msg)}") + + def handle_myInt32(self, msg): + # Handle myInt32 msg + self.get_logger().info(f"Received myInt32: {self.message_to_string(msg)}") + + def handle_myInt64(self, msg): + # Handle myInt64 msg + self.get_logger().info(f"Received myInt64: {self.message_to_string(msg)}") + + def handle_myUInt8(self, msg): + # Handle myUInt8 msg + self.get_logger().info(f"Received myUInt8: {self.message_to_string(msg)}") + + def handle_myUInt16(self, msg): + # Handle myUInt16 msg + self.get_logger().info(f"Received myUInt16: {self.message_to_string(msg)}") + + def handle_myUInt32(self, msg): + # Handle myUInt32 msg + self.get_logger().info(f"Received myUInt32: {self.message_to_string(msg)}") + + def handle_myUInt64(self, msg): + # Handle myUInt64 msg + self.get_logger().info(f"Received myUInt64: {self.message_to_string(msg)}") + + def handle_myFloat32(self, msg): + # Handle myFloat32 msg + self.get_logger().info(f"Received myFloat32: {self.message_to_string(msg)}") + + def handle_myFloat64(self, msg): + # Handle myFloat64 msg + self.get_logger().info(f"Received myFloat64: {self.message_to_string(msg)}") + + def handle_myEnum(self, msg): + # Handle myEnum msg + self.get_logger().info(f"Received myEnum: {self.message_to_string(msg)}") + + def handle_myStruct(self, msg): + # Handle myStruct msg + self.get_logger().info(f"Received myStruct: {self.message_to_string(msg)}") + + def handle_myArray1(self, msg): + # Handle myArray1 msg + self.get_logger().info(f"Received myArray1: {self.message_to_string(msg)}") + + def handle_myArray2(self, msg): + # Handle myArray2 msg + self.get_logger().info(f"Received myArray2: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py new file mode 100644 index 000000000..e287d285f --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from datatypes_system_py_pkg.base_code.producer_producer_base_src import producer_producer_base +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded +from datatypes_system_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class producer_producer(producer_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("producer_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myBoolean = Boolean() + self.put_myBoolean(myBoolean) + + myInteger = Integer64() + self.put_myInteger(myInteger) + + myFloat = Float64() + self.put_myFloat(myFloat) + + myCharacter = Character() + self.put_myCharacter(myCharacter) + + myString = String() + self.put_myString(myString) + + myInt8 = Integer8() + self.put_myInt8(myInt8) + + myInt16 = Integer16() + self.put_myInt16(myInt16) + + myInt32 = Integer32() + self.put_myInt32(myInt32) + + myInt64 = Integer64() + self.put_myInt64(myInt64) + + myUInt8 = Unsigned8() + self.put_myUInt8(myUInt8) + + myUInt16 = Unsigned16() + self.put_myUInt16(myUInt16) + + myUInt32 = Unsigned32() + self.put_myUInt32(myUInt32) + + myUInt64 = Unsigned64() + self.put_myUInt64(myUInt64) + + myFloat32 = Float32() + self.put_myFloat32(myFloat32) + + myFloat64 = Float64() + self.put_myFloat64(myFloat64) + + myEnum = MyEnum() + self.put_myEnum(myEnum) + + myStruct = MyStructi() + self.put_myStruct(myStruct) + + myArray1 = MyArrayOneDim() + self.put_myArray1(myArray1) + + myArray2 = MyArrayUnbounded() + self.put_myArray2(myArray2) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/package.xml b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/package.xml new file mode 100644 index 000000000..84db30a4b --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + datatypes_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + datatypes_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.cfg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.cfg new file mode 100644 index 000000000..582e1f3fb --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/datatypes_system_py_pkg +[develop] +script_dir=$base/lib/datatypes_system_py_pkg +[install] +install_scripts=$base/lib/datatypes_system_py_pkg diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.py new file mode 100644 index 000000000..c4ae5a449 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/setup.py @@ -0,0 +1,29 @@ +# setup.py in src/datatypes_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'datatypes_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "producer_producer_exe = datatypes_system_py_pkg.base_code.producer_producer_runner:main", + "consumer_consumer_exe = datatypes_system_py_pkg.base_code.consumer_consumer_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..60565bf01 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(datatypes_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..c9db37cda --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,25 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + producer_producer_node = Node( + package = "datatypes_system_py_pkg", + executable = "producer_producer_exe" + ) + + consumer_consumer_node = Node( + package = "datatypes_system_py_pkg", + executable = "consumer_consumer_exe" + ) + + ld.add_action(producer_producer_node) + ld.add_action(consumer_consumer_node) + + return ld diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..941a1ef43 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + datatypes_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + datatypes_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..abed80967 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.8) +project(datatypes_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Boolean.msg + msg/Integer64.msg + msg/Float64.msg + msg/Character.msg + msg/String.msg + msg/Integer8.msg + msg/Integer16.msg + msg/Integer32.msg + msg/Unsigned8.msg + msg/Unsigned16.msg + msg/Unsigned32.msg + msg/Unsigned64.msg + msg/Float32.msg + msg/MyEnum.msg + msg/MyStruct2i.msg + msg/MyArrayOneDim.msg + msg/MyArrayUnbounded.msg + msg/MyStructi.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Character.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Character.msg new file mode 100644 index 000000000..39a1d46a9 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Character.msg @@ -0,0 +1 @@ +char data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg new file mode 100644 index 000000000..cd09d39b8 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg @@ -0,0 +1 @@ +float64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg new file mode 100644 index 000000000..28b7bef9e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg @@ -0,0 +1 @@ +int16 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg new file mode 100644 index 000000000..0ecfe35f5 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg @@ -0,0 +1 @@ +int32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg new file mode 100644 index 000000000..eef7d19b9 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg @@ -0,0 +1 @@ +int8 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg new file mode 100644 index 000000000..3679c5865 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg @@ -0,0 +1 @@ +Integer64[10] arr \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg new file mode 100644 index 000000000..5d32f8e13 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg @@ -0,0 +1 @@ +Integer64[] arr \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg new file mode 100644 index 000000000..1d7ab4a14 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg @@ -0,0 +1,3 @@ +uint8 my_enum +uint8 MY_ENUM_ON=0 +uint8 MY_ENUM_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg new file mode 100644 index 000000000..f695fd8a4 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg @@ -0,0 +1,2 @@ +Float64 field_float +Character field_s_char \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg new file mode 100644 index 000000000..e07f88749 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg @@ -0,0 +1,6 @@ +Integer64 field_int64 +String field_str +MyEnum field_enum +MyStruct2i field_rec +MyArrayOneDim field_array +MyArrayUnbounded field_array_unbounded \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/String.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/String.msg new file mode 100644 index 000000000..44e5aaf86 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/String.msg @@ -0,0 +1 @@ +string data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg new file mode 100644 index 000000000..eec391bfb --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg @@ -0,0 +1 @@ +uint16 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg new file mode 100644 index 000000000..b6c696b42 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg @@ -0,0 +1 @@ +uint32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg new file mode 100644 index 000000000..2eb1afad3 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg @@ -0,0 +1 @@ +uint64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg new file mode 100644 index 000000000..498f60988 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg @@ -0,0 +1 @@ +uint8 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..ec718a2d1 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/lax/src/datatypes_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + datatypes_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py new file mode 100644 index 000000000..e9b326914 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_base_src.py @@ -0,0 +1,716 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class consumer_consumer_base(Node): + def __init__(self): + super().__init__("consumer_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.consumer_consumer_myBoolean_subscription_ = self.create_subscription( + Boolean, + "consumer_consumer_myBoolean", + self.accept_myBoolean, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInteger_subscription_ = self.create_subscription( + Integer64, + "consumer_consumer_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat_subscription_ = self.create_subscription( + Float64, + "consumer_consumer_myFloat", + self.accept_myFloat, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myCharacter_subscription_ = self.create_subscription( + Character, + "consumer_consumer_myCharacter", + self.accept_myCharacter, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myString_subscription_ = self.create_subscription( + String, + "consumer_consumer_myString", + self.accept_myString, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt8_subscription_ = self.create_subscription( + Integer8, + "consumer_consumer_myInt8", + self.accept_myInt8, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt16_subscription_ = self.create_subscription( + Integer16, + "consumer_consumer_myInt16", + self.accept_myInt16, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt32_subscription_ = self.create_subscription( + Integer32, + "consumer_consumer_myInt32", + self.accept_myInt32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myInt64_subscription_ = self.create_subscription( + Integer64, + "consumer_consumer_myInt64", + self.accept_myInt64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt8_subscription_ = self.create_subscription( + Unsigned8, + "consumer_consumer_myUInt8", + self.accept_myUInt8, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt16_subscription_ = self.create_subscription( + Unsigned16, + "consumer_consumer_myUInt16", + self.accept_myUInt16, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt32_subscription_ = self.create_subscription( + Unsigned32, + "consumer_consumer_myUInt32", + self.accept_myUInt32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myUInt64_subscription_ = self.create_subscription( + Unsigned64, + "consumer_consumer_myUInt64", + self.accept_myUInt64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat32_subscription_ = self.create_subscription( + Float32, + "consumer_consumer_myFloat32", + self.accept_myFloat32, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myFloat64_subscription_ = self.create_subscription( + Float64, + "consumer_consumer_myFloat64", + self.accept_myFloat64, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myEnum_subscription_ = self.create_subscription( + MyEnum, + "consumer_consumer_myEnum", + self.accept_myEnum, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myStruct_subscription_ = self.create_subscription( + MyStructi, + "consumer_consumer_myStruct", + self.accept_myStruct, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myArray1_subscription_ = self.create_subscription( + MyArrayOneDim, + "consumer_consumer_myArray1", + self.accept_myArray1, + 1, + callback_group=self.cb_group_) + + self.consumer_consumer_myArray2_subscription_ = self.create_subscription( + MyArrayUnbounded, + "consumer_consumer_myArray2", + self.accept_myArray2, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myBoolean = deque() + self.applicationIn_myBoolean = deque() + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + self.infrastructureIn_myFloat = deque() + self.applicationIn_myFloat = deque() + self.infrastructureIn_myCharacter = deque() + self.applicationIn_myCharacter = deque() + self.infrastructureIn_myString = deque() + self.applicationIn_myString = deque() + self.infrastructureIn_myInt8 = deque() + self.applicationIn_myInt8 = deque() + self.infrastructureIn_myInt16 = deque() + self.applicationIn_myInt16 = deque() + self.infrastructureIn_myInt32 = deque() + self.applicationIn_myInt32 = deque() + self.infrastructureIn_myInt64 = deque() + self.applicationIn_myInt64 = deque() + self.infrastructureIn_myUInt8 = deque() + self.applicationIn_myUInt8 = deque() + self.infrastructureIn_myUInt16 = deque() + self.applicationIn_myUInt16 = deque() + self.infrastructureIn_myUInt32 = deque() + self.applicationIn_myUInt32 = deque() + self.infrastructureIn_myUInt64 = deque() + self.applicationIn_myUInt64 = deque() + self.infrastructureIn_myFloat32 = deque() + self.applicationIn_myFloat32 = deque() + self.infrastructureIn_myFloat64 = deque() + self.applicationIn_myFloat64 = deque() + self.infrastructureIn_myEnum = deque() + self.applicationIn_myEnum = deque() + self.infrastructureIn_myStruct = deque() + self.applicationIn_myStruct = deque() + self.infrastructureIn_myArray1 = deque() + self.applicationIn_myArray1 = deque() + self.infrastructureIn_myArray2 = deque() + self.applicationIn_myArray2 = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myBoolean_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myBoolean, self.applicationIn_myBoolean) + if len(self.applicationIn_myBoolean) == 0: return + self.handle_myBoolean_base(self.applicationIn_myBoolean[0]) + self.applicationIn_myBoolean.pop() + self.sendOutputs() + + def accept_myBoolean(self, msg): + self.enqueue(self.infrastructureIn_myBoolean, msg) + thread = threading.Thread(target=self.myBoolean_thread) + thread.daemon = True + thread.start() + + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + def myFloat_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myFloat, self.applicationIn_myFloat) + if len(self.applicationIn_myFloat) == 0: return + self.handle_myFloat_base(self.applicationIn_myFloat[0]) + self.applicationIn_myFloat.pop() + self.sendOutputs() + + def accept_myFloat(self, msg): + self.enqueue(self.infrastructureIn_myFloat, msg) + thread = threading.Thread(target=self.myFloat_thread) + thread.daemon = True + thread.start() + + + def myCharacter_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myCharacter, self.applicationIn_myCharacter) + if len(self.applicationIn_myCharacter) == 0: return + self.handle_myCharacter_base(self.applicationIn_myCharacter[0]) + self.applicationIn_myCharacter.pop() + self.sendOutputs() + + def accept_myCharacter(self, msg): + self.enqueue(self.infrastructureIn_myCharacter, msg) + thread = threading.Thread(target=self.myCharacter_thread) + thread.daemon = True + thread.start() + + + def myString_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myString, self.applicationIn_myString) + if len(self.applicationIn_myString) == 0: return + self.handle_myString_base(self.applicationIn_myString[0]) + self.applicationIn_myString.pop() + self.sendOutputs() + + def accept_myString(self, msg): + self.enqueue(self.infrastructureIn_myString, msg) + thread = threading.Thread(target=self.myString_thread) + thread.daemon = True + thread.start() + + + def myInt8_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInt8, self.applicationIn_myInt8) + if len(self.applicationIn_myInt8) == 0: return + self.handle_myInt8_base(self.applicationIn_myInt8[0]) + self.applicationIn_myInt8.pop() + self.sendOutputs() + + def accept_myInt8(self, msg): + self.enqueue(self.infrastructureIn_myInt8, msg) + thread = threading.Thread(target=self.myInt8_thread) + thread.daemon = True + thread.start() + + + def myInt16_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInt16, self.applicationIn_myInt16) + if len(self.applicationIn_myInt16) == 0: return + self.handle_myInt16_base(self.applicationIn_myInt16[0]) + self.applicationIn_myInt16.pop() + self.sendOutputs() + + def accept_myInt16(self, msg): + self.enqueue(self.infrastructureIn_myInt16, msg) + thread = threading.Thread(target=self.myInt16_thread) + thread.daemon = True + thread.start() + + + def myInt32_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInt32, self.applicationIn_myInt32) + if len(self.applicationIn_myInt32) == 0: return + self.handle_myInt32_base(self.applicationIn_myInt32[0]) + self.applicationIn_myInt32.pop() + self.sendOutputs() + + def accept_myInt32(self, msg): + self.enqueue(self.infrastructureIn_myInt32, msg) + thread = threading.Thread(target=self.myInt32_thread) + thread.daemon = True + thread.start() + + + def myInt64_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInt64, self.applicationIn_myInt64) + if len(self.applicationIn_myInt64) == 0: return + self.handle_myInt64_base(self.applicationIn_myInt64[0]) + self.applicationIn_myInt64.pop() + self.sendOutputs() + + def accept_myInt64(self, msg): + self.enqueue(self.infrastructureIn_myInt64, msg) + thread = threading.Thread(target=self.myInt64_thread) + thread.daemon = True + thread.start() + + + def myUInt8_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myUInt8, self.applicationIn_myUInt8) + if len(self.applicationIn_myUInt8) == 0: return + self.handle_myUInt8_base(self.applicationIn_myUInt8[0]) + self.applicationIn_myUInt8.pop() + self.sendOutputs() + + def accept_myUInt8(self, msg): + self.enqueue(self.infrastructureIn_myUInt8, msg) + thread = threading.Thread(target=self.myUInt8_thread) + thread.daemon = True + thread.start() + + + def myUInt16_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myUInt16, self.applicationIn_myUInt16) + if len(self.applicationIn_myUInt16) == 0: return + self.handle_myUInt16_base(self.applicationIn_myUInt16[0]) + self.applicationIn_myUInt16.pop() + self.sendOutputs() + + def accept_myUInt16(self, msg): + self.enqueue(self.infrastructureIn_myUInt16, msg) + thread = threading.Thread(target=self.myUInt16_thread) + thread.daemon = True + thread.start() + + + def myUInt32_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myUInt32, self.applicationIn_myUInt32) + if len(self.applicationIn_myUInt32) == 0: return + self.handle_myUInt32_base(self.applicationIn_myUInt32[0]) + self.applicationIn_myUInt32.pop() + self.sendOutputs() + + def accept_myUInt32(self, msg): + self.enqueue(self.infrastructureIn_myUInt32, msg) + thread = threading.Thread(target=self.myUInt32_thread) + thread.daemon = True + thread.start() + + + def myUInt64_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myUInt64, self.applicationIn_myUInt64) + if len(self.applicationIn_myUInt64) == 0: return + self.handle_myUInt64_base(self.applicationIn_myUInt64[0]) + self.applicationIn_myUInt64.pop() + self.sendOutputs() + + def accept_myUInt64(self, msg): + self.enqueue(self.infrastructureIn_myUInt64, msg) + thread = threading.Thread(target=self.myUInt64_thread) + thread.daemon = True + thread.start() + + + def myFloat32_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myFloat32, self.applicationIn_myFloat32) + if len(self.applicationIn_myFloat32) == 0: return + self.handle_myFloat32_base(self.applicationIn_myFloat32[0]) + self.applicationIn_myFloat32.pop() + self.sendOutputs() + + def accept_myFloat32(self, msg): + self.enqueue(self.infrastructureIn_myFloat32, msg) + thread = threading.Thread(target=self.myFloat32_thread) + thread.daemon = True + thread.start() + + + def myFloat64_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myFloat64, self.applicationIn_myFloat64) + if len(self.applicationIn_myFloat64) == 0: return + self.handle_myFloat64_base(self.applicationIn_myFloat64[0]) + self.applicationIn_myFloat64.pop() + self.sendOutputs() + + def accept_myFloat64(self, msg): + self.enqueue(self.infrastructureIn_myFloat64, msg) + thread = threading.Thread(target=self.myFloat64_thread) + thread.daemon = True + thread.start() + + + def myEnum_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myEnum, self.applicationIn_myEnum) + if len(self.applicationIn_myEnum) == 0: return + self.handle_myEnum_base(self.applicationIn_myEnum[0]) + self.applicationIn_myEnum.pop() + self.sendOutputs() + + def accept_myEnum(self, msg): + self.enqueue(self.infrastructureIn_myEnum, msg) + thread = threading.Thread(target=self.myEnum_thread) + thread.daemon = True + thread.start() + + + def myStruct_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myStruct, self.applicationIn_myStruct) + if len(self.applicationIn_myStruct) == 0: return + self.handle_myStruct_base(self.applicationIn_myStruct[0]) + self.applicationIn_myStruct.pop() + self.sendOutputs() + + def accept_myStruct(self, msg): + self.enqueue(self.infrastructureIn_myStruct, msg) + thread = threading.Thread(target=self.myStruct_thread) + thread.daemon = True + thread.start() + + + def myArray1_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myArray1, self.applicationIn_myArray1) + if len(self.applicationIn_myArray1) == 0: return + self.handle_myArray1_base(self.applicationIn_myArray1[0]) + self.applicationIn_myArray1.pop() + self.sendOutputs() + + def accept_myArray1(self, msg): + self.enqueue(self.infrastructureIn_myArray1, msg) + thread = threading.Thread(target=self.myArray1_thread) + thread.daemon = True + thread.start() + + + def myArray2_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myArray2, self.applicationIn_myArray2) + if len(self.applicationIn_myArray2) == 0: return + self.handle_myArray2_base(self.applicationIn_myArray2[0]) + self.applicationIn_myArray2.pop() + self.sendOutputs() + + def accept_myArray2(self, msg): + self.enqueue(self.infrastructureIn_myArray2, msg) + thread = threading.Thread(target=self.myArray2_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myBoolean(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myBoolean_base(self, msg): + if type(msg) is Boolean: + self.handle_myBoolean(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myBoolean.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myFloat(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat_base(self, msg): + if type(msg) is Float64: + self.handle_myFloat(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myFloat.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myCharacter(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myCharacter_base(self, msg): + if type(msg) is Character: + self.handle_myCharacter(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myCharacter.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myString(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myString_base(self, msg): + if type(msg) is String: + self.handle_myString(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myString.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myInt8(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt8_base(self, msg): + if type(msg) is Integer8: + self.handle_myInt8(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInt8.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myInt16(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt16_base(self, msg): + if type(msg) is Integer16: + self.handle_myInt16(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInt16.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myInt32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt32_base(self, msg): + if type(msg) is Integer32: + self.handle_myInt32(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInt32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myInt64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInt64_base(self, msg): + if type(msg) is Integer64: + self.handle_myInt64(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInt64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myUInt8(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt8_base(self, msg): + if type(msg) is Unsigned8: + self.handle_myUInt8(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myUInt8.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myUInt16(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt16_base(self, msg): + if type(msg) is Unsigned16: + self.handle_myUInt16(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myUInt16.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myUInt32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt32_base(self, msg): + if type(msg) is Unsigned32: + self.handle_myUInt32(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myUInt32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myUInt64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myUInt64_base(self, msg): + if type(msg) is Unsigned64: + self.handle_myUInt64(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myUInt64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myFloat32(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat32_base(self, msg): + if type(msg) is Float32: + self.handle_myFloat32(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myFloat32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myFloat64(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myFloat64_base(self, msg): + if type(msg) is Float64: + self.handle_myFloat64(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myFloat64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myEnum(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myEnum_base(self, msg): + if type(msg) is MyEnum: + self.handle_myEnum(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myEnum.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myStruct(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myStruct_base(self, msg): + if type(msg) is MyStructi: + self.handle_myStruct(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myStruct.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myArray1(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myArray1_base(self, msg): + if type(msg) is MyArrayOneDim: + self.handle_myArray1(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myArray1.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def handle_myArray2(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myArray2_base(self, msg): + if type(msg) is MyArrayUnbounded: + self.handle_myArray2(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myArray2.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py new file mode 100644 index 000000000..51b0efb40 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/consumer_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from datatypes_system_py_pkg.user_code.consumer_consumer_src import consumer_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = consumer_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..0064b50fa --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/enum_converter.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +from datatypes_system_py_pkg_interfaces.msg import MyEnum + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = MyEnum() + typedValue.data = value + match (typedValue.my_enum): + case MyEnum.MY_ENUM_ON: + return "MyEnum On" + case MyEnum.MY_ENUM_OFF: + return "MyEnum Off" + case default: + return "Unknown value for MyEnum" + diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py new file mode 100644 index 000000000..29cf6c56d --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_base_src.py @@ -0,0 +1,422 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class producer_producer_base(Node): + def __init__(self): + super().__init__("producer_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.producer_producer_myBoolean_publisher_ = self.create_publisher( + Boolean, + "consumer_consumer_myBoolean", + 1) + + self.producer_producer_myInteger_publisher_ = self.create_publisher( + Integer64, + "consumer_consumer_myInteger", + 1) + + self.producer_producer_myFloat_publisher_ = self.create_publisher( + Float64, + "consumer_consumer_myFloat", + 1) + + self.producer_producer_myCharacter_publisher_ = self.create_publisher( + Character, + "consumer_consumer_myCharacter", + 1) + + self.producer_producer_myString_publisher_ = self.create_publisher( + String, + "consumer_consumer_myString", + 1) + + self.producer_producer_myInt8_publisher_ = self.create_publisher( + Integer8, + "consumer_consumer_myInt8", + 1) + + self.producer_producer_myInt16_publisher_ = self.create_publisher( + Integer16, + "consumer_consumer_myInt16", + 1) + + self.producer_producer_myInt32_publisher_ = self.create_publisher( + Integer32, + "consumer_consumer_myInt32", + 1) + + self.producer_producer_myInt64_publisher_ = self.create_publisher( + Integer64, + "consumer_consumer_myInt64", + 1) + + self.producer_producer_myUInt8_publisher_ = self.create_publisher( + Unsigned8, + "consumer_consumer_myUInt8", + 1) + + self.producer_producer_myUInt16_publisher_ = self.create_publisher( + Unsigned16, + "consumer_consumer_myUInt16", + 1) + + self.producer_producer_myUInt32_publisher_ = self.create_publisher( + Unsigned32, + "consumer_consumer_myUInt32", + 1) + + self.producer_producer_myUInt64_publisher_ = self.create_publisher( + Unsigned64, + "consumer_consumer_myUInt64", + 1) + + self.producer_producer_myFloat32_publisher_ = self.create_publisher( + Float32, + "consumer_consumer_myFloat32", + 1) + + self.producer_producer_myFloat64_publisher_ = self.create_publisher( + Float64, + "consumer_consumer_myFloat64", + 1) + + self.producer_producer_myEnum_publisher_ = self.create_publisher( + MyEnum, + "consumer_consumer_myEnum", + 1) + + self.producer_producer_myStruct_publisher_ = self.create_publisher( + MyStructi, + "consumer_consumer_myStruct", + 1) + + self.producer_producer_myArray1_publisher_ = self.create_publisher( + MyArrayOneDim, + "consumer_consumer_myArray1", + 1) + + self.producer_producer_myArray2_publisher_ = self.create_publisher( + MyArrayUnbounded, + "consumer_consumer_myArray2", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myBoolean = deque() + self.applicationOut_myBoolean = deque() + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + self.infrastructureOut_myFloat = deque() + self.applicationOut_myFloat = deque() + self.infrastructureOut_myCharacter = deque() + self.applicationOut_myCharacter = deque() + self.infrastructureOut_myString = deque() + self.applicationOut_myString = deque() + self.infrastructureOut_myInt8 = deque() + self.applicationOut_myInt8 = deque() + self.infrastructureOut_myInt16 = deque() + self.applicationOut_myInt16 = deque() + self.infrastructureOut_myInt32 = deque() + self.applicationOut_myInt32 = deque() + self.infrastructureOut_myInt64 = deque() + self.applicationOut_myInt64 = deque() + self.infrastructureOut_myUInt8 = deque() + self.applicationOut_myUInt8 = deque() + self.infrastructureOut_myUInt16 = deque() + self.applicationOut_myUInt16 = deque() + self.infrastructureOut_myUInt32 = deque() + self.applicationOut_myUInt32 = deque() + self.infrastructureOut_myUInt64 = deque() + self.applicationOut_myUInt64 = deque() + self.infrastructureOut_myFloat32 = deque() + self.applicationOut_myFloat32 = deque() + self.infrastructureOut_myFloat64 = deque() + self.applicationOut_myFloat64 = deque() + self.infrastructureOut_myEnum = deque() + self.applicationOut_myEnum = deque() + self.infrastructureOut_myStruct = deque() + self.applicationOut_myStruct = deque() + self.infrastructureOut_myArray1 = deque() + self.applicationOut_myArray1 = deque() + self.infrastructureOut_myArray2 = deque() + self.applicationOut_myArray2 = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myBoolean, self.infrastructureOut_myBoolean, self.sendOut_myBoolean], + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger], + [self.applicationOut_myFloat, self.infrastructureOut_myFloat, self.sendOut_myFloat], + [self.applicationOut_myCharacter, self.infrastructureOut_myCharacter, self.sendOut_myCharacter], + [self.applicationOut_myString, self.infrastructureOut_myString, self.sendOut_myString], + [self.applicationOut_myInt8, self.infrastructureOut_myInt8, self.sendOut_myInt8], + [self.applicationOut_myInt16, self.infrastructureOut_myInt16, self.sendOut_myInt16], + [self.applicationOut_myInt32, self.infrastructureOut_myInt32, self.sendOut_myInt32], + [self.applicationOut_myInt64, self.infrastructureOut_myInt64, self.sendOut_myInt64], + [self.applicationOut_myUInt8, self.infrastructureOut_myUInt8, self.sendOut_myUInt8], + [self.applicationOut_myUInt16, self.infrastructureOut_myUInt16, self.sendOut_myUInt16], + [self.applicationOut_myUInt32, self.infrastructureOut_myUInt32, self.sendOut_myUInt32], + [self.applicationOut_myUInt64, self.infrastructureOut_myUInt64, self.sendOut_myUInt64], + [self.applicationOut_myFloat32, self.infrastructureOut_myFloat32, self.sendOut_myFloat32], + [self.applicationOut_myFloat64, self.infrastructureOut_myFloat64, self.sendOut_myFloat64], + [self.applicationOut_myEnum, self.infrastructureOut_myEnum, self.sendOut_myEnum], + [self.applicationOut_myStruct, self.infrastructureOut_myStruct, self.sendOut_myStruct], + [self.applicationOut_myArray1, self.infrastructureOut_myArray1, self.sendOut_myArray1], + [self.applicationOut_myArray2, self.infrastructureOut_myArray2, self.sendOut_myArray2] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myBoolean(self, msg): + if type(msg) is Boolean: + self.producer_producer_myBoolean_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myBoolean.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.producer_producer_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myFloat(self, msg): + if type(msg) is Float64: + self.producer_producer_myFloat_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myFloat.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myCharacter(self, msg): + if type(msg) is Character: + self.producer_producer_myCharacter_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myCharacter.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myString(self, msg): + if type(msg) is String: + self.producer_producer_myString_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myString.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myInt8(self, msg): + if type(msg) is Integer8: + self.producer_producer_myInt8_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInt8.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myInt16(self, msg): + if type(msg) is Integer16: + self.producer_producer_myInt16_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInt16.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myInt32(self, msg): + if type(msg) is Integer32: + self.producer_producer_myInt32_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInt32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myInt64(self, msg): + if type(msg) is Integer64: + self.producer_producer_myInt64_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInt64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myUInt8(self, msg): + if type(msg) is Unsigned8: + self.producer_producer_myUInt8_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myUInt8.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myUInt16(self, msg): + if type(msg) is Unsigned16: + self.producer_producer_myUInt16_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myUInt16.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myUInt32(self, msg): + if type(msg) is Unsigned32: + self.producer_producer_myUInt32_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myUInt32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myUInt64(self, msg): + if type(msg) is Unsigned64: + self.producer_producer_myUInt64_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myUInt64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myFloat32(self, msg): + if type(msg) is Float32: + self.producer_producer_myFloat32_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myFloat32.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myFloat64(self, msg): + if type(msg) is Float64: + self.producer_producer_myFloat64_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myFloat64.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myEnum(self, msg): + if type(msg) is MyEnum: + self.producer_producer_myEnum_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myEnum.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myStruct(self, msg): + if type(msg) is MyStructi: + self.producer_producer_myStruct_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myStruct.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myArray1(self, msg): + if type(msg) is MyArrayOneDim: + self.producer_producer_myArray1_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myArray1.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_myArray2(self, msg): + if type(msg) is MyArrayUnbounded: + self.producer_producer_myArray2_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myArray2.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myBoolean(self, msg): + self.enqueue(self.applicationOut_myBoolean, msg) + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def put_myFloat(self, msg): + self.enqueue(self.applicationOut_myFloat, msg) + + def put_myCharacter(self, msg): + self.enqueue(self.applicationOut_myCharacter, msg) + + def put_myString(self, msg): + self.enqueue(self.applicationOut_myString, msg) + + def put_myInt8(self, msg): + self.enqueue(self.applicationOut_myInt8, msg) + + def put_myInt16(self, msg): + self.enqueue(self.applicationOut_myInt16, msg) + + def put_myInt32(self, msg): + self.enqueue(self.applicationOut_myInt32, msg) + + def put_myInt64(self, msg): + self.enqueue(self.applicationOut_myInt64, msg) + + def put_myUInt8(self, msg): + self.enqueue(self.applicationOut_myUInt8, msg) + + def put_myUInt16(self, msg): + self.enqueue(self.applicationOut_myUInt16, msg) + + def put_myUInt32(self, msg): + self.enqueue(self.applicationOut_myUInt32, msg) + + def put_myUInt64(self, msg): + self.enqueue(self.applicationOut_myUInt64, msg) + + def put_myFloat32(self, msg): + self.enqueue(self.applicationOut_myFloat32, msg) + + def put_myFloat64(self, msg): + self.enqueue(self.applicationOut_myFloat64, msg) + + def put_myEnum(self, msg): + self.enqueue(self.applicationOut_myEnum, msg) + + def put_myStruct(self, msg): + self.enqueue(self.applicationOut_myStruct, msg) + + def put_myArray1(self, msg): + self.enqueue(self.applicationOut_myArray1, msg) + + def put_myArray2(self, msg): + self.enqueue(self.applicationOut_myArray2, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py new file mode 100644 index 000000000..e7da22227 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/base_code/producer_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from datatypes_system_py_pkg.user_code.producer_producer_src import producer_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = producer_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py new file mode 100644 index 000000000..b8c55446e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/consumer_consumer_src.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from datatypes_system_py_pkg.base_code.consumer_consumer_base_src import consumer_consumer_base +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded +from datatypes_system_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class consumer_consumer(consumer_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("consumer_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myBoolean(self, msg): + # Handle myBoolean msg + self.get_logger().info(f"Received myBoolean: {self.message_to_string(msg)}") + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + def handle_myFloat(self, msg): + # Handle myFloat msg + self.get_logger().info(f"Received myFloat: {self.message_to_string(msg)}") + + def handle_myCharacter(self, msg): + # Handle myCharacter msg + self.get_logger().info(f"Received myCharacter: {self.message_to_string(msg)}") + + def handle_myString(self, msg): + # Handle myString msg + self.get_logger().info(f"Received myString: {self.message_to_string(msg)}") + + def handle_myInt8(self, msg): + # Handle myInt8 msg + self.get_logger().info(f"Received myInt8: {self.message_to_string(msg)}") + + def handle_myInt16(self, msg): + # Handle myInt16 msg + self.get_logger().info(f"Received myInt16: {self.message_to_string(msg)}") + + def handle_myInt32(self, msg): + # Handle myInt32 msg + self.get_logger().info(f"Received myInt32: {self.message_to_string(msg)}") + + def handle_myInt64(self, msg): + # Handle myInt64 msg + self.get_logger().info(f"Received myInt64: {self.message_to_string(msg)}") + + def handle_myUInt8(self, msg): + # Handle myUInt8 msg + self.get_logger().info(f"Received myUInt8: {self.message_to_string(msg)}") + + def handle_myUInt16(self, msg): + # Handle myUInt16 msg + self.get_logger().info(f"Received myUInt16: {self.message_to_string(msg)}") + + def handle_myUInt32(self, msg): + # Handle myUInt32 msg + self.get_logger().info(f"Received myUInt32: {self.message_to_string(msg)}") + + def handle_myUInt64(self, msg): + # Handle myUInt64 msg + self.get_logger().info(f"Received myUInt64: {self.message_to_string(msg)}") + + def handle_myFloat32(self, msg): + # Handle myFloat32 msg + self.get_logger().info(f"Received myFloat32: {self.message_to_string(msg)}") + + def handle_myFloat64(self, msg): + # Handle myFloat64 msg + self.get_logger().info(f"Received myFloat64: {self.message_to_string(msg)}") + + def handle_myEnum(self, msg): + # Handle myEnum msg + self.get_logger().info(f"Received myEnum: {self.message_to_string(msg)}") + + def handle_myStruct(self, msg): + # Handle myStruct msg + self.get_logger().info(f"Received myStruct: {self.message_to_string(msg)}") + + def handle_myArray1(self, msg): + # Handle myArray1 msg + self.get_logger().info(f"Received myArray1: {self.message_to_string(msg)}") + + def handle_myArray2(self, msg): + # Handle myArray2 msg + self.get_logger().info(f"Received myArray2: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py new file mode 100644 index 000000000..e287d285f --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/datatypes_system_py_pkg/user_code/producer_producer_src.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from datatypes_system_py_pkg.base_code.producer_producer_base_src import producer_producer_base +from datatypes_system_py_pkg_interfaces.msg import Boolean +from datatypes_system_py_pkg_interfaces.msg import Integer64 +from datatypes_system_py_pkg_interfaces.msg import Float64 +from datatypes_system_py_pkg_interfaces.msg import Character +from datatypes_system_py_pkg_interfaces.msg import String +from datatypes_system_py_pkg_interfaces.msg import Integer8 +from datatypes_system_py_pkg_interfaces.msg import Integer16 +from datatypes_system_py_pkg_interfaces.msg import Integer32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned8 +from datatypes_system_py_pkg_interfaces.msg import Unsigned16 +from datatypes_system_py_pkg_interfaces.msg import Unsigned32 +from datatypes_system_py_pkg_interfaces.msg import Unsigned64 +from datatypes_system_py_pkg_interfaces.msg import Float32 +from datatypes_system_py_pkg_interfaces.msg import MyEnum +from datatypes_system_py_pkg_interfaces.msg import MyStructi +from datatypes_system_py_pkg_interfaces.msg import MyArrayOneDim +from datatypes_system_py_pkg_interfaces.msg import MyArrayUnbounded +from datatypes_system_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class producer_producer(producer_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("producer_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myBoolean = Boolean() + self.put_myBoolean(myBoolean) + + myInteger = Integer64() + self.put_myInteger(myInteger) + + myFloat = Float64() + self.put_myFloat(myFloat) + + myCharacter = Character() + self.put_myCharacter(myCharacter) + + myString = String() + self.put_myString(myString) + + myInt8 = Integer8() + self.put_myInt8(myInt8) + + myInt16 = Integer16() + self.put_myInt16(myInt16) + + myInt32 = Integer32() + self.put_myInt32(myInt32) + + myInt64 = Integer64() + self.put_myInt64(myInt64) + + myUInt8 = Unsigned8() + self.put_myUInt8(myUInt8) + + myUInt16 = Unsigned16() + self.put_myUInt16(myUInt16) + + myUInt32 = Unsigned32() + self.put_myUInt32(myUInt32) + + myUInt64 = Unsigned64() + self.put_myUInt64(myUInt64) + + myFloat32 = Float32() + self.put_myFloat32(myFloat32) + + myFloat64 = Float64() + self.put_myFloat64(myFloat64) + + myEnum = MyEnum() + self.put_myEnum(myEnum) + + myStruct = MyStructi() + self.put_myStruct(myStruct) + + myArray1 = MyArrayOneDim() + self.put_myArray1(myArray1) + + myArray2 = MyArrayUnbounded() + self.put_myArray2(myArray2) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/package.xml b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/package.xml new file mode 100644 index 000000000..84db30a4b --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + datatypes_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + datatypes_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/resource/datatypes_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.cfg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.cfg new file mode 100644 index 000000000..582e1f3fb --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/datatypes_system_py_pkg +[develop] +script_dir=$base/lib/datatypes_system_py_pkg +[install] +install_scripts=$base/lib/datatypes_system_py_pkg diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.py new file mode 100644 index 000000000..c4ae5a449 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/setup.py @@ -0,0 +1,29 @@ +# setup.py in src/datatypes_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'datatypes_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "producer_producer_exe = datatypes_system_py_pkg.base_code.producer_producer_runner:main", + "consumer_consumer_exe = datatypes_system_py_pkg.base_code.consumer_consumer_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..60565bf01 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(datatypes_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..c9db37cda --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,25 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + producer_producer_node = Node( + package = "datatypes_system_py_pkg", + executable = "producer_producer_exe" + ) + + consumer_consumer_node = Node( + package = "datatypes_system_py_pkg", + executable = "consumer_consumer_exe" + ) + + ld.add_action(producer_producer_node) + ld.add_action(consumer_consumer_node) + + return ld diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..941a1ef43 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + datatypes_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + datatypes_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..abed80967 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.8) +project(datatypes_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Boolean.msg + msg/Integer64.msg + msg/Float64.msg + msg/Character.msg + msg/String.msg + msg/Integer8.msg + msg/Integer16.msg + msg/Integer32.msg + msg/Unsigned8.msg + msg/Unsigned16.msg + msg/Unsigned32.msg + msg/Unsigned64.msg + msg/Float32.msg + msg/MyEnum.msg + msg/MyStruct2i.msg + msg/MyArrayOneDim.msg + msg/MyArrayUnbounded.msg + msg/MyStructi.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Character.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Character.msg new file mode 100644 index 000000000..39a1d46a9 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Character.msg @@ -0,0 +1 @@ +char data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg new file mode 100644 index 000000000..cd09d39b8 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Float64.msg @@ -0,0 +1 @@ +float64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg new file mode 100644 index 000000000..28b7bef9e --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer16.msg @@ -0,0 +1 @@ +int16 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg new file mode 100644 index 000000000..0ecfe35f5 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer32.msg @@ -0,0 +1 @@ +int32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg new file mode 100644 index 000000000..eef7d19b9 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Integer8.msg @@ -0,0 +1 @@ +int8 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg new file mode 100644 index 000000000..3679c5865 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayOneDim.msg @@ -0,0 +1 @@ +Integer64[10] arr \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg new file mode 100644 index 000000000..5d32f8e13 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyArrayUnbounded.msg @@ -0,0 +1 @@ +Integer64[] arr \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg new file mode 100644 index 000000000..1d7ab4a14 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyEnum.msg @@ -0,0 +1,3 @@ +uint8 my_enum +uint8 MY_ENUM_ON=0 +uint8 MY_ENUM_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg new file mode 100644 index 000000000..f695fd8a4 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStruct2i.msg @@ -0,0 +1,2 @@ +Float64 field_float +Character field_s_char \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg new file mode 100644 index 000000000..e07f88749 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/MyStructi.msg @@ -0,0 +1,6 @@ +Integer64 field_int64 +String field_str +MyEnum field_enum +MyStruct2i field_rec +MyArrayOneDim field_array +MyArrayUnbounded field_array_unbounded \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/String.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/String.msg new file mode 100644 index 000000000..44e5aaf86 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/String.msg @@ -0,0 +1 @@ +string data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg new file mode 100644 index 000000000..eec391bfb --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned16.msg @@ -0,0 +1 @@ +uint16 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg new file mode 100644 index 000000000..b6c696b42 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned32.msg @@ -0,0 +1 @@ +uint32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg new file mode 100644 index 000000000..2eb1afad3 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned64.msg @@ -0,0 +1 @@ +uint64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg new file mode 100644 index 000000000..498f60988 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/msg/Unsigned8.msg @@ -0,0 +1 @@ +uint8 data \ No newline at end of file diff --git a/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..ec718a2d1 --- /dev/null +++ b/resources/expected/ros2/python-datatype-examples/strict/src/datatypes_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + datatypes_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py new file mode 100644 index 000000000..cc82d7e4a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_consumer_base(Node): + def __init__(self): + super().__init__("fanIn_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_consumer_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanIn_consumer_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py new file mode 100644 index 000000000..9ede1544f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import fanIn_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py new file mode 100644 index 000000000..8a6b6ee64 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer1_base(Node): + def __init__(self): + super().__init__("fanIn_producer1") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_producer1_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_consumer_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanIn_producer1_myInteger_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py new file mode 100644 index 000000000..37092de01 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer1_src import fanIn_producer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py new file mode 100644 index 000000000..85ae1da69 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer2_base(Node): + def __init__(self): + super().__init__("fanIn_producer2") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_producer2_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_consumer_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanIn_producer2_myInteger_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py new file mode 100644 index 000000000..273f79c9a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer2_src import fanIn_producer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py new file mode 100644 index 000000000..1c61e783f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer1_base(Node): + def __init__(self): + super().__init__("fanOut_consumer1") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_consumer1_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_consumer1_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py new file mode 100644 index 000000000..b45f071dc --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import fanOut_consumer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py new file mode 100644 index 000000000..66a622627 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer2_base(Node): + def __init__(self): + super().__init__("fanOut_consumer2") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_consumer2_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_consumer2_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py new file mode 100644 index 000000000..771b13baf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import fanOut_consumer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py new file mode 100644 index 000000000..be973c54e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_producer_base(Node): + def __init__(self): + super().__init__("fanOut_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_producer_myInteger_publisher_1 = self.create_publisher( + Integer64, + "fanOut_consumer1_myInteger", + 1) + + self.fanOut_producer_myInteger_publisher_2 = self.create_publisher( + Integer64, + "fanOut_consumer2_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanOut_producer_myInteger_publisher_1.publish(msg) + self.fanOut_producer_myInteger_publisher_2.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py new file mode 100644 index 000000000..36e6c97d2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_producer_src import fanOut_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py new file mode 100644 index 000000000..f9b3efe05 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_base_src import fanIn_consumer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_consumer(fanIn_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py new file mode 100644 index 000000000..cab202331 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_base_src import fanIn_producer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer1(fanIn_producer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py new file mode 100644 index 000000000..7f16fe979 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_base_src import fanIn_producer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer2(fanIn_producer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py new file mode 100644 index 000000000..7b4f98097 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_base_src import fanOut_consumer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer1(fanOut_consumer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py new file mode 100644 index 000000000..7400c9d85 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_base_src import fanOut_consumer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer2(fanOut_consumer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py new file mode 100644 index 000000000..e0b8706ad --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_base_src import fanOut_producer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_producer(fanOut_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/package.xml b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/package.xml new file mode 100644 index 000000000..0bd3d8e5a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + fan_in_fan_out_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + fan_in_fan_out_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg new file mode 100644 index 000000000..716fb99fe --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/fan_in_fan_out_system_py_pkg +[develop] +script_dir=$base/lib/fan_in_fan_out_system_py_pkg +[install] +install_scripts=$base/lib/fan_in_fan_out_system_py_pkg diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.py new file mode 100644 index 000000000..82fed3b3e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/setup.py @@ -0,0 +1,33 @@ +# setup.py in src/fan_in_fan_out_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'fan_in_fan_out_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "fanIn_producer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_runner:main", + "fanIn_producer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_runner:main", + "fanIn_consumer_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_runner:main", + "fanOut_producer_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_runner:main", + "fanOut_consumer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_runner:main", + "fanOut_consumer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..bf77748ca --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..3a92bf73f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,49 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + fanIn_producer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer1_exe" + ) + + fanIn_producer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer2_exe" + ) + + fanIn_consumer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_consumer_exe" + ) + + fanOut_producer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_producer_exe" + ) + + fanOut_consumer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer1_exe" + ) + + fanOut_consumer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer2_exe" + ) + + ld.add_action(fanIn_producer1_node) + ld.add_action(fanIn_producer2_node) + ld.add_action(fanIn_consumer_node) + ld.add_action(fanOut_producer_node) + ld.add_action(fanOut_consumer1_node) + ld.add_action(fanOut_consumer2_node) + + return ld diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..e61722118 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + fan_in_fan_out_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + fan_in_fan_out_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f98ffff4c --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Integer64.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..289bcb4f4 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + fan_in_fan_out_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py new file mode 100644 index 000000000..6f4a1cf19 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_consumer_base(Node): + def __init__(self): + super().__init__("fanIn_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_consumer_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanIn_consumer_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py new file mode 100644 index 000000000..9ede1544f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import fanIn_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py new file mode 100644 index 000000000..655210be5 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer1_base(Node): + def __init__(self): + super().__init__("fanIn_producer1") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_producer1_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_consumer_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanIn_producer1_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py new file mode 100644 index 000000000..37092de01 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer1_src import fanIn_producer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py new file mode 100644 index 000000000..257076d2c --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer2_base(Node): + def __init__(self): + super().__init__("fanIn_producer2") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_producer2_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_consumer_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanIn_producer2_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py new file mode 100644 index 000000000..273f79c9a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer2_src import fanIn_producer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py new file mode 100644 index 000000000..d1332421b --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer1_base(Node): + def __init__(self): + super().__init__("fanOut_consumer1") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_consumer1_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_consumer1_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py new file mode 100644 index 000000000..b45f071dc --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import fanOut_consumer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py new file mode 100644 index 000000000..040c7faf2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer2_base(Node): + def __init__(self): + super().__init__("fanOut_consumer2") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_consumer2_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_consumer2_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py new file mode 100644 index 000000000..771b13baf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import fanOut_consumer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py new file mode 100644 index 000000000..505918908 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_producer_base(Node): + def __init__(self): + super().__init__("fanOut_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_producer_myInteger_publisher_1 = self.create_publisher( + Integer64, + "fanOut_consumer1_myInteger", + 1) + + self.fanOut_producer_myInteger_publisher_2 = self.create_publisher( + Integer64, + "fanOut_consumer2_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanOut_producer_myInteger_publisher_1.publish(msg) + self.fanOut_producer_myInteger_publisher_2.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py new file mode 100644 index 000000000..36e6c97d2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_producer_src import fanOut_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py new file mode 100644 index 000000000..f9b3efe05 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_base_src import fanIn_consumer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_consumer(fanIn_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py new file mode 100644 index 000000000..cab202331 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_base_src import fanIn_producer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer1(fanIn_producer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py new file mode 100644 index 000000000..7f16fe979 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_base_src import fanIn_producer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer2(fanIn_producer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py new file mode 100644 index 000000000..7b4f98097 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_base_src import fanOut_consumer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer1(fanOut_consumer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py new file mode 100644 index 000000000..7400c9d85 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_base_src import fanOut_consumer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer2(fanOut_consumer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py new file mode 100644 index 000000000..e0b8706ad --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_base_src import fanOut_producer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_producer(fanOut_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/package.xml b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/package.xml new file mode 100644 index 000000000..0bd3d8e5a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + fan_in_fan_out_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + fan_in_fan_out_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg new file mode 100644 index 000000000..716fb99fe --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/fan_in_fan_out_system_py_pkg +[develop] +script_dir=$base/lib/fan_in_fan_out_system_py_pkg +[install] +install_scripts=$base/lib/fan_in_fan_out_system_py_pkg diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.py new file mode 100644 index 000000000..82fed3b3e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/setup.py @@ -0,0 +1,33 @@ +# setup.py in src/fan_in_fan_out_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'fan_in_fan_out_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "fanIn_producer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_runner:main", + "fanIn_producer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_runner:main", + "fanIn_consumer_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_runner:main", + "fanOut_producer_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_runner:main", + "fanOut_consumer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_runner:main", + "fanOut_consumer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..bf77748ca --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..3a92bf73f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,49 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + fanIn_producer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer1_exe" + ) + + fanIn_producer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer2_exe" + ) + + fanIn_consumer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_consumer_exe" + ) + + fanOut_producer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_producer_exe" + ) + + fanOut_consumer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer1_exe" + ) + + fanOut_consumer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer2_exe" + ) + + ld.add_action(fanIn_producer1_node) + ld.add_action(fanIn_producer2_node) + ld.add_action(fanIn_consumer_node) + ld.add_action(fanOut_producer_node) + ld.add_action(fanOut_consumer1_node) + ld.add_action(fanOut_consumer2_node) + + return ld diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..e61722118 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + fan_in_fan_out_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + fan_in_fan_out_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f98ffff4c --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Integer64.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..289bcb4f4 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + fan_in_fan_out_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py new file mode 100644 index 000000000..d58419a69 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_consumer_base(Node): + def __init__(self): + super().__init__("fanIn_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_consumer_myInteger_subscription_1 = self.create_subscription( + Integer64, + "fanIn_producer1_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + self.fanIn_consumer_myInteger_subscription_2 = self.create_subscription( + Integer64, + "fanIn_producer2_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py new file mode 100644 index 000000000..9ede1544f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import fanIn_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py new file mode 100644 index 000000000..5075b1ac4 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer1_base(Node): + def __init__(self): + super().__init__("fanIn_producer1") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_producer1_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_producer1_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanIn_producer1_myInteger_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py new file mode 100644 index 000000000..37092de01 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer1_src import fanIn_producer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py new file mode 100644 index 000000000..a610b1cdf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer2_base(Node): + def __init__(self): + super().__init__("fanIn_producer2") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanIn_producer2_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_producer2_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanIn_producer2_myInteger_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py new file mode 100644 index 000000000..273f79c9a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer2_src import fanIn_producer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py new file mode 100644 index 000000000..1248b9ab2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer1_base(Node): + def __init__(self): + super().__init__("fanOut_consumer1") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_consumer1_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_producer_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py new file mode 100644 index 000000000..b45f071dc --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import fanOut_consumer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py new file mode 100644 index 000000000..4d19936f3 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer2_base(Node): + def __init__(self): + super().__init__("fanOut_consumer2") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_consumer2_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_producer_myInteger", + self.handle_myInteger, + 1, + callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py new file mode 100644 index 000000000..771b13baf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import fanOut_consumer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py new file mode 100644 index 000000000..085454703 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_producer_base(Node): + def __init__(self): + super().__init__("fanOut_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.fanOut_producer_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanOut_producer_myInteger", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def put_myInteger(self, msg): + self.fanOut_producer_myInteger_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py new file mode 100644 index 000000000..36e6c97d2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_producer_src import fanOut_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py new file mode 100644 index 000000000..f9b3efe05 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_base_src import fanIn_consumer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_consumer(fanIn_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py new file mode 100644 index 000000000..cab202331 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_base_src import fanIn_producer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer1(fanIn_producer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py new file mode 100644 index 000000000..7f16fe979 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_base_src import fanIn_producer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer2(fanIn_producer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py new file mode 100644 index 000000000..7b4f98097 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_base_src import fanOut_consumer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer1(fanOut_consumer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py new file mode 100644 index 000000000..7400c9d85 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_base_src import fanOut_consumer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer2(fanOut_consumer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py new file mode 100644 index 000000000..e0b8706ad --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_base_src import fanOut_producer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_producer(fanOut_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/package.xml new file mode 100644 index 000000000..0bd3d8e5a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + fan_in_fan_out_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + fan_in_fan_out_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg new file mode 100644 index 000000000..716fb99fe --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/fan_in_fan_out_system_py_pkg +[develop] +script_dir=$base/lib/fan_in_fan_out_system_py_pkg +[install] +install_scripts=$base/lib/fan_in_fan_out_system_py_pkg diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.py new file mode 100644 index 000000000..82fed3b3e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/setup.py @@ -0,0 +1,33 @@ +# setup.py in src/fan_in_fan_out_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'fan_in_fan_out_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "fanIn_producer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_runner:main", + "fanIn_producer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_runner:main", + "fanIn_consumer_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_runner:main", + "fanOut_producer_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_runner:main", + "fanOut_consumer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_runner:main", + "fanOut_consumer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..bf77748ca --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..3a92bf73f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,49 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + fanIn_producer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer1_exe" + ) + + fanIn_producer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer2_exe" + ) + + fanIn_consumer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_consumer_exe" + ) + + fanOut_producer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_producer_exe" + ) + + fanOut_consumer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer1_exe" + ) + + fanOut_consumer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer2_exe" + ) + + ld.add_action(fanIn_producer1_node) + ld.add_action(fanIn_producer2_node) + ld.add_action(fanIn_consumer_node) + ld.add_action(fanOut_producer_node) + ld.add_action(fanOut_consumer1_node) + ld.add_action(fanOut_consumer2_node) + + return ld diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..e61722118 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + fan_in_fan_out_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + fan_in_fan_out_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f98ffff4c --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Integer64.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..289bcb4f4 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/lax/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + fan_in_fan_out_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py new file mode 100644 index 000000000..86643c12d --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_base_src.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_consumer_base(Node): + def __init__(self): + super().__init__("fanIn_consumer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_consumer_myInteger_subscription_1 = self.create_subscription( + Integer64, + "fanIn_producer1_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.fanIn_consumer_myInteger_subscription_2 = self.create_subscription( + Integer64, + "fanIn_producer2_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py new file mode 100644 index 000000000..9ede1544f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_consumer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_consumer_src import fanIn_consumer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_consumer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py new file mode 100644 index 000000000..9e93bd200 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_base_src.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer1_base(Node): + def __init__(self): + super().__init__("fanIn_producer1") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_producer1_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_producer1_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanIn_producer1_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py new file mode 100644 index 000000000..37092de01 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer1_src import fanIn_producer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py new file mode 100644 index 000000000..426fab014 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_base_src.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanIn_producer2_base(Node): + def __init__(self): + super().__init__("fanIn_producer2") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanIn_producer2_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanIn_producer2_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanIn_producer2_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py new file mode 100644 index 000000000..273f79c9a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanIn_producer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanIn_producer2_src import fanIn_producer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanIn_producer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py new file mode 100644 index 000000000..7819b4be3 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer1_base(Node): + def __init__(self): + super().__init__("fanOut_consumer1") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_consumer1_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_producer_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py new file mode 100644 index 000000000..b45f071dc --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer1_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer1_src import fanOut_consumer1 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer1() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py new file mode 100644 index 000000000..63f667acf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_base_src.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_consumer2_base(Node): + def __init__(self): + super().__init__("fanOut_consumer2") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_consumer2_myInteger_subscription_ = self.create_subscription( + Integer64, + "fanOut_producer_myInteger", + self.accept_myInteger, + 1, + callback_group=self.cb_group_) + + self.infrastructureIn_myInteger = deque() + self.applicationIn_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def myInteger_thread(self): + with self.lock_: + self.receiveInputs(self.infrastructureIn_myInteger, self.applicationIn_myInteger) + if len(self.applicationIn_myInteger) == 0: return + self.handle_myInteger_base(self.applicationIn_myInteger[0]) + self.applicationIn_myInteger.pop() + self.sendOutputs() + + def accept_myInteger(self, msg): + self.enqueue(self.infrastructureIn_myInteger, msg) + thread = threading.Thread(target=self.myInteger_thread) + thread.daemon = True + thread.start() + + + #================================================= + # C o m p u t e E n t r y P o i n t + #================================================= + def handle_myInteger(self, msg): + raise NotImplementedError("Subclasses must implement this method") + + def handle_myInteger_base(self, msg): + if type(msg) is Integer64: + self.handle_myInteger(msg) + else: + self.get_logger.error("Receiving wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + + def receiveInputs(self, infrastructureQueue, applicationQueue): + if not(len(infrastructureQueue) == 0): + eventMsg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(applicationQueue, eventMsg) + + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py new file mode 100644 index 000000000..771b13baf --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_consumer2_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_consumer2_src import fanOut_consumer2 +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_consumer2() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py new file mode 100644 index 000000000..8e317e552 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_base_src.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class fanOut_producer_base(Node): + def __init__(self): + super().__init__("fanOut_producer") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.fanOut_producer_myInteger_publisher_ = self.create_publisher( + Integer64, + "fanOut_producer_myInteger", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureOut_myInteger = deque() + self.applicationOut_myInteger = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_myInteger, self.infrastructureOut_myInteger, self.sendOut_myInteger] + ] + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def sendOut_myInteger(self, msg): + if type(msg) is Integer64: + self.fanOut_producer_myInteger_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port myInteger.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_myInteger(self, msg): + self.enqueue(self.applicationOut_myInteger, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py new file mode 100644 index 000000000..36e6c97d2 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/base_code/fanOut_producer_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from fan_in_fan_out_system_py_pkg.user_code.fanOut_producer_src import fanOut_producer +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = fanOut_producer() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py new file mode 100644 index 000000000..f9b3efe05 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_consumer_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_base_src import fanIn_consumer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_consumer(fanIn_consumer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_consumer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py new file mode 100644 index 000000000..cab202331 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer1_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_base_src import fanIn_producer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer1(fanIn_producer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py new file mode 100644 index 000000000..7f16fe979 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanIn_producer2_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_base_src import fanIn_producer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanIn_producer2(fanIn_producer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanIn_producer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py new file mode 100644 index 000000000..7b4f98097 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer1_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_base_src import fanOut_consumer1_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer1(fanOut_consumer1_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer1 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py new file mode 100644 index 000000000..7400c9d85 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_consumer2_src.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_base_src import fanOut_consumer2_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_consumer2(fanOut_consumer2_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_consumer2 infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def handle_myInteger(self, msg): + # Handle myInteger msg + self.get_logger().info(f"Received myInteger: {self.message_to_string(msg)}") + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py new file mode 100644 index 000000000..e0b8706ad --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/fan_in_fan_out_system_py_pkg/user_code/fanOut_producer_src.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_base_src import fanOut_producer_base +from fan_in_fan_out_system_py_pkg_interfaces.msg import Integer64 + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class fanOut_producer(fanOut_producer_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("fanOut_producer infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example publishing messages + myInteger = Integer64() + self.put_myInteger(myInteger) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/package.xml new file mode 100644 index 000000000..0bd3d8e5a --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + fan_in_fan_out_system_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + fan_in_fan_out_system_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/resource/fan_in_fan_out_system_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg new file mode 100644 index 000000000..716fb99fe --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/fan_in_fan_out_system_py_pkg +[develop] +script_dir=$base/lib/fan_in_fan_out_system_py_pkg +[install] +install_scripts=$base/lib/fan_in_fan_out_system_py_pkg diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.py new file mode 100644 index 000000000..82fed3b3e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/setup.py @@ -0,0 +1,33 @@ +# setup.py in src/fan_in_fan_out_system_py_pkg + +from setuptools import find_packages, setup + +package_name = 'fan_in_fan_out_system_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "fanIn_producer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer1_runner:main", + "fanIn_producer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_producer2_runner:main", + "fanIn_consumer_exe = fan_in_fan_out_system_py_pkg.base_code.fanIn_consumer_runner:main", + "fanOut_producer_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_producer_runner:main", + "fanOut_consumer1_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer1_runner:main", + "fanOut_consumer2_exe = fan_in_fan_out_system_py_pkg.base_code.fanOut_consumer2_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..bf77748ca --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py new file mode 100644 index 000000000..3a92bf73f --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/launch/Sys_i_Instance.launch.py @@ -0,0 +1,49 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + fanIn_producer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer1_exe" + ) + + fanIn_producer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_producer2_exe" + ) + + fanIn_consumer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanIn_consumer_exe" + ) + + fanOut_producer_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_producer_exe" + ) + + fanOut_consumer1_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer1_exe" + ) + + fanOut_consumer2_node = Node( + package = "fan_in_fan_out_system_py_pkg", + executable = "fanOut_consumer2_exe" + ) + + ld.add_action(fanIn_producer1_node) + ld.add_action(fanIn_producer2_node) + ld.add_action(fanIn_consumer_node) + ld.add_action(fanOut_producer_node) + ld.add_action(fanOut_consumer1_node) + ld.add_action(fanOut_consumer2_node) + + return ld diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml new file mode 100644 index 000000000..e61722118 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + fan_in_fan_out_system_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + fan_in_fan_out_system_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..f98ffff4c --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(fan_in_fan_out_system_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Integer64.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg new file mode 100644 index 000000000..6961e00f5 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/msg/Integer64.msg @@ -0,0 +1 @@ +int64 data \ No newline at end of file diff --git a/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..289bcb4f4 --- /dev/null +++ b/resources/expected/ros2/python-fan_in_fan_out_inverted_topics/strict/src/fan_in_fan_out_system_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + fan_in_fan_out_system_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..92bc818f8 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg_interfaces.msg import InterfaceInteraction +from isolette_py_pkg_interfaces.msg import ValueStatus +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = Heat() + typedValue.data = value + match (typedValue.heat): + case Heat.HEAT_DUMMY_HEAD_ENUM: + return "Heat Dummy_Head_Enum" + case default: + return "Unknown value for Heat" + +def enumToString(value): + typedValue = InterfaceInteraction() + typedValue.data = value + match (typedValue.interface_interaction): + case InterfaceInteraction.INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM: + return "InterfaceInteraction Dummy_Interface_Interaction_Enum" + case default: + return "Unknown value for InterfaceInteraction" + +def enumToString(value): + typedValue = ValueStatus() + typedValue.data = value + match (typedValue.value_status): + case ValueStatus.VALUE_STATUS_VALID: + return "ValueStatus Valid" + case ValueStatus.VALUE_STATUS_INVALID: + return "ValueStatus Invalid" + case default: + return "Unknown value for ValueStatus" + +def enumToString(value): + typedValue = OnOff() + typedValue.data = value + match (typedValue.on_off): + case OnOff.ON_OFF_ONN: + return "OnOff Onn" + case OnOff.ON_OFF_OFF: + return "OnOff Off" + case default: + return "Unknown value for OnOff" + +def enumToString(value): + typedValue = Status() + typedValue.data = value + match (typedValue.status): + case Status.STATUS_INIT_STATUS: + return "Status Init_Status" + case Status.STATUS_ON_STATUS: + return "Status On_Status" + case Status.STATUS_FAILED_STATUS: + return "Status Failed_Status" + case default: + return "Unknown value for Status" + +def enumToString(value): + typedValue = RegulatorMode() + typedValue.data = value + match (typedValue.regulator_mode): + case RegulatorMode.REGULATOR_MODE_INIT_REGULATOR_MODE: + return "RegulatorMode Init_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_NORMAL_REGULATOR_MODE: + return "RegulatorMode Normal_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_FAILED_REGULATOR_MODE: + return "RegulatorMode Failed_Regulator_Mode" + case default: + return "Unknown value for RegulatorMode" + +def enumToString(value): + typedValue = MonitorMode() + typedValue.data = value + match (typedValue.monitor_mode): + case MonitorMode.MONITOR_MODE_INIT_MONITOR_MODE: + return "MonitorMode Init_Monitor_Mode" + case MonitorMode.MONITOR_MODE_NORMAL_MONITOR_MODE: + return "MonitorMode Normal_Monitor_Mode" + case MonitorMode.MONITOR_MODE_FAILED_MONITOR_MODE: + return "MonitorMode Failed_Monitor_Mode" + case default: + return "Unknown value for MonitorMode" + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py new file mode 100644 index 000000000..c7afe1fb5 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class heat_source_cpi_heat_controller_base(Node): + def __init__(self): + super().__init__("heat_source_cpi_heat_controller") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.heat_source_cpi_heat_controller_heat_control_subscription_ = self.create_subscription( + OnOff, + "heat_source_cpi_heat_controller_heat_control", + self.handle_heat_control, + 1, + callback_group=self.cb_group_) + + self.heat_source_cpi_heat_controller_heat_out_publisher_ = self.create_publisher( + Heat, + "heat_source_cpi_heat_controller_heat_out", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.heat_control_msg_holder = None + + def init_heat_control(self, val): + self.heat_control_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_heat_control(self, msg): + self.heat_control_msg_holder = msg + + def get_heat_control(self): + return self.heat_control_msg_holder + + def put_heat_out(self, msg): + self.heat_source_cpi_heat_controller_heat_out_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py new file mode 100644 index 000000000..dfdc41ce7 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import heat_source_cpi_heat_controller +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = heat_source_cpi_heat_controller() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py new file mode 100644 index 000000000..ebd8ba206 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class operator_interface_oip_oit_base(Node): + def __init__(self): + super().__init__("operator_interface_oip_oit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.operator_interface_oip_oit_regulator_status_subscription_ = self.create_subscription( + Status, + "operator_interface_oip_oit_regulator_status", + self.handle_regulator_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_monitor_status_subscription_ = self.create_subscription( + Status, + "operator_interface_oip_oit_monitor_status", + self.handle_monitor_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_display_temperature_subscription_ = self.create_subscription( + Tempimpl, + "operator_interface_oip_oit_display_temperature", + self.handle_display_temperature, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_alarm_control_subscription_ = self.create_subscription( + OnOff, + "operator_interface_oip_oit_alarm_control", + self.handle_alarm_control, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_1 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_2 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.regulator_status_msg_holder = None + self.monitor_status_msg_holder = None + self.display_temperature_msg_holder = None + self.alarm_control_msg_holder = None + + def init_regulator_status(self, val): + self.regulator_status_msg_holder = val + + def init_monitor_status(self, val): + self.monitor_status_msg_holder = val + + def init_display_temperature(self, val): + self.display_temperature_msg_holder = val + + def init_alarm_control(self, val): + self.alarm_control_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_regulator_status(self, msg): + self.regulator_status_msg_holder = msg + + def handle_monitor_status(self, msg): + self.monitor_status_msg_holder = msg + + def handle_display_temperature(self, msg): + self.display_temperature_msg_holder = msg + + def handle_alarm_control(self, msg): + self.alarm_control_msg_holder = msg + + def get_regulator_status(self): + return self.regulator_status_msg_holder + + def get_monitor_status(self): + return self.monitor_status_msg_holder + + def get_display_temperature(self): + return self.display_temperature_msg_holder + + def get_alarm_control(self): + return self.alarm_control_msg_holder + + def put_lower_desired_tempWstatus(self, msg): + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_.publish(msg) + + def put_upper_desired_tempWstatus(self, msg): + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_.publish(msg) + + def put_lower_alarm_tempWstatus(self, msg): + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_.publish(msg) + + def put_upper_alarm_tempWstatus(self, msg): + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_1.publish(msg) + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_2.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py new file mode 100644 index 000000000..6a5d84ad4 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import operator_interface_oip_oit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = operator_interface_oip_oit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py new file mode 100644 index 000000000..b6161e4bd --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class temperature_sensor_cpi_thermostat_base(Node): + def __init__(self): + super().__init__("temperature_sensor_cpi_thermostat") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.temperature_sensor_cpi_thermostat_air_subscription_ = self.create_subscription( + PhysicalTempimpl, + "temperature_sensor_cpi_thermostat_air", + self.handle_air, + 1, + callback_group=self.cb_group_) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_1 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_2 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_3 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_4 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_5 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_6 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.air_msg_holder = None + + def init_air(self, val): + self.air_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_air(self, msg): + self.air_msg_holder = msg + + def get_air(self): + return self.air_msg_holder + + def put_current_tempWstatus(self, msg): + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_1.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_2.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_3.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_4.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_5.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_6.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py new file mode 100644 index 000000000..98fb35b96 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import temperature_sensor_cpi_thermostat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = temperature_sensor_cpi_thermostat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py new file mode 100644 index 000000000..975467ac0 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_alarm_mat_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_alarm_mat") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp", + self.handle_lower_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp", + self.handle_upper_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_alarm_mat_monitor_mode", + self.handle_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_ = self.create_publisher( + OnOff, + "operator_interface_oip_oit_alarm_control", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_alarm_temp_msg_holder = None + self.upper_alarm_temp_msg_holder = None + self.monitor_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_alarm_temp(self, val): + self.lower_alarm_temp_msg_holder = val + + def init_upper_alarm_temp(self, val): + self.upper_alarm_temp_msg_holder = val + + def init_monitor_mode(self, val): + self.monitor_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_alarm_temp(self, msg): + self.lower_alarm_temp_msg_holder = msg + + def handle_upper_alarm_temp(self, msg): + self.upper_alarm_temp_msg_holder = msg + + def handle_monitor_mode(self, msg): + self.monitor_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_alarm_temp(self): + return self.lower_alarm_temp_msg_holder + + def get_upper_alarm_temp(self): + return self.upper_alarm_temp_msg_holder + + def get_monitor_mode(self): + return self.monitor_mode_msg_holder + + def put_alarm_control(self, msg): + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py new file mode 100644 index 000000000..fb00dc3f0 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import thermostat_monitor_temperature_manage_alarm_mat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_alarm_mat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py new file mode 100644 index 000000000..1edeecc01 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_interface_mmit_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_interface_mmit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus", + self.handle_upper_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus", + self.handle_lower_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode", + self.handle_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_ = self.create_publisher( + Status, + "operator_interface_oip_oit_monitor_status", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.upper_alarm_tempWstatus_msg_holder = None + self.lower_alarm_tempWstatus_msg_holder = None + self.current_tempWstatus_msg_holder = None + self.monitor_mode_msg_holder = None + + def init_upper_alarm_tempWstatus(self, val): + self.upper_alarm_tempWstatus_msg_holder = val + + def init_lower_alarm_tempWstatus(self, val): + self.lower_alarm_tempWstatus_msg_holder = val + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_monitor_mode(self, val): + self.monitor_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_upper_alarm_tempWstatus(self, msg): + self.upper_alarm_tempWstatus_msg_holder = msg + + def handle_lower_alarm_tempWstatus(self, msg): + self.lower_alarm_tempWstatus_msg_holder = msg + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_monitor_mode(self, msg): + self.monitor_mode_msg_holder = msg + + def get_upper_alarm_tempWstatus(self): + return self.upper_alarm_tempWstatus_msg_holder + + def get_lower_alarm_tempWstatus(self): + return self.lower_alarm_tempWstatus_msg_holder + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_monitor_mode(self): + return self.monitor_mode_msg_holder + + def put_upper_alarm_temp(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_.publish(msg) + + def put_lower_alarm_temp(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_.publish(msg) + + def put_monitor_status(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_.publish(msg) + + def put_interface_failure(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py new file mode 100644 index 000000000..4e4b756ea --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import thermostat_monitor_temperature_manage_monitor_interface_mmit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_interface_mmit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py new file mode 100644 index 000000000..f60508e08 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_mode_mmmt_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_mode_mmmt") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure", + self.handle_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure", + self.handle_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_1 = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode", + 1) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_2 = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_alarm_mat_monitor_mode", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.interface_failure_msg_holder = None + self.internal_failure_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_interface_failure(self, val): + self.interface_failure_msg_holder = val + + def init_internal_failure(self, val): + self.internal_failure_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_interface_failure(self, msg): + self.interface_failure_msg_holder = msg + + def handle_internal_failure(self, msg): + self.internal_failure_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_interface_failure(self): + return self.interface_failure_msg_holder + + def get_internal_failure(self): + return self.internal_failure_msg_holder + + def put_monitor_mode(self, msg): + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_1.publish(msg) + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_2.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py new file mode 100644 index 000000000..c19f85dc4 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_mode_mmmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py new file mode 100644 index 000000000..78f782a2e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_heat_source_mhst_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_heat_source_mhst") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp", + self.handle_lower_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp", + self.handle_upper_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode", + self.handle_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_ = self.create_publisher( + OnOff, + "heat_source_cpi_heat_controller_heat_control", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_desired_temp_msg_holder = None + self.upper_desired_temp_msg_holder = None + self.regulator_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_desired_temp(self, val): + self.lower_desired_temp_msg_holder = val + + def init_upper_desired_temp(self, val): + self.upper_desired_temp_msg_holder = val + + def init_regulator_mode(self, val): + self.regulator_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_desired_temp(self, msg): + self.lower_desired_temp_msg_holder = msg + + def handle_upper_desired_temp(self, msg): + self.upper_desired_temp_msg_holder = msg + + def handle_regulator_mode(self, msg): + self.regulator_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_desired_temp(self): + return self.lower_desired_temp_msg_holder + + def get_upper_desired_temp(self): + return self.upper_desired_temp_msg_holder + + def get_regulator_mode(self): + return self.regulator_mode_msg_holder + + def put_heat_control(self, msg): + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py new file mode 100644 index 000000000..63044f20a --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import thermostat_regulate_temperature_manage_heat_source_mhst +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_heat_source_mhst() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py new file mode 100644 index 000000000..93b996481 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_interface_mrit_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_interface_mrit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus", + self.handle_lower_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus", + self.handle_upper_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode", + self.handle_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_ = self.create_publisher( + Tempimpl, + "operator_interface_oip_oit_display_temperature", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_ = self.create_publisher( + Status, + "operator_interface_oip_oit_regulator_status", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_desired_tempWstatus_msg_holder = None + self.upper_desired_tempWstatus_msg_holder = None + self.regulator_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_desired_tempWstatus(self, val): + self.lower_desired_tempWstatus_msg_holder = val + + def init_upper_desired_tempWstatus(self, val): + self.upper_desired_tempWstatus_msg_holder = val + + def init_regulator_mode(self, val): + self.regulator_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_desired_tempWstatus(self, msg): + self.lower_desired_tempWstatus_msg_holder = msg + + def handle_upper_desired_tempWstatus(self, msg): + self.upper_desired_tempWstatus_msg_holder = msg + + def handle_regulator_mode(self, msg): + self.regulator_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_desired_tempWstatus(self): + return self.lower_desired_tempWstatus_msg_holder + + def get_upper_desired_tempWstatus(self): + return self.upper_desired_tempWstatus_msg_holder + + def get_regulator_mode(self): + return self.regulator_mode_msg_holder + + def put_upper_desired_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_.publish(msg) + + def put_lower_desired_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_.publish(msg) + + def put_displayed_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_.publish(msg) + + def put_regulator_status(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_.publish(msg) + + def put_interface_failure(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py new file mode 100644 index 000000000..0ce8e2d1e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import thermostat_regulate_temperature_manage_regulator_interface_mrit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_interface_mrit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py new file mode 100644 index 000000000..5b5b1fcfc --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_mode_mrmt_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_mode_mrmt") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure", + self.handle_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure", + self.handle_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_1 = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode", + 1) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_2 = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.interface_failure_msg_holder = None + self.internal_failure_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_interface_failure(self, val): + self.interface_failure_msg_holder = val + + def init_internal_failure(self, val): + self.internal_failure_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_interface_failure(self, msg): + self.interface_failure_msg_holder = msg + + def handle_internal_failure(self, msg): + self.internal_failure_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_interface_failure(self): + return self.interface_failure_msg_holder + + def get_internal_failure(self): + return self.internal_failure_msg_holder + + def put_regulator_mode(self, msg): + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_1.publish(msg) + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_2.publish(msg) + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py new file mode 100644 index 000000000..b7d9a68ee --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_mode_mrmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py new file mode 100644 index 000000000..3ded2b5fa --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.heat_source_cpi_heat_controller_base_src import heat_source_cpi_heat_controller_base +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class heat_source_cpi_heat_controller(heat_source_cpi_heat_controller_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("heat_source_cpi_heat_controller infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + heat_control = OnOff() + self.init_heat_control(heat_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + heat_control = self.get_heat_control() + self.get_logger().info(f"Received heat_control: {self.message_to_string(heat_control)}") + + + # Example publishing messages + heat_out = Heat() + self.put_heat_out(heat_out) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py new file mode 100644 index 000000000..ac40b469a --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.operator_interface_oip_oit_base_src import operator_interface_oip_oit_base +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class operator_interface_oip_oit(operator_interface_oip_oit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("operator_interface_oip_oit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + regulator_status = Status() + self.init_regulator_status(regulator_status) + + monitor_status = Status() + self.init_monitor_status(monitor_status) + + display_temperature = Tempimpl() + self.init_display_temperature(display_temperature) + + alarm_control = OnOff() + self.init_alarm_control(alarm_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + regulator_status = self.get_regulator_status() + self.get_logger().info(f"Received regulator_status: {self.message_to_string(regulator_status)}") + + monitor_status = self.get_monitor_status() + self.get_logger().info(f"Received monitor_status: {self.message_to_string(monitor_status)}") + + display_temperature = self.get_display_temperature() + self.get_logger().info(f"Received display_temperature: {self.message_to_string(display_temperature)}") + + alarm_control = self.get_alarm_control() + self.get_logger().info(f"Received alarm_control: {self.message_to_string(alarm_control)}") + + + # Example publishing messages + lower_desired_tempWstatus = TempWstatusimpl() + self.put_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.put_upper_desired_tempWstatus(upper_desired_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.put_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + upper_alarm_tempWstatus = TempWstatusimpl() + self.put_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py new file mode 100644 index 000000000..e1c1ca3af --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_base_src import temperature_sensor_cpi_thermostat_base +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class temperature_sensor_cpi_thermostat(temperature_sensor_cpi_thermostat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("temperature_sensor_cpi_thermostat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + air = PhysicalTempimpl() + self.init_air(air) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + air = self.get_air() + self.get_logger().info(f"Received air: {self.message_to_string(air)}") + + + # Example publishing messages + current_tempWstatus = TempWstatusimpl() + self.put_current_tempWstatus(current_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py new file mode 100644 index 000000000..f67a7c036 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_base_src import thermostat_monitor_temperature_manage_alarm_mat_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_alarm_mat(thermostat_monitor_temperature_manage_alarm_mat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_alarm_mat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_alarm_temp = Tempimpl() + self.init_lower_alarm_temp(lower_alarm_temp) + + upper_alarm_temp = Tempimpl() + self.init_upper_alarm_temp(upper_alarm_temp) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_alarm_temp = self.get_lower_alarm_temp() + self.get_logger().info(f"Received lower_alarm_temp: {self.message_to_string(lower_alarm_temp)}") + + upper_alarm_temp = self.get_upper_alarm_temp() + self.get_logger().info(f"Received upper_alarm_temp: {self.message_to_string(upper_alarm_temp)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + alarm_control = OnOff() + self.put_alarm_control(alarm_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py new file mode 100644 index 000000000..4f3930578 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src import thermostat_monitor_temperature_manage_monitor_interface_mmit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_interface_mmit(thermostat_monitor_temperature_manage_monitor_interface_mmit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_interface_mmit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + upper_alarm_tempWstatus = TempWstatusimpl() + self.init_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.init_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + upper_alarm_tempWstatus = self.get_upper_alarm_tempWstatus() + self.get_logger().info(f"Received upper_alarm_tempWstatus: {self.message_to_string(upper_alarm_tempWstatus)}") + + lower_alarm_tempWstatus = self.get_lower_alarm_tempWstatus() + self.get_logger().info(f"Received lower_alarm_tempWstatus: {self.message_to_string(lower_alarm_tempWstatus)}") + + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + upper_alarm_temp = Tempimpl() + self.put_upper_alarm_temp(upper_alarm_temp) + + lower_alarm_temp = Tempimpl() + self.put_lower_alarm_temp(lower_alarm_temp) + + monitor_status = Status() + self.put_monitor_status(monitor_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py new file mode 100644 index 000000000..973aa609c --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_mode_mmmt(thermostat_monitor_temperature_manage_monitor_mode_mmmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_mode_mmmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + monitor_mode = MonitorMode() + self.put_monitor_mode(monitor_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py new file mode 100644 index 000000000..4826e5681 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_base_src import thermostat_regulate_temperature_manage_heat_source_mhst_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_heat_source_mhst(thermostat_regulate_temperature_manage_heat_source_mhst_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_heat_source_mhst infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_temp = Tempimpl() + self.init_lower_desired_temp(lower_desired_temp) + + upper_desired_temp = Tempimpl() + self.init_upper_desired_temp(upper_desired_temp) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_temp = self.get_lower_desired_temp() + self.get_logger().info(f"Received lower_desired_temp: {self.message_to_string(lower_desired_temp)}") + + upper_desired_temp = self.get_upper_desired_temp() + self.get_logger().info(f"Received upper_desired_temp: {self.message_to_string(upper_desired_temp)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + heat_control = OnOff() + self.put_heat_control(heat_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py new file mode 100644 index 000000000..94513c84d --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src import thermostat_regulate_temperature_manage_regulator_interface_mrit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_interface_mrit(thermostat_regulate_temperature_manage_regulator_interface_mrit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_interface_mrit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_tempWstatus = TempWstatusimpl() + self.init_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.init_upper_desired_tempWstatus(upper_desired_tempWstatus) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_tempWstatus = self.get_lower_desired_tempWstatus() + self.get_logger().info(f"Received lower_desired_tempWstatus: {self.message_to_string(lower_desired_tempWstatus)}") + + upper_desired_tempWstatus = self.get_upper_desired_tempWstatus() + self.get_logger().info(f"Received upper_desired_tempWstatus: {self.message_to_string(upper_desired_tempWstatus)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + upper_desired_temp = Tempimpl() + self.put_upper_desired_temp(upper_desired_temp) + + lower_desired_temp = Tempimpl() + self.put_lower_desired_temp(lower_desired_temp) + + displayed_temp = Tempimpl() + self.put_displayed_temp(displayed_temp) + + regulator_status = Status() + self.put_regulator_status(regulator_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py new file mode 100644 index 000000000..ea5e59937 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_mode_mrmt(thermostat_regulate_temperature_manage_regulator_mode_mrmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_mode_mrmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + regulator_mode = RegulatorMode() + self.put_regulator_mode(regulator_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/package.xml b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/package.xml new file mode 100644 index 000000000..ddc125c8a --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + isolette_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + isolette_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/resource/isolette_py_pkg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/resource/isolette_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/resource/isolette_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.cfg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.cfg new file mode 100644 index 000000000..de71f7785 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/isolette_py_pkg +[develop] +script_dir=$base/lib/isolette_py_pkg +[install] +install_scripts=$base/lib/isolette_py_pkg diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.py new file mode 100644 index 000000000..4db5def61 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/setup.py @@ -0,0 +1,36 @@ +# setup.py in src/isolette_py_pkg + +from setuptools import find_packages, setup + +package_name = 'isolette_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_runner:main", + "thermostat_regulate_temperature_manage_heat_source_mhst_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_runner:main", + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner:main", + "thermostat_monitor_temperature_manage_alarm_mat_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_runner:main", + "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_runner:main", + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner:main", + "operator_interface_oip_oit_exe = isolette_py_pkg.base_code.operator_interface_oip_oit_runner:main", + "temperature_sensor_cpi_thermostat_exe = isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_runner:main", + "heat_source_cpi_heat_controller_exe = isolette_py_pkg.base_code.heat_source_cpi_heat_controller_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..7ef2c8397 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py new file mode 100644 index 000000000..19d78f040 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + heat_source_cpi_heat_controller_node = Node( + package = "isolette_py_pkg", + executable = "heat_source_cpi_heat_controller_exe" + ) + + ld.add_action(heat_source_cpi_heat_controller_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py new file mode 100644 index 000000000..265c24dc0 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py @@ -0,0 +1,45 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/thermostat.launch.py') + ) + ) + + operator_interface_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/operator_interface.launch.py') + ) + ) + + temperature_sensor_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/temperature_sensor.launch.py') + ) + ) + + heat_source_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/heat_source.launch.py') + ) + ) + + ld.add_action(thermostat_node) + ld.add_action(operator_interface_node) + ld.add_action(temperature_sensor_node) + ld.add_action(heat_source_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py new file mode 100644 index 000000000..b9e2c624f --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_monitor_temperature_manage_alarm_mat_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_alarm_mat_exe" + ) + + thermostat_monitor_temperature_manage_monitor_interface_mmit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe" + ) + + thermostat_monitor_temperature_manage_monitor_mode_mmmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe" + ) + + ld.add_action(thermostat_monitor_temperature_manage_alarm_mat_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_interface_mmit_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_mode_mmmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py new file mode 100644 index 000000000..5f488a919 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + operator_interface_oip_oit_node = Node( + package = "isolette_py_pkg", + executable = "operator_interface_oip_oit_exe" + ) + + ld.add_action(operator_interface_oip_oit_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py new file mode 100644 index 000000000..014c61c26 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_regulate_temperature_manage_regulator_interface_mrit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe" + ) + + thermostat_regulate_temperature_manage_heat_source_mhst_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_heat_source_mhst_exe" + ) + + thermostat_regulate_temperature_manage_regulator_mode_mrmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe" + ) + + ld.add_action(thermostat_regulate_temperature_manage_regulator_interface_mrit_node) + ld.add_action(thermostat_regulate_temperature_manage_heat_source_mhst_node) + ld.add_action(thermostat_regulate_temperature_manage_regulator_mode_mrmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py new file mode 100644 index 000000000..04c0d9de3 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + temperature_sensor_cpi_thermostat_node = Node( + package = "isolette_py_pkg", + executable = "temperature_sensor_cpi_thermostat_exe" + ) + + ld.add_action(temperature_sensor_cpi_thermostat_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py new file mode 100644 index 000000000..383d3f3b9 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py @@ -0,0 +1,29 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + regulate_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/regulate_temperature.launch.py') + ) + ) + + monitor_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/monitor_temperature.launch.py') + ) + ) + + ld.add_action(regulate_temperature_node) + ld.add_action(monitor_temperature_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/package.xml b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/package.xml new file mode 100644 index 000000000..c0ef1c8bb --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + isolette_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + isolette_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..3c237e7ba --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Heat.msg + msg/InterfaceInteraction.msg + msg/Float32.msg + msg/PhysicalTempimpl.msg + msg/ValueStatus.msg + msg/TempWstatusimpl.msg + msg/OnOff.msg + msg/Status.msg + msg/Tempimpl.msg + msg/RegulatorMode.msg + msg/Boolean.msg + msg/FailureFlagimpl.msg + msg/MonitorMode.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg new file mode 100644 index 000000000..85e9459f2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg @@ -0,0 +1 @@ +Boolean value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg new file mode 100644 index 000000000..8510ca2f7 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg @@ -0,0 +1,2 @@ +uint8 heat +uint8 HEAT_DUMMY_HEAD_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg new file mode 100644 index 000000000..74fd55b51 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg @@ -0,0 +1,2 @@ +uint8 interface_interaction +uint8 INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg new file mode 100644 index 000000000..23c152693 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg @@ -0,0 +1,4 @@ +uint8 monitor_mode +uint8 MONITOR_MODE_INIT_MONITOR_MODE=0 +uint8 MONITOR_MODE_NORMAL_MONITOR_MODE=1 +uint8 MONITOR_MODE_FAILED_MONITOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg new file mode 100644 index 000000000..2b93a6e9b --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg @@ -0,0 +1,3 @@ +uint8 on_off +uint8 ON_OFF_ONN=0 +uint8 ON_OFF_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg new file mode 100644 index 000000000..3e575ec38 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg @@ -0,0 +1,4 @@ +uint8 regulator_mode +uint8 REGULATOR_MODE_INIT_REGULATOR_MODE=0 +uint8 REGULATOR_MODE_NORMAL_REGULATOR_MODE=1 +uint8 REGULATOR_MODE_FAILED_REGULATOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Status.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Status.msg new file mode 100644 index 000000000..f921080e2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Status.msg @@ -0,0 +1,4 @@ +uint8 status +uint8 STATUS_INIT_STATUS=0 +uint8 STATUS_ON_STATUS=1 +uint8 STATUS_FAILED_STATUS=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg new file mode 100644 index 000000000..013b4d370 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg @@ -0,0 +1,2 @@ +Float32 value +ValueStatus status \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg new file mode 100644 index 000000000..cd93b8a5e --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg @@ -0,0 +1,3 @@ +uint8 value_status +uint8 VALUE_STATUS_VALID=0 +uint8 VALUE_STATUS_INVALID=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..c0d3e4f59 --- /dev/null +++ b/resources/expected/ros2/python-isolette/lax/src/isolette_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + isolette_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..92bc818f8 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg_interfaces.msg import InterfaceInteraction +from isolette_py_pkg_interfaces.msg import ValueStatus +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = Heat() + typedValue.data = value + match (typedValue.heat): + case Heat.HEAT_DUMMY_HEAD_ENUM: + return "Heat Dummy_Head_Enum" + case default: + return "Unknown value for Heat" + +def enumToString(value): + typedValue = InterfaceInteraction() + typedValue.data = value + match (typedValue.interface_interaction): + case InterfaceInteraction.INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM: + return "InterfaceInteraction Dummy_Interface_Interaction_Enum" + case default: + return "Unknown value for InterfaceInteraction" + +def enumToString(value): + typedValue = ValueStatus() + typedValue.data = value + match (typedValue.value_status): + case ValueStatus.VALUE_STATUS_VALID: + return "ValueStatus Valid" + case ValueStatus.VALUE_STATUS_INVALID: + return "ValueStatus Invalid" + case default: + return "Unknown value for ValueStatus" + +def enumToString(value): + typedValue = OnOff() + typedValue.data = value + match (typedValue.on_off): + case OnOff.ON_OFF_ONN: + return "OnOff Onn" + case OnOff.ON_OFF_OFF: + return "OnOff Off" + case default: + return "Unknown value for OnOff" + +def enumToString(value): + typedValue = Status() + typedValue.data = value + match (typedValue.status): + case Status.STATUS_INIT_STATUS: + return "Status Init_Status" + case Status.STATUS_ON_STATUS: + return "Status On_Status" + case Status.STATUS_FAILED_STATUS: + return "Status Failed_Status" + case default: + return "Unknown value for Status" + +def enumToString(value): + typedValue = RegulatorMode() + typedValue.data = value + match (typedValue.regulator_mode): + case RegulatorMode.REGULATOR_MODE_INIT_REGULATOR_MODE: + return "RegulatorMode Init_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_NORMAL_REGULATOR_MODE: + return "RegulatorMode Normal_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_FAILED_REGULATOR_MODE: + return "RegulatorMode Failed_Regulator_Mode" + case default: + return "Unknown value for RegulatorMode" + +def enumToString(value): + typedValue = MonitorMode() + typedValue.data = value + match (typedValue.monitor_mode): + case MonitorMode.MONITOR_MODE_INIT_MONITOR_MODE: + return "MonitorMode Init_Monitor_Mode" + case MonitorMode.MONITOR_MODE_NORMAL_MONITOR_MODE: + return "MonitorMode Normal_Monitor_Mode" + case MonitorMode.MONITOR_MODE_FAILED_MONITOR_MODE: + return "MonitorMode Failed_Monitor_Mode" + case default: + return "Unknown value for MonitorMode" + diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py new file mode 100644 index 000000000..622693c1f --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class heat_source_cpi_heat_controller_base(Node): + def __init__(self): + super().__init__("heat_source_cpi_heat_controller") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.heat_source_cpi_heat_controller_heat_control_subscription_ = self.create_subscription( + OnOff, + "heat_source_cpi_heat_controller_heat_control", + self.accept_heat_control, + 1, + callback_group=self.cb_group_) + + self.heat_source_cpi_heat_controller_heat_out_publisher_ = self.create_publisher( + Heat, + "heat_source_cpi_heat_controller_heat_out", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_heat_control = deque() + self.applicationIn_heat_control = deque() + + self.infrastructureOut_heat_out = deque() + self.applicationOut_heat_out = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_heat_control, self.applicationIn_heat_control] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_heat_control, self.applicationIn_heat_control] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_heat_out, self.infrastructureOut_heat_out, self.sendOut_heat_out] + ] + + def init_heat_control(self, val): + self.enqueue(self.infrastructureIn_heat_control, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_heat_control(self, msg): + self.enqueue(self.infrastructureIn_heat_control, msg) + + def get_heat_control(self): + msg = self.applicationIn_heat_control[0] + return msg + + def sendOut_heat_out(self, msg): + if type(msg) is Heat: + self.heat_source_cpi_heat_controller_heat_out_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port heat_out.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_heat_out(self, msg): + self.enqueue(self.applicationOut_heat_out, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py new file mode 100644 index 000000000..dfdc41ce7 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import heat_source_cpi_heat_controller +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = heat_source_cpi_heat_controller() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py new file mode 100644 index 000000000..7cbdfb982 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class operator_interface_oip_oit_base(Node): + def __init__(self): + super().__init__("operator_interface_oip_oit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.operator_interface_oip_oit_regulator_status_subscription_ = self.create_subscription( + Status, + "operator_interface_oip_oit_regulator_status", + self.accept_regulator_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_monitor_status_subscription_ = self.create_subscription( + Status, + "operator_interface_oip_oit_monitor_status", + self.accept_monitor_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_display_temperature_subscription_ = self.create_subscription( + Tempimpl, + "operator_interface_oip_oit_display_temperature", + self.accept_display_temperature, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_alarm_control_subscription_ = self.create_subscription( + OnOff, + "operator_interface_oip_oit_alarm_control", + self.accept_alarm_control, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_1 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_2 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_regulator_status = deque() + self.applicationIn_regulator_status = deque() + self.infrastructureIn_monitor_status = deque() + self.applicationIn_monitor_status = deque() + self.infrastructureIn_display_temperature = deque() + self.applicationIn_display_temperature = deque() + self.infrastructureIn_alarm_control = deque() + self.applicationIn_alarm_control = deque() + + self.infrastructureOut_lower_desired_tempWstatus = deque() + self.applicationOut_lower_desired_tempWstatus = deque() + self.infrastructureOut_upper_desired_tempWstatus = deque() + self.applicationOut_upper_desired_tempWstatus = deque() + self.infrastructureOut_lower_alarm_tempWstatus = deque() + self.applicationOut_lower_alarm_tempWstatus = deque() + self.infrastructureOut_upper_alarm_tempWstatus = deque() + self.applicationOut_upper_alarm_tempWstatus = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_regulator_status, self.applicationIn_regulator_status], + [self.infrastructureIn_monitor_status, self.applicationIn_monitor_status], + [self.infrastructureIn_display_temperature, self.applicationIn_display_temperature], + [self.infrastructureIn_alarm_control, self.applicationIn_alarm_control] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_regulator_status, self.applicationIn_regulator_status], + [self.infrastructureIn_monitor_status, self.applicationIn_monitor_status], + [self.infrastructureIn_display_temperature, self.applicationIn_display_temperature], + [self.infrastructureIn_alarm_control, self.applicationIn_alarm_control] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_lower_desired_tempWstatus, self.infrastructureOut_lower_desired_tempWstatus, self.sendOut_lower_desired_tempWstatus], + [self.applicationOut_upper_desired_tempWstatus, self.infrastructureOut_upper_desired_tempWstatus, self.sendOut_upper_desired_tempWstatus], + [self.applicationOut_lower_alarm_tempWstatus, self.infrastructureOut_lower_alarm_tempWstatus, self.sendOut_lower_alarm_tempWstatus], + [self.applicationOut_upper_alarm_tempWstatus, self.infrastructureOut_upper_alarm_tempWstatus, self.sendOut_upper_alarm_tempWstatus] + ] + + def init_regulator_status(self, val): + self.enqueue(self.infrastructureIn_regulator_status, val) + + + def init_monitor_status(self, val): + self.enqueue(self.infrastructureIn_monitor_status, val) + + + def init_display_temperature(self, val): + self.enqueue(self.infrastructureIn_display_temperature, val) + + + def init_alarm_control(self, val): + self.enqueue(self.infrastructureIn_alarm_control, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_regulator_status(self, msg): + self.enqueue(self.infrastructureIn_regulator_status, msg) + + def accept_monitor_status(self, msg): + self.enqueue(self.infrastructureIn_monitor_status, msg) + + def accept_display_temperature(self, msg): + self.enqueue(self.infrastructureIn_display_temperature, msg) + + def accept_alarm_control(self, msg): + self.enqueue(self.infrastructureIn_alarm_control, msg) + + def get_regulator_status(self): + msg = self.applicationIn_regulator_status[0] + return msg + + def get_monitor_status(self): + msg = self.applicationIn_monitor_status[0] + return msg + + def get_display_temperature(self): + msg = self.applicationIn_display_temperature[0] + return msg + + def get_alarm_control(self): + msg = self.applicationIn_alarm_control[0] + return msg + + def sendOut_lower_desired_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_desired_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_upper_desired_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_desired_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_alarm_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_alarm_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_upper_alarm_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_1.publish(msg) + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_2.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_alarm_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_lower_desired_tempWstatus(self, msg): + self.enqueue(self.applicationOut_lower_desired_tempWstatus, msg) + + def put_upper_desired_tempWstatus(self, msg): + self.enqueue(self.applicationOut_upper_desired_tempWstatus, msg) + + def put_lower_alarm_tempWstatus(self, msg): + self.enqueue(self.applicationOut_lower_alarm_tempWstatus, msg) + + def put_upper_alarm_tempWstatus(self, msg): + self.enqueue(self.applicationOut_upper_alarm_tempWstatus, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py new file mode 100644 index 000000000..6a5d84ad4 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import operator_interface_oip_oit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = operator_interface_oip_oit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py new file mode 100644 index 000000000..aed48c6fa --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class temperature_sensor_cpi_thermostat_base(Node): + def __init__(self): + super().__init__("temperature_sensor_cpi_thermostat") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.temperature_sensor_cpi_thermostat_air_subscription_ = self.create_subscription( + PhysicalTempimpl, + "temperature_sensor_cpi_thermostat_air", + self.accept_air, + 1, + callback_group=self.cb_group_) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_1 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_2 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_3 = self.create_publisher( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_4 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_5 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus", + 1) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_6 = self.create_publisher( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_air = deque() + self.applicationIn_air = deque() + + self.infrastructureOut_current_tempWstatus = deque() + self.applicationOut_current_tempWstatus = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_air, self.applicationIn_air] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_air, self.applicationIn_air] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_current_tempWstatus, self.infrastructureOut_current_tempWstatus, self.sendOut_current_tempWstatus] + ] + + def init_air(self, val): + self.enqueue(self.infrastructureIn_air, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_air(self, msg): + self.enqueue(self.infrastructureIn_air, msg) + + def get_air(self): + msg = self.applicationIn_air[0] + return msg + + def sendOut_current_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_1.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_2.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_3.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_4.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_5.publish(msg) + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_6.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port current_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_current_tempWstatus(self, msg): + self.enqueue(self.applicationOut_current_tempWstatus, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py new file mode 100644 index 000000000..98fb35b96 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import temperature_sensor_cpi_thermostat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = temperature_sensor_cpi_thermostat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py new file mode 100644 index 000000000..bb515e7d3 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_alarm_mat_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_alarm_mat") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp", + self.accept_lower_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp", + self.accept_upper_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_alarm_mat_monitor_mode", + self.accept_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_ = self.create_publisher( + OnOff, + "operator_interface_oip_oit_alarm_control", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_alarm_temp = deque() + self.applicationIn_lower_alarm_temp = deque() + self.infrastructureIn_upper_alarm_temp = deque() + self.applicationIn_upper_alarm_temp = deque() + self.infrastructureIn_monitor_mode = deque() + self.applicationIn_monitor_mode = deque() + + self.infrastructureOut_alarm_control = deque() + self.applicationOut_alarm_control = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_alarm_temp, self.applicationIn_lower_alarm_temp], + [self.infrastructureIn_upper_alarm_temp, self.applicationIn_upper_alarm_temp], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_alarm_temp, self.applicationIn_lower_alarm_temp], + [self.infrastructureIn_upper_alarm_temp, self.applicationIn_upper_alarm_temp], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_alarm_control, self.infrastructureOut_alarm_control, self.sendOut_alarm_control] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_alarm_temp(self, val): + self.enqueue(self.infrastructureIn_lower_alarm_temp, val) + + + def init_upper_alarm_temp(self, val): + self.enqueue(self.infrastructureIn_upper_alarm_temp, val) + + + def init_monitor_mode(self, val): + self.enqueue(self.infrastructureIn_monitor_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_alarm_temp(self, msg): + self.enqueue(self.infrastructureIn_lower_alarm_temp, msg) + + def accept_upper_alarm_temp(self, msg): + self.enqueue(self.infrastructureIn_upper_alarm_temp, msg) + + def accept_monitor_mode(self, msg): + self.enqueue(self.infrastructureIn_monitor_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_alarm_temp(self): + msg = self.applicationIn_lower_alarm_temp[0] + return msg + + def get_upper_alarm_temp(self): + msg = self.applicationIn_upper_alarm_temp[0] + return msg + + def get_monitor_mode(self): + msg = self.applicationIn_monitor_mode[0] + return msg + + def sendOut_alarm_control(self, msg): + if type(msg) is OnOff: + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port alarm_control.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_alarm_control(self, msg): + self.enqueue(self.applicationOut_alarm_control, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py new file mode 100644 index 000000000..fb00dc3f0 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import thermostat_monitor_temperature_manage_alarm_mat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_alarm_mat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py new file mode 100644 index 000000000..5d7183c73 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_interface_mmit_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_interface_mmit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus", + self.accept_upper_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus", + self.accept_lower_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode", + self.accept_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_ = self.create_publisher( + Status, + "operator_interface_oip_oit_monitor_status", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_upper_alarm_tempWstatus = deque() + self.applicationIn_upper_alarm_tempWstatus = deque() + self.infrastructureIn_lower_alarm_tempWstatus = deque() + self.applicationIn_lower_alarm_tempWstatus = deque() + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_monitor_mode = deque() + self.applicationIn_monitor_mode = deque() + + self.infrastructureOut_upper_alarm_temp = deque() + self.applicationOut_upper_alarm_temp = deque() + self.infrastructureOut_lower_alarm_temp = deque() + self.applicationOut_lower_alarm_temp = deque() + self.infrastructureOut_monitor_status = deque() + self.applicationOut_monitor_status = deque() + self.infrastructureOut_interface_failure = deque() + self.applicationOut_interface_failure = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_upper_alarm_tempWstatus, self.applicationIn_upper_alarm_tempWstatus], + [self.infrastructureIn_lower_alarm_tempWstatus, self.applicationIn_lower_alarm_tempWstatus], + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_upper_alarm_tempWstatus, self.applicationIn_upper_alarm_tempWstatus], + [self.infrastructureIn_lower_alarm_tempWstatus, self.applicationIn_lower_alarm_tempWstatus], + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_upper_alarm_temp, self.infrastructureOut_upper_alarm_temp, self.sendOut_upper_alarm_temp], + [self.applicationOut_lower_alarm_temp, self.infrastructureOut_lower_alarm_temp, self.sendOut_lower_alarm_temp], + [self.applicationOut_monitor_status, self.infrastructureOut_monitor_status, self.sendOut_monitor_status], + [self.applicationOut_interface_failure, self.infrastructureOut_interface_failure, self.sendOut_interface_failure] + ] + + def init_upper_alarm_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_upper_alarm_tempWstatus, val) + + + def init_lower_alarm_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_lower_alarm_tempWstatus, val) + + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_monitor_mode(self, val): + self.enqueue(self.infrastructureIn_monitor_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_upper_alarm_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_upper_alarm_tempWstatus, msg) + + def accept_lower_alarm_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_lower_alarm_tempWstatus, msg) + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_monitor_mode(self, msg): + self.enqueue(self.infrastructureIn_monitor_mode, msg) + + def get_upper_alarm_tempWstatus(self): + msg = self.applicationIn_upper_alarm_tempWstatus[0] + return msg + + def get_lower_alarm_tempWstatus(self): + msg = self.applicationIn_lower_alarm_tempWstatus[0] + return msg + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_monitor_mode(self): + msg = self.applicationIn_monitor_mode[0] + return msg + + def sendOut_upper_alarm_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_alarm_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_alarm_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_alarm_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_monitor_status(self, msg): + if type(msg) is Status: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port monitor_status.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_interface_failure(self, msg): + if type(msg) is FailureFlagimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port interface_failure.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_upper_alarm_temp(self, msg): + self.enqueue(self.applicationOut_upper_alarm_temp, msg) + + def put_lower_alarm_temp(self, msg): + self.enqueue(self.applicationOut_lower_alarm_temp, msg) + + def put_monitor_status(self, msg): + self.enqueue(self.applicationOut_monitor_status, msg) + + def put_interface_failure(self, msg): + self.enqueue(self.applicationOut_interface_failure, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py new file mode 100644 index 000000000..4e4b756ea --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import thermostat_monitor_temperature_manage_monitor_interface_mmit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_interface_mmit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py new file mode 100644 index 000000000..f7a7a5dc2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_mode_mmmt_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_mode_mmmt") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure", + self.accept_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure", + self.accept_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_1 = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode", + 1) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_2 = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_alarm_mat_monitor_mode", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_interface_failure = deque() + self.applicationIn_interface_failure = deque() + self.infrastructureIn_internal_failure = deque() + self.applicationIn_internal_failure = deque() + + self.infrastructureOut_monitor_mode = deque() + self.applicationOut_monitor_mode = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_monitor_mode, self.infrastructureOut_monitor_mode, self.sendOut_monitor_mode] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_interface_failure(self, val): + self.enqueue(self.infrastructureIn_interface_failure, val) + + + def init_internal_failure(self, val): + self.enqueue(self.infrastructureIn_internal_failure, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_interface_failure(self, msg): + self.enqueue(self.infrastructureIn_interface_failure, msg) + + def accept_internal_failure(self, msg): + self.enqueue(self.infrastructureIn_internal_failure, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_interface_failure(self): + msg = self.applicationIn_interface_failure[0] + return msg + + def get_internal_failure(self): + msg = self.applicationIn_internal_failure[0] + return msg + + def sendOut_monitor_mode(self, msg): + if type(msg) is MonitorMode: + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_1.publish(msg) + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_2.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port monitor_mode.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_monitor_mode(self, msg): + self.enqueue(self.applicationOut_monitor_mode, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py new file mode 100644 index 000000000..c19f85dc4 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_mode_mmmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py new file mode 100644 index 000000000..280843911 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_heat_source_mhst_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_heat_source_mhst") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp", + self.accept_lower_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp", + self.accept_upper_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode", + self.accept_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_ = self.create_publisher( + OnOff, + "heat_source_cpi_heat_controller_heat_control", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_desired_temp = deque() + self.applicationIn_lower_desired_temp = deque() + self.infrastructureIn_upper_desired_temp = deque() + self.applicationIn_upper_desired_temp = deque() + self.infrastructureIn_regulator_mode = deque() + self.applicationIn_regulator_mode = deque() + + self.infrastructureOut_heat_control = deque() + self.applicationOut_heat_control = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_temp, self.applicationIn_lower_desired_temp], + [self.infrastructureIn_upper_desired_temp, self.applicationIn_upper_desired_temp], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_temp, self.applicationIn_lower_desired_temp], + [self.infrastructureIn_upper_desired_temp, self.applicationIn_upper_desired_temp], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_heat_control, self.infrastructureOut_heat_control, self.sendOut_heat_control] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_desired_temp(self, val): + self.enqueue(self.infrastructureIn_lower_desired_temp, val) + + + def init_upper_desired_temp(self, val): + self.enqueue(self.infrastructureIn_upper_desired_temp, val) + + + def init_regulator_mode(self, val): + self.enqueue(self.infrastructureIn_regulator_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_desired_temp(self, msg): + self.enqueue(self.infrastructureIn_lower_desired_temp, msg) + + def accept_upper_desired_temp(self, msg): + self.enqueue(self.infrastructureIn_upper_desired_temp, msg) + + def accept_regulator_mode(self, msg): + self.enqueue(self.infrastructureIn_regulator_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_desired_temp(self): + msg = self.applicationIn_lower_desired_temp[0] + return msg + + def get_upper_desired_temp(self): + msg = self.applicationIn_upper_desired_temp[0] + return msg + + def get_regulator_mode(self): + msg = self.applicationIn_regulator_mode[0] + return msg + + def sendOut_heat_control(self, msg): + if type(msg) is OnOff: + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port heat_control.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_heat_control(self, msg): + self.enqueue(self.applicationOut_heat_control, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py new file mode 100644 index 000000000..63044f20a --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import thermostat_regulate_temperature_manage_heat_source_mhst +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_heat_source_mhst() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py new file mode 100644 index 000000000..344e2fce2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_interface_mrit_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_interface_mrit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus", + self.accept_lower_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus", + self.accept_upper_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode", + self.accept_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_ = self.create_publisher( + Tempimpl, + "operator_interface_oip_oit_display_temperature", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_ = self.create_publisher( + Status, + "operator_interface_oip_oit_regulator_status", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_desired_tempWstatus = deque() + self.applicationIn_lower_desired_tempWstatus = deque() + self.infrastructureIn_upper_desired_tempWstatus = deque() + self.applicationIn_upper_desired_tempWstatus = deque() + self.infrastructureIn_regulator_mode = deque() + self.applicationIn_regulator_mode = deque() + + self.infrastructureOut_upper_desired_temp = deque() + self.applicationOut_upper_desired_temp = deque() + self.infrastructureOut_lower_desired_temp = deque() + self.applicationOut_lower_desired_temp = deque() + self.infrastructureOut_displayed_temp = deque() + self.applicationOut_displayed_temp = deque() + self.infrastructureOut_regulator_status = deque() + self.applicationOut_regulator_status = deque() + self.infrastructureOut_interface_failure = deque() + self.applicationOut_interface_failure = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_tempWstatus, self.applicationIn_lower_desired_tempWstatus], + [self.infrastructureIn_upper_desired_tempWstatus, self.applicationIn_upper_desired_tempWstatus], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_tempWstatus, self.applicationIn_lower_desired_tempWstatus], + [self.infrastructureIn_upper_desired_tempWstatus, self.applicationIn_upper_desired_tempWstatus], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_upper_desired_temp, self.infrastructureOut_upper_desired_temp, self.sendOut_upper_desired_temp], + [self.applicationOut_lower_desired_temp, self.infrastructureOut_lower_desired_temp, self.sendOut_lower_desired_temp], + [self.applicationOut_displayed_temp, self.infrastructureOut_displayed_temp, self.sendOut_displayed_temp], + [self.applicationOut_regulator_status, self.infrastructureOut_regulator_status, self.sendOut_regulator_status], + [self.applicationOut_interface_failure, self.infrastructureOut_interface_failure, self.sendOut_interface_failure] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_desired_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_lower_desired_tempWstatus, val) + + + def init_upper_desired_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_upper_desired_tempWstatus, val) + + + def init_regulator_mode(self, val): + self.enqueue(self.infrastructureIn_regulator_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_desired_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_lower_desired_tempWstatus, msg) + + def accept_upper_desired_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_upper_desired_tempWstatus, msg) + + def accept_regulator_mode(self, msg): + self.enqueue(self.infrastructureIn_regulator_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_desired_tempWstatus(self): + msg = self.applicationIn_lower_desired_tempWstatus[0] + return msg + + def get_upper_desired_tempWstatus(self): + msg = self.applicationIn_upper_desired_tempWstatus[0] + return msg + + def get_regulator_mode(self): + msg = self.applicationIn_regulator_mode[0] + return msg + + def sendOut_upper_desired_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_desired_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_desired_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_desired_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_displayed_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port displayed_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_regulator_status(self, msg): + if type(msg) is Status: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port regulator_status.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_interface_failure(self, msg): + if type(msg) is FailureFlagimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port interface_failure.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_upper_desired_temp(self, msg): + self.enqueue(self.applicationOut_upper_desired_temp, msg) + + def put_lower_desired_temp(self, msg): + self.enqueue(self.applicationOut_lower_desired_temp, msg) + + def put_displayed_temp(self, msg): + self.enqueue(self.applicationOut_displayed_temp, msg) + + def put_regulator_status(self, msg): + self.enqueue(self.applicationOut_regulator_status, msg) + + def put_interface_failure(self, msg): + self.enqueue(self.applicationOut_interface_failure, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py new file mode 100644 index 000000000..0ce8e2d1e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import thermostat_regulate_temperature_manage_regulator_interface_mrit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_interface_mrit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py new file mode 100644 index 000000000..fdb159497 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_mode_mrmt_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_mode_mrmt") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure", + self.accept_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure", + self.accept_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_1 = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode", + 1) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_2 = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_interface_failure = deque() + self.applicationIn_interface_failure = deque() + self.infrastructureIn_internal_failure = deque() + self.applicationIn_internal_failure = deque() + + self.infrastructureOut_regulator_mode = deque() + self.applicationOut_regulator_mode = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_regulator_mode, self.infrastructureOut_regulator_mode, self.sendOut_regulator_mode] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_interface_failure(self, val): + self.enqueue(self.infrastructureIn_interface_failure, val) + + + def init_internal_failure(self, val): + self.enqueue(self.infrastructureIn_internal_failure, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_interface_failure(self, msg): + self.enqueue(self.infrastructureIn_interface_failure, msg) + + def accept_internal_failure(self, msg): + self.enqueue(self.infrastructureIn_internal_failure, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_interface_failure(self): + msg = self.applicationIn_interface_failure[0] + return msg + + def get_internal_failure(self): + msg = self.applicationIn_internal_failure[0] + return msg + + def sendOut_regulator_mode(self, msg): + if type(msg) is RegulatorMode: + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_1.publish(msg) + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_2.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port regulator_mode.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_regulator_mode(self, msg): + self.enqueue(self.applicationOut_regulator_mode, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py new file mode 100644 index 000000000..b7d9a68ee --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_mode_mrmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py new file mode 100644 index 000000000..3ded2b5fa --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.heat_source_cpi_heat_controller_base_src import heat_source_cpi_heat_controller_base +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class heat_source_cpi_heat_controller(heat_source_cpi_heat_controller_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("heat_source_cpi_heat_controller infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + heat_control = OnOff() + self.init_heat_control(heat_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + heat_control = self.get_heat_control() + self.get_logger().info(f"Received heat_control: {self.message_to_string(heat_control)}") + + + # Example publishing messages + heat_out = Heat() + self.put_heat_out(heat_out) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py new file mode 100644 index 000000000..ac40b469a --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.operator_interface_oip_oit_base_src import operator_interface_oip_oit_base +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class operator_interface_oip_oit(operator_interface_oip_oit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("operator_interface_oip_oit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + regulator_status = Status() + self.init_regulator_status(regulator_status) + + monitor_status = Status() + self.init_monitor_status(monitor_status) + + display_temperature = Tempimpl() + self.init_display_temperature(display_temperature) + + alarm_control = OnOff() + self.init_alarm_control(alarm_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + regulator_status = self.get_regulator_status() + self.get_logger().info(f"Received regulator_status: {self.message_to_string(regulator_status)}") + + monitor_status = self.get_monitor_status() + self.get_logger().info(f"Received monitor_status: {self.message_to_string(monitor_status)}") + + display_temperature = self.get_display_temperature() + self.get_logger().info(f"Received display_temperature: {self.message_to_string(display_temperature)}") + + alarm_control = self.get_alarm_control() + self.get_logger().info(f"Received alarm_control: {self.message_to_string(alarm_control)}") + + + # Example publishing messages + lower_desired_tempWstatus = TempWstatusimpl() + self.put_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.put_upper_desired_tempWstatus(upper_desired_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.put_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + upper_alarm_tempWstatus = TempWstatusimpl() + self.put_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py new file mode 100644 index 000000000..e1c1ca3af --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_base_src import temperature_sensor_cpi_thermostat_base +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class temperature_sensor_cpi_thermostat(temperature_sensor_cpi_thermostat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("temperature_sensor_cpi_thermostat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + air = PhysicalTempimpl() + self.init_air(air) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + air = self.get_air() + self.get_logger().info(f"Received air: {self.message_to_string(air)}") + + + # Example publishing messages + current_tempWstatus = TempWstatusimpl() + self.put_current_tempWstatus(current_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py new file mode 100644 index 000000000..f67a7c036 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_base_src import thermostat_monitor_temperature_manage_alarm_mat_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_alarm_mat(thermostat_monitor_temperature_manage_alarm_mat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_alarm_mat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_alarm_temp = Tempimpl() + self.init_lower_alarm_temp(lower_alarm_temp) + + upper_alarm_temp = Tempimpl() + self.init_upper_alarm_temp(upper_alarm_temp) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_alarm_temp = self.get_lower_alarm_temp() + self.get_logger().info(f"Received lower_alarm_temp: {self.message_to_string(lower_alarm_temp)}") + + upper_alarm_temp = self.get_upper_alarm_temp() + self.get_logger().info(f"Received upper_alarm_temp: {self.message_to_string(upper_alarm_temp)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + alarm_control = OnOff() + self.put_alarm_control(alarm_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py new file mode 100644 index 000000000..4f3930578 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src import thermostat_monitor_temperature_manage_monitor_interface_mmit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_interface_mmit(thermostat_monitor_temperature_manage_monitor_interface_mmit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_interface_mmit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + upper_alarm_tempWstatus = TempWstatusimpl() + self.init_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.init_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + upper_alarm_tempWstatus = self.get_upper_alarm_tempWstatus() + self.get_logger().info(f"Received upper_alarm_tempWstatus: {self.message_to_string(upper_alarm_tempWstatus)}") + + lower_alarm_tempWstatus = self.get_lower_alarm_tempWstatus() + self.get_logger().info(f"Received lower_alarm_tempWstatus: {self.message_to_string(lower_alarm_tempWstatus)}") + + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + upper_alarm_temp = Tempimpl() + self.put_upper_alarm_temp(upper_alarm_temp) + + lower_alarm_temp = Tempimpl() + self.put_lower_alarm_temp(lower_alarm_temp) + + monitor_status = Status() + self.put_monitor_status(monitor_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py new file mode 100644 index 000000000..973aa609c --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_mode_mmmt(thermostat_monitor_temperature_manage_monitor_mode_mmmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_mode_mmmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + monitor_mode = MonitorMode() + self.put_monitor_mode(monitor_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py new file mode 100644 index 000000000..4826e5681 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_base_src import thermostat_regulate_temperature_manage_heat_source_mhst_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_heat_source_mhst(thermostat_regulate_temperature_manage_heat_source_mhst_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_heat_source_mhst infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_temp = Tempimpl() + self.init_lower_desired_temp(lower_desired_temp) + + upper_desired_temp = Tempimpl() + self.init_upper_desired_temp(upper_desired_temp) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_temp = self.get_lower_desired_temp() + self.get_logger().info(f"Received lower_desired_temp: {self.message_to_string(lower_desired_temp)}") + + upper_desired_temp = self.get_upper_desired_temp() + self.get_logger().info(f"Received upper_desired_temp: {self.message_to_string(upper_desired_temp)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + heat_control = OnOff() + self.put_heat_control(heat_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py new file mode 100644 index 000000000..94513c84d --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src import thermostat_regulate_temperature_manage_regulator_interface_mrit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_interface_mrit(thermostat_regulate_temperature_manage_regulator_interface_mrit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_interface_mrit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_tempWstatus = TempWstatusimpl() + self.init_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.init_upper_desired_tempWstatus(upper_desired_tempWstatus) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_tempWstatus = self.get_lower_desired_tempWstatus() + self.get_logger().info(f"Received lower_desired_tempWstatus: {self.message_to_string(lower_desired_tempWstatus)}") + + upper_desired_tempWstatus = self.get_upper_desired_tempWstatus() + self.get_logger().info(f"Received upper_desired_tempWstatus: {self.message_to_string(upper_desired_tempWstatus)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + upper_desired_temp = Tempimpl() + self.put_upper_desired_temp(upper_desired_temp) + + lower_desired_temp = Tempimpl() + self.put_lower_desired_temp(lower_desired_temp) + + displayed_temp = Tempimpl() + self.put_displayed_temp(displayed_temp) + + regulator_status = Status() + self.put_regulator_status(regulator_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py new file mode 100644 index 000000000..ea5e59937 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_mode_mrmt(thermostat_regulate_temperature_manage_regulator_mode_mrmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_mode_mrmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + regulator_mode = RegulatorMode() + self.put_regulator_mode(regulator_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/package.xml b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/package.xml new file mode 100644 index 000000000..ddc125c8a --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + isolette_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + isolette_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/resource/isolette_py_pkg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/resource/isolette_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/resource/isolette_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.cfg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.cfg new file mode 100644 index 000000000..de71f7785 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/isolette_py_pkg +[develop] +script_dir=$base/lib/isolette_py_pkg +[install] +install_scripts=$base/lib/isolette_py_pkg diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.py new file mode 100644 index 000000000..4db5def61 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/setup.py @@ -0,0 +1,36 @@ +# setup.py in src/isolette_py_pkg + +from setuptools import find_packages, setup + +package_name = 'isolette_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_runner:main", + "thermostat_regulate_temperature_manage_heat_source_mhst_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_runner:main", + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner:main", + "thermostat_monitor_temperature_manage_alarm_mat_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_runner:main", + "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_runner:main", + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner:main", + "operator_interface_oip_oit_exe = isolette_py_pkg.base_code.operator_interface_oip_oit_runner:main", + "temperature_sensor_cpi_thermostat_exe = isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_runner:main", + "heat_source_cpi_heat_controller_exe = isolette_py_pkg.base_code.heat_source_cpi_heat_controller_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..7ef2c8397 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py new file mode 100644 index 000000000..19d78f040 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + heat_source_cpi_heat_controller_node = Node( + package = "isolette_py_pkg", + executable = "heat_source_cpi_heat_controller_exe" + ) + + ld.add_action(heat_source_cpi_heat_controller_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py new file mode 100644 index 000000000..265c24dc0 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py @@ -0,0 +1,45 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/thermostat.launch.py') + ) + ) + + operator_interface_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/operator_interface.launch.py') + ) + ) + + temperature_sensor_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/temperature_sensor.launch.py') + ) + ) + + heat_source_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/heat_source.launch.py') + ) + ) + + ld.add_action(thermostat_node) + ld.add_action(operator_interface_node) + ld.add_action(temperature_sensor_node) + ld.add_action(heat_source_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py new file mode 100644 index 000000000..b9e2c624f --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_monitor_temperature_manage_alarm_mat_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_alarm_mat_exe" + ) + + thermostat_monitor_temperature_manage_monitor_interface_mmit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe" + ) + + thermostat_monitor_temperature_manage_monitor_mode_mmmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe" + ) + + ld.add_action(thermostat_monitor_temperature_manage_alarm_mat_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_interface_mmit_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_mode_mmmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py new file mode 100644 index 000000000..5f488a919 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + operator_interface_oip_oit_node = Node( + package = "isolette_py_pkg", + executable = "operator_interface_oip_oit_exe" + ) + + ld.add_action(operator_interface_oip_oit_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py new file mode 100644 index 000000000..014c61c26 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_regulate_temperature_manage_regulator_interface_mrit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe" + ) + + thermostat_regulate_temperature_manage_heat_source_mhst_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_heat_source_mhst_exe" + ) + + thermostat_regulate_temperature_manage_regulator_mode_mrmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe" + ) + + ld.add_action(thermostat_regulate_temperature_manage_regulator_interface_mrit_node) + ld.add_action(thermostat_regulate_temperature_manage_heat_source_mhst_node) + ld.add_action(thermostat_regulate_temperature_manage_regulator_mode_mrmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py new file mode 100644 index 000000000..04c0d9de3 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + temperature_sensor_cpi_thermostat_node = Node( + package = "isolette_py_pkg", + executable = "temperature_sensor_cpi_thermostat_exe" + ) + + ld.add_action(temperature_sensor_cpi_thermostat_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py new file mode 100644 index 000000000..383d3f3b9 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py @@ -0,0 +1,29 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + regulate_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/regulate_temperature.launch.py') + ) + ) + + monitor_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/monitor_temperature.launch.py') + ) + ) + + ld.add_action(regulate_temperature_node) + ld.add_action(monitor_temperature_node) + + return ld diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/package.xml b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/package.xml new file mode 100644 index 000000000..c0ef1c8bb --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + isolette_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + isolette_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..3c237e7ba --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Heat.msg + msg/InterfaceInteraction.msg + msg/Float32.msg + msg/PhysicalTempimpl.msg + msg/ValueStatus.msg + msg/TempWstatusimpl.msg + msg/OnOff.msg + msg/Status.msg + msg/Tempimpl.msg + msg/RegulatorMode.msg + msg/Boolean.msg + msg/FailureFlagimpl.msg + msg/MonitorMode.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg new file mode 100644 index 000000000..85e9459f2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg @@ -0,0 +1 @@ +Boolean value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg new file mode 100644 index 000000000..8510ca2f7 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg @@ -0,0 +1,2 @@ +uint8 heat +uint8 HEAT_DUMMY_HEAD_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg new file mode 100644 index 000000000..74fd55b51 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg @@ -0,0 +1,2 @@ +uint8 interface_interaction +uint8 INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg new file mode 100644 index 000000000..23c152693 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg @@ -0,0 +1,4 @@ +uint8 monitor_mode +uint8 MONITOR_MODE_INIT_MONITOR_MODE=0 +uint8 MONITOR_MODE_NORMAL_MONITOR_MODE=1 +uint8 MONITOR_MODE_FAILED_MONITOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg new file mode 100644 index 000000000..2b93a6e9b --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg @@ -0,0 +1,3 @@ +uint8 on_off +uint8 ON_OFF_ONN=0 +uint8 ON_OFF_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg new file mode 100644 index 000000000..3e575ec38 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg @@ -0,0 +1,4 @@ +uint8 regulator_mode +uint8 REGULATOR_MODE_INIT_REGULATOR_MODE=0 +uint8 REGULATOR_MODE_NORMAL_REGULATOR_MODE=1 +uint8 REGULATOR_MODE_FAILED_REGULATOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Status.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Status.msg new file mode 100644 index 000000000..f921080e2 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Status.msg @@ -0,0 +1,4 @@ +uint8 status +uint8 STATUS_INIT_STATUS=0 +uint8 STATUS_ON_STATUS=1 +uint8 STATUS_FAILED_STATUS=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg new file mode 100644 index 000000000..013b4d370 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg @@ -0,0 +1,2 @@ +Float32 value +ValueStatus status \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg new file mode 100644 index 000000000..cd93b8a5e --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg @@ -0,0 +1,3 @@ +uint8 value_status +uint8 VALUE_STATUS_VALID=0 +uint8 VALUE_STATUS_INVALID=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..c0d3e4f59 --- /dev/null +++ b/resources/expected/ros2/python-isolette/strict/src/isolette_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + isolette_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..92bc818f8 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg_interfaces.msg import InterfaceInteraction +from isolette_py_pkg_interfaces.msg import ValueStatus +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = Heat() + typedValue.data = value + match (typedValue.heat): + case Heat.HEAT_DUMMY_HEAD_ENUM: + return "Heat Dummy_Head_Enum" + case default: + return "Unknown value for Heat" + +def enumToString(value): + typedValue = InterfaceInteraction() + typedValue.data = value + match (typedValue.interface_interaction): + case InterfaceInteraction.INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM: + return "InterfaceInteraction Dummy_Interface_Interaction_Enum" + case default: + return "Unknown value for InterfaceInteraction" + +def enumToString(value): + typedValue = ValueStatus() + typedValue.data = value + match (typedValue.value_status): + case ValueStatus.VALUE_STATUS_VALID: + return "ValueStatus Valid" + case ValueStatus.VALUE_STATUS_INVALID: + return "ValueStatus Invalid" + case default: + return "Unknown value for ValueStatus" + +def enumToString(value): + typedValue = OnOff() + typedValue.data = value + match (typedValue.on_off): + case OnOff.ON_OFF_ONN: + return "OnOff Onn" + case OnOff.ON_OFF_OFF: + return "OnOff Off" + case default: + return "Unknown value for OnOff" + +def enumToString(value): + typedValue = Status() + typedValue.data = value + match (typedValue.status): + case Status.STATUS_INIT_STATUS: + return "Status Init_Status" + case Status.STATUS_ON_STATUS: + return "Status On_Status" + case Status.STATUS_FAILED_STATUS: + return "Status Failed_Status" + case default: + return "Unknown value for Status" + +def enumToString(value): + typedValue = RegulatorMode() + typedValue.data = value + match (typedValue.regulator_mode): + case RegulatorMode.REGULATOR_MODE_INIT_REGULATOR_MODE: + return "RegulatorMode Init_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_NORMAL_REGULATOR_MODE: + return "RegulatorMode Normal_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_FAILED_REGULATOR_MODE: + return "RegulatorMode Failed_Regulator_Mode" + case default: + return "Unknown value for RegulatorMode" + +def enumToString(value): + typedValue = MonitorMode() + typedValue.data = value + match (typedValue.monitor_mode): + case MonitorMode.MONITOR_MODE_INIT_MONITOR_MODE: + return "MonitorMode Init_Monitor_Mode" + case MonitorMode.MONITOR_MODE_NORMAL_MONITOR_MODE: + return "MonitorMode Normal_Monitor_Mode" + case MonitorMode.MONITOR_MODE_FAILED_MONITOR_MODE: + return "MonitorMode Failed_Monitor_Mode" + case default: + return "Unknown value for MonitorMode" + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py new file mode 100644 index 000000000..f5f4223a1 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class heat_source_cpi_heat_controller_base(Node): + def __init__(self): + super().__init__("heat_source_cpi_heat_controller") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.heat_source_cpi_heat_controller_heat_control_subscription_ = self.create_subscription( + OnOff, + "thermostat_regulate_temperature_manage_heat_source_mhst_heat_control", + self.handle_heat_control, + 1, + callback_group=self.cb_group_) + + self.heat_source_cpi_heat_controller_heat_out_publisher_ = self.create_publisher( + Heat, + "heat_source_cpi_heat_controller_heat_out", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.heat_control_msg_holder = None + + def init_heat_control(self, val): + self.heat_control_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_heat_control(self, msg): + self.heat_control_msg_holder = msg + + def get_heat_control(self): + return self.heat_control_msg_holder + + def put_heat_out(self, msg): + self.heat_source_cpi_heat_controller_heat_out_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py new file mode 100644 index 000000000..dfdc41ce7 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import heat_source_cpi_heat_controller +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = heat_source_cpi_heat_controller() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py new file mode 100644 index 000000000..a3d1e6367 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class operator_interface_oip_oit_base(Node): + def __init__(self): + super().__init__("operator_interface_oip_oit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.operator_interface_oip_oit_regulator_status_subscription_ = self.create_subscription( + Status, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status", + self.handle_regulator_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_monitor_status_subscription_ = self.create_subscription( + Status, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status", + self.handle_monitor_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_display_temperature_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp", + self.handle_display_temperature, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_alarm_control_subscription_ = self.create_subscription( + OnOff, + "thermostat_monitor_temperature_manage_alarm_mat_alarm_control", + self.handle_alarm_control, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_upper_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.regulator_status_msg_holder = None + self.monitor_status_msg_holder = None + self.display_temperature_msg_holder = None + self.alarm_control_msg_holder = None + + def init_regulator_status(self, val): + self.regulator_status_msg_holder = val + + def init_monitor_status(self, val): + self.monitor_status_msg_holder = val + + def init_display_temperature(self, val): + self.display_temperature_msg_holder = val + + def init_alarm_control(self, val): + self.alarm_control_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_regulator_status(self, msg): + self.regulator_status_msg_holder = msg + + def handle_monitor_status(self, msg): + self.monitor_status_msg_holder = msg + + def handle_display_temperature(self, msg): + self.display_temperature_msg_holder = msg + + def handle_alarm_control(self, msg): + self.alarm_control_msg_holder = msg + + def get_regulator_status(self): + return self.regulator_status_msg_holder + + def get_monitor_status(self): + return self.monitor_status_msg_holder + + def get_display_temperature(self): + return self.display_temperature_msg_holder + + def get_alarm_control(self): + return self.alarm_control_msg_holder + + def put_lower_desired_tempWstatus(self, msg): + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_.publish(msg) + + def put_upper_desired_tempWstatus(self, msg): + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_.publish(msg) + + def put_lower_alarm_tempWstatus(self, msg): + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_.publish(msg) + + def put_upper_alarm_tempWstatus(self, msg): + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py new file mode 100644 index 000000000..6a5d84ad4 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import operator_interface_oip_oit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = operator_interface_oip_oit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py new file mode 100644 index 000000000..3c240b402 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class temperature_sensor_cpi_thermostat_base(Node): + def __init__(self): + super().__init__("temperature_sensor_cpi_thermostat") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.temperature_sensor_cpi_thermostat_air_subscription_ = self.create_subscription( + PhysicalTempimpl, + "temperature_sensor_cpi_thermostat_air", + self.handle_air, + 1, + callback_group=self.cb_group_) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.air_msg_holder = None + + def init_air(self, val): + self.air_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_air(self, msg): + self.air_msg_holder = msg + + def get_air(self): + return self.air_msg_holder + + def put_current_tempWstatus(self, msg): + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py new file mode 100644 index 000000000..98fb35b96 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import temperature_sensor_cpi_thermostat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = temperature_sensor_cpi_thermostat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py new file mode 100644 index 000000000..3b029ee71 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_alarm_mat_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_alarm_mat") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp", + self.handle_lower_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp", + self.handle_upper_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + self.handle_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_ = self.create_publisher( + OnOff, + "thermostat_monitor_temperature_manage_alarm_mat_alarm_control", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_alarm_temp_msg_holder = None + self.upper_alarm_temp_msg_holder = None + self.monitor_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_alarm_temp(self, val): + self.lower_alarm_temp_msg_holder = val + + def init_upper_alarm_temp(self, val): + self.upper_alarm_temp_msg_holder = val + + def init_monitor_mode(self, val): + self.monitor_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_alarm_temp(self, msg): + self.lower_alarm_temp_msg_holder = msg + + def handle_upper_alarm_temp(self, msg): + self.upper_alarm_temp_msg_holder = msg + + def handle_monitor_mode(self, msg): + self.monitor_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_alarm_temp(self): + return self.lower_alarm_temp_msg_holder + + def get_upper_alarm_temp(self): + return self.upper_alarm_temp_msg_holder + + def get_monitor_mode(self): + return self.monitor_mode_msg_holder + + def put_alarm_control(self, msg): + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py new file mode 100644 index 000000000..fb00dc3f0 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import thermostat_monitor_temperature_manage_alarm_mat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_alarm_mat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py new file mode 100644 index 000000000..433293153 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_interface_mmit_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_interface_mmit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + self.handle_upper_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + self.handle_lower_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + self.handle_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_ = self.create_publisher( + Status, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.upper_alarm_tempWstatus_msg_holder = None + self.lower_alarm_tempWstatus_msg_holder = None + self.current_tempWstatus_msg_holder = None + self.monitor_mode_msg_holder = None + + def init_upper_alarm_tempWstatus(self, val): + self.upper_alarm_tempWstatus_msg_holder = val + + def init_lower_alarm_tempWstatus(self, val): + self.lower_alarm_tempWstatus_msg_holder = val + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_monitor_mode(self, val): + self.monitor_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_upper_alarm_tempWstatus(self, msg): + self.upper_alarm_tempWstatus_msg_holder = msg + + def handle_lower_alarm_tempWstatus(self, msg): + self.lower_alarm_tempWstatus_msg_holder = msg + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_monitor_mode(self, msg): + self.monitor_mode_msg_holder = msg + + def get_upper_alarm_tempWstatus(self): + return self.upper_alarm_tempWstatus_msg_holder + + def get_lower_alarm_tempWstatus(self): + return self.lower_alarm_tempWstatus_msg_holder + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_monitor_mode(self): + return self.monitor_mode_msg_holder + + def put_upper_alarm_temp(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_.publish(msg) + + def put_lower_alarm_temp(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_.publish(msg) + + def put_monitor_status(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_.publish(msg) + + def put_interface_failure(self, msg): + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py new file mode 100644 index 000000000..4e4b756ea --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import thermostat_monitor_temperature_manage_monitor_interface_mmit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_interface_mmit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py new file mode 100644 index 000000000..26a632dd1 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_mode_mmmt_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_mode_mmmt") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure", + self.handle_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure", + self.handle_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_ = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.interface_failure_msg_holder = None + self.internal_failure_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_interface_failure(self, val): + self.interface_failure_msg_holder = val + + def init_internal_failure(self, val): + self.internal_failure_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_interface_failure(self, msg): + self.interface_failure_msg_holder = msg + + def handle_internal_failure(self, msg): + self.internal_failure_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_interface_failure(self): + return self.interface_failure_msg_holder + + def get_internal_failure(self): + return self.internal_failure_msg_holder + + def put_monitor_mode(self, msg): + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py new file mode 100644 index 000000000..c19f85dc4 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_mode_mmmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py new file mode 100644 index 000000000..e747e800e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_heat_source_mhst_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_heat_source_mhst") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp", + self.handle_lower_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp", + self.handle_upper_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + self.handle_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_ = self.create_publisher( + OnOff, + "thermostat_regulate_temperature_manage_heat_source_mhst_heat_control", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_desired_temp_msg_holder = None + self.upper_desired_temp_msg_holder = None + self.regulator_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_desired_temp(self, val): + self.lower_desired_temp_msg_holder = val + + def init_upper_desired_temp(self, val): + self.upper_desired_temp_msg_holder = val + + def init_regulator_mode(self, val): + self.regulator_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_desired_temp(self, msg): + self.lower_desired_temp_msg_holder = msg + + def handle_upper_desired_temp(self, msg): + self.upper_desired_temp_msg_holder = msg + + def handle_regulator_mode(self, msg): + self.regulator_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_desired_temp(self): + return self.lower_desired_temp_msg_holder + + def get_upper_desired_temp(self): + return self.upper_desired_temp_msg_holder + + def get_regulator_mode(self): + return self.regulator_mode_msg_holder + + def put_heat_control(self, msg): + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py new file mode 100644 index 000000000..63044f20a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import thermostat_regulate_temperature_manage_heat_source_mhst +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_heat_source_mhst() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py new file mode 100644 index 000000000..8598ecb7d --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_interface_mrit_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_interface_mrit") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_lower_desired_tempWstatus", + self.handle_lower_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_desired_tempWstatus", + self.handle_upper_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + self.handle_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_ = self.create_publisher( + Status, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.lower_desired_tempWstatus_msg_holder = None + self.upper_desired_tempWstatus_msg_holder = None + self.regulator_mode_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_lower_desired_tempWstatus(self, val): + self.lower_desired_tempWstatus_msg_holder = val + + def init_upper_desired_tempWstatus(self, val): + self.upper_desired_tempWstatus_msg_holder = val + + def init_regulator_mode(self, val): + self.regulator_mode_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_lower_desired_tempWstatus(self, msg): + self.lower_desired_tempWstatus_msg_holder = msg + + def handle_upper_desired_tempWstatus(self, msg): + self.upper_desired_tempWstatus_msg_holder = msg + + def handle_regulator_mode(self, msg): + self.regulator_mode_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_lower_desired_tempWstatus(self): + return self.lower_desired_tempWstatus_msg_holder + + def get_upper_desired_tempWstatus(self): + return self.upper_desired_tempWstatus_msg_holder + + def get_regulator_mode(self): + return self.regulator_mode_msg_holder + + def put_upper_desired_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_.publish(msg) + + def put_lower_desired_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_.publish(msg) + + def put_displayed_temp(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_.publish(msg) + + def put_regulator_status(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_.publish(msg) + + def put_interface_failure(self, msg): + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py new file mode 100644 index 000000000..0ce8e2d1e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import thermostat_regulate_temperature_manage_regulator_interface_mrit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_interface_mrit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py new file mode 100644 index 000000000..8cc2f2397 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import * +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_mode_mrmt_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_mode_mrmt") + + self.cb_group_ = ReentrantCallbackGroup() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.handle_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure", + self.handle_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure", + self.handle_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_ = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + 1) + + # timeTriggered callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_) + + self.current_tempWstatus_msg_holder = None + self.interface_failure_msg_holder = None + self.internal_failure_msg_holder = None + + def init_current_tempWstatus(self, val): + self.current_tempWstatus_msg_holder = val + + def init_interface_failure(self, val): + self.interface_failure_msg_holder = val + + def init_internal_failure(self, val): + self.internal_failure_msg_holder = val + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def handle_current_tempWstatus(self, msg): + self.current_tempWstatus_msg_holder = msg + + def handle_interface_failure(self, msg): + self.interface_failure_msg_holder = msg + + def handle_internal_failure(self, msg): + self.internal_failure_msg_holder = msg + + def get_current_tempWstatus(self): + return self.current_tempWstatus_msg_holder + + def get_interface_failure(self): + return self.interface_failure_msg_holder + + def get_internal_failure(self): + return self.internal_failure_msg_holder + + def put_regulator_mode(self, msg): + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_.publish(msg) + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py new file mode 100644 index 000000000..b7d9a68ee --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_mode_mrmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py new file mode 100644 index 000000000..3ded2b5fa --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.heat_source_cpi_heat_controller_base_src import heat_source_cpi_heat_controller_base +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class heat_source_cpi_heat_controller(heat_source_cpi_heat_controller_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("heat_source_cpi_heat_controller infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + heat_control = OnOff() + self.init_heat_control(heat_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + heat_control = self.get_heat_control() + self.get_logger().info(f"Received heat_control: {self.message_to_string(heat_control)}") + + + # Example publishing messages + heat_out = Heat() + self.put_heat_out(heat_out) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py new file mode 100644 index 000000000..ac40b469a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.operator_interface_oip_oit_base_src import operator_interface_oip_oit_base +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class operator_interface_oip_oit(operator_interface_oip_oit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("operator_interface_oip_oit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + regulator_status = Status() + self.init_regulator_status(regulator_status) + + monitor_status = Status() + self.init_monitor_status(monitor_status) + + display_temperature = Tempimpl() + self.init_display_temperature(display_temperature) + + alarm_control = OnOff() + self.init_alarm_control(alarm_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + regulator_status = self.get_regulator_status() + self.get_logger().info(f"Received regulator_status: {self.message_to_string(regulator_status)}") + + monitor_status = self.get_monitor_status() + self.get_logger().info(f"Received monitor_status: {self.message_to_string(monitor_status)}") + + display_temperature = self.get_display_temperature() + self.get_logger().info(f"Received display_temperature: {self.message_to_string(display_temperature)}") + + alarm_control = self.get_alarm_control() + self.get_logger().info(f"Received alarm_control: {self.message_to_string(alarm_control)}") + + + # Example publishing messages + lower_desired_tempWstatus = TempWstatusimpl() + self.put_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.put_upper_desired_tempWstatus(upper_desired_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.put_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + upper_alarm_tempWstatus = TempWstatusimpl() + self.put_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py new file mode 100644 index 000000000..e1c1ca3af --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_base_src import temperature_sensor_cpi_thermostat_base +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class temperature_sensor_cpi_thermostat(temperature_sensor_cpi_thermostat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("temperature_sensor_cpi_thermostat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + air = PhysicalTempimpl() + self.init_air(air) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + air = self.get_air() + self.get_logger().info(f"Received air: {self.message_to_string(air)}") + + + # Example publishing messages + current_tempWstatus = TempWstatusimpl() + self.put_current_tempWstatus(current_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py new file mode 100644 index 000000000..f67a7c036 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_base_src import thermostat_monitor_temperature_manage_alarm_mat_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_alarm_mat(thermostat_monitor_temperature_manage_alarm_mat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_alarm_mat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_alarm_temp = Tempimpl() + self.init_lower_alarm_temp(lower_alarm_temp) + + upper_alarm_temp = Tempimpl() + self.init_upper_alarm_temp(upper_alarm_temp) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_alarm_temp = self.get_lower_alarm_temp() + self.get_logger().info(f"Received lower_alarm_temp: {self.message_to_string(lower_alarm_temp)}") + + upper_alarm_temp = self.get_upper_alarm_temp() + self.get_logger().info(f"Received upper_alarm_temp: {self.message_to_string(upper_alarm_temp)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + alarm_control = OnOff() + self.put_alarm_control(alarm_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py new file mode 100644 index 000000000..4f3930578 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src import thermostat_monitor_temperature_manage_monitor_interface_mmit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_interface_mmit(thermostat_monitor_temperature_manage_monitor_interface_mmit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_interface_mmit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + upper_alarm_tempWstatus = TempWstatusimpl() + self.init_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.init_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + upper_alarm_tempWstatus = self.get_upper_alarm_tempWstatus() + self.get_logger().info(f"Received upper_alarm_tempWstatus: {self.message_to_string(upper_alarm_tempWstatus)}") + + lower_alarm_tempWstatus = self.get_lower_alarm_tempWstatus() + self.get_logger().info(f"Received lower_alarm_tempWstatus: {self.message_to_string(lower_alarm_tempWstatus)}") + + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + upper_alarm_temp = Tempimpl() + self.put_upper_alarm_temp(upper_alarm_temp) + + lower_alarm_temp = Tempimpl() + self.put_lower_alarm_temp(lower_alarm_temp) + + monitor_status = Status() + self.put_monitor_status(monitor_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py new file mode 100644 index 000000000..973aa609c --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_mode_mmmt(thermostat_monitor_temperature_manage_monitor_mode_mmmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_mode_mmmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + monitor_mode = MonitorMode() + self.put_monitor_mode(monitor_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py new file mode 100644 index 000000000..4826e5681 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_base_src import thermostat_regulate_temperature_manage_heat_source_mhst_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_heat_source_mhst(thermostat_regulate_temperature_manage_heat_source_mhst_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_heat_source_mhst infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_temp = Tempimpl() + self.init_lower_desired_temp(lower_desired_temp) + + upper_desired_temp = Tempimpl() + self.init_upper_desired_temp(upper_desired_temp) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_temp = self.get_lower_desired_temp() + self.get_logger().info(f"Received lower_desired_temp: {self.message_to_string(lower_desired_temp)}") + + upper_desired_temp = self.get_upper_desired_temp() + self.get_logger().info(f"Received upper_desired_temp: {self.message_to_string(upper_desired_temp)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + heat_control = OnOff() + self.put_heat_control(heat_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py new file mode 100644 index 000000000..94513c84d --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src import thermostat_regulate_temperature_manage_regulator_interface_mrit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_interface_mrit(thermostat_regulate_temperature_manage_regulator_interface_mrit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_interface_mrit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_tempWstatus = TempWstatusimpl() + self.init_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.init_upper_desired_tempWstatus(upper_desired_tempWstatus) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_tempWstatus = self.get_lower_desired_tempWstatus() + self.get_logger().info(f"Received lower_desired_tempWstatus: {self.message_to_string(lower_desired_tempWstatus)}") + + upper_desired_tempWstatus = self.get_upper_desired_tempWstatus() + self.get_logger().info(f"Received upper_desired_tempWstatus: {self.message_to_string(upper_desired_tempWstatus)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + upper_desired_temp = Tempimpl() + self.put_upper_desired_temp(upper_desired_temp) + + lower_desired_temp = Tempimpl() + self.put_lower_desired_temp(lower_desired_temp) + + displayed_temp = Tempimpl() + self.put_displayed_temp(displayed_temp) + + regulator_status = Status() + self.put_regulator_status(regulator_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py new file mode 100644 index 000000000..ea5e59937 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_mode_mrmt(thermostat_regulate_temperature_manage_regulator_mode_mrmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_mode_mrmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + regulator_mode = RegulatorMode() + self.put_regulator_mode(regulator_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/package.xml new file mode 100644 index 000000000..ddc125c8a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + isolette_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + isolette_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/resource/isolette_py_pkg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/resource/isolette_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/resource/isolette_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.cfg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.cfg new file mode 100644 index 000000000..de71f7785 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/isolette_py_pkg +[develop] +script_dir=$base/lib/isolette_py_pkg +[install] +install_scripts=$base/lib/isolette_py_pkg diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.py new file mode 100644 index 000000000..4db5def61 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/setup.py @@ -0,0 +1,36 @@ +# setup.py in src/isolette_py_pkg + +from setuptools import find_packages, setup + +package_name = 'isolette_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_runner:main", + "thermostat_regulate_temperature_manage_heat_source_mhst_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_runner:main", + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner:main", + "thermostat_monitor_temperature_manage_alarm_mat_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_runner:main", + "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_runner:main", + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner:main", + "operator_interface_oip_oit_exe = isolette_py_pkg.base_code.operator_interface_oip_oit_runner:main", + "temperature_sensor_cpi_thermostat_exe = isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_runner:main", + "heat_source_cpi_heat_controller_exe = isolette_py_pkg.base_code.heat_source_cpi_heat_controller_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..7ef2c8397 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py new file mode 100644 index 000000000..19d78f040 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/heat_source.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + heat_source_cpi_heat_controller_node = Node( + package = "isolette_py_pkg", + executable = "heat_source_cpi_heat_controller_exe" + ) + + ld.add_action(heat_source_cpi_heat_controller_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py new file mode 100644 index 000000000..265c24dc0 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py @@ -0,0 +1,45 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/thermostat.launch.py') + ) + ) + + operator_interface_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/operator_interface.launch.py') + ) + ) + + temperature_sensor_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/temperature_sensor.launch.py') + ) + ) + + heat_source_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/heat_source.launch.py') + ) + ) + + ld.add_action(thermostat_node) + ld.add_action(operator_interface_node) + ld.add_action(temperature_sensor_node) + ld.add_action(heat_source_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py new file mode 100644 index 000000000..b9e2c624f --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_monitor_temperature_manage_alarm_mat_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_alarm_mat_exe" + ) + + thermostat_monitor_temperature_manage_monitor_interface_mmit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe" + ) + + thermostat_monitor_temperature_manage_monitor_mode_mmmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe" + ) + + ld.add_action(thermostat_monitor_temperature_manage_alarm_mat_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_interface_mmit_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_mode_mmmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py new file mode 100644 index 000000000..5f488a919 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + operator_interface_oip_oit_node = Node( + package = "isolette_py_pkg", + executable = "operator_interface_oip_oit_exe" + ) + + ld.add_action(operator_interface_oip_oit_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py new file mode 100644 index 000000000..014c61c26 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_regulate_temperature_manage_regulator_interface_mrit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe" + ) + + thermostat_regulate_temperature_manage_heat_source_mhst_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_heat_source_mhst_exe" + ) + + thermostat_regulate_temperature_manage_regulator_mode_mrmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe" + ) + + ld.add_action(thermostat_regulate_temperature_manage_regulator_interface_mrit_node) + ld.add_action(thermostat_regulate_temperature_manage_heat_source_mhst_node) + ld.add_action(thermostat_regulate_temperature_manage_regulator_mode_mrmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py new file mode 100644 index 000000000..04c0d9de3 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + temperature_sensor_cpi_thermostat_node = Node( + package = "isolette_py_pkg", + executable = "temperature_sensor_cpi_thermostat_exe" + ) + + ld.add_action(temperature_sensor_cpi_thermostat_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py new file mode 100644 index 000000000..383d3f3b9 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/launch/thermostat.launch.py @@ -0,0 +1,29 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + regulate_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/regulate_temperature.launch.py') + ) + ) + + monitor_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/monitor_temperature.launch.py') + ) + ) + + ld.add_action(regulate_temperature_node) + ld.add_action(monitor_temperature_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/package.xml new file mode 100644 index 000000000..c0ef1c8bb --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + isolette_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + isolette_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..3c237e7ba --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Heat.msg + msg/InterfaceInteraction.msg + msg/Float32.msg + msg/PhysicalTempimpl.msg + msg/ValueStatus.msg + msg/TempWstatusimpl.msg + msg/OnOff.msg + msg/Status.msg + msg/Tempimpl.msg + msg/RegulatorMode.msg + msg/Boolean.msg + msg/FailureFlagimpl.msg + msg/MonitorMode.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg new file mode 100644 index 000000000..85e9459f2 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg @@ -0,0 +1 @@ +Boolean value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg new file mode 100644 index 000000000..8510ca2f7 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Heat.msg @@ -0,0 +1,2 @@ +uint8 heat +uint8 HEAT_DUMMY_HEAD_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg new file mode 100644 index 000000000..74fd55b51 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg @@ -0,0 +1,2 @@ +uint8 interface_interaction +uint8 INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg new file mode 100644 index 000000000..23c152693 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg @@ -0,0 +1,4 @@ +uint8 monitor_mode +uint8 MONITOR_MODE_INIT_MONITOR_MODE=0 +uint8 MONITOR_MODE_NORMAL_MONITOR_MODE=1 +uint8 MONITOR_MODE_FAILED_MONITOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg new file mode 100644 index 000000000..2b93a6e9b --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/OnOff.msg @@ -0,0 +1,3 @@ +uint8 on_off +uint8 ON_OFF_ONN=0 +uint8 ON_OFF_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg new file mode 100644 index 000000000..3e575ec38 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg @@ -0,0 +1,4 @@ +uint8 regulator_mode +uint8 REGULATOR_MODE_INIT_REGULATOR_MODE=0 +uint8 REGULATOR_MODE_NORMAL_REGULATOR_MODE=1 +uint8 REGULATOR_MODE_FAILED_REGULATOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Status.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Status.msg new file mode 100644 index 000000000..f921080e2 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Status.msg @@ -0,0 +1,4 @@ +uint8 status +uint8 STATUS_INIT_STATUS=0 +uint8 STATUS_ON_STATUS=1 +uint8 STATUS_FAILED_STATUS=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg new file mode 100644 index 000000000..013b4d370 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg @@ -0,0 +1,2 @@ +Float32 value +ValueStatus status \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg new file mode 100644 index 000000000..cd93b8a5e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg @@ -0,0 +1,3 @@ +uint8 value_status +uint8 VALUE_STATUS_VALID=0 +uint8 VALUE_STATUS_INVALID=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..c0d3e4f59 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/lax/src/isolette_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + isolette_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py new file mode 100644 index 000000000..92bc818f8 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/enum_converter.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg_interfaces.msg import InterfaceInteraction +from isolette_py_pkg_interfaces.msg import ValueStatus +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +def enumToString(value): + typedValue = Heat() + typedValue.data = value + match (typedValue.heat): + case Heat.HEAT_DUMMY_HEAD_ENUM: + return "Heat Dummy_Head_Enum" + case default: + return "Unknown value for Heat" + +def enumToString(value): + typedValue = InterfaceInteraction() + typedValue.data = value + match (typedValue.interface_interaction): + case InterfaceInteraction.INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM: + return "InterfaceInteraction Dummy_Interface_Interaction_Enum" + case default: + return "Unknown value for InterfaceInteraction" + +def enumToString(value): + typedValue = ValueStatus() + typedValue.data = value + match (typedValue.value_status): + case ValueStatus.VALUE_STATUS_VALID: + return "ValueStatus Valid" + case ValueStatus.VALUE_STATUS_INVALID: + return "ValueStatus Invalid" + case default: + return "Unknown value for ValueStatus" + +def enumToString(value): + typedValue = OnOff() + typedValue.data = value + match (typedValue.on_off): + case OnOff.ON_OFF_ONN: + return "OnOff Onn" + case OnOff.ON_OFF_OFF: + return "OnOff Off" + case default: + return "Unknown value for OnOff" + +def enumToString(value): + typedValue = Status() + typedValue.data = value + match (typedValue.status): + case Status.STATUS_INIT_STATUS: + return "Status Init_Status" + case Status.STATUS_ON_STATUS: + return "Status On_Status" + case Status.STATUS_FAILED_STATUS: + return "Status Failed_Status" + case default: + return "Unknown value for Status" + +def enumToString(value): + typedValue = RegulatorMode() + typedValue.data = value + match (typedValue.regulator_mode): + case RegulatorMode.REGULATOR_MODE_INIT_REGULATOR_MODE: + return "RegulatorMode Init_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_NORMAL_REGULATOR_MODE: + return "RegulatorMode Normal_Regulator_Mode" + case RegulatorMode.REGULATOR_MODE_FAILED_REGULATOR_MODE: + return "RegulatorMode Failed_Regulator_Mode" + case default: + return "Unknown value for RegulatorMode" + +def enumToString(value): + typedValue = MonitorMode() + typedValue.data = value + match (typedValue.monitor_mode): + case MonitorMode.MONITOR_MODE_INIT_MONITOR_MODE: + return "MonitorMode Init_Monitor_Mode" + case MonitorMode.MONITOR_MODE_NORMAL_MONITOR_MODE: + return "MonitorMode Normal_Monitor_Mode" + case MonitorMode.MONITOR_MODE_FAILED_MONITOR_MODE: + return "MonitorMode Failed_Monitor_Mode" + case default: + return "Unknown value for MonitorMode" + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py new file mode 100644 index 000000000..a57b22ec8 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_base_src.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class heat_source_cpi_heat_controller_base(Node): + def __init__(self): + super().__init__("heat_source_cpi_heat_controller") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.heat_source_cpi_heat_controller_heat_control_subscription_ = self.create_subscription( + OnOff, + "thermostat_regulate_temperature_manage_heat_source_mhst_heat_control", + self.accept_heat_control, + 1, + callback_group=self.cb_group_) + + self.heat_source_cpi_heat_controller_heat_out_publisher_ = self.create_publisher( + Heat, + "heat_source_cpi_heat_controller_heat_out", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_heat_control = deque() + self.applicationIn_heat_control = deque() + + self.infrastructureOut_heat_out = deque() + self.applicationOut_heat_out = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_heat_control, self.applicationIn_heat_control] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_heat_control, self.applicationIn_heat_control] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_heat_out, self.infrastructureOut_heat_out, self.sendOut_heat_out] + ] + + def init_heat_control(self, val): + self.enqueue(self.infrastructureIn_heat_control, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_heat_control(self, msg): + self.enqueue(self.infrastructureIn_heat_control, msg) + + def get_heat_control(self): + msg = self.applicationIn_heat_control[0] + return msg + + def sendOut_heat_out(self, msg): + if type(msg) is Heat: + self.heat_source_cpi_heat_controller_heat_out_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port heat_out.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_heat_out(self, msg): + self.enqueue(self.applicationOut_heat_out, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py new file mode 100644 index 000000000..dfdc41ce7 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/heat_source_cpi_heat_controller_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.heat_source_cpi_heat_controller_src import heat_source_cpi_heat_controller +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = heat_source_cpi_heat_controller() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py new file mode 100644 index 000000000..812f95bed --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_base_src.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class operator_interface_oip_oit_base(Node): + def __init__(self): + super().__init__("operator_interface_oip_oit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.operator_interface_oip_oit_regulator_status_subscription_ = self.create_subscription( + Status, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status", + self.accept_regulator_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_monitor_status_subscription_ = self.create_subscription( + Status, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status", + self.accept_monitor_status, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_display_temperature_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp", + self.accept_display_temperature, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_alarm_control_subscription_ = self.create_subscription( + OnOff, + "thermostat_monitor_temperature_manage_alarm_mat_alarm_control", + self.accept_alarm_control, + 1, + callback_group=self.cb_group_) + + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_upper_desired_tempWstatus", + 1) + + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_lower_alarm_tempWstatus", + 1) + + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_regulator_status = deque() + self.applicationIn_regulator_status = deque() + self.infrastructureIn_monitor_status = deque() + self.applicationIn_monitor_status = deque() + self.infrastructureIn_display_temperature = deque() + self.applicationIn_display_temperature = deque() + self.infrastructureIn_alarm_control = deque() + self.applicationIn_alarm_control = deque() + + self.infrastructureOut_lower_desired_tempWstatus = deque() + self.applicationOut_lower_desired_tempWstatus = deque() + self.infrastructureOut_upper_desired_tempWstatus = deque() + self.applicationOut_upper_desired_tempWstatus = deque() + self.infrastructureOut_lower_alarm_tempWstatus = deque() + self.applicationOut_lower_alarm_tempWstatus = deque() + self.infrastructureOut_upper_alarm_tempWstatus = deque() + self.applicationOut_upper_alarm_tempWstatus = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_regulator_status, self.applicationIn_regulator_status], + [self.infrastructureIn_monitor_status, self.applicationIn_monitor_status], + [self.infrastructureIn_display_temperature, self.applicationIn_display_temperature], + [self.infrastructureIn_alarm_control, self.applicationIn_alarm_control] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_regulator_status, self.applicationIn_regulator_status], + [self.infrastructureIn_monitor_status, self.applicationIn_monitor_status], + [self.infrastructureIn_display_temperature, self.applicationIn_display_temperature], + [self.infrastructureIn_alarm_control, self.applicationIn_alarm_control] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_lower_desired_tempWstatus, self.infrastructureOut_lower_desired_tempWstatus, self.sendOut_lower_desired_tempWstatus], + [self.applicationOut_upper_desired_tempWstatus, self.infrastructureOut_upper_desired_tempWstatus, self.sendOut_upper_desired_tempWstatus], + [self.applicationOut_lower_alarm_tempWstatus, self.infrastructureOut_lower_alarm_tempWstatus, self.sendOut_lower_alarm_tempWstatus], + [self.applicationOut_upper_alarm_tempWstatus, self.infrastructureOut_upper_alarm_tempWstatus, self.sendOut_upper_alarm_tempWstatus] + ] + + def init_regulator_status(self, val): + self.enqueue(self.infrastructureIn_regulator_status, val) + + + def init_monitor_status(self, val): + self.enqueue(self.infrastructureIn_monitor_status, val) + + + def init_display_temperature(self, val): + self.enqueue(self.infrastructureIn_display_temperature, val) + + + def init_alarm_control(self, val): + self.enqueue(self.infrastructureIn_alarm_control, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_regulator_status(self, msg): + self.enqueue(self.infrastructureIn_regulator_status, msg) + + def accept_monitor_status(self, msg): + self.enqueue(self.infrastructureIn_monitor_status, msg) + + def accept_display_temperature(self, msg): + self.enqueue(self.infrastructureIn_display_temperature, msg) + + def accept_alarm_control(self, msg): + self.enqueue(self.infrastructureIn_alarm_control, msg) + + def get_regulator_status(self): + msg = self.applicationIn_regulator_status[0] + return msg + + def get_monitor_status(self): + msg = self.applicationIn_monitor_status[0] + return msg + + def get_display_temperature(self): + msg = self.applicationIn_display_temperature[0] + return msg + + def get_alarm_control(self): + msg = self.applicationIn_alarm_control[0] + return msg + + def sendOut_lower_desired_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_lower_desired_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_desired_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_upper_desired_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_upper_desired_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_desired_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_alarm_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_lower_alarm_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_alarm_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_upper_alarm_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.operator_interface_oip_oit_upper_alarm_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_alarm_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_lower_desired_tempWstatus(self, msg): + self.enqueue(self.applicationOut_lower_desired_tempWstatus, msg) + + def put_upper_desired_tempWstatus(self, msg): + self.enqueue(self.applicationOut_upper_desired_tempWstatus, msg) + + def put_lower_alarm_tempWstatus(self, msg): + self.enqueue(self.applicationOut_lower_alarm_tempWstatus, msg) + + def put_upper_alarm_tempWstatus(self, msg): + self.enqueue(self.applicationOut_upper_alarm_tempWstatus, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py new file mode 100644 index 000000000..6a5d84ad4 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/operator_interface_oip_oit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.operator_interface_oip_oit_src import operator_interface_oip_oit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = operator_interface_oip_oit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py new file mode 100644 index 000000000..a42c80b37 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_base_src.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class temperature_sensor_cpi_thermostat_base(Node): + def __init__(self): + super().__init__("temperature_sensor_cpi_thermostat") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.temperature_sensor_cpi_thermostat_air_subscription_ = self.create_subscription( + PhysicalTempimpl, + "temperature_sensor_cpi_thermostat_air", + self.accept_air, + 1, + callback_group=self.cb_group_) + + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_ = self.create_publisher( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_air = deque() + self.applicationIn_air = deque() + + self.infrastructureOut_current_tempWstatus = deque() + self.applicationOut_current_tempWstatus = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_air, self.applicationIn_air] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_air, self.applicationIn_air] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_current_tempWstatus, self.infrastructureOut_current_tempWstatus, self.sendOut_current_tempWstatus] + ] + + def init_air(self, val): + self.enqueue(self.infrastructureIn_air, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_air(self, msg): + self.enqueue(self.infrastructureIn_air, msg) + + def get_air(self): + msg = self.applicationIn_air[0] + return msg + + def sendOut_current_tempWstatus(self, msg): + if type(msg) is TempWstatusimpl: + self.temperature_sensor_cpi_thermostat_current_tempWstatus_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port current_tempWstatus.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_current_tempWstatus(self, msg): + self.enqueue(self.applicationOut_current_tempWstatus, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py new file mode 100644 index 000000000..98fb35b96 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/temperature_sensor_cpi_thermostat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.temperature_sensor_cpi_thermostat_src import temperature_sensor_cpi_thermostat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = temperature_sensor_cpi_thermostat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py new file mode 100644 index 000000000..15f7a559e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_base_src.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_alarm_mat_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_alarm_mat") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_alarm_mat_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_lower_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp", + self.accept_lower_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_upper_alarm_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp", + self.accept_upper_alarm_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + self.accept_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_ = self.create_publisher( + OnOff, + "thermostat_monitor_temperature_manage_alarm_mat_alarm_control", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_alarm_temp = deque() + self.applicationIn_lower_alarm_temp = deque() + self.infrastructureIn_upper_alarm_temp = deque() + self.applicationIn_upper_alarm_temp = deque() + self.infrastructureIn_monitor_mode = deque() + self.applicationIn_monitor_mode = deque() + + self.infrastructureOut_alarm_control = deque() + self.applicationOut_alarm_control = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_alarm_temp, self.applicationIn_lower_alarm_temp], + [self.infrastructureIn_upper_alarm_temp, self.applicationIn_upper_alarm_temp], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_alarm_temp, self.applicationIn_lower_alarm_temp], + [self.infrastructureIn_upper_alarm_temp, self.applicationIn_upper_alarm_temp], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_alarm_control, self.infrastructureOut_alarm_control, self.sendOut_alarm_control] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_alarm_temp(self, val): + self.enqueue(self.infrastructureIn_lower_alarm_temp, val) + + + def init_upper_alarm_temp(self, val): + self.enqueue(self.infrastructureIn_upper_alarm_temp, val) + + + def init_monitor_mode(self, val): + self.enqueue(self.infrastructureIn_monitor_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_alarm_temp(self, msg): + self.enqueue(self.infrastructureIn_lower_alarm_temp, msg) + + def accept_upper_alarm_temp(self, msg): + self.enqueue(self.infrastructureIn_upper_alarm_temp, msg) + + def accept_monitor_mode(self, msg): + self.enqueue(self.infrastructureIn_monitor_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_alarm_temp(self): + msg = self.applicationIn_lower_alarm_temp[0] + return msg + + def get_upper_alarm_temp(self): + msg = self.applicationIn_upper_alarm_temp[0] + return msg + + def get_monitor_mode(self): + msg = self.applicationIn_monitor_mode[0] + return msg + + def sendOut_alarm_control(self, msg): + if type(msg) is OnOff: + self.thermostat_monitor_temperature_manage_alarm_mat_alarm_control_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port alarm_control.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_alarm_control(self, msg): + self.enqueue(self.applicationOut_alarm_control, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py new file mode 100644 index 000000000..fb00dc3f0 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_alarm_mat_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_alarm_mat_src import thermostat_monitor_temperature_manage_alarm_mat +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_alarm_mat() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py new file mode 100644 index 000000000..6fb98ff3b --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_interface_mmit_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_interface_mmit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + self.accept_upper_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_alarm_tempWstatus", + self.accept_lower_alarm_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_mode_subscription_ = self.create_subscription( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + self.accept_monitor_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_ = self.create_publisher( + Status, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status", + 1) + + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_upper_alarm_tempWstatus = deque() + self.applicationIn_upper_alarm_tempWstatus = deque() + self.infrastructureIn_lower_alarm_tempWstatus = deque() + self.applicationIn_lower_alarm_tempWstatus = deque() + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_monitor_mode = deque() + self.applicationIn_monitor_mode = deque() + + self.infrastructureOut_upper_alarm_temp = deque() + self.applicationOut_upper_alarm_temp = deque() + self.infrastructureOut_lower_alarm_temp = deque() + self.applicationOut_lower_alarm_temp = deque() + self.infrastructureOut_monitor_status = deque() + self.applicationOut_monitor_status = deque() + self.infrastructureOut_interface_failure = deque() + self.applicationOut_interface_failure = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_upper_alarm_tempWstatus, self.applicationIn_upper_alarm_tempWstatus], + [self.infrastructureIn_lower_alarm_tempWstatus, self.applicationIn_lower_alarm_tempWstatus], + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_upper_alarm_tempWstatus, self.applicationIn_upper_alarm_tempWstatus], + [self.infrastructureIn_lower_alarm_tempWstatus, self.applicationIn_lower_alarm_tempWstatus], + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_monitor_mode, self.applicationIn_monitor_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_upper_alarm_temp, self.infrastructureOut_upper_alarm_temp, self.sendOut_upper_alarm_temp], + [self.applicationOut_lower_alarm_temp, self.infrastructureOut_lower_alarm_temp, self.sendOut_lower_alarm_temp], + [self.applicationOut_monitor_status, self.infrastructureOut_monitor_status, self.sendOut_monitor_status], + [self.applicationOut_interface_failure, self.infrastructureOut_interface_failure, self.sendOut_interface_failure] + ] + + def init_upper_alarm_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_upper_alarm_tempWstatus, val) + + + def init_lower_alarm_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_lower_alarm_tempWstatus, val) + + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_monitor_mode(self, val): + self.enqueue(self.infrastructureIn_monitor_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_upper_alarm_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_upper_alarm_tempWstatus, msg) + + def accept_lower_alarm_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_lower_alarm_tempWstatus, msg) + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_monitor_mode(self, msg): + self.enqueue(self.infrastructureIn_monitor_mode, msg) + + def get_upper_alarm_tempWstatus(self): + msg = self.applicationIn_upper_alarm_tempWstatus[0] + return msg + + def get_lower_alarm_tempWstatus(self): + msg = self.applicationIn_lower_alarm_tempWstatus[0] + return msg + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_monitor_mode(self): + msg = self.applicationIn_monitor_mode[0] + return msg + + def sendOut_upper_alarm_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_upper_alarm_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_alarm_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_alarm_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_lower_alarm_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_alarm_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_monitor_status(self, msg): + if type(msg) is Status: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_monitor_status_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port monitor_status.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_interface_failure(self, msg): + if type(msg) is FailureFlagimpl: + self.thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port interface_failure.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_upper_alarm_temp(self, msg): + self.enqueue(self.applicationOut_upper_alarm_temp, msg) + + def put_lower_alarm_temp(self, msg): + self.enqueue(self.applicationOut_lower_alarm_temp, msg) + + def put_monitor_status(self, msg): + self.enqueue(self.applicationOut_monitor_status, msg) + + def put_interface_failure(self, msg): + self.enqueue(self.applicationOut_interface_failure, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py new file mode 100644 index 000000000..4e4b756ea --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_src import thermostat_monitor_temperature_manage_monitor_interface_mmit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_interface_mmit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py new file mode 100644 index 000000000..d42f5e65e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_monitor_temperature_manage_monitor_mode_mmmt_base(Node): + def __init__(self): + super().__init__("thermostat_monitor_temperature_manage_monitor_mode_mmmt") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_interface_mmit_interface_failure", + self.accept_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_internal_failure", + self.accept_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_ = self.create_publisher( + MonitorMode, + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_interface_failure = deque() + self.applicationIn_interface_failure = deque() + self.infrastructureIn_internal_failure = deque() + self.applicationIn_internal_failure = deque() + + self.infrastructureOut_monitor_mode = deque() + self.applicationOut_monitor_mode = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_monitor_mode, self.infrastructureOut_monitor_mode, self.sendOut_monitor_mode] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_interface_failure(self, val): + self.enqueue(self.infrastructureIn_interface_failure, val) + + + def init_internal_failure(self, val): + self.enqueue(self.infrastructureIn_internal_failure, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_interface_failure(self, msg): + self.enqueue(self.infrastructureIn_interface_failure, msg) + + def accept_internal_failure(self, msg): + self.enqueue(self.infrastructureIn_internal_failure, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_interface_failure(self): + msg = self.applicationIn_interface_failure[0] + return msg + + def get_internal_failure(self): + msg = self.applicationIn_internal_failure[0] + return msg + + def sendOut_monitor_mode(self, msg): + if type(msg) is MonitorMode: + self.thermostat_monitor_temperature_manage_monitor_mode_mmmt_monitor_mode_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port monitor_mode.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_monitor_mode(self, msg): + self.enqueue(self.applicationOut_monitor_mode, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py new file mode 100644 index 000000000..c19f85dc4 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_monitor_temperature_manage_monitor_mode_mmmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py new file mode 100644 index 000000000..e9a9c4345 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_base_src.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_heat_source_mhst_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_heat_source_mhst") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_heat_source_mhst_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_lower_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp", + self.accept_lower_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_upper_desired_temp_subscription_ = self.create_subscription( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp", + self.accept_upper_desired_temp, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + self.accept_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_ = self.create_publisher( + OnOff, + "thermostat_regulate_temperature_manage_heat_source_mhst_heat_control", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_desired_temp = deque() + self.applicationIn_lower_desired_temp = deque() + self.infrastructureIn_upper_desired_temp = deque() + self.applicationIn_upper_desired_temp = deque() + self.infrastructureIn_regulator_mode = deque() + self.applicationIn_regulator_mode = deque() + + self.infrastructureOut_heat_control = deque() + self.applicationOut_heat_control = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_temp, self.applicationIn_lower_desired_temp], + [self.infrastructureIn_upper_desired_temp, self.applicationIn_upper_desired_temp], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_temp, self.applicationIn_lower_desired_temp], + [self.infrastructureIn_upper_desired_temp, self.applicationIn_upper_desired_temp], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_heat_control, self.infrastructureOut_heat_control, self.sendOut_heat_control] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_desired_temp(self, val): + self.enqueue(self.infrastructureIn_lower_desired_temp, val) + + + def init_upper_desired_temp(self, val): + self.enqueue(self.infrastructureIn_upper_desired_temp, val) + + + def init_regulator_mode(self, val): + self.enqueue(self.infrastructureIn_regulator_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_desired_temp(self, msg): + self.enqueue(self.infrastructureIn_lower_desired_temp, msg) + + def accept_upper_desired_temp(self, msg): + self.enqueue(self.infrastructureIn_upper_desired_temp, msg) + + def accept_regulator_mode(self, msg): + self.enqueue(self.infrastructureIn_regulator_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_desired_temp(self): + msg = self.applicationIn_lower_desired_temp[0] + return msg + + def get_upper_desired_temp(self): + msg = self.applicationIn_upper_desired_temp[0] + return msg + + def get_regulator_mode(self): + msg = self.applicationIn_regulator_mode[0] + return msg + + def sendOut_heat_control(self, msg): + if type(msg) is OnOff: + self.thermostat_regulate_temperature_manage_heat_source_mhst_heat_control_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port heat_control.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_heat_control(self, msg): + self.enqueue(self.applicationOut_heat_control, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py new file mode 100644 index 000000000..63044f20a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_heat_source_mhst_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_heat_source_mhst_src import thermostat_regulate_temperature_manage_heat_source_mhst +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_heat_source_mhst() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py new file mode 100644 index 000000000..cc337e52b --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_interface_mrit_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_interface_mrit") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_lower_desired_tempWstatus", + self.accept_lower_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "operator_interface_oip_oit_upper_desired_tempWstatus", + self.accept_upper_desired_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_mode_subscription_ = self.create_subscription( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + self.accept_regulator_mode, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_ = self.create_publisher( + Tempimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_ = self.create_publisher( + Status, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status", + 1) + + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_ = self.create_publisher( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_lower_desired_tempWstatus = deque() + self.applicationIn_lower_desired_tempWstatus = deque() + self.infrastructureIn_upper_desired_tempWstatus = deque() + self.applicationIn_upper_desired_tempWstatus = deque() + self.infrastructureIn_regulator_mode = deque() + self.applicationIn_regulator_mode = deque() + + self.infrastructureOut_upper_desired_temp = deque() + self.applicationOut_upper_desired_temp = deque() + self.infrastructureOut_lower_desired_temp = deque() + self.applicationOut_lower_desired_temp = deque() + self.infrastructureOut_displayed_temp = deque() + self.applicationOut_displayed_temp = deque() + self.infrastructureOut_regulator_status = deque() + self.applicationOut_regulator_status = deque() + self.infrastructureOut_interface_failure = deque() + self.applicationOut_interface_failure = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_tempWstatus, self.applicationIn_lower_desired_tempWstatus], + [self.infrastructureIn_upper_desired_tempWstatus, self.applicationIn_upper_desired_tempWstatus], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_lower_desired_tempWstatus, self.applicationIn_lower_desired_tempWstatus], + [self.infrastructureIn_upper_desired_tempWstatus, self.applicationIn_upper_desired_tempWstatus], + [self.infrastructureIn_regulator_mode, self.applicationIn_regulator_mode] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_upper_desired_temp, self.infrastructureOut_upper_desired_temp, self.sendOut_upper_desired_temp], + [self.applicationOut_lower_desired_temp, self.infrastructureOut_lower_desired_temp, self.sendOut_lower_desired_temp], + [self.applicationOut_displayed_temp, self.infrastructureOut_displayed_temp, self.sendOut_displayed_temp], + [self.applicationOut_regulator_status, self.infrastructureOut_regulator_status, self.sendOut_regulator_status], + [self.applicationOut_interface_failure, self.infrastructureOut_interface_failure, self.sendOut_interface_failure] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_lower_desired_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_lower_desired_tempWstatus, val) + + + def init_upper_desired_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_upper_desired_tempWstatus, val) + + + def init_regulator_mode(self, val): + self.enqueue(self.infrastructureIn_regulator_mode, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_lower_desired_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_lower_desired_tempWstatus, msg) + + def accept_upper_desired_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_upper_desired_tempWstatus, msg) + + def accept_regulator_mode(self, msg): + self.enqueue(self.infrastructureIn_regulator_mode, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_lower_desired_tempWstatus(self): + msg = self.applicationIn_lower_desired_tempWstatus[0] + return msg + + def get_upper_desired_tempWstatus(self): + msg = self.applicationIn_upper_desired_tempWstatus[0] + return msg + + def get_regulator_mode(self): + msg = self.applicationIn_regulator_mode[0] + return msg + + def sendOut_upper_desired_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_upper_desired_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port upper_desired_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_lower_desired_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_lower_desired_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port lower_desired_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_displayed_temp(self, msg): + if type(msg) is Tempimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_displayed_temp_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port displayed_temp.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_regulator_status(self, msg): + if type(msg) is Status: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_regulator_status_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port regulator_status.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def sendOut_interface_failure(self, msg): + if type(msg) is FailureFlagimpl: + self.thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port interface_failure.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_upper_desired_temp(self, msg): + self.enqueue(self.applicationOut_upper_desired_temp, msg) + + def put_lower_desired_temp(self, msg): + self.enqueue(self.applicationOut_lower_desired_temp, msg) + + def put_displayed_temp(self, msg): + self.enqueue(self.applicationOut_displayed_temp, msg) + + def put_regulator_status(self, msg): + self.enqueue(self.applicationOut_regulator_status, msg) + + def put_interface_failure(self, msg): + self.enqueue(self.applicationOut_interface_failure, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py new file mode 100644 index 000000000..0ce8e2d1e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_src import thermostat_regulate_temperature_manage_regulator_interface_mrit +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_interface_mrit() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py new file mode 100644 index 000000000..b49b79005 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from collections import deque +from typing import Union +import threading +from rclpy.callback_groups import ReentrantCallbackGroup +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode + +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== + +class thermostat_regulate_temperature_manage_regulator_mode_mrmt_base(Node): + def __init__(self): + super().__init__("thermostat_regulate_temperature_manage_regulator_mode_mrmt") + + self.cb_group_ = ReentrantCallbackGroup() + + self.lock_ = threading.Lock() + + # Setting up connections + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_current_tempWstatus_subscription_ = self.create_subscription( + TempWstatusimpl, + "temperature_sensor_cpi_thermostat_current_tempWstatus", + self.accept_current_tempWstatus, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_interface_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_interface_mrit_interface_failure", + self.accept_interface_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure_subscription_ = self.create_subscription( + FailureFlagimpl, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_internal_failure", + self.accept_internal_failure, + 1, + callback_group=self.cb_group_) + + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_ = self.create_publisher( + RegulatorMode, + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode", + 1) + + # timeTriggeredCaller callback timer + self.periodTimer_ = self.create_timer(1, self.timeTriggeredCaller, callback_group=self.cb_group_) + + self.infrastructureIn_current_tempWstatus = deque() + self.applicationIn_current_tempWstatus = deque() + self.infrastructureIn_interface_failure = deque() + self.applicationIn_interface_failure = deque() + self.infrastructureIn_internal_failure = deque() + self.applicationIn_internal_failure = deque() + + self.infrastructureOut_regulator_mode = deque() + self.applicationOut_regulator_mode = deque() + + # Used by receiveInputs + self.inDataPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by receiveInputs + self.inEventPortTupleVector = [ + [self.infrastructureIn_current_tempWstatus, self.applicationIn_current_tempWstatus], + [self.infrastructureIn_interface_failure, self.applicationIn_interface_failure], + [self.infrastructureIn_internal_failure, self.applicationIn_internal_failure] + ] + + # Used by sendOutputs + self.outPortTupleVector = [ + [self.applicationOut_regulator_mode, self.infrastructureOut_regulator_mode, self.sendOut_regulator_mode] + ] + + def init_current_tempWstatus(self, val): + self.enqueue(self.infrastructureIn_current_tempWstatus, val) + + + def init_interface_failure(self, val): + self.enqueue(self.infrastructureIn_interface_failure, val) + + + def init_internal_failure(self, val): + self.enqueue(self.infrastructureIn_internal_failure, val) + + + def timeTriggered(self): + raise NotImplementedError("Subclasses must implement this method") + + #================================================= + # C o m m u n i c a t i o n + #================================================= + + def accept_current_tempWstatus(self, msg): + self.enqueue(self.infrastructureIn_current_tempWstatus, msg) + + def accept_interface_failure(self, msg): + self.enqueue(self.infrastructureIn_interface_failure, msg) + + def accept_internal_failure(self, msg): + self.enqueue(self.infrastructureIn_internal_failure, msg) + + def get_current_tempWstatus(self): + msg = self.applicationIn_current_tempWstatus[0] + return msg + + def get_interface_failure(self): + msg = self.applicationIn_interface_failure[0] + return msg + + def get_internal_failure(self): + msg = self.applicationIn_internal_failure[0] + return msg + + def sendOut_regulator_mode(self, msg): + if type(msg) is RegulatorMode: + self.thermostat_regulate_temperature_manage_regulator_mode_mrmt_regulator_mode_publisher_.publish(msg) + else: + self.get_logger().error("Sending out wrong type of variable on port regulator_mode.\nThis shouldn't be possible. If you are seeing this message, please notify this tool's current maintainer.") + + def put_regulator_mode(self, msg): + self.enqueue(self.applicationOut_regulator_mode, msg) + + def timeTriggeredCaller(self): + self.receiveInputs() + self.timeTriggered() + self.sendOutputs() + + def receiveInputs(self): + for port in self.inDataPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + self.enqueue(port[1], msg) + + for port in self.inEventPortTupleVector: + infrastructureQueue = port[0] + if not(len(infrastructureQueue) == 0): + msg = infrastructureQueue[0] + infrastructureQueue.pop() + self.enqueue(port[1], msg) + + def enqueue(self, queue, val): + if len(queue) >= 1: + queue.pop() + queue.append(val) + + def sendOutputs(self): + for port in self.outPortTupleVector: + applicationQueue = port[0] + if len(applicationQueue) != 0: + msg = applicationQueue[0] + applicationQueue.pop() + self.enqueue(port[1], msg) + + for port in self.outPortTupleVector: + infrastructureQueue = port[1] + if len(infrastructureQueue) != 0: + msg = infrastructureQueue[0] + infrastructureQueue.pop() + (port[2])(msg) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py new file mode 100644 index 000000000..b7d9a68ee --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/base_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rclpy.executors import MultiThreadedExecutor +from isolette_py_pkg.user_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt +#======================================================== +# Re-running Codegen will overwrite changes to this file +#======================================================== +def main(args=None): + rclpy.init(args=args) + node = thermostat_regulate_temperature_manage_regulator_mode_mrmt() + executor = MultiThreadedExecutor() + executor.add_node(node) + executor.spin() + rclpy.shutdown() + +if __name__ == "__main__": + main() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py new file mode 100644 index 000000000..3ded2b5fa --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/heat_source_cpi_heat_controller_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.heat_source_cpi_heat_controller_base_src import heat_source_cpi_heat_controller_base +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import Heat +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class heat_source_cpi_heat_controller(heat_source_cpi_heat_controller_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("heat_source_cpi_heat_controller infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + heat_control = OnOff() + self.init_heat_control(heat_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + heat_control = self.get_heat_control() + self.get_logger().info(f"Received heat_control: {self.message_to_string(heat_control)}") + + + # Example publishing messages + heat_out = Heat() + self.put_heat_out(heat_out) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py new file mode 100644 index 000000000..ac40b469a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/operator_interface_oip_oit_src.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.operator_interface_oip_oit_base_src import operator_interface_oip_oit_base +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class operator_interface_oip_oit(operator_interface_oip_oit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("operator_interface_oip_oit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + regulator_status = Status() + self.init_regulator_status(regulator_status) + + monitor_status = Status() + self.init_monitor_status(monitor_status) + + display_temperature = Tempimpl() + self.init_display_temperature(display_temperature) + + alarm_control = OnOff() + self.init_alarm_control(alarm_control) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + regulator_status = self.get_regulator_status() + self.get_logger().info(f"Received regulator_status: {self.message_to_string(regulator_status)}") + + monitor_status = self.get_monitor_status() + self.get_logger().info(f"Received monitor_status: {self.message_to_string(monitor_status)}") + + display_temperature = self.get_display_temperature() + self.get_logger().info(f"Received display_temperature: {self.message_to_string(display_temperature)}") + + alarm_control = self.get_alarm_control() + self.get_logger().info(f"Received alarm_control: {self.message_to_string(alarm_control)}") + + + # Example publishing messages + lower_desired_tempWstatus = TempWstatusimpl() + self.put_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.put_upper_desired_tempWstatus(upper_desired_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.put_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + upper_alarm_tempWstatus = TempWstatusimpl() + self.put_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py new file mode 100644 index 000000000..e1c1ca3af --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/temperature_sensor_cpi_thermostat_src.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_base_src import temperature_sensor_cpi_thermostat_base +from isolette_py_pkg_interfaces.msg import PhysicalTempimpl +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class temperature_sensor_cpi_thermostat(temperature_sensor_cpi_thermostat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("temperature_sensor_cpi_thermostat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + air = PhysicalTempimpl() + self.init_air(air) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + air = self.get_air() + self.get_logger().info(f"Received air: {self.message_to_string(air)}") + + + # Example publishing messages + current_tempWstatus = TempWstatusimpl() + self.put_current_tempWstatus(current_tempWstatus) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py new file mode 100644 index 000000000..f67a7c036 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_alarm_mat_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_base_src import thermostat_monitor_temperature_manage_alarm_mat_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_alarm_mat(thermostat_monitor_temperature_manage_alarm_mat_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_alarm_mat infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_alarm_temp = Tempimpl() + self.init_lower_alarm_temp(lower_alarm_temp) + + upper_alarm_temp = Tempimpl() + self.init_upper_alarm_temp(upper_alarm_temp) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_alarm_temp = self.get_lower_alarm_temp() + self.get_logger().info(f"Received lower_alarm_temp: {self.message_to_string(lower_alarm_temp)}") + + upper_alarm_temp = self.get_upper_alarm_temp() + self.get_logger().info(f"Received upper_alarm_temp: {self.message_to_string(upper_alarm_temp)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + alarm_control = OnOff() + self.put_alarm_control(alarm_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py new file mode 100644 index 000000000..4f3930578 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_interface_mmit_src.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_base_src import thermostat_monitor_temperature_manage_monitor_interface_mmit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_interface_mmit(thermostat_monitor_temperature_manage_monitor_interface_mmit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_interface_mmit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + upper_alarm_tempWstatus = TempWstatusimpl() + self.init_upper_alarm_tempWstatus(upper_alarm_tempWstatus) + + lower_alarm_tempWstatus = TempWstatusimpl() + self.init_lower_alarm_tempWstatus(lower_alarm_tempWstatus) + + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + monitor_mode = MonitorMode() + self.init_monitor_mode(monitor_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + upper_alarm_tempWstatus = self.get_upper_alarm_tempWstatus() + self.get_logger().info(f"Received upper_alarm_tempWstatus: {self.message_to_string(upper_alarm_tempWstatus)}") + + lower_alarm_tempWstatus = self.get_lower_alarm_tempWstatus() + self.get_logger().info(f"Received lower_alarm_tempWstatus: {self.message_to_string(lower_alarm_tempWstatus)}") + + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + monitor_mode = self.get_monitor_mode() + self.get_logger().info(f"Received monitor_mode: {self.message_to_string(monitor_mode)}") + + + # Example publishing messages + upper_alarm_temp = Tempimpl() + self.put_upper_alarm_temp(upper_alarm_temp) + + lower_alarm_temp = Tempimpl() + self.put_lower_alarm_temp(lower_alarm_temp) + + monitor_status = Status() + self.put_monitor_status(monitor_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py new file mode 100644 index 000000000..973aa609c --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_monitor_temperature_manage_monitor_mode_mmmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_base_src import thermostat_monitor_temperature_manage_monitor_mode_mmmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import MonitorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_monitor_temperature_manage_monitor_mode_mmmt(thermostat_monitor_temperature_manage_monitor_mode_mmmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_monitor_temperature_manage_monitor_mode_mmmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + monitor_mode = MonitorMode() + self.put_monitor_mode(monitor_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py new file mode 100644 index 000000000..4826e5681 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_heat_source_mhst_src.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_base_src import thermostat_regulate_temperature_manage_heat_source_mhst_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import OnOff +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_heat_source_mhst(thermostat_regulate_temperature_manage_heat_source_mhst_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_heat_source_mhst infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_temp = Tempimpl() + self.init_lower_desired_temp(lower_desired_temp) + + upper_desired_temp = Tempimpl() + self.init_upper_desired_temp(upper_desired_temp) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_temp = self.get_lower_desired_temp() + self.get_logger().info(f"Received lower_desired_temp: {self.message_to_string(lower_desired_temp)}") + + upper_desired_temp = self.get_upper_desired_temp() + self.get_logger().info(f"Received upper_desired_temp: {self.message_to_string(upper_desired_temp)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + heat_control = OnOff() + self.put_heat_control(heat_control) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py new file mode 100644 index 000000000..94513c84d --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_interface_mrit_src.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_base_src import thermostat_regulate_temperature_manage_regulator_interface_mrit_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg_interfaces.msg import Tempimpl +from isolette_py_pkg_interfaces.msg import Status +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_interface_mrit(thermostat_regulate_temperature_manage_regulator_interface_mrit_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_interface_mrit infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + lower_desired_tempWstatus = TempWstatusimpl() + self.init_lower_desired_tempWstatus(lower_desired_tempWstatus) + + upper_desired_tempWstatus = TempWstatusimpl() + self.init_upper_desired_tempWstatus(upper_desired_tempWstatus) + + regulator_mode = RegulatorMode() + self.init_regulator_mode(regulator_mode) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + lower_desired_tempWstatus = self.get_lower_desired_tempWstatus() + self.get_logger().info(f"Received lower_desired_tempWstatus: {self.message_to_string(lower_desired_tempWstatus)}") + + upper_desired_tempWstatus = self.get_upper_desired_tempWstatus() + self.get_logger().info(f"Received upper_desired_tempWstatus: {self.message_to_string(upper_desired_tempWstatus)}") + + regulator_mode = self.get_regulator_mode() + self.get_logger().info(f"Received regulator_mode: {self.message_to_string(regulator_mode)}") + + + # Example publishing messages + upper_desired_temp = Tempimpl() + self.put_upper_desired_temp(upper_desired_temp) + + lower_desired_temp = Tempimpl() + self.put_lower_desired_temp(lower_desired_temp) + + displayed_temp = Tempimpl() + self.put_displayed_temp(displayed_temp) + + regulator_status = Status() + self.put_regulator_status(regulator_status) + + interface_failure = FailureFlagimpl() + self.put_interface_failure(interface_failure) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py new file mode 100644 index 000000000..ea5e59937 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/isolette_py_pkg/user_code/thermostat_regulate_temperature_manage_regulator_mode_mrmt_src.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +import rclpy +from rclpy.node import Node +from rosidl_runtime_py.convert import message_to_yaml +from isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_base_src import thermostat_regulate_temperature_manage_regulator_mode_mrmt_base +from isolette_py_pkg_interfaces.msg import TempWstatusimpl +from isolette_py_pkg_interfaces.msg import FailureFlagimpl +from isolette_py_pkg_interfaces.msg import RegulatorMode +from isolette_py_pkg.base_code.enum_converter import * + +#=========================================================== +# This file will not be overwritten when re-running Codegen +#=========================================================== +class thermostat_regulate_temperature_manage_regulator_mode_mrmt(thermostat_regulate_temperature_manage_regulator_mode_mrmt_base): + def __init__(self): + super().__init__() + # invoke initialize entry point + self.initialize() + + self.get_logger().info("thermostat_regulate_temperature_manage_regulator_mode_mrmt infrastructure set up") + +#================================================= +# I n i t i a l i z e E n t r y P o i n t +#================================================= + def initialize(self): + self.get_logger().info("Initialize Entry Point invoked") + + # Initialize the node + + # Initialize the node's incoming data port values here + + # Initialize the node's incoming data port values here + current_tempWstatus = TempWstatusimpl() + self.init_current_tempWstatus(current_tempWstatus) + + interface_failure = FailureFlagimpl() + self.init_interface_failure(interface_failure) + + internal_failure = FailureFlagimpl() + self.init_internal_failure(internal_failure) + + +#================================================= +# C o m p u t e E n t r y P o i n t +#================================================= + def message_to_string(self, msg): + yaml_str = message_to_yaml(msg) + return yaml_str + + def timeTriggered(self): + # Handle communication + + # Example receiving messages on data ports + current_tempWstatus = self.get_current_tempWstatus() + self.get_logger().info(f"Received current_tempWstatus: {self.message_to_string(current_tempWstatus)}") + + interface_failure = self.get_interface_failure() + self.get_logger().info(f"Received interface_failure: {self.message_to_string(interface_failure)}") + + internal_failure = self.get_internal_failure() + self.get_logger().info(f"Received internal_failure: {self.message_to_string(internal_failure)}") + + + # Example publishing messages + regulator_mode = RegulatorMode() + self.put_regulator_mode(regulator_mode) + + +#================================================= +# Include any additional declarations here +#================================================= +# Additions within these tags will be preserved when re-running Codegen + +# Additions within these tags will be preserved when re-running Codegen diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/package.xml new file mode 100644 index 000000000..ddc125c8a --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/package.xml @@ -0,0 +1,26 @@ + + + + isolette_py_pkg + 0.0.0 + TODO: Package description + ed + TODO: License declaration + + rclpy + rosidl_runtime_py + isolette_py_pkg_interfaces + + + + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/resource/isolette_py_pkg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/resource/isolette_py_pkg new file mode 100644 index 000000000..d8a39898e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/resource/isolette_py_pkg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.cfg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.cfg new file mode 100644 index 000000000..de71f7785 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.cfg @@ -0,0 +1,5 @@ +# setup.cfg in src/isolette_py_pkg +[develop] +script_dir=$base/lib/isolette_py_pkg +[install] +install_scripts=$base/lib/isolette_py_pkg diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.py new file mode 100644 index 000000000..4db5def61 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/setup.py @@ -0,0 +1,36 @@ +# setup.py in src/isolette_py_pkg + +from setuptools import find_packages, setup + +package_name = 'isolette_py_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='sireum', + maintainer_email='sireum@todo.todo', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_interface_mrit_runner:main", + "thermostat_regulate_temperature_manage_heat_source_mhst_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_heat_source_mhst_runner:main", + "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe = isolette_py_pkg.base_code.thermostat_regulate_temperature_manage_regulator_mode_mrmt_runner:main", + "thermostat_monitor_temperature_manage_alarm_mat_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_alarm_mat_runner:main", + "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_interface_mmit_runner:main", + "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe = isolette_py_pkg.base_code.thermostat_monitor_temperature_manage_monitor_mode_mmmt_runner:main", + "operator_interface_oip_oit_exe = isolette_py_pkg.base_code.operator_interface_oip_oit_runner:main", + "temperature_sensor_cpi_thermostat_exe = isolette_py_pkg.base_code.temperature_sensor_cpi_thermostat_runner:main", + "heat_source_cpi_heat_controller_exe = isolette_py_pkg.base_code.heat_source_cpi_heat_controller_runner:main" + ], + }, +) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_copyright.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_copyright.py new file mode 100644 index 000000000..97a39196e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_flake8.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_flake8.py new file mode 100644 index 000000000..7dc87a490 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \\ + 'Found %d code style errors / warnings:\n' % len(errors) + \\ + '\n'.join(errors) diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_prep257.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_prep257.py new file mode 100644 index 000000000..b234a3840 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg/test/test_prep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/CMakeLists.txt b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/CMakeLists.txt new file mode 100644 index 000000000..7ef2c8397 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_bringup) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py new file mode 100644 index 000000000..19d78f040 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/heat_source.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + heat_source_cpi_heat_controller_node = Node( + package = "isolette_py_pkg", + executable = "heat_source_cpi_heat_controller_exe" + ) + + ld.add_action(heat_source_cpi_heat_controller_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py new file mode 100644 index 000000000..265c24dc0 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/isolette_single_sensor_Instance.launch.py @@ -0,0 +1,45 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/thermostat.launch.py') + ) + ) + + operator_interface_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/operator_interface.launch.py') + ) + ) + + temperature_sensor_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/temperature_sensor.launch.py') + ) + ) + + heat_source_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/heat_source.launch.py') + ) + ) + + ld.add_action(thermostat_node) + ld.add_action(operator_interface_node) + ld.add_action(temperature_sensor_node) + ld.add_action(heat_source_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py new file mode 100644 index 000000000..b9e2c624f --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/monitor_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_monitor_temperature_manage_alarm_mat_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_alarm_mat_exe" + ) + + thermostat_monitor_temperature_manage_monitor_interface_mmit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_interface_mmit_exe" + ) + + thermostat_monitor_temperature_manage_monitor_mode_mmmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_monitor_temperature_manage_monitor_mode_mmmt_exe" + ) + + ld.add_action(thermostat_monitor_temperature_manage_alarm_mat_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_interface_mmit_node) + ld.add_action(thermostat_monitor_temperature_manage_monitor_mode_mmmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py new file mode 100644 index 000000000..5f488a919 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/operator_interface.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + operator_interface_oip_oit_node = Node( + package = "isolette_py_pkg", + executable = "operator_interface_oip_oit_exe" + ) + + ld.add_action(operator_interface_oip_oit_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py new file mode 100644 index 000000000..014c61c26 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/regulate_temperature.launch.py @@ -0,0 +1,31 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + thermostat_regulate_temperature_manage_regulator_interface_mrit_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_interface_mrit_exe" + ) + + thermostat_regulate_temperature_manage_heat_source_mhst_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_heat_source_mhst_exe" + ) + + thermostat_regulate_temperature_manage_regulator_mode_mrmt_node = Node( + package = "isolette_py_pkg", + executable = "thermostat_regulate_temperature_manage_regulator_mode_mrmt_exe" + ) + + ld.add_action(thermostat_regulate_temperature_manage_regulator_interface_mrit_node) + ld.add_action(thermostat_regulate_temperature_manage_heat_source_mhst_node) + ld.add_action(thermostat_regulate_temperature_manage_regulator_mode_mrmt_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py new file mode 100644 index 000000000..04c0d9de3 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/temperature_sensor.launch.py @@ -0,0 +1,19 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + temperature_sensor_cpi_thermostat_node = Node( + package = "isolette_py_pkg", + executable = "temperature_sensor_cpi_thermostat_exe" + ) + + ld.add_action(temperature_sensor_cpi_thermostat_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py new file mode 100644 index 000000000..383d3f3b9 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/launch/thermostat.launch.py @@ -0,0 +1,29 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +import os +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + ld = LaunchDescription() + + regulate_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/regulate_temperature.launch.py') + ) + ) + + monitor_temperature_node = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('isolette_py_pkg_bringup'), + 'launch/monitor_temperature.launch.py') + ) + ) + + ld.add_action(regulate_temperature_node) + ld.add_action(monitor_temperature_node) + + return ld diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/package.xml new file mode 100644 index 000000000..c0ef1c8bb --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_bringup/package.xml @@ -0,0 +1,24 @@ + + + + isolette_py_pkg_bringup + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + isolette_py_pkg + + + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt new file mode 100644 index 000000000..3c237e7ba --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.8) +project(isolette_py_pkg_interfaces) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) + +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + msg/Heat.msg + msg/InterfaceInteraction.msg + msg/Float32.msg + msg/PhysicalTempimpl.msg + msg/ValueStatus.msg + msg/TempWstatusimpl.msg + msg/OnOff.msg + msg/Status.msg + msg/Tempimpl.msg + msg/RegulatorMode.msg + msg/Boolean.msg + msg/FailureFlagimpl.msg + msg/MonitorMode.msg + msg/Empty.msg +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg new file mode 100644 index 000000000..f7cabb94f --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Boolean.msg @@ -0,0 +1 @@ +bool data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Empty.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Empty.msg new file mode 100644 index 000000000..e69de29bb diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg new file mode 100644 index 000000000..85e9459f2 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/FailureFlagimpl.msg @@ -0,0 +1 @@ +Boolean value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg new file mode 100644 index 000000000..e89740534 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Float32.msg @@ -0,0 +1 @@ +float32 data \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg new file mode 100644 index 000000000..8510ca2f7 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Heat.msg @@ -0,0 +1,2 @@ +uint8 heat +uint8 HEAT_DUMMY_HEAD_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg new file mode 100644 index 000000000..74fd55b51 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/InterfaceInteraction.msg @@ -0,0 +1,2 @@ +uint8 interface_interaction +uint8 INTERFACE_INTERACTION_DUMMY_INTERFACE_INTERACTION_ENUM=0 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg new file mode 100644 index 000000000..23c152693 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/MonitorMode.msg @@ -0,0 +1,4 @@ +uint8 monitor_mode +uint8 MONITOR_MODE_INIT_MONITOR_MODE=0 +uint8 MONITOR_MODE_NORMAL_MONITOR_MODE=1 +uint8 MONITOR_MODE_FAILED_MONITOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg new file mode 100644 index 000000000..2b93a6e9b --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/OnOff.msg @@ -0,0 +1,3 @@ +uint8 on_off +uint8 ON_OFF_ONN=0 +uint8 ON_OFF_OFF=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/PhysicalTempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg new file mode 100644 index 000000000..3e575ec38 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/RegulatorMode.msg @@ -0,0 +1,4 @@ +uint8 regulator_mode +uint8 REGULATOR_MODE_INIT_REGULATOR_MODE=0 +uint8 REGULATOR_MODE_NORMAL_REGULATOR_MODE=1 +uint8 REGULATOR_MODE_FAILED_REGULATOR_MODE=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Status.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Status.msg new file mode 100644 index 000000000..f921080e2 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Status.msg @@ -0,0 +1,4 @@ +uint8 status +uint8 STATUS_INIT_STATUS=0 +uint8 STATUS_ON_STATUS=1 +uint8 STATUS_FAILED_STATUS=2 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg new file mode 100644 index 000000000..013b4d370 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/TempWstatusimpl.msg @@ -0,0 +1,2 @@ +Float32 value +ValueStatus status \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg new file mode 100644 index 000000000..f974a1a52 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/Tempimpl.msg @@ -0,0 +1 @@ +Float32 value \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg new file mode 100644 index 000000000..cd93b8a5e --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/msg/ValueStatus.msg @@ -0,0 +1,3 @@ +uint8 value_status +uint8 VALUE_STATUS_VALID=0 +uint8 VALUE_STATUS_INVALID=1 \ No newline at end of file diff --git a/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/package.xml b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/package.xml new file mode 100644 index 000000000..c0d3e4f59 --- /dev/null +++ b/resources/expected/ros2/python-isolette_inverted_topics/strict/src/isolette_py_pkg_interfaces/package.xml @@ -0,0 +1,22 @@ + + + + isolette_py_pkg_interfaces + 0.0.0 + TODO: Package description + sireum + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/scala/org/sireum/hamr/codegen/test/ros2/Ros2TestUtil.scala b/scala/org/sireum/hamr/codegen/test/ros2/Ros2TestUtil.scala index 52079acf7..5b0c770e4 100644 --- a/scala/org/sireum/hamr/codegen/test/ros2/Ros2TestUtil.scala +++ b/scala/org/sireum/hamr/codegen/test/ros2/Ros2TestUtil.scala @@ -12,7 +12,9 @@ trait Ros2TestUtil { def verbose: B - assert (!isCI || !verbose, "verbose must be F when pushed to github") + def generateExpected: B + + assert (!isCI || !generateExpected, "generate expected must be F when pushed to github") val ros2SetupPath: Option[Os.Path] = Os.env("ROS2_HOME") match { case Some(dist) => diff --git a/scala/org/sireum/hamr/codegen/test/ros2/Ros2Tests.scala b/scala/org/sireum/hamr/codegen/test/ros2/Ros2Tests.scala index 2633d49f4..c0dbfe64d 100644 --- a/scala/org/sireum/hamr/codegen/test/ros2/Ros2Tests.scala +++ b/scala/org/sireum/hamr/codegen/test/ros2/Ros2Tests.scala @@ -45,6 +45,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false), T, verbose) } + "python-building_control_gen_mixed_lax" in { + val testName = "python-building_control_gen_mixed" + val rootName = "building_control_gen_mixed" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-building_control_gen_mixed_strict" in { + val testName = "python-building_control_gen_mixed" + val rootName = "building_control_gen_mixed" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + "isolette_lax" in { val testName = "isolette" val root = codegen_base / testName @@ -63,6 +83,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false), T, verbose) } + "python-isolette_lax" in { + val testName = "python-isolette" + val rootName = "isolette" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-isolette_strict" in { + val testName = "python-isolette" + val rootName = "isolette" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + // TODO: Fix/implement PCA Pump to-do types "pca-pump_lax" ignore { val testName = "pca-pump" @@ -101,6 +141,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false), T, verbose) } + "python-datatype-examples_lax" in { + val testName = "python-datatype-examples" + val rootName = "datatype-examples" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-datatype-examples_strict" in { + val testName = "python-datatype-examples" + val rootName = "datatype-examples" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + "fan_in_fan_out_lax" in { val testName = "fan_in_fan_out" val root = codegen_base / testName @@ -119,6 +179,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false), T, verbose) } + "python-fan_in_fan_out_lax" in { + val testName = "python-fan_in_fan_out" + val rootName = "fan_in_fan_out" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-fan_in_fan_out_strict" in { + val testName = "python-fan_in_fan_out" + val rootName = "fan_in_fan_out" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = false, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + // ---------------------------------- // Inverted Port/Topic Binding Tests // ---------------------------------- @@ -143,6 +223,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true), T, verbose) } + "python-building_control_gen_mixed_lax_inverted_topics" in { + val testName = "python-building_control_gen_mixed_inverted_topics" + val rootName = "building_control_gen_mixed" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-building_control_gen_mixed_strict_inverted_topics" in { + val testName = "python-building_control_gen_mixed_inverted_topics" + val rootName = "building_control_gen_mixed" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + "isolette_lax_inverted_topics" in { val testName = "isolette_inverted_topics" val rootName = "isolette" @@ -163,6 +263,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true), T, verbose) } + "python-isolette_lax_inverted_topics" in { + val testName = "python-isolette_inverted_topics" + val rootName = "isolette" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-isolette_strict_inverted_topics" in { + val testName = "python-isolette_inverted_topics" + val rootName = "isolette" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + "fan_in_fan_out_lax_inverted_topics" in { val testName = "fan_in_fan_out_inverted_topics" val rootName = "fan_in_fan_out" @@ -183,6 +303,26 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true), T, verbose) } + "python-fan_in_fan_out_lax_inverted_topics" in { + val testName = "python-fan_in_fan_out_inverted_topics" + val rootName = "fan_in_fan_out" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = false, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + + "python-fan_in_fan_out_strict_inverted_topics" in { + val testName = "python-fan_in_fan_out_inverted_topics" + val rootName = "fan_in_fan_out" + val root = codegen_base / rootName + val airFile = getAir(root) + assert (root.exists) + + testRos(testName, airFile, airFile.up, baseOptions.apply(strictAadlMode = true, invertTopicBinding = true, ros2NodesLanguage = CodegenNodesCodeLanguage.Python, ros2LaunchLanguage = CodegenLaunchCodeLanguage.Python), T, verbose) + } + // ---------------------------------- // File Change Persistence Tests // ---------------------------------- @@ -229,11 +369,10 @@ class Ros2Tests extends TestSuite with Ros2TestUtil { workspaceRootDir = if (config.workspaceRootDir.nonEmpty) config.workspaceRootDir else Some(modelDir.canon.value) ) - // TODO: Currently hardcoded, since I'm just working on cpp and xml testOps = testOps.apply( ros2OutputWorkspaceDir = Some(destDir.value), - ros2NodesLanguage = CodegenNodesCodeLanguage.Cpp, - ros2LaunchLanguage = CodegenLaunchCodeLanguage.Xml + ros2NodesLanguage = config.ros2NodesLanguage, + ros2LaunchLanguage = config.ros2LaunchLanguage ) if (clearDestDir) {