# ros-feynman-camera **Repository Path**: cnrobot_cluster/ros-feynman-camera ## Basic Information - **Project Name**: ros-feynman-camera - **Description**: ros example code of feynman camera - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: newprotocol - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2024-05-20 - **Last Updated**: 2024-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # feynman_camera A ROS driver for Nextvpu 3D cameras. ## Install This package supports ROS and tested in Melodic(ubuntu 18.04 lts). 1. Install [ROS](http://wiki.ros.org/ROS/Installation). 2. Install dependences ```sh sudo apt install libusb-1.0-0-dev ros-$ROS_DISTRO-rgbd-launch ros-$ROS_DISTRO-libuvc ros-$ROS_DISTRO-libuvc-camera ros-$ROS_DISTRO-libuvc-ros ``` 3. Create a [ROS Workspace](http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment)(if you don't have one) ```sh mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make source devel/setup.bash ``` or ```sh mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make install source install/setup.bash ``` 4. Pull the repository into your ROS workspace clone the repository if you don't have one(only for newprotocol branch): ```sh cd ~/catkin_ws/src git clone --recurse-submodules https://gitee.com/nextvpu/ros-feynman-camera -b newprotocol cd ~/catkin_ws/src/ros-feynman-camera git submodule update --init --recursive ``` or update the repository if you have one(only for newprotocol branch): ```sh cd ~/catkin_ws/src/ros-feynman-camera git pull git submodule update --init --recursive ``` 5. cp feynman udev rule ```sh roscd feynman_camera sudo cp nextvpu-usb.rules /etc/udev/rules.d ``` 6. Go to catkin workspace and compile feynman_camera ```sh cd ~/catkin_ws catkin_make --pkg feynman_camera ``` or install: ```sh cd ~/catkin_ws catkin_make install --pkg feynman_camera ``` or clean: ```sh cd ~/catkin_ws catkin_make clean --pkg feynman_camera ``` ## Run feynman_camera If you didn't add `source $YOUR_WORKSPACE/devel/setup.bash` to your `.bashrc`, remember to source it when open a new terminal :) or If you didn't add `source $YOUR_WORKSPACE/install/setup.bash` to your `.bashrc`, remember to source it when open a new terminal :) ### Examples #### Set correct device_id of camera edit launch/feynman.launch and change the device_id to proper value. #### Use feynman `roslaunch feynman_camera feynman.launch` ## Important Topics (* means device_id of camera) * `/feynman_camera/*/depth/image_raw`:depth raw data,sensor_msgs::Image(16bit integer) * `/feynman_camera/*/leftir/image_rect`:depth left data(rectified),sensor_msgs::Image(rgb888) * `/feynman_camera/*/rightir/image_rect`:depth right data(rectified),sensor_msgs::Image(rgb888) * `/feynman_camera/*/temperature`:cpu and projector temperature,feynman_camera::temp_info(2 float point) * `/feynman_camera/*/depth/dotcloud`:dot cloud data,sensor_msgs::PointCloud2 * `/feynman_camera/*/rgb/image_rect_color`:rgb sensor data,sensor_msgs::Image(rgb888) * `/feynman_camera/*/leftir/image_color`:left sensor raw data(not rectified),sensor_msgs::Image(rgb888) * `/feynman_camera/*/rightir/image_color`:right sensor raw data(not rectified),sensor_msgs::Image(rgb888) * `/feynman_camera/*/leftir/image_rect_color`:rectify left sensor data,sensor_msgs::Image(rgb888) * `/feynman_camera/*/rightir/image_rect_color`:rectify right sensor data,sensor_msgs::Image(rgb888) * `/feynman_camera/*/leftir/camera_info`:camerainfo of left ir camera * `/feynman_camera/*/rightir/camera_info`:camerainfo of right ir camera * `/feynman_camera/*/rgb/camera_info`:camerainfo of rgb camera * `/feynman_camera/*/cnn_info`:cnn bbox info,feynman_camera::cnn_info ## Useful Services This package provides multiple [ros services](http://wiki.ros.org/Services) for users to get useful information and set up devices. To know more about using these services, please check [this tutorial](http://wiki.ros.org/rosservice).(* means device_id of camera) * `/feynman_camera/*/cameraparam`:return cameraparam * `/feynman_camera/*/streammode`:set stream mode mode 0:sensor raw+rgb mode 1:sensor raw or sensor rectify mode 2:depth mode 2:depth+cnn * `/feynman_camera/*/depthmode`:set depth mode of denoise/fusion/zoom/stitch * `/feynman_camera/*/exposure`:set exposure data: {isauto: 0, leftexposureus: 0, rightexposureus: 0, leftgain: 0, rightgain: 0} isauto=0:manual exposure isauto =1:auto exposure when isauto is equal to 0,you can set left and right sensor's exposure time in microseconds and set gain * `/feynman_camera/*/setprojector`:set projector on(1) or off(0) * `/feynman_camera/*/switchrectify`:switch sensor data of rectify('rectify') or not('vi') ### Change Resolution 1.run rqt_reconfigure ``` rosrun rqt_reconfigure rqt_reconfigure ``` 2.change resolution in rqt_reconfigure dialog support resolution:1280x800,1280x720,640x480,640x400,320x200 after modify resolution in the dialog,press enter key ### Examples After launching an feynman camera, you can get camera param by the following command(* means device_id of camera) 1. get camera param ```sh rosservice call /feynman_camera/*/cameraparam ``` 2. change stream mode ```sh rosservice call /feynman_camera/*/streammode 0 #set stream mode to output sensor raw data rosservice call /feynman_camera/*/streammode 1 #set stream mode to output sensor raw or rectify data rosservice call /feynman_camera/*/streammode 2 #set stream mode to output depth data rosservice call /feynman_camera/*/streammode 3 #set stream mode to output depth and cnn data ``` The usage of other services, is same as above examples. ### params in launch file 1. device_id:camera device id 2. resolution:resolution of rgb and ir and depth,one of:"1280x800","1280x720","640x480","640x400","320x200" 3. fps:fps of rgb and ir and depth origin fps,one of:15,30 4. fpsratio:ratio of fps,result fps is fps/fpsratio,for example:fps=15,fpsratio=2,result fps:15/2=7.5 5. pubrgb: when set true,program will enable camera to transfer rgb data and publish to ros 6. pubir: when set true,program will enable camera to transfer ir data and publish to ros 6. pubdotcloud: when set true,program will compute dotcloud from depth data and publish to ros 7. pubdepth: when set true,program will enable camera to transfer depth data and publish to ros 8. savedata: when set true,program will start save data thread,then you can call the service to save depth data to png file 9. pubdepthalign:when set true,program will compute depth align to rgb and publish to ros 10. confidence:when set true,program will set camera to apply confidence algorithm to depth data 11. lightfilter:when set true,program will apply light removal algorithm to depth data to filter light area in depth data 12. pubpseudo:when set true,program will compute pseudo image from depth data and publish to ros 13. pubimu:when set true,program will set camera to transfer imu data and publish to ros 14. clip_distance: when set positive value of m,program will clip dot cloud data,only dotcloud's distance less than the clip_distance will be left 15. edgefilter:when set true,program will set camera to apply edge filter algorithm to depth or rgb or ir data to cut edge area,the width will be set in xxedgeoffset params 16. iredgeoffset:when edgefilter is true and this value is positive,iredgeoffset pixels width will be cut in ir image data 17. rgbedgeoffset:when edgefilter is true,this value is positive,rgbedgeoffset pixels width will be cut in rgb image data 18. depthedgeoffset:when edgefilter is true,this value is positive,depthedgeoffset pixels width will be cut in depth image data ## License Copyright 2019 NextVPU Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *Other names and brands may be claimed as the property of others*