Skip to content

Commit 6d94f05

Browse files
committed
Updated Expected Python Files
1 parent ca81102 commit 6d94f05

File tree

254 files changed

+5524
-3901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+5524
-3901
lines changed

.DS_Store

2 KB
Binary file not shown.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4-
from queue import Queue
4+
from collections import deque
55
from building_control_py_pkg.user_code.tcp_fan_src import *
66
from rclpy.callback_groups import ReentrantCallbackGroup
77
from building_control_py_pkg_interfaces.msg import FanCmd
@@ -30,15 +30,15 @@ def __init__(self):
3030
"tcp_tempControl_fanAck",
3131
1)
3232

33+
def timeTriggered(self):
34+
raise NotImplementedError("Subclasses must implement this method")
35+
3336
#=================================================
3437
# C o m m u n i c a t i o n
3538
#=================================================
3639

3740
def put_fanAck(self, msg):
38-
typedMsg = FanAck()
39-
typedMsg.data = msg
40-
self.tcp_fan_fanAck_publisher_.publish(typedMsg)
41-
41+
self.tcp_fan_fanAck_publisher_.publish(msg)
4242

4343
#=================================================
4444
# C o m p u t e E n t r y P o i n t

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_fan_runner.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,10 @@
22
import rclpy
33
from rclpy.node import Node
44
from rclpy.executors import MultiThreadedExecutor
5-
from building_control_py_pkg.user_code.tcp_fan_src import initialize
6-
from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base
5+
from building_control_py_pkg.user_code.tcp_fan_src import tcp_fan
76
#========================================================
87
# Re-running Codegen will overwrite changes to this file
98
#========================================================
10-
11-
class tcp_fan(tcp_fan_base):
12-
def __init__(self):
13-
super().__init__()
14-
# invoke initialize entry point
15-
initialize(self)
16-
17-
self.get_logger().info("tcp_fan infrastructure set up")
18-
199
def main(args=None):
2010
rclpy.init(args=args)
2111
node = tcp_fan()

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4-
from queue import Queue
4+
from collections import deque
55
from building_control_py_pkg.user_code.tcp_tempControl_src import *
66
from rclpy.callback_groups import ReentrantCallbackGroup
77
from building_control_py_pkg_interfaces.msg import Temperatureimpl
@@ -54,26 +54,27 @@ def __init__(self):
5454
"tcp_fan_fanCmd",
5555
1)
5656

57+
def init_currentTemp(self, val):
58+
self.currentTemp_msg_holder = val
59+
60+
def timeTriggered(self):
61+
raise NotImplementedError("Subclasses must implement this method")
62+
5763
#=================================================
5864
# C o m m u n i c a t i o n
5965
#=================================================
6066

6167
def handle_currentTemp(self, msg):
62-
typedMsg = Temperatureimpl()
63-
typedMsg.data = msg
64-
self.currentTemp_msg_holder = typedMsg
68+
self.currentTemp_msg_holder = msg
6569

6670
def get_currentTemp(self):
6771
return self.currentTemp_msg_holder
6872

6973
def event_handle_tempChanged(self, msg):
70-
handle_tempChanged()
74+
self.handle_tempChanged()
7175

7276
def put_fanCmd(self, msg):
73-
typedMsg = FanCmd()
74-
typedMsg.data = msg
75-
self.tcp_tempControl_fanCmd_publisher_.publish(typedMsg)
76-
77+
self.tcp_tempControl_fanCmd_publisher_.publish(msg)
7778

7879
#=================================================
7980
# C o m p u t e E n t r y P o i n t

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempControl_runner.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,10 @@
22
import rclpy
33
from rclpy.node import Node
44
from rclpy.executors import MultiThreadedExecutor
5-
from building_control_py_pkg.user_code.tcp_tempControl_src import initialize
6-
from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base
5+
from building_control_py_pkg.user_code.tcp_tempControl_src import tcp_tempControl
76
#========================================================
87
# Re-running Codegen will overwrite changes to this file
98
#========================================================
10-
11-
class tcp_tempControl(tcp_tempControl_base):
12-
def __init__(self):
13-
super().__init__()
14-
# invoke initialize entry point
15-
initialize(self)
16-
17-
self.get_logger().info("tcp_tempControl infrastructure set up")
18-
199
def main(args=None):
2010
rclpy.init(args=args)
2111
node = tcp_tempControl()

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4-
from queue import Queue
4+
from collections import deque
55
from rclpy.callback_groups import ReentrantCallbackGroup
66
from building_control_py_pkg_interfaces.msg import Temperatureimpl
77
from building_control_py_pkg_interfaces.msg import Empty
@@ -28,22 +28,17 @@ def __init__(self):
2828
1)
2929

3030
# timeTriggered callback timer
31-
self.periodTimer_ = self.create_timer(1000, self.timeTriggered, callback_group=self.cb_group_)
31+
self.periodTimer_ = self.create_timer(1, self.timeTriggered, callback_group=self.cb_group_)
3232

3333
def timeTriggered(self):
34-
pass
34+
raise NotImplementedError("Subclasses must implement this method")
3535

3636
#=================================================
3737
# C o m m u n i c a t i o n
3838
#=================================================
3939

4040
def put_currentTemp(self, msg):
41-
typedMsg = Temperatureimpl()
42-
typedMsg.data = msg
43-
self.tcp_tempSensor_currentTemp_publisher_.publish(typedMsg)
44-
41+
self.tcp_tempSensor_currentTemp_publisher_.publish(msg)
4542
def put_tempChanged(self):
46-
typedMsg = Empty()
47-
48-
self.tcp_tempSensor_tempChanged_publisher_.publish(typedMsg)
49-
43+
msg = Empty()
44+
self.tcp_tempSensor_tempChanged_publisher_.publish(msg)

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/base_code/tcp_tempSensor_runner.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,10 @@
22
import rclpy
33
from rclpy.node import Node
44
from rclpy.executors import MultiThreadedExecutor
5-
from building_control_py_pkg.user_code.tcp_tempSensor_src import initialize
6-
from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base
5+
from building_control_py_pkg.user_code.tcp_tempSensor_src import tcp_tempSensor
76
#========================================================
87
# Re-running Codegen will overwrite changes to this file
98
#========================================================
10-
11-
class tcp_tempSensor(tcp_tempSensor_base):
12-
def __init__(self):
13-
super().__init__()
14-
# invoke initialize entry point
15-
initialize(self)
16-
17-
self.get_logger().info("tcp_tempSensor infrastructure set up")
18-
199
def main(args=None):
2010
rclpy.init(args=args)
2111
node = tcp_tempSensor()

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_fan_src.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4+
from rosidl_runtime_py.convert import message_to_yaml
5+
from building_control_py_pkg.base_code.tcp_fan_base_src import tcp_fan_base
6+
from building_control_py_pkg_interfaces.msg import FanAck
47
from building_control_py_pkg.base_code.enum_converter import *
58

69
#===========================================================
710
# This file will not be overwritten when re-running Codegen
811
#===========================================================
12+
class tcp_fan(tcp_fan_base):
13+
def __init__(self):
14+
super().__init__()
15+
# invoke initialize entry point
16+
self.initialize()
17+
18+
self.get_logger().info("tcp_fan infrastructure set up")
919

1020
#=================================================
1121
# I n i t i a l i z e E n t r y P o i n t
1222
#=================================================
13-
def initialize(node):
14-
node.get_logger().info("Initialize Entry Point invoked")
23+
def initialize(node):
24+
node.get_logger().info("Initialize Entry Point invoked")
25+
26+
# Initialize the node
27+
28+
# Initialize the node's incoming data port values here
1529

16-
# Initialize the node
17-
node.handle_fanCmd = handle_fanCmd
1830

1931
#=================================================
2032
# C o m p u t e E n t r y P o i n t
2133
#=================================================
22-
def handle_fanCmd(msg):
23-
pass # Handle fanCmd msg
34+
def message_to_string(msg):
35+
yaml_str = message_to_yaml(msg)
36+
return yaml_str
2437

38+
def handle_fanCmd(self, msg):
39+
# Handle fanCmd msg
40+
self.get_logger().info("Received fanCmd: %s", message_to_string(msg))
2541

2642
#=================================================
2743
# Include any additional declarations here

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempControl_src.py

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4+
from rosidl_runtime_py.convert import message_to_yaml
5+
from building_control_py_pkg.base_code.tcp_tempControl_base_src import tcp_tempControl_base
6+
from building_control_py_pkg_interfaces.msg import FanCmd
47
from building_control_py_pkg.base_code.enum_converter import *
58

69
#===========================================================
710
# This file will not be overwritten when re-running Codegen
811
#===========================================================
12+
class tcp_tempControl(tcp_tempControl_base):
13+
def __init__(self):
14+
super().__init__()
15+
# invoke initialize entry point
16+
self.initialize()
17+
18+
self.get_logger().info("tcp_tempControl infrastructure set up")
919

1020
#=================================================
1121
# I n i t i a l i z e E n t r y P o i n t
1222
#=================================================
13-
def initialize(node):
14-
node.get_logger().info("Initialize Entry Point invoked")
23+
def initialize(node):
24+
node.get_logger().info("Initialize Entry Point invoked")
25+
26+
# Initialize the node
27+
28+
# Initialize the node's incoming data port values here
1529

16-
# Initialize the node
17-
node.handle_fanAck = handle_fanAck
18-
node.handle_setPoint = handle_setPoint
19-
node.handle_tempChanged = handle_tempChanged
2030

2131
#=================================================
2232
# C o m p u t e E n t r y P o i n t
2333
#=================================================
24-
def handle_fanAck(msg):
25-
pass # Handle fanAck msg
26-
27-
def handle_setPoint(msg):
28-
pass # Handle setPoint msg
29-
30-
def handle_tempChanged():
31-
pass # Handle tempChanged event
34+
def message_to_string(msg):
35+
yaml_str = message_to_yaml(msg)
36+
return yaml_str
37+
38+
def handle_fanAck(self, msg):
39+
# Handle fanAck msg
40+
self.get_logger().info("Received fanAck: %s", message_to_string(msg))
41+
42+
# Example receiving messages on data ports
43+
currentTemp = get_currentTemp()
44+
self.get_logger().info("Received currentTemp: %s", message_to_string(currentTemp))
45+
def handle_setPoint(self, msg):
46+
# Handle setPoint msg
47+
self.get_logger().info("Received setPoint: %s", message_to_string(msg))
48+
49+
def handle_tempChanged(self):
50+
# Handle tempChanged event
51+
self.get_logger().info("Received tempChanged")
3252

3353

3454
#=================================================

resources/expected/ros2/python-building_control_gen_mixed/lax/src/building_control_py_pkg/building_control_py_pkg/user_code/tcp_tempSensor_src.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,47 @@
11
#!/usr/bin/env python3
22
import rclpy
33
from rclpy.node import Node
4+
from rosidl_runtime_py.convert import message_to_yaml
5+
from building_control_py_pkg.base_code.tcp_tempSensor_base_src import tcp_tempSensor_base
6+
from building_control_py_pkg_interfaces.msg import Temperatureimpl
47
from building_control_py_pkg.base_code.enum_converter import *
58

69
#===========================================================
710
# This file will not be overwritten when re-running Codegen
811
#===========================================================
12+
class tcp_tempSensor(tcp_tempSensor_base):
13+
def __init__(self):
14+
super().__init__()
15+
# invoke initialize entry point
16+
self.initialize()
17+
18+
self.get_logger().info("tcp_tempSensor infrastructure set up")
919

1020
#=================================================
1121
# I n i t i a l i z e E n t r y P o i n t
1222
#=================================================
13-
def initialize(node):
14-
node.get_logger().info("Initialize Entry Point invoked")
23+
def initialize(node):
24+
node.get_logger().info("Initialize Entry Point invoked")
25+
26+
# Initialize the node
27+
28+
# Initialize the node's incoming data port values here
1529

16-
# Initialize the node
17-
node.timeTriggered = timeTriggered
1830

1931
#=================================================
2032
# C o m p u t e E n t r y P o i n t
2133
#=================================================
22-
def timeTriggered():
23-
pass # Handle communication
34+
def message_to_string(msg):
35+
yaml_str = message_to_yaml(msg)
36+
return yaml_str
37+
38+
def timeTriggered(self):
39+
# Handle communication
2440

41+
# Example publishing messages
42+
currentTemp = Temperatureimpl()
43+
self.put_currentTemp(currentTemp)
44+
self.put_tempChanged()
2545

2646
#=================================================
2747
# Include any additional declarations here

0 commit comments

Comments
 (0)