I have installed the picar-V (via github) software onto a raspberry pi 4 and setup a startup script for the django server in etc/rc.local on bootup. I want to make some enhancements to the python code but am unsure what source code to update. The *.py and *.pyc files seem to be scattered across multiple directories on the raspberry pi. So I am asking how to make python programing modifications and re-deploy. I am confused as to the multiple locations and copies of the various files.
Thank You
faja1130,
If you want to modify the content of the remote control part, you can modify
~/SunFounder_PiCar-V/remote_control/remote_control/
I want to add functions like sensors and I2C devices. I am trying to do this by modifying ~/SunFounder_PiCar-V/client/Client.py. Is this the correct place?
There are copies of the client.py code scattered everywhere:
/usr/lib/python…
/usr/local/lib/python…
(And many more places)
When I modify SunFounder_PiCar-V/client/Client.py, it only works running in the python IDE (Thonny) and not when run as a service. I believe the actual binary is executed from some other place.
I have also checked $PATH and nothing referenced there.
Thanks
To add sensors, the I2C device should be changed in ~/SunFounder_PiCar-V/remote_control/remote_control/. You can see that the run function in views.py will run different functions under different actions. The code inside client.py is to do the client, that is, the control page, it is not recommended to implement the sensor function on this.
OK, I did a simple test by changing the camdown action to cam.turn_up and it worked. I understand to update the views.py to add/change actions. But if I want to write a new subroutine action and use it, or modify an existing subroutine, where do I put that NEW/Mod subroutine? Do I look in the ./driver folder?
Thank You
Not quite understand what subroutine refers to, can you give me an example? /driver is a library, that is, some relatively complex operations are abstracted out of a library and put into the driver, in order to simplify the code of the views.
I’m sorry, I wasn’t using the correct Python term. I meant writing a new class object (instead of ‘subroutine’) , like you did with the camera.py. I think I have it figured out. Thank You!!!
1 Like