Jetbot collision avoidance - ultrasonic sensor trigger take picture

Hi

I have a jetbot that works great running the collision_avoidance Jupyter notebook examples from NVIDIA

and an ultrasonic sensor hc-sr04

when a certain distance from an object is detected, was hoping to have the camera take a picture and save it to the blocked_data_collection folder.

I could than re run the program periodically with the new blocked_data pictures and hopefully it learns on its own in new spaces.

My question is how can I trigger the camera to take a picture and save it to a folder, after the ultrasonic sensor detects an obstacle?

Thanks!

I found this article on calculating distance with the ultrasonic sensor as well

https://tutorials-raspberrypi.com/raspberry-pi-ultrasonic-sensor-hc-sr04/

ultrasonic sensor
https://www.sparkfun.com/products/15569

Hi,

Calling the ultrasonic sensor directly from the Jetson Nano may not be ideal as the Jetson Nano does not do real time processing. This causes your distance measurement to become unreliable.

You’re probably better off adding a small Arduino Nano or Adafruit Feather microcontroller (the latter fits nicely under the Adafruit motor controller) to measure the distance. You can then use I2C communication to instruct the microcontroller to make a measurement and return the result via I2C.

If you’re looking for more detailed installation instructions and / or sample code you can check out my blog on this subject at https://thestrongestlink.nl/2020/05/31/ultrasonic-sensor-for-the-jetbot/ .

1 Like