diff --git a/joint_state_publisher/README.md b/joint_state_publisher/README.md index 7d3b6af..02a0052 100644 --- a/joint_state_publisher/README.md +++ b/joint_state_publisher/README.md @@ -24,6 +24,7 @@ Parameters * `use_mimic_tags` (bool) - Whether to honor `` tags in the URDF. Defaults to True. * `use_smallest_joint_limits` (bool) - Whether to honor `` tags in the URDF. Defaults to True. * `source_list` (array of strings) - Each string in this array represents a topic name. For each string, create a subscription to the named topic of type `sensor_msgs/msg/JointStates`. Publication to that topic will update the joints named in the message. Defaults to an empty array. +* `relay_sources` (bool) - Whether to immediately republish messages coming in on topics from `source_list`. Makes for smoother joints sometimes. Defaults to False. * `delta` (double) - How much to automatically move joints during each iteration. Defaults to 0.0. #### Mapped Parameters diff --git a/joint_state_publisher/joint_state_publisher/joint_state_publisher.py b/joint_state_publisher/joint_state_publisher/joint_state_publisher.py index fc2ae96..b67c93e 100644 --- a/joint_state_publisher/joint_state_publisher/joint_state_publisher.py +++ b/joint_state_publisher/joint_state_publisher/joint_state_publisher.py @@ -364,6 +364,8 @@ def __init__(self, description_file): ParameterDescriptor(type=ParameterType.PARAMETER_INTEGER)) self.declare_ros_parameter('source_list', [], ParameterDescriptor(type=ParameterType.PARAMETER_STRING_ARRAY)) + self.declare_ros_parameter('relay_sources', False, + ParameterDescriptor(type=ParameterType.PARAMETER_BOOL)) self.declare_ros_parameter('use_mimic_tags', True, ParameterDescriptor(type=ParameterType.PARAMETER_BOOL)) self.declare_ros_parameter('use_smallest_joint_limits', True, @@ -459,6 +461,9 @@ def source_cb(self, msg): if self.source_update_cb is not None: self.source_update_cb() + if self.get_param('relay_sources'): + self.pub.publish(msg) + def set_source_update_cb(self, user_cb): self.source_update_cb = user_cb