Pidog iPad Controller

Instructions on website state:
https://docs.sunfounder.com/projects/pidog/en/latest/python/py_12_app_control.html

cd ~/pidog/examples
sudo python3 12_app_control.py

and the results will be:

Running on: http://192.168.18.138:9000/mjpg

* Serving Flask app “vilib.vilib” (lazy loading)

* Environment: development

* Debug mode: off

* Running on http://0.0.0.0:9000/ (Press CTRL+C to quit)

The results are:

IndexError: list index out of range

And there is no mention on 192 in the dialogue

Needless to say my iPad could not find the PiDog

Thanks for your help

Carl

The 192.xxx.xxx.xxs is the ip address address allocated to your pidog by your own router. The one shown is only an example. ifconfig will show your actual one.

The main problem though seems to be this

IndexError: list index out of range

This usually indicates a bad hardware connection typically camera, so the program cannot progress further. Does the camera and other hardware all work in the example programs?

I believe I have the correct ip address, I am not the person experiencing the index error.

How can I check the camera, I have never seen a display. All of the other servos seem to work when I use the exercise to enter commands via the keyboard.

I ran the following code that I found on the internet:

pi@raspberrypi:~/pidog/examples $ libcamera-hello -t 0
bash: libcamera-hello: command not found
pi@raspberrypi:~/pidog/examples $

Am I missing a module, if so where can I find it?

>>> I am not the person experiencing the index error.

This was what you reported

The results are:
IndexError: list index out of range

Depending on which OS you are using, e.g ubuntu, then you may need to install libcamera

sudo apt install libcamera-apps

If you’re using a newer raspbian style OS then libcamera has been superseded by rpicam* e.g

rpicam-hello

I installed libcamera-apps but I still can’t get the iPad controller to find the pidog.

It’s very important that you report which OS you are using. Im not an expert, and i only try to help out at the weekends until sunfounder get back in the office, but if you let the forum know which os you are using somebody can help you.

Did rpicam-hello work as I suggested?

I apologize for my ignorance, I never realized that I would have to get this technically involved to build a PiDog. I am using the operating system that the instructions required that I install in the Raspberry Pi 3B + computer. I assume that it is some derivative of Linux.

I ran through the testing of the PiDog and all of the servos appear to be operating correctly and I wanted to be able to control it with the controller app on my iPad. However the app can’t connect to the pidog. I gave the controller the ip address and it wouldn’t connect, then I tried the Scan option with the same result.

The rpcam-hello option did not work, the command could not be found.

Thanks for your patience and help

Is your Pidog connected to a Wi-Fi network?
We recommend setting up a Wi-Fi connection for your Pidog and then trying the APP example again to see if it works properly.

Important reminder:
Your Pidog and your mobile phone must be connected to the same local network in order to establish a normal connection and function correctly.

You are correct, it should not be required to get so technically involved to get pidog working. Unfortunately, in your case, something seems to have gone wrong, either in the hardware build or software installation.

So, we now need to establish what is wrong, which is more involved.

Your initial out of range index error suggests a hardware problem, my best guess is that the camera cable isn’t installed properly, or maybe i2c devices and the main program is simply exiting before it gets to the point to connect your controller. If you post your FULL commands output that will be easier to see what’s going on.

Assuming it is the camera then, If you are using a newer raspbian OS, then rpicam-hello is one method to verify camera operation. Neither rpicam-hello nor libcamera-hello, will fix your problem, they will just give more information as to the source of the problem.

You said that the rpicam-hello command was not found, however the command you showed was incorrectly spelled.

It’s rpicam-hello (with an i)

Not

rpcam–hello

Please run this, or libcamera-hello and post the full output here.

If neither command can be found then we need to know your actual OS, as one of them should definitely be available, under all raspbian builds, so something else is amiss. Run this command and post the full output to establish your OS

cat /etc/os-release

Thanks for reporting that the servos run ok, thats a step in the right direction. I also suggested running the sunfounder basic example programs. Some use i2c, so that would let us check i2c connections too.

Whilst typing this I noticed that sunfounder gave some alternative possible fixes. I’d suggest trying their suggestions first before getting deeper technically involved, which may be unnecessary.

I ran the three commands and the results follow:
pi@raspberrypi:~ $ rpicam-hello
[0:12:09.736699009] [1614] INFO Camera camera_manager.cpp:340 libcamera v0.6.0+rpt20251202
Made X/EGL preview window
ERROR: *** no cameras available ***
pi@raspberrypi:~ $ libcamera-hello
bash: libcamera-hello: command not found
pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME=“Debian GNU/Linux 13 (trixie)”
NAME=“Debian GNU/Linux”
VERSION_ID=“13”
VERSION=“13 (trixie)”
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.3
ID=debian
HOME_URL=“https://www.debian.org/
SUPPORT_URL=“https://www.debian.org/support
BUG_REPORT_URL=“https://bugs.debian.org/
pi@raspberrypi:~ $

I am not the person that had the array overflow. I don’t know how that happened.

Thanks again for your help.

OK so you are on Trixie OS. So, rpicam-hello is the correct debug tool to run. As you can see, it reported that you have no camera available.

ERROR: *** no cameras available ***

libcamera-hello didnt work because its for older OS, we now know that we can ignore that option from now on.

So, either you have a genuinely broken camera, which is possible but rare. Or your camera cable isn’t connected correctly. It could be inserted into the socket 180 degrees rotated at either or both ends, I’ve seen this several times on this forum, or it’s simply not been fully inserted. It’s a tricky little cable to get right!

I dont have a photo of the correct connection but there are several posted by sunfounder on this forum. Just search for them.

Good luck!

As an aside, i got the index error report from here…

Something got bollixed up, this was not my posting. I do not know what went wrong.

Carl

I will reseat the cable according to the instructions on https://www.youtube.com/watch?v=PTo6smSIlDY.

I will let you know the results.

Thanks

Be careful of any dangling wires during disassembly and reassembly, those batteries are live and unforgiving!

Thank you, that will be all that I need, I will unplug the battery.

I noticed that the female connectors have a black side and a white side, also the cable has a male black and white side. Should I have black to black in both instances? Also, the kit included two cables - one white and the other yellow labeled HBV-Raspberry-300FPC- I used the white.

My Pidog is connected to the network and I can access the Raspberry via the network. I am still having problems getting the camera to work on my PiDog V2, please see if you have any ideas. I disassembled the device to reseat the ribbon cable and make sure it is connected properly, see attachment A and B.

Then I tried to enable the camera as instructed by:

https://www.google.com/search?q=sunfounder+raspberry+pidog+v2+install+camera+software&oq=sunfounder+&gs_lcrp=EgZjaHJvbWUqCAgBEEUYJxg7MgYIABBFGDkyCAgBEEUYJxg7MgYIAhBFGDsyBggDEEUYOzIMCAQQABgUGIcCGIAEMgYIBRBFGDwyBggGEEUYPDIGCAcQRRg80gEJMjUzMTFqMGo0qAIAsAIA&sourceid=chrome&ie=UTF-8

When I went to the page specified to enable the camera there was the following menu:

sudo raspi-config

┌─────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐

│ │

│ I1 SSH Enable/disable remote command line access using SSH │

│ I2 RPi Connect Enable/disable Raspberry Pi Connect │

│ I3 VNC Enable/disable graphical remote desktop access │

│ I4 SPI Enable/disable automatic loading of SPI kernel module │

│ I5 I2C Enable/disable automatic loading of I2C kernel module │

│ I6 Serial Port Enable/disable shell messages on the serial connection │

│ I7 1-Wire Enable/disable one-wire interface

There is no reference to Camera or Legacy Camera as specified in the documentation

Next I tried to install the software via the following:

cd ~

git clone https://github.com/sunfounder/pidog.git

cd pidog

sudo python3 install.py

pi@raspberrypi:~ $ ^[[200~cd ~

bash: $‘\E[200~cd’: command not found

pi@raspberrypi:~ $ git clone https://github.com/sunfounder/pidog.git

fatal: destination path ‘pidog’ already exists and is not an empty directory.

pi@raspberrypi:~ $ cd pidog

pi@raspberrypi:~/pidog $ sudo python3 install.py~

python3: can’t open file ‘/home/pi/pidog/install.py~’: [Errno 2] No such file or directory

The line above indicated there was another error

(attachments)


  1. That’s correct, the newer versions of rpi os no longer have camera enable in raspi-config, its fully automatic now. It’s not a required step.
pi@raspberrypi:~ $ ^[[200~cd ~
bash: $‘\E[200~cd’: command not found

Yes, the command you typed contained illegal characters, specifically \E^[[200 this usually happens if you’ve picked up an escape sequence in your paste buffer, in this case its part of the bracketed paste mode. It should be simply cd ~

3. fatal: destination path ‘pidog’ already exists and is not an empty directory

OK, so you’ve already downloaded pidog, and the os is preventing you from overwriting your existing directory. That’s to protect your installation. You would need to remove the existing instalation pidog directory if you need to reinstall.

  1. sudo python3 install.py~ command not found.
    This is also incorrectly typed, there should be no tilde ~ at the end of the command install.py. That’s why the os reported that the file with a tilde suffix does not exist.
  2. From the photos you posted: I cannot see the camera cable connection properly at the rpi end, but it is flipped 180’ at the pidog head end. The blue tag should face away from the lens. You may be able to simply remove, rotate and reinsert it in situ? I don’t know.

  1. The camera cable is also incorrectly routed. It should come out of the rear of pidogs head not under the neck/chest from the front. Your routing could damage the cable when pidog moves its head

Please verify all of above with the sunfounder instructions, they may have made changes since I did my build, which was a v1, so your v2 may be a bit different, i dont know as I don’t have a v2. Just my best guesses