Power for Picar

Is it possible to feed the on-board raspberry with its own USB power supply plug (as an example during programming) via an external power supply. In this case, what must be the status of the on-off switch on the hat board ? Is it necessary to remove batteries ?
Thanks in advance for your answer.

You can power the raspberry pi through an external power supply when you program it, the robot hat’s on/off button can be turned off and the battery can be removed without affecting the programming, but if you execute the robot code, you must leave the robot hat powered on and you must connect the battery to power the robot hat. But this way is a bit redundant and troublesome.
Because the external power supply powers the raspberry pi, and the raspberry pi does not power the robot hat. So when you want to run the code, you still have to connect the battery to power the robot hat.
If you use the battery directly, the battery will power the robot hat, and the power will flow to the Raspberry Pi to make the Raspberry Pi work, so you don’t need to connect the external power supply. (Connect the battery, turn on the robot hat’s switch button, and once the Raspberry Pi boots up, you can start programming or running code)
This is very convenient, both programming and running code. When the battery is too low, just charge the battery in time.

I have 4 sets of batteries - so 3 fully charged backup sets. However, sometimes, when programming, my thought processes take a long time to come together, especially if I’m doing internet searches to back up my ideas, or nipping out for a coffee, so in those cases I power off my Picar-X, I leave the batteries in (because the power switch is off) and power the Pi through USB. That means I can take my time setting up my software, then shutdown, remove the USB, and switch on the Picar to see whether it works.

Hope that helps.

What you mean is.
If you connect the battery and also connect the external power supply, and turn the robot hat on/off button when you go out (this is a good idea to save battery power), it will not affect your code editing function, because only the robot hat is off, and the Raspberry Pi is not off (the external power supply is powering the Raspberry Pi), so you can connect to edit the code remotely normally.
If you want to make the robot work, you need to turn on the robot hat switch button, and the battery to power the robot hat, the robot can work properly, at this time you unplug the external power supply, and it will not affect the work.