Doesn't connect to docker

I have made the following steps:

  • Working in Ubuntu 20 with Chrome.
  • Got the last docker image: sudo docker pull jderobot/robotics-academy

First try:

  • Run docker: sudo docker run -it -p 8080:8080 -p 7681:7681 -p 2303:2303 -p 1905:1905 -p 8765:8765 jderobot/robotics-academy python3.8 manager.py
  • Show Follow Line exercise at Unibotics.
  • Connect
  • Got this errors at terminal with docker:

The VNC desktop is: 17a413f5818e:0


Have you tried the x11vnc ‘-ncache’ VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster*
retrieval. It should work with any VNC viewer. Try it by running:

  • x11vnc -ncache 10 …*

One can also add -ncache_cr for smooth ‘copyrect’ window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

PORT=5900

[Wrn] [GuiIface.cc:120] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/f1/imgs”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/f1/launch”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/f1/worlds”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/roomba_robot/imgs”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/3d_reconstruction/launch”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/3d_reconstruction/words”
[Err] [InsertModelWidget.cc:426] Missing model.config for model “/opt/jderobot/CustomRobots/Taxi_navigator/Imgs”


When trying to show Gazebo or console, a “Failed to connect to server” and “NoVNC” messages are shown.

Second try:

  • run docker: docker run --rm -it -p 8080:8080 -p 7681:7681 -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 5900:5900 -d jderobot/robotics-academy python3.8 manager.py
  • Connect. Seems everything is OK, Gazebo and console works.
  • Play the following code:
    from GUI import GUI
    from HAL import HAL
    import cv2 as cv

# Enter sequential code!
HAL.motors.sendW(0.5)

while True:

  • Enter iterative code!*

  • img=HAL.getImage()*
  • (b, g, r) = cv.split(img)*
  • ret, thresh = cv.threshold(r, 200, 255, cv.THRESH_BINARY)*
  • GUI.showImage(r)*
  • console.print(‘Hola’)*

Console message:
Exception in thread Thread-15:
Traceback (most recent call last):

  • File “/usr/lib/python2.7/threading.py”, line 801, in __bootstrap_inner*
  • self.run()*
  • File “/usr/lib/python2.7/threading.py”, line 754, in run*
  • self.__target(*self.__args, *self.__kwargs)
  • File “/RoboticsAcademy/exercises/follow_line/web-template/brain.py”, line 87, in process_code*
  • exec(iterative_code, reference_environment)*
  • File “”, line 7*
  • console.print(‘Hola’)*

Remove the console.print(‘Hola’) and play again:
Exception in thread Thread-15:
Traceback (most recent call last):

  • File “/usr/lib/python2.7/threading.py”, line 801, in __bootstrap_inner*
  • self.run()*
  • File “/usr/lib/python2.7/threading.py”, line 754, in run*
  • self.__target(*self.__args, *self.__kwargs)
  • File “/RoboticsAcademy/exercises/follow_line/web-template/brain.py”, line 87, in process_code*
  • exec(iterative_code, reference_environment)*
  • File “”, line 6, in *
  • File “/RoboticsAcademy/exercises/follow_line/web-template/user_functions.py”, line 33, in showImage*
  • self.shared_image.add(image)*
  • File “/RoboticsAcademy/exercises/follow_line/web-template/shared/image.py”, line 85, in add*
  • metadata = MD(image.shape[0], image.shape[1], image.shape[2], byte_size)*
    IndexError: tuple index out of range

Hi miguel, thanks for reporting these errors.

Regarding the first error, the correct docker image launch instruction is the second one you used:

docker run --rm -it -p 8080:8080 -p 7681:7681 -p 2303:2303 -p
1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 5900:5900 -d
jderobot/robotics-academy python3.8 manager.py

About the second error, we are working on it. Images with less than 3 channels cannot be diplayed with GUI.showImage() right now. While we update the docker image you can visualize the filtered image using this code that sets the other channels value to 0 instead of removing them:

img = HAL.getImage()
redChannel = img
redChannel[:,:,1] = 0
redChannel[:,:,0] = 0
ret, thresh = cv.threshold(redChannel, 200, 255, cv.THRESH_BINARY)
GUI.showImage(thresh)

Also, the correct function to print console messages is

print(‘Text to print’)