20 from sensor_msgs.msg
import Range
31 SONAR_MIN_RANGE = 0.25
32 SONAR_MAX_RANGE = 2.55
35 def __init__(self, memoryKey, frameID, rosTopic):
40 self.msg.header.frame_id = frameID
44 self.msg.radiation_type = Range.ULTRASOUND
49 NAOQI_SONAR_SUB_NAME =
'ros_sonar_subsription' 51 def __init__(self, param_sonar_rate="~sonar_rate", sonar_rate=10):
52 NaoqiNode.__init__(self,
"sonar_publisher")
53 self.
sonarRate = rospy.Rate(rospy.get_param(param_sonar_rate, sonar_rate))
56 memory_key = rospy.get_param(
"~memory_key")
57 frame_id = rospy.get_param(
"~frame_id")
59 self.
publisher = rospy.Publisher( self.sonarSensor.rosTopic, Range, queue_size=5)
63 rospy.loginfo(
"Connecting to NaoQi at %s:%d", self.
pip, self.
pport)
67 rospy.loginfo(
'sonar or memory proxy is invalid' )
76 if (self.publisher.get_num_connections() > 0):
78 sonar.msg.header.stamp = rospy.Time.now()
81 sonar.msg.range = self.memProxy.getData(sonar.memoryKey)
82 except RuntimeError
as e:
83 rospy.loginfo(
'key not found, correct robot ?', e )
87 self.publisher.publish(sonar.msg)
90 self.sonarRate.sleep()
string NAOQI_SONAR_SUB_NAME
def __init__(self, memoryKey, frameID, rosTopic)
def __init__(self, param_sonar_rate="~sonar_rate", sonar_rate=10)
def get_proxy(self, name, warn=True)