File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 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)
Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments