{"id":20164835,"url":"https://github.com/px4/snap_cam","last_synced_at":"2025-04-10T00:51:51.034Z","repository":{"id":147824457,"uuid":"56772743","full_name":"PX4/snap_cam","owner":"PX4","description":"This package provides tools to work with the Snapdragon Flight cameras as well as perform optical flow for use with the PX4 flight stack.","archived":false,"fork":false,"pushed_at":"2018-10-11T11:47:25.000Z","size":177,"stargazers_count":28,"open_issues_count":4,"forks_count":29,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-04-10T00:51:46.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PX4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-21T12:42:20.000Z","updated_at":"2024-12-27T07:14:23.000Z","dependencies_parsed_at":"2023-05-27T15:15:29.794Z","dependency_job_id":null,"html_url":"https://github.com/PX4/snap_cam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2Fsnap_cam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2Fsnap_cam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2Fsnap_cam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2Fsnap_cam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PX4","download_url":"https://codeload.github.com/PX4/snap_cam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137997,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T00:35:51.136Z","updated_at":"2025-04-10T00:51:51.025Z","avatar_url":"https://github.com/PX4.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snapdragon: Camera driver\nThis package provides tools to work with the Snapdragon Flight cameras as well as perform optical flow for use with the PX4 flight stack.\nThe package can be used with ROS by building with catkin or, alternatively, with pure cmake, where only the executables that do not depend on ROS will be built.\n\nThe package is to be compiled on the Snapdragon board. Two variants are provided: Building with ROS, where all features are available, and building with pure CMake, where only ROS-independent applications are compiled (including the optical flow node).\n\n## Setup\nFor the pure CMake install variant, clone the required repositories in a directory, e.g. `~/src`:\n```sh\ncd ~/src\ngit clone https://github.com/PX4/snap_cam.git\n```\n\nInitialize the Mavlink submodule:\n```sh\ncd snap_cam\ngit submodule update --init --recursive\n```\n\nInstall the dependencies\n```sh\nsudo apt-get install libeigen3-dev sip-dev libyaml-cpp-dev libboost-dev cmake\n```\n\nTo install OpenCV, [download](http://px4-tools.s3.amazonaws.com/opencv3_20160222-1_armhf.deb) and push the `.deb` package to the Snapdragon and install it using\n\n```sh\nadb push /path/to/file /home/linaro/ (run on host)\ndpkg -i opencv3_20160222-1_armhf.deb (run on Snapdragon Flight)\n```\nor when using with ROS `ros-indigo-opencv3` can be installed.\n\n\n## Building with pure CMake\n```sh\nmkdir -p build\ncd build\ncmake ..\nmake\n```\n\nRun the optical flow application with (note that you need to be root for this):\n```sh\n./optical_flow [arguments ...]\n```\n\n## Building with ROS\n### Prerequisites\nTo run the ROS nodes on the Snapdragon Flight, ROS indigo (base) has to be installed. Follow [this](http://wiki.ros.org/indigo/Installation/UbuntuARM) link to install it on your Snapdragon Flight. (preferably using the linaro user: `$ su linaro`)\n\nIf you're having permission issues while installing ros try\n```sh\nsudo chown -R linaro:linaro /home/linaro\n```\n\n#### Install the following dependencies:\nROS dependencies\n```sh\nsudo apt-get install ros-indigo-mavlink ros-indigo-orocos-toolchain ros-indigo-angles ros-indigo-tf2 ros-indigo-tf2-ros\n```\n\n#### create a catkin workspace\nNext, create a catkin workspace (e.g. in /home/linaro)\n```sh\nmkdir -p ~/catkin_ws/src\ncd ~/catkin_ws/src\ncatkin_init_workspace\ncd ..\ncatkin_make\n```\n\nThen clone the following three catkin packages and build\n```sh\ncd src\ngit clone https://github.com/ros-perception/vision_opencv\ngit clone https://github.com/ros-perception/image_common\ngit clone https://github.com/PX4/snap_cam.git\ncd ..\ncatkin_make\n```\n\n## Image publisher node\nOnce your catkin workspace is built and sourced you can start the image publisher using\n```sh\nroslaunch snap_cam \u003cCAM\u003e.launch\n```\nwhere `\u003cCAM\u003e` is either `optflow` or `highres` to stream the optical flow or high resolution cameras, respectively.\nYou can set the parameters (camera, resolution and fps) in the launch files (`pathToYourCatkinWs/src/snap_cam/launch/\u003ccam\u003e.launch`)\n\nYou can now subscribe to the images in your own ROS node.\n\n## Camera calibration\nFor optical flow computations, a calibration file needs to be used. This package contains default calibration files for VGA and QVGA resolution. Nevertheless, we recommend calibrating your camera (see below) for better performance.\nFor this you must build this package with catkin as described above and launch the optical flow image publisher:\n```sh\nroslaunch snap_cam optflow.launch\n```\n\nClone and build this package in a catkin workspace on your computer. Add any missing dependencies:\n```sh\nsudo apt-get install python-pyside\n```\nOn your computer launch the calibration app:\n```sh\nexport ROS_MASTER_URI=http://\u003csnapdragon IP\u003e:11311\nroslaunch snap_cam cameraCalibrator.launch\n```\n\nNOTE:\nIf your image topics are empty, make sure to set the environment variable ROS_IP to the respective IP on both devices.\n\n\nSet the appropriate checkerboard parameters in the app.\nStart recording by clicking on the button and record your checkerboard from sufficiently varying angles.\nOnce done, click stop recording.\nThe camera calibration will be written to `pathToYourCatkinWs/src/snap_cam/calib/cameraParameters.yaml`.\nPush this file to your snapdragon.\n```sh\nadb push /pathToYourCatkinWs/src/snap_cam/calib/cameraParameters.yaml pathToSnapCam/calib/cameraParameters.yaml\n```\n\n## Running the optical flow\nCheck the [PX4 user guide](https://docs.px4.io/en/flight_controller/snapdragon_flight_camera.html) for more info.\n### With pure CMake\nRun the following in your build directory:\n```sh\n./optical_flow [arguments ...]\n```\nAll arguments are optional.\n* `-r` specifies the camera resolution. The default is `VGA`. Valid resolutions are `VGA` and `QVGA`.\n* `-f` specifies the camera frame-rate. The default is 30. Valid values are 30, 60, 90.\n* `-n` specifies the number of features with which to compute the optical flow. The default is 10.\n* `-c` specifies the calibration file. The default is `../calib/\u003cresolution\u003e/cameraParameters.yaml`.\n* `-e` specifies the exposure. The default is 100. Valid values are between 0 and 511.\n* `-g` specifies the gain. The default is 50. Valid values are between 0 and 255.\n* `-a` enables auto exposure (with gain control on top if exceeding max exposure).\n\n### With ROS\nAfter sourcing your workspace with `source ~/catkin_ws/devel/setup.bash`, run:\n```sh\nrosrun snap_cam optical_flow [arguments ...]\n```\nThe arguments are the same as for the pure CMake build/=.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpx4%2Fsnap_cam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpx4%2Fsnap_cam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpx4%2Fsnap_cam/lists"}