I looked into the details to see what was going on.
NewPing was used, and instead of the time being sent back to the arduino the ping_cm() was.
The reason we switched to NewPing, is the previous Ping in Arduino blocked communication until the the time came back or there was a timeout.
I'll fix this in Nixie, for Manticore version of MRL you can just multiply it to get microseconds or milliseconds
Therefore echoTime = distance_cm * 57 in micro-seconds.
I understand that these settings are made in MrlComm for Arduino. Please tell me which variable is responsible for the polling rate of the HC-SR04. And yet, I need to do a synchronous launch of two HC-SR04. Because one of them will only listen.
Within MrlComm devices - update() is called in a processing loop which has a high as possible frequency rate. MrlUltrasonicSensor.cpp uses NewPing to process the ping. calling ping_cm() before the echo has processed, is a noop I believe.
If you want to synchronize multiple Sensors I would suggest that you NOT do it in MrlComm. Rather use the sensor startRanging() stopRanging() in Python.
Hmm... I would think "at the same time" is not a good idea -
If you have the sensor placed anywhere near one another, you'll start getting interference from one to the other.
I'd recommend you just reduce the sleep time between the sensors but keep them alternating. You can probably reduce the time so much the "appear" to be working simultaneously.
Helllo alexstarter, Check the
Helllo alexstarter,
Check the UltrasonicSensor service page :
http://myrobotlab.org/service/ultrasonicsensor
At the bottom of a service page is an example script
This returns me the same
Ha ! Thanks. I looked into
Ha ! Thanks.
I looked into the details to see what was going on.
NewPing was used, and instead of the time being sent back to the arduino the ping_cm() was.
The reason we switched to NewPing, is the previous Ping in Arduino blocked communication until the the time came back or there was a timeout.
I'll fix this in Nixie, for Manticore version of MRL you can just multiply it to get microseconds or milliseconds
Therefore echoTime = distance_cm * 57 in micro-seconds.
Hope this helps.
Thank You, GroG! I will
Thank You, GroG! I will definitely try it tomorrow.
Hi GroG! I understand that
The details are in
The details are in MrlUltrasonicSensor.cpp
Within MrlComm devices - update() is called in a processing loop which has a high as possible frequency rate. MrlUltrasonicSensor.cpp uses NewPing to process the ping. calling ping_cm() before the echo has processed, is a noop I believe.
If you want to synchronize multiple Sensors I would suggest that you NOT do it in MrlComm. Rather use the sensor startRanging() stopRanging() in Python.
e.g.
s1 = Runtime.start("s1","UltrasonicSensor")
s2 = Runtime.start("s2","UltrasonicSensor")
current_sensor = "s1"
def onRange(rang):
.. do something ..
while (True):
if current_sensor == "s1"
s2.stopRanging()
s1.startRanging()
sleep(3)
current_sensor = "s2"
else:
s1.stopRanging()
s2.startRanging()
sleep(3)
current_sensor = "s1"
this alternates 3 seconds for each sensor
Oh, GroG ! It's great that
Oh, GroG ! It's great that you took the time to give me an example. Thanks! I will definitely try it!
GroG. Your example
Hmm... I would think "at the
Hmm... I would think "at the same time" is not a good idea -
If you have the sensor placed anywhere near one another, you'll start getting interference from one to the other.
I'd recommend you just reduce the sleep time between the sensors but keep them alternating. You can probably reduce the time so much the "appear" to be working simultaneously.
Thank GroG I understood
Looks Great Alextstarter !
Looks Great Alextstarter !
Hi GroG! I am new to
Hi GroG!
Tell me how can I post a
Tell me how can I post a video?
https://vk.com/wall187347478_98
I posted your video here
I posted your video here - http://myrobotlab.org/content/ultrasonic-sensors-and-mecanum-wheel-platform
Its pretty easy, you just need the embed code from your video
press this button and copy / paste the embed code in it
UltrasonicSensor
[MAIN]
ultraSonicRightActivated=True
ultraSonicRightArduino=right
trigRightPin=64
echoRightPin=63
ultraSonicLeftActivated=False
ultraSonicLeftArduino=left
trigLeftPin=64
echoLeftPin=63
But that doesn't work.
I think there is a problem in the file
C:\mrl\InMoov\services I_UltraSonicSensor.py