Ok, we’re currently in the process of putting together some more concrete examples of that, because the existing ones are a bit difficult to find/navigate.
I’ll write instructions for Python, because it’s what I’m more familiar with and is a bit easier to get started in.
To start with you’ll need to have Python 3 installed, along with pip. I haven’t used a Jetson Nano before, but it seems to run linux, so you should be able to
- Open a Terminal window
- Update all existing packages
sudo apt-get update && sudo apt-get -y upgrade
- Install Python 3 and pip using
sudo apt-get install -y python3 python3-pip
- Install the latest version of our ping-python library
pip3 install --user bluerobotics-ping --upgrade
Then you can run python using the python3
command in your terminal, and you can run python files using python3 my_file.py
.
Using the adaptor that comes with the Ping360 you can connect it up to a USB port in your Jetson Nano, and supply power to the Ping360 power wires with a suitable battery or power supply:
Assuming it’s the only thing plugged in to a USB port, you should be able to run the following Python code to interact with it
from brping import Ping360
# connect to and initialize device
p = Ping360()
p.connect_serial('/dev/ttyUSB0', 115200)
print(f'{p.initialize() = }')
# set some settings
print(p.set_number_of_samples(200))
print(p.set_gain_setting(1))
# get some data, full revolution in steps of 10 gradians (9 degrees)
for gradians in range(0, 400, 10):
print(p.transmitAngle(gradians))
The methods I was using there are defined here, but note that the auto-transmit functionality isn’t available in the Ping360 firmware yet. For some more information on processing the data, see this post
If there’s anything in particular that isn’t clear feel free to post follow-ups - hopefully some more complete examples will be available soon.