NAO Robot Learning_7 Using Sonars by python

一、sonars硬件资料:

http://doc.aldebaran.com/2-8/family/nao_technical/sonar_naov6.html#naov6-sonar

 

二、sonar的内存键值及相关使用解释:

http://doc.aldebaran.com/2-8/family/nao_technical/lola/actuator_sensor_names.html#sonars

1.可以通过向US/Actuator/Value写入相应的数值来设置传感器发射和接受的方式,每一位表示不同的功能。通过这种方式可以自己定义超声传感器的使用方式,区别与官方提供的ALSonar API方法。

2.当同时使用左右两个接收器时:

每组超声传感器一次可以存储十个传感数据,可以通过内存键值Device/SubDeviceList/US/Right/Sensor/Value-Device/SubDeviceList/US/Right/Sensor/Value9来读取

3.当只使用单个接收器时:

读取Device/SubDeviceList/US/Sensor/Value的值,表示的是单侧的传感器的数值,大致在设置完10ms后即有接受值被写入。

4.读取的过程如果dis<0 or dis>5,则表示读取出错或没有接受到回波

5.注意可能检测到身体的某些部位以及地面等

6.内存中的超声传感器的值每100ms会被更新一次,所以读取的周期应长于100ms

 

三、ALSonar API使用方法:

http://doc.aldebaran.com/2-8/naoqi/sensors/alsonar.html

默认使用两侧传感器进行工作

使用示例:

# example for sonar

memory_service = session.service("ALMemory")
sonar_service = session.service("ALSonar")

# Subscribe to sonars, this will launch sonars (at hardware level)
# and start data acquisition.
sonar_service.subscribe("myApplication")

# Now you can retrieve sonar data from ALMemory.
# Get sonar left first echo (distance in meters to the first obstacle).
memory_service.getData("Device/SubDeviceList/US/Left/Sensor/Value")

# Same thing for right.
memory_service.getData("Device/SubDeviceList/US/Right/Sensor/Value")

# Unsubscribe from sonars, this will stop sonars (at hardware level)
sonar_service.unsubscribe("myApplication")

提供有四个响应事件:SonarLeftDetectedSonarRightDetectedSonarLeftNothingDetectedSonarRightNothingDetected 

当满足相应条件时,就会触发相应事件。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值