You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. # Working with Sensors
  2. ## Realsense Cameras
  3. Use the `pyrealsense2` library to interact with the two Intel Realsense depth cameras on Stretch 3. The library can configure camera parameters, collect imagery, calculate point clouds, and much more. Start by creating a "pipeline", which is an interface for streaming data from the camera.
  4. ```python
  5. import pyrealsense2 as rs
  6. cam = rs.pipeline()
  7. cam.start()
  8. cam.stop()
  9. ```
  10. `start()` returns a "profile", which returns information about the Realsense camera.
  11. ```
  12. profile = cam.start()
  13. print(profile.get_device().get_info()) # "D435if"
  14. ```
  15. ### Configuration
  16. We pass a "config" to `start()` to choose which camera we want to stream from, what resolution the imagery should be, what frames per second the data should arrive at, and more.
  17. ```
  18. config = rs.config()
  19. config.enable_device(d405_info['serial_number'])
  20. width, height, fps = 640, 480, 15
  21. config.enable_stream(rs.stream.depth, width, height, rs.format.z16, fps)
  22. config.enable_stream(rs.stream.color, width, height, rs.format.bgr8, fps)
  23. profile = cam.start(config)
  24. ```
  25. ### Frames
  26. ### API and Docs
  27. https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python#python-wrapper
  28. https://intelrealsense.github.io/librealsense/python_docs/_generated/pyrealsense2.html