diff --git a/setup.py b/setup.py index 23b61bc..5057e7f 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ license='Apache-2.0', entry_points={ 'console_scripts': [ + 'joint_states_relay = sr_ros2_python_utils.js_publisher:main' ], }, ) diff --git a/sr_ros2_python_utils/js_publisher.py b/sr_ros2_python_utils/js_publisher.py new file mode 100755 index 0000000..a12d3ea --- /dev/null +++ b/sr_ros2_python_utils/js_publisher.py @@ -0,0 +1,27 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import JointState + +class JointStatesRelay(Node): + def __init__(self): + super().__init__('joint_states_relay') + self.subscription = self.create_subscription( + JointState, + '/ros1_joint_states', + self.joint_states_callback, + 10 + ) + self.publisher = self.create_publisher(JointState, '/joint_states', 10) + + def joint_states_callback(self, msg): + self.publisher.publish(msg) + +def main(args=None): + rclpy.init(args=args) + node = JointStatesRelay() + rclpy.spin(node) + node.destroy_node() + rclpy.shutdown() + +if __name__ == '__main__': + main() diff --git a/sr_ros2_python_utils/transforms.py b/sr_ros2_python_utils/transforms.py index a9ebdc6..f46a968 100644 --- a/sr_ros2_python_utils/transforms.py +++ b/sr_ros2_python_utils/transforms.py @@ -113,7 +113,7 @@ def _quaternion_multiply(q0:ArrayLike, q1:ArrayLike) -> ArrayLike: class TCPTransforms: - def __init__(self, node:Node, tcp_link_name:str='tcp_link', tool_link_name:str='tcp_gripper') -> None: + def __init__(self, node:Node, tcp_link_name:str='tcp_link', tool_link_name:str='tcp_link') -> None: """ TCP transformation helper class