Jetbot Examples

Hi I have purchased the following product https://www.sparkfun.com/products/16417
and am trying to go through the sample programmes.
I am also new to the subject and don’t have much previous knowledge.

The following problem occurs. I am at the collision avoidance example. I had no problem running the programme at first. The robot only had problems recognising obstacles at the beginning. The internet connection was then lost. And when I run the program for the second time, nothing worked. I didn’t change the code, just reconnected and run it.
Then it worked again after several attempts ( restarted Jetbot and JupiterLab kernel again). But then I got the same error messages again and it doesn’t work any more. The programmes I ran before don’t work anymore either. There are problems creating a class instance of the class Camera.


RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetbot-0.4.0-py3.6.egg/jetbot/camera.py in init(self, *args, **kwargs)
29 if not re:
—> 30 raise RuntimeError(‘Could not read image from camera.’)
31

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)
in
4 from jetbot import Camera, bgr8_to_jpeg
5
----> 6 camera = Camera.instance(width=224, height=224)
7
8 image = widgets.Image(format=‘jpeg’, width=224, height=224) # this width and height doesn’t necessarily have to match the camera

/usr/local/lib/python3.6/dist-packages/traitlets/config/configurable.py in instance(cls, *args, **kwargs)
508 # Create and save the instance
509 if cls._instance is None:
–> 510 inst = cls(*args, **kwargs)
511 # Now make sure that the instance will also be returned by
512 # parent classes’ _instance attribute.

/usr/local/lib/python3.6/dist-packages/jetbot-0.4.0-py3.6.egg/jetbot/camera.py in init(self, *args, **kwargs)
35 self.stop()
36 raise RuntimeError(
—> 37 ‘Could not initialize camera. Please see error trace.’)
38
39 atexit.register(self.stop)

RuntimeError: Could not initialize camera. Please see error trace.


Sometimes the JupyterLab kernel also hangs up:

Why can I sometimes execute the programme code and sometimes not? I have not changed anything in the programme code and the camera is connected correctly.

I do not use this model but similar one.

I would recommend

  • close other Jupyter notebook tabs if you do not run it together
  • kernel shutdown before you close the tab
  • run “sudo systemctl restart nvargus-daemon”, when camera does not start

Good luck