# About jetson reboot, when I use camera function

**URL:** <https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771>\
**Category:** Robotics\
**Created:** [June 15, 2023, 7:51am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771 "2023-06-15T07:51:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 15, 2023, 7:51am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/1 "2023-06-15T07:51:27Z")

</div>

please teach me about ‘[https://github.com/NVIDIA-AI-IOT/jetbot/wiki/examples](https://github.com/NVIDIA-AI-IOT/jetbot/wiki/examples)’

([https://www.sparkfun.com/products/18486#documents-tab](https://www.sparkfun.com/products/18486#documents-tab))

I want to use camera function.

Jetson reboots when camera function is used.

For example, When I try to run the code given below,

jetson restarts…

* * *

directory:Notebooks/collision\_avoidance/data\_collection.ipynb

import traitlets

import ipywidgets.widgets as widgets

from IPython.display import display

from jetbot import Camera, bgr8\_to\_jpeg

camera = Camera.instance(width=224, height=224)

image = widgets.Image(format=‘jpeg’, width=224, height=224) # this width and height doesn’t necessarily have to match the camera

camera\_link = traitlets.dlink((camera, ‘value’), (image, ‘value’), transform=bgr8\_to\_jpeg)

display(image)

* * *

why?

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [June 15, 2023, 9:20pm UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/2 "2023-06-15T21:20:09Z")

</div>

It could be a few things…

Be sure to install the modification files mentioned toward the bottom here [https://learn.sparkfun.com/tutorials/as … rom-nvidia](https://learn.sparkfun.com/tutorials/assembly-guide-for-sparkfun-jetbot-ai-kit-v20/4-software-setup-guide-from-nvidia)

Do the other preceding notebooks (1&2) work?

Can you run the camera at all? Motors?

Also be sure the camera’s connectors/cable are facing the correct way and secure

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 16, 2023, 12:14am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/3 "2023-06-16T00:14:47Z")

</div>

thank you for your reply.

I ran the below command.

ーーーーー

git clone [https://github.com/NVIDIA-AI-IOT/jetbot](https://github.com/NVIDIA-AI-IOT/jetbot)

cd jetbot

sudo python3 setup.py install

sudo apt-get install rsync

rsync jetbot/notebooks ~/Notebooks

sudo nvpmodel -m1

sudo nvpmodel -q

ーーーーーー

the motor can move.(notebook1,Example 1 - Basic Motion)

It is confirmed that the camera also projects in a different way

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 16, 2023, 12:18am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/4 "2023-06-16T00:18:57Z")

</div>

> Be sure to install the modification files mentioned toward the bottom here [https://learn.sparkfun.com/tutorials/as](https://learn.sparkfun.com/tutorials/as) … rom-nvidia

oh…I’m sorry.

I can not confirmed!!I’ll try .

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 16, 2023, 1:11am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/5 "2023-06-16T01:11:11Z")

</div>

> Be sure to install the modification files mentioned toward the bottom here [https://learn.sparkfun.com/tutorials/as](https://learn.sparkfun.com/tutorials/as) … rom-nvidia

I could not do it…

I have two concern…

・About 「Replace the old notebooks with the new notebooks by entering」([https://github.com/NVIDIA-AI-IOT/jetbot … ware-setup](https://github.com/NVIDIA-AI-IOT/jetbot/wiki/software-setup))

jetbot@jetson-4-3:~/jetbot$ rsync jetbot/notebooks ~/Notebooks

rsync: link\_stat “/home/jetbot/jetbot/jetbot/notebooks” failed: No such file or directory (2)

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

・About Basic Motion

［2］robot = Robot()

* * *

OSError Traceback (most recent call last)

in

----\> 1 robot = Robot()

/usr/local/lib/python3.6/dist-packages/jetbot-0.4.0-py3.6.egg/jetbot/robot.py in **init** (self, \*args, \*\*kwargs)

20 def **init** (self, \*args, \*\*kwargs):

21 super(Robot, self). **init** (\*args, \*\*kwargs)

—\> 22 self.motor\_driver = Adafruit\_MotorHAT(i2c\_bus=self.i2c\_bus)

23 self.left\_motor = Motor(self.motor\_driver, channel=self.left\_motor\_channel, alpha=self.left\_motor\_alpha)

24 self.right\_motor = Motor(self.motor\_driver, channel=self.right\_motor\_channel, alpha=self.right\_motor\_alpha)

/usr/local/lib/python3.6/dist-packages/Adafruit\_MotorHAT-1.4.0-py3.6.egg/Adafruit\_MotorHAT/Adafruit\_MotorHAT\_Motors.py in **init** (self, addr, freq, i2c, i2c\_bus)

229 self.motors = [Adafruit\_DCMotor(self, m) for m in range(4)]

230 self.steppers = [Adafruit\_StepperMotor(self, 1), Adafruit\_StepperMotor(self, 2)]

→ 231 self.\_pwm = PWM(addr, debug=False, i2c=i2c, i2c\_bus=i2c\_bus)

232 self.\_pwm.setPWMFreq(self.\_frequency)

233

/usr/local/lib/python3.6/dist-packages/Adafruit\_MotorHAT-1.4.0-py3.6.egg/Adafruit\_MotorHAT/Adafruit\_PWM\_Servo\_Driver.py in **init** (self, address, debug, i2c, i2c\_bus)

57 self.i2c = get\_i2c\_device(address, i2c, i2c\_bus)

58 logger.debug(“Reseting PCA9685 MODE1 (without SLEEP) and MODE2”)

—\> 59 self.setAllPWM(0, 0)

60 self.i2c.write8(self.\_\_MODE2, self.\_\_OUTDRV)

61 self.i2c.write8(self.\_\_MODE1, self.\_\_ALLCALL)

/usr/local/lib/python3.6/dist-packages/Adafruit\_MotorHAT-1.4.0-py3.6.egg/Adafruit\_MotorHAT/Adafruit\_PWM\_Servo\_Driver.py in setAllPWM(self, on, off)

93 def setAllPWM(self, on, off):

94 “Sets a all PWM channels”

—\> 95 self.i2c.write8(self.\_\_ALL\_LED\_ON\_L, on & 0xFF)

96 self.i2c.write8(self.\_\_ALL\_LED\_ON\_H, on \>\> 8)

97 self.i2c.write8(self.\_\_ALL\_LED\_OFF\_L, off & 0xFF)

/usr/local/lib/python3.6/dist-packages/Adafruit\_GPIO-1.0.4-py3.6.egg/Adafruit\_GPIO/I2C.py in write8(self, register, value)

114 “”“Write an 8-bit value to the specified register.”“”

115 value = value & 0xFF

→ 116 self.\_bus.write\_byte\_data(self.\_address, register, value)

117 self.\_logger.debug(“Wrote 0x%02X to register 0x%02X”,

118 value, register)

/usr/local/lib/python3.6/dist-packages/Adafruit\_PureIO-1.0.4-py3.6.egg/Adafruit\_PureIO/smbus.py in write\_byte\_data(self, addr, cmd, val)

266 # Send the data to the device.

267 self.\_select\_device(addr)

→ 268 self.\_device.write(data)

269

270 def write\_word\_data(self, addr, cmd, val):

OSError: [Errno 121] Remote I/O error

★★solution:sudo pip install pyserial

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 16, 2023, 1:24am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/6 "2023-06-16T01:24:22Z")

</div>

About image

It’s OK?

jetbot\_image\_v0p4p0.zip([https://github.com/NVIDIA-AI-IOT/jetbot … ware-setup](https://github.com/NVIDIA-AI-IOT/jetbot/wiki/software-setup))

I use Jetson Nano 4G

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 16, 2023, 12:42pm UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/7 "2023-06-16T12:42:23Z")

</div>

I’m sorry.

I could resolve this problem.

Thank you.

---

<div class="post-metadata">

**Author:** ![santaimpersonator](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/santaimpersonator/32/6108_2.png) [@santaimpersonator](https://community.sparkfun.com/u/santaimpersonator)\
**Post date:** [June 16, 2023, 8:43pm UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/8 "2023-06-16T20:43:52Z")

</div>

For the latest instructions, follow this guide: [https://jetbot.org/master/](https://jetbot.org/master/)

You’ll have to install the [[SparkFun Qwiic Python package](https://github.com/sparkfun/Qwiic_Py#pypi-installation), but the code changes for our hardware should have been [[pulled into the Nvidia’s jetbot repo](https://github.com/NVIDIA-AI-IOT/jetbot/pull/467).

Additionally, I would recommend using [[iPython](https://ipython.readthedocs.io/en/stable/index.html#) to exceute lines individually instead of the enitre cell of the Jupyter notebook. Jupyter notebook doesn’t always show all the error messages and executing each line individually will help you isolate where the error is occuring (i.e. which instruction is cauing it).]([IPython Documentation — IPython 8.26.0 documentation](https://ipython.readthedocs.io/en/stable/index.html#))]([Add SparkFun hardware support by santaimpersonator · Pull Request #467 · NVIDIA-AI-IOT/jetbot · GitHub](https://github.com/NVIDIA-AI-IOT/jetbot/pull/467))]([GitHub - sparkfun/Qwiic\_Py: Python package for the qwiic system.](https://github.com/sparkfun/Qwiic_Py#pypi-installation))

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 20, 2023, 6:17am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/9 "2023-06-20T06:17:50Z")

</div>

I appreciate your kind and information.

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 21, 2023, 4:31am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/10 "2023-06-21T04:31:13Z")

</div>

I want to execute train\_model.ipynb.

But I got an error as below.

Why?num\_samples=0?

‘dateset.zip’ has been obtained by ‘data\_collection.ipynb’

* * *

train\_loader = torch.utils.data.DataLoader(

train\_dataset,

batch\_size=16,

shuffle=True,

num\_workers=4

)

test\_loader = torch.utils.data.DataLoader(

test\_dataset,

batch\_size=16,

shuffle=True,

num\_workers=4

)

* * *

* * *

ValueError Traceback (most recent call last)

in

3 batch\_size=16,

4 shuffle=True,

----\> 5 num\_workers=4

6 )

7

/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in **init** (self, dataset, batch\_size, shuffle, sampler, batch\_sampler, num\_workers, collate\_fn, pin\_memory, drop\_last, timeout, worker\_init\_fn, multiprocessing\_context)

211 else: # map-style

212 if shuffle:

→ 213 sampler = RandomSampler(dataset)

214 else:

215 sampler = SequentialSampler(dataset)

/usr/local/lib/python3.6/dist-packages/torch/utils/data/sampler.py in **init** (self, data\_source, replacement, num\_samples)

92 if not isinstance(self.num\_samples, int) or self.num\_samples \<= 0:

93 raise ValueError("num\_samples should be a positive integer "

—\> 94 “value, but got num\_samples={}”.format(self.num\_samples))

95

96 @property

ValueError: num\_samples should be a positive integer value, but got num\_samples=0

* * *

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 22, 2023, 5:41am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/11 "2023-06-22T05:41:48Z")

</div>

Sorry, It’s resolved.

---

<div class="post-metadata">

**Author:** ![santaimpersonator](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/santaimpersonator/32/6108_2.png) [@santaimpersonator](https://community.sparkfun.com/u/santaimpersonator)\
**Post date:** [June 22, 2023, 2:48pm UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/12 "2023-06-22T14:48:05Z")

</div>

Oh, cool. Glad you were able to figure it out on your own!

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 23, 2023, 1:16am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/13 "2023-06-23T01:16:27Z")

</div>

Thank you🙇‍♂️

Is it possible to implement collision avoidance and automatic driving on a container? I am investigating this,

I was able to confirm by referring to the manual that collision avoidance and automatic driving are possible on the host OS.

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 23, 2023, 2:33am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/14 "2023-06-23T02:33:43Z")

</div>

[https://github.com/NVIDIA-AI-IOT/jetbot … ware-setup](https://github.com/NVIDIA-AI-IOT/jetbot/wiki/software-setup)

Is this link implemented in docker?

It is a recognition implemented in the host OS.

jetbot@jetson-4-3:~$ sudo docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

jetbot@jetson-4-3:~$

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 23, 2023, 2:35am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/15 "2023-06-23T02:35:26Z")

</div>

sorry for my lack of knowledge🙇‍♂️

---

<div class="post-metadata">

**Author:** ![santaimpersonator](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/santaimpersonator/32/6108_2.png) [@santaimpersonator](https://community.sparkfun.com/u/santaimpersonator)\
**Post date:** [June 25, 2023, 12:49am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/16 "2023-06-25T00:49:47Z")

</div>

Again, I wouldn’t follow the instructions from the GitHub wiki. They are older instructions for an older version of the software.

I would focus on the information from the **[jetbot.org](http://jetbot.org)** website. They have some information here regarding that question: [https://jetbot.org/master/examples/comm … mples.html](https://jetbot.org/master/examples/community_examples.html)

Also the information there, indicates that the “jetbot” software is already running in a docker container: [https://jetbot.org/master/software\_setup/docker.html](https://jetbot.org/master/software_setup/docker.html)

Also, most of our expertise will be limited to assemblying our kit and getting started with their examples. I would recommend the [[Nvidia forum](https://forums.developer.nvidia.com/c/agx-autonomous-machines/jetson-embedded-systems/jetson-nano/76) for more technical questions.]([Jetson Nano - NVIDIA Developer Forums](https://forums.developer.nvidia.com/c/agx-autonomous-machines/jetson-embedded-systems/jetson-nano/76))

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 27, 2023, 5:19am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/17 "2023-06-27T05:19:21Z")

</div>

.

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 27, 2023, 5:20am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/18 "2023-06-27T05:20:39Z")

</div>

No jetbot on container,

jetbot@jetson-4-3:~$ sudo docker run -it --rm -v $HOME:$HOME -v /usr/local/lib/python3.6/dist-packages:/usr/local/lib/python3.6/dist-packages --device /dev/i2c-1 --privileged --entrypoint /bin/bash python:3

root@9eae61bc7e45:/# python3 a.py

Traceback (most recent call last):

File “[//a.py](https://a.py)”, line 2, in

from jetbot import Robot

ModuleNotFoundError: No module named ‘jetbot’

root@9eae61bc7e45:/#

jetbot@jetson-4-3:~$ more a.py

import time

from jetbot import Robot

robot = Robot()

robot.forward(0.3)

time.sleep(3)

robot.stop()

---

<div class="post-metadata">

**Author:** ![aok](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@aok](https://community.sparkfun.com/u/aok)\
**Post date:** [June 27, 2023, 5:26am UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/19 "2023-06-27T05:26:16Z")

</div>

> Again, I wouldn’t follow the instructions from the GitHub wiki. They are older instructions for an older version of the software.

> I would focus on the information from the [jetbot.org](http://jetbot.org) website. They have some information here regarding that question: [https://jetbot.org/master/examples/comm](https://jetbot.org/master/examples/comm) … mples.html

> Also the information there, indicates that the “jetbot” software is already running in a docker container: [https://jetbot.org/master/software\_setup/docker.html](https://jetbot.org/master/software_setup/docker.html)

> Also, most of our expertise will be limited to assemblying our kit and getting started with their examples. I would recommend the Nvidia forum for more technical questions.

sorry, I just realized now.

---

<div class="post-metadata">

**Author:** ![SaladinTheWise](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@SaladinTheWise](https://community.sparkfun.com/u/SaladinTheWise)\
**Post date:** [October 27, 2023, 2:52pm UTC](https://community.sparkfun.com/t/about-jetson-reboot-when-i-use-camera-function/45771/20 "2023-10-27T14:52:59Z")

</div>

> aok:  
> I’m sorry.
> 
> I could resolve this problem.
> 
> Thank you.

Hi,

Could you pls tell how you solved this?

Thanks in advance
