I want to merge the examples using keyboard for movement and reading the VL53L1X sensors to stop short of walls. When I use pipenv shell to use the keyboard, the program can’t find the QWIIC routines. If I don’t use pipenv, QWIIC is found but other things don’t work in the keyboard section as mentioned in the doc.
SparkFun-qwiic is included in pipenv shell. How would I refer to the qwiic routines to get at ToF sensor values. ToF sensor addresses are initialized. I tested accessing them in another program that imports qwiic.
I looked thru the getting_started directories (observer and asyncio). I didn’t find any examples of using qwiic sensors along with RVR SDK calls. Browsing/searching Github is daunting for examples, as well as Google searches on using SparkFun-qwiic.
Update: Used pip3 install sparkfun-qwiic. Now ‘import qwiic’ doesn’t cause an error after using pipenv shell. However the example python to change i2c address throws an error ( ‘QwiicVL53L1X’ object has no attribute ‘SensorInit’) while pipenv shell is active. Example code for address change works Ok when not in pipenv shell.
pipenv shell doesn’t seem to incorporate libraries for ToF or GPS or directories. Library errors (module not found) occur when merging Python into using WSAD example. ToF or GPS examples do not run when pipenv shell is active.
Others have asked similar questions (I think there are a bunch of duplicate posts):
We have not included a “complete integration” example in order to challenge users to develop their own code. That being said, here are a few tips to get you pointed in the right direction:
- You will probably need to install the Qwiic Python package in the pipenv to run all the code in single script. - Otherwise, like the servo controls you can run a script for the distance sensors and GPS as a "background service"; then overlay the data on the webpage. (*It would be advisable to run all I2C devices in the same script to avoid bus contention.*)
You could try to [ping Sphero to see if there is a way to operate their SDK outside of the pipenv environment or to ask for help using pipenv. Otherwise, I’m not really familiar with how pipenv exactly works (Sphero implemented that with their SDK); however, I think you need to call:
pipenv install [package]
There are a bunch of documentation and tutorial resources online for [how to use pipenv and install packages.
However, I would probably tie in the GPS and ToF sensors’ readouts to the [servo control for the web interface (runs in the background when you execute start.sh). Specifically, to run all the I2C devices together (servo controller is an I2C device), so that you don’t have bus contention issue between separate scripts running simultaneously.
From there, you would need to overlay your data on the video feed. I thought I remember seeing some information in the [web camera interface wiki. You can also check the [GitHub repository and [project page for more details.[/quote]](http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=63276)](GitHub - silvanmelchior/RPi_Cam_Web_Interface: A web interface for the RPi Cam)](RPi-Cam-Web-Interface - eLinux.org)](sparkfun_autonomous_kit/piservohat_web_interface_firmware.py at master · sparkfun/sparkfun_autonomous_kit · GitHub)](Basic Usage of Pipenv — pipenv 2020.6.2.dev0 documentation)](https://community.sphero.com/c/advanced-programming)
Alan45:
Update: Used pip3 install sparkfun-qwiic. Now ‘import qwiic’ doesn’t cause an error after using pipenv shell. However the example python to change i2c address throws an error ( ‘QwiicVL53L1X’ object has no attribute ‘SensorInit’) while pipenv shell is active. Example code for address change works Ok when not in pipenv shell.
The reason you are getting the “QwiicVL53L1X object has no attribute SensorInit” error is because the symbol table for the QwiicVL53L1X object is different between the Github/pip3 sparkfun-qwiic package and the SparkFun provided RVR Autonomous image (release date: 2019-09-26).
Refer to the post entitled “CANNOT DETECT AN I2C TOF SENSOR (VL53L1X) THAT CONNECTED TO A PROPERLY CONFIGURED I2C MUX (TCA9548A)” in the Kits forum. If you look at the “Mon May 24, 2021” entry, you will see how to fix your problem.