MonsterAuto.py (Monster View 639) Cannot Open Display

My son and I have our MonsterBorg set up and are trying to calibrate settings.py. We have an HDMI display and a wireless keyboard plugged in to the Monsterborg and are not using SSH or VNC in this instance. When we run
DISPLAY 0: Sudo python ~/monster-self-drive/MonsterAuto.py &

We get setup camera input, setup stream processor threads, 4 processor threads set up , setup control loop, wait and then (Monster View:629) Gtk WARNING **: cannot open Display: 0:

Can you give us some advice please?

piborg's picture

The error is caused because the script is unable to open a window to display the images to. In this case it is likely that the sudo command is causing the problem.

Try running the script without it: python ~/monster-self-drive/MonsterAuto.py &

We ran the suggested command without Sudo as it appears in the comment above and still got:

(Monster view:698) Gtk-warning **: cannot open display.

This followed:
TEST Mode: Skipping board setup
Setup camera input
Setup stream processor threads
Processor thread 1 started with idle time of 0.27s
(Repeated for threads 2,3,4)
Setup control loop
Control loop thread started with idle time of 0,07s
Wait....
Press CTRL-C to quit
(Then the display error that appears above)

We started with the non-GUI version of Raspbian and added all the patches and config changes in the "getting started" guide. We could not get git-hub running on this pi, so we ran it on another pi with the Gui version of the OS and transferred all the files in Monster-self-drive to the Monsterborg with SSH copy. Any more suggestions would be welcomed as this Monsterborg needs to turn into an operational 8th grade project very shortly! Thanks

piborg's picture

I think I understand what is going on now.

With default settings the code tries to open a window to show you what the robot is seeing, but it is failing because it is running without the GUI required to show the window itself. There are three ways around the problem:

  1. Set showImages to False in Settings.py.
    This will stop the code trying to show the images, allowing it to run. The problem with this is you will not be able to see the camera data which will make tuning the colour settings very difficult.
  2. Run the script on a full version of Raspbian from the desktop.
    This will provide the GUI required to display the window and the script will now be able to run.
  3. Use SSH with X11 forwarding to show the window on another Pi or computer.
    This is harder to get going but it means you can see the window from a remote connection. I believe this will still need a full version of Raspbian on the MonsterBorg as it needs the programs used to show the GUI to work.
    Here is a quick guide explaining what you need to do:
    http://raspberry-python.blogspot.co.uk/2012/09/sidekick.html
Subscribe to Comments for "MonsterAuto.py (Monster View 639) Cannot Open Display"