当前位置: 首页>>代码示例>>Python>>正文


Python Range.radiation_type方法代码示例

本文整理汇总了Python中sensor_msgs.msg.Range.radiation_type方法的典型用法代码示例。如果您正苦于以下问题:Python Range.radiation_type方法的具体用法?Python Range.radiation_type怎么用?Python Range.radiation_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sensor_msgs.msg.Range的用法示例。


在下文中一共展示了Range.radiation_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: callDist

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def callDist(data):

		#reads voltage value
        voltage = ADC.read("P9_40")
		#converts voltage values into distance(meters)
        distance = (voltage**-.8271732796)
        distance = distance*.1679936709
    	#checks and discards data outside of accurate range
        if distance>2:
            distance = 2
        elif distance<.15:
            distance = .15

    	#Writes data to Range message
        msg = Range()
        header = Header()
        #creates header
        msg.header.stamp.secs = rospy.get_time()
        msg.header.frame_id = "/base_link"
        msg.radiation_type = 1
        msg.field_of_view = .15	#about 8.5 degrees
        msg.min_range = .15
        msg.max_range = 2
        msg.range = distance
        pub.publish(msg)
开发者ID:mdykshorn,项目名称:mapBot,代码行数:27,代码来源:irOutput.py

示例2: prepareArray

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
 def prepareArray(self):
     for i in range(0, len(self.sensors)):
         r = Range()
         r.header.frame_id = "ir{}_link".format(i + 1)
         r.min_range = self.sensors[i].min_range
         r.max_range = self.sensors[i].max_range
         r.radiation_type = r.INFRARED
         self.msg.array += [r]
开发者ID:DD2425-2015-Group7,项目名称:catkin_ws,代码行数:10,代码来源:ir_publish.py

示例3: _msg

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
    def _msg(self, frame_id, distance):
        msg = Range()
        msg.header.frame_id = frame_id
        msg.header.stamp = rospy.Time.now()
        msg.radiation_type = self._type
        msg.field_of_view = self._fov
        msg.min_range = self._min
        msg.max_range = self._max
        msg.range = min(max(distance, msg.min_range), msg.max_range)

        return msg
开发者ID:tslator,项目名称:arlobot_rpi,代码行数:13,代码来源:range_array_sensor.py

示例4: send_range

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
	def send_range(self, msg, current_time):
		# ultra sonic range finder
		scan = Range()
		scan.header.stamp = current_time
		scan.header.frame_id = "forward_sensor"
		scan.radiation_type = 0
		scan.field_of_view = 60*pi/180
		scan.min_range = 0.0
		scan.max_range = 4.0
		scan.range = msg.d1/100.0
		self.pub_sonar.publish(scan)
开发者ID:bsmr-misc-forks,项目名称:ros_roboint,代码行数:13,代码来源:robo_explorer.py

示例5: sonar_publisher

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def sonar_publisher():
    # NAO connect
    # Connect to ALSonar module.
    sonarProxy = ALProxy("ALSonar", IP, PORT)
    # Subscribe to sonars, this will launch sonars (at hardware level) and start data acquisition.
    sonarProxy.subscribe("ROS_sonar_publisher")
    #Now you can retrieve sonar data from ALMemory.
    memoryProxy = ALProxy("ALMemory", IP, PORT)

    #ROS
    pub_right = rospy.Publisher(TOPIC_NAME+'right', Range, queue_size=10)
    pub_left = rospy.Publisher(TOPIC_NAME+'left', Range, queue_size=10)
    rospy.init_node('nao_sonar_publisher')
    r = rospy.Rate(PUBLISH_RATE)
    while not rospy.is_shutdown():
        # Get sonar left first echo (distance in meters to the first obstacle).
        left_range = memoryProxy.getData("Device/SubDeviceList/US/Left/Sensor/Value")
        # Same thing for right.
        right_range = memoryProxy.getData("Device/SubDeviceList/US/Right/Sensor/Value")

        left = Range()
        left.header.stamp = rospy.Time.now()
        left.header.frame_id = '/torso'
        left.radiation_type = Range.ULTRASOUND
        left.field_of_view = 60
        left.min_range = 0.25 # m
        left.max_range = 2.55 # m
        left.range = left_range

        right = Range()
        right.header.stamp = rospy.Time.now()
        right.header.frame_id = '/torso'
        right.radiation_type = Range.ULTRASOUND
        right.field_of_view = 60
        right.min_range = 0.25 # m
        right.max_range = 2.55 # m
        right.range = right_range

        pub_right.publish(right)
        pub_left.publish(left)
        r.sleep()
开发者ID:gerardcanal,项目名称:NAO-UPC,代码行数:43,代码来源:nao_sonar_publisher.py

示例6: default

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
    def default(self, ci="unused"):
        msg = Range()
        msg.radiation_type = Range.INFRARED
        msg.field_of_view = 20
        msg.min_range = 0
        msg.max_range = self.component_instance.bge_object["laser_range"]
        tmp = msg.max_range
        for ray in self.data["range_list"]:
            if tmp > ray:
                tmp = ray
        msg.range = tmp

        self.publish(msg)
开发者ID:Greg8978,项目名称:morse_MaRDi,代码行数:15,代码来源:infrared.py

示例7: talker

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def talker():
    signal.signal(signal.SIGINT, signal_handler)
    time.sleep(1)
    setup_servo()
    pub = rospy.Publisher('servo_ulta', Range, queue_size=10)
    rospy.init_node('servo_ultra', anonymous=True, disable_signals=False )
    rate = rospy.Rate(10) # 10hz
    ultrasonic_number = 1
    
    pause_time = 0.1
    delay_ultrasonic = 0.11
    STEP_ANGLE = 10

    CURR_ANGLE = (90.0 * math.pi) / 180.0

    mindt = 0.65
    maxdt = 2.48
    dt = [mindt, maxdt]
    extremes = [int(x * 1024.0 / 20.0) for x in dt]

    dt_range = extremes[1] - extremes[0]
    dt_step = int((dt_range / 180.0) * STEP_ANGLE)

    br = tf.TransformBroadcaster()

    while not rospy.is_shutdown():
        #broadcast_transforms()

        # Move servo to counter-clockwise extreme.
        wiringpi.pwmWrite(18, extremes[1])
        sleep(0.2)
        CURR_ANGLE = (90.0 * math.pi) / 180.0

        for i in range(extremes[1],extremes[0],-dt_step):         # 1025 because it stops at 1024
            wiringpi.pwmWrite(18,i)
            sleep(pause_time)
            br.sendTransform((0.15, 0.0, 0.0),tf.transformations.quaternion_about_axis(CURR_ANGLE, (0, 0, 1)), rospy.Time.now(), "1", "base_link")
            data = Range()
            data.header.frame_id = "1"
            data.header.stamp = rospy.Time.now()
            data.radiation_type = 0
            data.min_range = 0.05 
            data.max_range = 2.0
            data.field_of_view = 0.164
            try :
                data.range = float(get_us_data_from(ultrasonic_number)) /100.0
            except IOError:
                subprocess.call(['i2cdetect', '-y', '1'])
                data.range = 0.0
            pub.publish(data)
            CURR_ANGLE -= (STEP_ANGLE * math.pi) / 180.0
开发者ID:digvijay7,项目名称:botpi,代码行数:53,代码来源:servo_ultra.py

示例8: default

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
    def default(self, ci='unused'):
        """ Publish the data of the infrared sensor as a ROS Range message """
        msg = Range()
        msg.radiation_type = Range.INFRARED
        msg.field_of_view = 20
        msg.min_range = 0
        msg.max_range = self.component_instance.bge_object['laser_range']
        tmp = msg.max_range
        for ray in self.data['range_list']:
            if tmp > ray:
                tmp = ray
        msg.range = tmp

        self.publish(msg)
开发者ID:matrixchan,项目名称:morse,代码行数:16,代码来源:infrared.py

示例9: default

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
    def default(self, ci='unused'):
        msg = Range()
        msg.header = self.get_ros_header()
        msg.radiation_type = Range.INFRARED
        msg.field_of_view = 20
        msg.min_range = 0
        msg.max_range = self.component_instance.bge_object['laser_range']
        tmp = msg.max_range
        for ray in self.data['range_list']:
            if tmp > ray:
                tmp = ray
        msg.range = tmp

        self.publish(msg)
开发者ID:HorvathJo,项目名称:morse,代码行数:16,代码来源:infrared.py

示例10: inputCallback

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
 def inputCallback(self, msg):
 #########################################################################
     # rospy.loginfo("-D- range_filter inputCallback")
     cur_val = msg.value
 
     if cur_val <= self.max_valid and cur_val >= self.min_valid:
         self.prev.append(cur_val)
         del self.prev[0]
     
         p = array(self.prev)
         self.rolling_ave = p.mean()
         self.rolling_std = p.std()
     
         self.rolling_meters = ((self.b * self.rolling_ave) ** self.m) / 100
     
         self.filtered_pub.publish( self.rolling_meters )
         self.std_pub.publish( self.rolling_std )
         
         rng = Range()
         rng.radiation_type = 1
         rng.min_range = self.min_range
         rng.max_range = self.max_range
         rng.range = self.rolling_meters
         rng.header.frame_id = self.frame
         rng.field_of_view = 0.1
         rng.header.stamp = rospy.Time.now()
         
         self.range_pub.publish( rng )
        
         ranges = [] 
         intensities = []
         angle_start = 0.0 - self.field_of_view
         angle_stop = self.field_of_view
         for angle in linspace( angle_start, angle_stop, 10):
             ranges.append( self.rolling_meters )
             intensities.append( 1.0 )
         scan = LaserScan()
         scan.ranges = ranges
         scan.header.frame_id = self.frame
         scan.time_increment = 0;
         scan.range_min = self.min_range
         scan.range_max = self.max_range
         scan.angle_min = angle_start
         scan.angle_max = angle_stop
         scan.angle_increment = (angle_stop - angle_start) / 10
         scan.intensities = intensities
         scan.scan_time = self.scan_time
         scan.header.stamp = rospy.Time.now()
         self.scan_pub.publish( scan )
开发者ID:jfstepha,项目名称:yertle-bot,代码行数:51,代码来源:int2range.py

示例11: talker

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def talker():
    pub = rospy.Publisher("sensor1", Range, queue_size=50)
    rospy.init_node("robot", anonymous=True)
    rate = rospy.Rate(1) # 10hz
    while not rospy.is_shutdown():
        msg = Range()
        msg.header.stamp = rospy.Time.now()
        msg.header.frame_id = "/sensor1"
        msg.min_range = 0
        msg.max_range = 2
        msg.radiation_type = Range.ULTRASOUND

        rospy.loginfo(msg)
        pub.publish(msg)
        rate.sleep()
开发者ID:ayeganov,项目名称:tank_roboto,代码行数:17,代码来源:sensor_proxy.py

示例12: publish

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
 def publish(self, data):
     msg = Range()
     msg.header.stamp = rospy.get_rostime()
     msg.header.frame_id = self._frameId
     if self._urfType == URF_HRLV:
         msg.min_range = MIN_RANGE_URF_HRLV_MaxSonar
         msg.max_range = MAX_RANGE_URF_HRLV_MaxSonar
         msg.field_of_view = FIELD_OF_VIEW_URF_HRLV_MaxSonar
     else:
         msg.min_range = MIN_RANGE_URF_LV_MaxSonar
         msg.max_range = MAX_RANGE_URF_LV_MaxSonar
         msg.field_of_view = FIELD_OF_VIEW_URF_LV_MaxSonar
     msg.radiation_type = Range.ULTRASOUND
     msg.range = data
     self._pub.publish(msg)
开发者ID:Itamare4,项目名称:robotican,代码行数:17,代码来源:RiCURF.py

示例13: sendLidar

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def sendLidar():
    global lasers_raw
    lidar_publisher = rospy.Publisher('mavros/distance_sensor/lidar', Range, queue_size=1)
    rate = rospy.Rate(30)
    msg = Range()
    sendLidar_count = 0
    msg.radiation_type = msg.INFRARED
    msg.field_of_view = 0.0523599 # 3° in radians
    msg.min_range = 0.05
    msg.max_range = 20.0
    while run:
        msg.header.stamp = rospy.Time.now()
        msg.header.seq=sendLidar_count
        msg.range = (lasers_raw.lasers[4] + lasers_raw.lasers[5])/200
        lidar_publisher.publish(msg)
        sendLidar_count = sendLidar_count + 1
        rate.sleep()
开发者ID:AlexisTM,项目名称:Indoor_Position_lasers,代码行数:19,代码来源:control_thread.py

示例14: node

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def node():
    rospy.init_node('sonar_node', anonymous=True)
    range_msg = Range()
    range_msg.radiation_type = range_msg.ULTRASOUND
    pub = rospy.Publisher("/msg_from_sonar", Range, queue_size=10)
    r = rospy.Rate(20)
    rospy.loginfo("reading sonar range")
    while not rospy.is_shutdown():
        #trigger sonar to measure
        cmd = chr(0x22)+chr(0x00)+chr(0x00)+chr(0x22)
        ser.write(cmd)
        data = ser.read(4)
        if len(data)==4 and (ord(data[0])+ord(data[1])+ord(data[2]))&255 == ord(data[3]):
            sonar_range = ord(data[1])*256+ord(data[2])
            range_msg.range = sonar_range
            pub.publish(range_msg)
            rospy.loginfo("distance : %d", sonar_range)
        else:
            rospy.logwarn("sonar error!")
        r.sleep()
开发者ID:taogashi,项目名称:smith,代码行数:22,代码来源:sonar.py

示例15: main

# 需要导入模块: from sensor_msgs.msg import Range [as 别名]
# 或者: from sensor_msgs.msg.Range import radiation_type [as 别名]
def main():
	pub = rospy.Publisher('ernest_sensors/imu', Imu, queue_size=10)
	eyes = rospy.Publisher('ernest_sensors/eyes', Range, queue_size=10)
	nunchuck = rospy.Publisher('ernest_sensors/joy', Joy, queue_size=10)
	nunchuck_giro = rospy.Publisher('ernest_sensors/joy_giro', Imu, queue_size=10)
	comm = ArduinoCommunicator()
	rospy.init_node('ernest_sensors')
	for line in comm.loop():
		print line
		try:
			x, y, z, dis, joy_x, joy_y, giro_x, giro_y, giro_z, but_c, but_z = line.split(",")
			imu = Imu()
			imu.header.frame_id = "imu"
			imu.linear_acceleration.x = -float(x)
			imu.linear_acceleration.y = float(z)
			imu.linear_acceleration.z = float(y)
			r = Range()
			r.header.frame_id = "imu"
			r.radiation_type = 1
			r.field_of_view = 0.5
			r.min_range = 0.20
			r.max_range = 3
			r.range = float(dis)/100.0
			j = Joy()
			j.axes = [
				maprange(float(joy_x), 25, 226, -1, 1), 
				maprange(float(joy_y), 32, 223, -1, 1)
			]
			j.buttons = [int(but_c), int(but_z)]
			imu2 = Imu()
			imu2.header.frame_id = "imu"
			imu2.linear_acceleration.x = (float(giro_y) - 512) / 512.0
			imu2.linear_acceleration.y = -(float(giro_x) - 512) / 512.0
			imu2.linear_acceleration.z = -(float(giro_z) - 512) / 512.0
			pub.publish(imu)
			eyes.publish(r)
			nunchuck.publish(j)
			nunchuck_giro.publish(imu2)
		except ValueError:
			continue
开发者ID:simkim,项目名称:ernest,代码行数:42,代码来源:sensors.py


注:本文中的sensor_msgs.msg.Range.radiation_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。