Quick peek at some of the new UltrasonicSensor Service stuff ..
Use 1.0.31+
MRLComm.ino version is 15 (I think) - so you'll probably have to reload it.
THIS HAS NON BLOCKING RANGING WHICH DOESNT INTERFERE WITH SERVOS (YAY TO THAT!)
This is copied from Java code .. so I might not have Python-ized it correctly
sr04 = Runtime.start("sr04", "UltrasonicSensor")sr04.attach("COM15", 7, 8) # I quick attach - will create an arduino if necessarydef publishRange(myRange):print myRange # call back - we will now setup the listener# sr04.arduino.setLoadTimingEnabled(true); # < you can look at the load timings of the duino with this# sr04.arduino.setLoadTimingEnabled(false);sr04.addPublishRangeListener(python);# IMPORTANT - I've added my python service as a listener# SO I BETTER HAVE a def publishRange(data) somewheresr04.startRanging() # start raging for 10 secondssleep(10)sr04.stopRanging();# blocking rangemyRange = sr04.range()print myRange
Can the Ultrasonic sensor be
Can the Ultrasonic sensor be used in place of the PIR sensor? Wondering if it can be configured to power up the robot when something comes within a set range. Also, can it be used as an override to prevent the robot from hitting something?
It "could" be .. here are
It "could" be .. here are some differences..
The Ultrasonic Senor has a more narrow field of view.. PIRs are usually designed to have wide field.
PIR can not do range.. Ultrasonic can
Ultrasonic is effected by sound absorbing materials - e.g. pillows, soft things.. PIR is sensitive to fluctuations in heat..
Yes, obstacle avoidance is a common application
Are there any instructions
Are there any instructions somewhere to install one on InMoov? I guess a "pin" would have to be available to connect it to.
No instructions as of
No instructions as of yet.
Depending on what kind of Ultrasonic sensor you have it might require 2 pins.
1 Trigger pin & 1 Echo pin - this is how the most common SR04 is configured.
Worky!
I got mine working even though there was no 4.000 MHz crystal soldered on the board.
Wow .. It's really nice to
Wow ..
It's really nice to hear something is Worky for a change :)
Thanks KMC .. I appreciate it