Skip to content

Commit 643fd6a

Browse files
committed
Added joint state transform
1 parent 672ece3 commit 643fd6a

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
license='Apache-2.0',
2020
entry_points={
2121
'console_scripts': [
22+
'joint_states_relay = sr_ros2_python_utils.js_publisher:main'
2223
],
2324
},
2425
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import rclpy
2+
from rclpy.node import Node
3+
from sensor_msgs.msg import JointState
4+
5+
class JointStatesRelay(Node):
6+
def __init__(self):
7+
super().__init__('joint_states_relay')
8+
self.subscription = self.create_subscription(
9+
JointState,
10+
'/ros1_joint_states',
11+
self.joint_states_callback,
12+
10
13+
)
14+
self.publisher = self.create_publisher(JointState, '/joint_states', 10)
15+
16+
def joint_states_callback(self, msg):
17+
self.publisher.publish(msg)
18+
19+
def main(args=None):
20+
rclpy.init(args=args)
21+
node = JointStatesRelay()
22+
rclpy.spin(node)
23+
node.destroy_node()
24+
rclpy.shutdown()
25+
26+
if __name__ == '__main__':
27+
main()

0 commit comments

Comments
 (0)