def set_port_value(self, port_name, port_value, port_type=None, timeout=5.0):
"""
set the value for the given port
return True if the port value is set, False if the requested port is invalid
"""
if port_name not in list_port_names():
rospy.logerr("Cannot find port '{0}' in this IO Device.".format(port_name))
return
if port_type == None:
p_type = self.get_port_type(port_name)
if p_type == None:
rospy.logerr("Failed to get 'type' for port '{0}'.".format(port_name))
return
else:
p_type = port_type
set_command = SetCommand().set_port(port_name, p_type, port_value)
self.publish_command(set_command.op, set_command.args, timeout=timeout)
# make sure both state and config are valid:
self.revalidate(timeout, invalidate_state=False, invalidate_config=False)
评论列表
文章目录