quickstart.rst 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. :github_url: https://github.com/gopro/OpenGoPro/tree/main/demos/python/sdk_wireless_camera_control
  2. ================
  3. QuickStart Guide
  4. ================
  5. .. warning:: This section assumes you have successfully :ref:`installed<Installation>` the package.
  6. Open GoPro installs with several demos to demonstrate BLE and Wi-Fi. The source code for these examples
  7. can be found on `Github <https://github.com/gopro/OpenGoPro/tree/main/demos/python/sdk_wireless_camera_control/open_gopro/demos>`_
  8. or locally in `$INSTALL/open_gopro/demos` where $INSTALL can be found with:
  9. .. code-block:: console
  10. $ pip show open-gopro
  11. Note that the GUI demos will only be available if OpenGoPro was installed with the additional GUI option.
  12. See the :ref:`installation<Installation>` steps for more informatoin.
  13. Command Line Interface (CLI) Demos
  14. ==================================
  15. All of the CLI demos have command-line help via the `--help` parameter. All demos will log to the console as well
  16. as write a more detailed log to a file (this file can be set with the `--log` parameter). The detailed log
  17. is very helpful for diagnosing BLE / WiFi inconsistencies.
  18. Photo Demo
  19. ----------
  20. The `photo` demo will discover a GoPro camera, connect to it, take a photo, and then download the
  21. photo to your local machine. It defaults to connecting to a wireless camera but can connect to a wired camera
  22. by setting the `wired` option. To run, do:
  23. .. code-block:: console
  24. $ gopro-photo
  25. For more information, do:
  26. .. code-block:: console
  27. $ gopro-photo --help
  28. usage: gopro-photo [-h] [--output OUTPUT] [--wired] [--log LOG] [--identifier IDENTIFIER] [--wifi_interface WIFI_INTERFACE] [--password]
  29. Connect to a GoPro camera, take a photo, then download it.
  30. options:
  31. -h, --help show this help message and exit
  32. --output OUTPUT Where to write the photo to. If not set, write to 'photo.jpg'
  33. --wired Set to use wired (USB) instead of wireless (BLE / WIFI) interface
  34. --log LOG Location to store detailed log
  35. --identifier IDENTIFIER
  36. Last 4 digits of GoPro serial number, which is the last 4 digits of the default camera SSID. If not used, first
  37. discovered GoPro will be connected to
  38. --wifi_interface WIFI_INTERFACE
  39. System Wifi Interface. If not set, first discovered interface will be used.
  40. --password Set to read sudo password from stdin. If not set, you will be prompted for password if needed
  41. Video Demo
  42. ----------
  43. The video demo will discover a GoPro camera, connect to it, take a video for a given amount of time, and then
  44. download the photo to your local machine. It defaults to connecting to a wireless camera but can connect to a
  45. wired camera by setting the `wired` option.To run and capture a 2 second video, do:
  46. .. code-block:: console
  47. $ gopro-video 2
  48. For more information, do:
  49. .. code-block:: console
  50. $ gopro-video --help
  51. usage: gopro-video [-h] [-o OUTPUT] [--wired] [--log LOG] [--identifier IDENTIFIER] [--wifi_interface WIFI_INTERFACE] [--password]
  52. record_time
  53. Connect to a GoPro camera, take a video, then download it.
  54. positional arguments:
  55. record_time How long to record for
  56. options:
  57. -h, --help show this help message and exit
  58. -o OUTPUT, --output OUTPUT
  59. Where to write the video to. If not set, write to 'video.mp4'
  60. --wired Set to use wired (USB) instead of wireless (BLE / WIFI) interface
  61. --log LOG Location to store detailed log
  62. --identifier IDENTIFIER
  63. Last 4 digits of GoPro serial number, which is the last 4 digits of the default camera SSID. If not used, first
  64. discovered GoPro will be connected to
  65. --wifi_interface WIFI_INTERFACE
  66. System Wifi Interface. If not set, first discovered interface will be used.
  67. --password Set to read sudo password from stdin. If not set, you will be prompted for password if needed
  68. WiFi Demo
  69. -----------
  70. The `wifi` demo will discover a GoPro camera, connect to it, enable the camera'a WiFi AP, and then connect
  71. to it via WiFi. This is useful if you want to send HTTP commands to it from some external source such as curl.
  72. Note that this demo will run, thus maintaining the WiFi connection, until exited by pressing enter.
  73. .. code-block:: console
  74. $ gopro-wifi
  75. For more information, do:
  76. .. code-block:: console
  77. $ gopro-wif --help
  78. usage: gopro-wifi [-h] [-l LOG] [-i IDENTIFIER] [-w WIFI_INTERFACE] [-p]
  79. Connect to a GoPro camera's Wifi Access Point.
  80. optional arguments:
  81. -h, --help show this help message and exit
  82. -l LOG, --log LOG Location to store detailed log
  83. -i IDENTIFIER, --identifier IDENTIFIER
  84. Last 4 digits of GoPro serial number, which is the last 4 digits of the
  85. default camera SSID. If not used, first discovered GoPro will be
  86. connected to
  87. -w WIFI_INTERFACE, --wifi_interface WIFI_INTERFACE
  88. System Wifi Interface. If not set, first discovered interface will be
  89. used.
  90. -p, --password Set to read sudo password from stdin. If not set, you will be prompted
  91. for password if needed
  92. Battery Demo
  93. ------------
  94. This demo will continuously read the battery level (either via polling or registering fro notifications as
  95. configured per the command line argument) and write
  96. the results to a .csv file. To run, do:
  97. .. code-block:: console
  98. $ gopro-log-battery
  99. For more information, do:
  100. .. code-block:: console
  101. $ gopro-log-battery --help
  102. usage: gopro-log-battery [-h] [-p POLL] [-l LOG] [-i IDENTIFIER]
  103. Connect to the GoPro via BLE only and continuously read the battery (either by polling or
  104. notifications).
  105. optional arguments:
  106. -h, --help show this help message and exit
  107. -p POLL, --poll POLL Set to poll the battery at a given interval. If not set, battery level
  108. will be notified instead. Defaults to notifications.
  109. -l LOG, --log LOG Location to store detailed log
  110. -i IDENTIFIER, --identifier IDENTIFIER
  111. Last 4 digits of GoPro serial number, which is the last 4 digits of the
  112. default camera SSID. If not used, first discovered GoPro will be
  113. connected to
  114. Graphical User Interface (GUI) Demos
  115. ====================================
  116. Wired Webcam Demo
  117. -----------------
  118. The `webcam` demo will configure a GoPro (identified via serial number) as a webcam, start the webcam, and use
  119. `OpenCV <https://pypi.org/project/opencv-python/>`_ to start a viewer to display the stream.
  120. .. code-block:: console
  121. $ gopro-webcam
  122. For more information, do:
  123. .. code-block:: console
  124. $ gopro-webcam --help
  125. usage: gopro-webcam [-h] [-i IDENTIFIER] [-l LOG]
  126. Setup and view a GoPro webcam.
  127. options:
  128. -h, --help show this help message and exit
  129. -i IDENTIFIER, --identifier IDENTIFIER
  130. Last 3 digits of GoPro serial number, which is the last 3 digits of the default camera SSID. If not specified, first
  131. GoPro discovered via mDNS will be used
  132. -l LOG, --log LOG Location to store detailed log
  133. Livestream Demo
  134. ---------------
  135. The `livestream` demo will connect via BLE to the camera, connect the camera to a Wifi AP, configure / start
  136. livestream, then use `OpenCV <https://pypi.org/project/opencv-python/>`_ to start a viewer to display the stream.
  137. .. code-block:: console
  138. $ gopro-webcam
  139. For more information, do:
  140. .. code-block:: console
  141. $ gopro-livestream --help
  142. usage: gopro-livestream [-h] [--min_bit MIN_BIT] [--max_bit MAX_BIT] [--start_bit START_BIT] [--resolution {4,7,12}] [--fov {0,4,3}]
  143. [--log LOG] [--identifier IDENTIFIER]
  144. ssid password url
  145. Connect to the GoPro via BLE only, configure then start a Livestream, then display it with CV2.
  146. positional arguments:
  147. ssid WiFi SSID to connect to.
  148. password Password of WiFi SSID.
  149. url RTMP server URL to stream to.
  150. options:
  151. -h, --help show this help message and exit
  152. --min_bit MIN_BIT Minimum bitrate.
  153. --max_bit MAX_BIT Maximum bitrate.
  154. --start_bit START_BIT
  155. Starting bitrate.
  156. --resolution {4,7,12}
  157. Resolution.
  158. --fov {0,4,3} Field of View.
  159. --log LOG Location to store detailed log
  160. --identifier IDENTIFIER
  161. Last 4 digits of GoPro serial number, which is the last 4 digits of the default camera SSID. If not used, first
  162. discovered GoPro will be connected to