I think a 4-pin JST Qwiic compatible cheap 360 degree lidar sensor would be a good item to have.
I have used $10 Hitachi rotary lidar sendors from Aliexpress with python and that’s pretty straight forward. I even wrote a class to deal with them if I can find it.
I would think run some code on a SparkFun Thing Plus - SAMD51 microconroller to read it and output through i2c.
I have an order for 9 XRP’s going in so I will tack a Thing Plus on the order and see what I can do.
I bought several Hitachi-LG LIDAR units a while back for $10 from Aliexpress.
It’s a HLS-LFCD2
I figured it would was worth it for the slip joint if nothing else.
I started to convert my old code from Python which I had been running on a raspberry pi. I found it full of remark statements about things I hadn’t done yet and it had no error catching, etc.
I found a fellow Matthew Hogan who was using a raspberry pi pico to control a HLS-LFCD. I didn’t look too closely at the code, but he appears to be calculating cartesian coordinates from the sensors output data.
I have a pi pico which what the xrp and Matthew Hogan are using.
I think the plan now looks more like this.
Run Matthew Hogan’s code on a rpi pico 2040
Connect the lidar sensor to the rpi pico 2040 and read some ranges
Connect the rpi pico 2040 to the XRP with qwiic / i2c
Get the comms for the XRP code to the code on the rpi pico 2040 figured out
Figure out what would be functions (eg mylidarob.rangeatangle()) or send back a data structure with lots of data, or whatever seems like a good idea.
Finalize the code on the rpi pico 2040
3d print some xrp friendly mounting kit for LIDAR, rpi pico, and xrp
Write a class for block or python to deal with the LIDAR/RPI pico sensor module
I just measured up the holes on the HLS-LFCD2 lidar sensor. I’ll start on a stl file for that , posted to printables?
Looking at making a custom block in blockly from the following site, I realize that this will be more complicated than making a class in python. Because this is for introduction to robotics, I guess I will have to make a custom block.
In the spirit of the XRP being an entry point for folks new to robotics, I did a mounting base for the lidar sensor in tinkercad.
Here’s a link (i think(=) to the file (which I think I made public)
I had center to center measurements for the lidar sensor mounting bosses. Tinkercad doesn’t seem to have C2C functionality so it was done with aligning and sizing groups.
I printed out some of the xrp sample mounting clips and printed them out to figure out an appropriate mounting system for the sensor.
I am currently thinking of two clips at the sides and one in the back that have an 8mm cylinderical peg coming off the top, then legs coming off of the mounting base to attache to those.
It would keep the space open at the top of the robot for access but still be stable enough for the relatively heavy sensor.
I ran Matthew Hogan’s code on a arduino mega (because that’s what was on my desk) and it basically worked out of the box so that was good.
I am starting to rethink my whole plan here.
Originally the idea was that a new XRP user could make the lidar sensor by 3d printing a mounting system, attach an rpi pico, run some code to turn it into an i2c sensor.
Then they could import the library to control it, plug in the qwiic connector and with some sample code access the sensor.
The problem is that they have to make the sensor, and at the end of the day for a new user, that might be a big trick.
What got me thinking of this was that I was using a rpi to read the sensor and then act like an i2c device so an rpi mictocontroller can access it…hmmm.
Might be better to just wire it directly into the XRP’s rpi microcontroller and have a class that takes care of reading it…
With the US FIRST robotics season, I haven’t had a lot of time to work on the XRP robots beyond running them in class. The direction I am now looking at is making a block that can read from the lidar sensor as report an angle measurement. I never made a blockly block before so that might take some research.