# Realsense RuntimeError: No device connected

**URL:** <https://forum.hello-robot.com/t/realsense-runtimeerror-no-device-connected/383>\
**Category:** Ask\
**Created:** [March 2, 2022, 6:55pm UTC](https://forum.hello-robot.com/t/realsense-runtimeerror-no-device-connected/383 "2022-03-02T18:55:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zackory](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/zackory/32/114_2.png) [@Zackory](https://forum.hello-robot.com/u/Zackory)\
**Post date:** [March 2, 2022, 6:55pm UTC](https://forum.hello-robot.com/t/realsense-runtimeerror-no-device-connected/383/1 "2022-03-02T18:55:12Z")

</div>

Hello,

We are running into this issue where if we run `stretch_realsense_visualizer.py` twice, it will work successfully on the first attempt, but the file throws an error on all successive attempts. The only method the students in my course have found to overcome this is to restart the robot after every use of the RealSense camera. The error is below:

```bash
hello-robot@stretch-re1:~$ stretch_realsense_visualizer.py 
For use with S T R E T C H (TM) RESEARCH EDITION from Hello Robot Inc.

Traceback (most recent call last):
  File "/home/hello-robot/.local/bin/stretch_realsense_visualizer.py", line 132, in <module>
    pipeline.start(config)
RuntimeError: No device connected

```

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [March 3, 2022, 9:43pm UTC](https://forum.hello-robot.com/t/realsense-runtimeerror-no-device-connected/383/2 "2022-03-03T21:43:37Z")

</div>

Hi @Zackory, this is definitely abnormal behavior from the Realsense camera. The likely reason the camera becomes inaccessible after running once is that it does not shutdown correctly, instead remaining in a busy state and causing startup issues on subsequent runs. Power cycling the robot remains the best way to hard reset the camera, but many Realsense users have also found success with adding software reset procedures[1](https://github.com/IntelRealSense/librealsense/issues/10139) [2](https://github.com/IntelRealSense/librealsense/issues/8393) to the camera’s initialization.

We’ve heard similar issues with using the camera from ROS, so we’re [experimenting](https://github.com/hello-robot/stretch_ros/tree/feature/separated_launch_files_melodic) with adding a reset to our ROS Realsense launch files. The `stretch_realsense_visualizer.py` script hasn’t included a reset yet, but it seems like including one would help in this case. Here’s a [branch](https://github.com/hello-robot/stretch_body/tree/bugfix/realsense_reset) that includes a software reset of the camera in the visualizer tool. Please let me know if helps resolve this issue. If it does not, we can go one step further by issuing a [USB hub reset](https://wiki.ubuntuusers.de/usbreset/) in the script.

In order to test this branch, you can use the following commands:

```nohighlight
$ cd ~/repos
$ git clone https://github.com/hello-robot/stretch_body.git
$ cd stretch_body
$ git pull
$ git checkout bugfix/realsense_reset
$ cd tools/bin/
$ python stretch_realsense_visualizer.py

```

Please let me know if you need any help.
