Installing additional libraries
#OpenGL and linear algebra library: sudo apt-get install freeglut3-dev libatlas-base-dev
Install ETHZASL_PTAM
# create and enter stack directory: mkdir ~/ros cd ~/ros # Fetch ethzasl_ptam stack git clone git://github.com/ethz-asl/ethzasl_ptam.git ethzasl_ptam # Update ROS_PACKAGE_PATH for this session export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros/ethzasl_ptam # Update ROS_PACKAGE_PATH for every session echo -e '\n\n#ethzasl_ptam ROS path:\nexport ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros/ethzasl_ptam' >> ~/.bashrc # Install system dependencies (in case some still is missing) rosdep install ptam # build rosmake ethzasl_ptam
Using ETHZASL_PTAM with ARDrone2
Modify the image details in cameracalibrator.launch as such:
... <remap from="image" to="/ardrone/front/image_raw" /> ...
Edit command:
For ptam.launch:
Next, start ptam and on the same machine or a different one that has the correct ROS_MASTER_URI, run:
nano ~/ros/ethzasl_ptam/ptam/launch/cameracalibrator.launch
For ptam.launch:
... <remap from="image" to="$(optenv IMAGE /ardrone/front/image_mono)" /> ...Edit command:
nano ~/ros/ethzasl_ptam/ptam/launch/ptam.launch
Calibrating the ARDrone2 camera
Print ~/ros/ethzasl_ptam/ptam/calib_pattern.pdf. It is a chessboard used to estimate the focal length of the camera.
Now start ROS and launch the calibrator:
#In one console start ROS: roscore #in another console roslaunch ptam cameracalibrator.launch
Now "grab" around 10 frames, then press "optimize" and "save".
As such:
Saving calibration values
Using the output values of the cameracalibrator, update PtamFixParams.yaml:
#edit the image size and Camera nano ~/ros/ethzasl_ptam/ptam/PtamFixParams.yaml
As such:
#ARDrone2 default camera resolution: ImageSizeX: 640 ImageSizeY: 360 ... ... #ARDrone2 camera intrinsic calibration values Cam_fx: first value (normalized focal length in x) Cam_fy: second value (normalized focal length in y) Cam_cx: third value (normalized camera center in x) Cam_cy: fourth value (normalized camera center in y) Cam_s: fifth value (normalized distortion factor, <1 for wide FoV)
Running it
Locally:
#start ROS in one console roscore #Start the ARDrone2 streaming (publishes the image/camera topics). In another console: rosrun ardrone_autonomy ardrone_driver _realtime_navdata:=True _navdata_demo:=0 #Use image_proc to convert to grayscale. In another console: ROS_NAMESPACE=/ardrone/front rosrun image_proc image_proc #Launch ETHZASL_PTAM in another console: roslaunch ptam ptam.launch
Remotely:
Edit PtamFixParams.yaml to not run the GUI:
Gui: False
Next, start ptam and on the same machine or a different one that has the correct ROS_MASTER_URI, run:
#image stream rosrun ptam remote_ptam #3D cloud stream rosrun ptam ptam_visualizer
References
ethzasl_ptam - ROS Wiki
ethzasl_ptam/Tutorials/using_ethzasl_ptam - ROS Wiki
ethzasl_ptam/Tutorials/camera_calibration - ROS Wiki
ethzasl_ptam/Tutorials/remote_ptam - ROS Wiki
ethzasl_ptam/Tutorials/using_ethzasl_ptam - ROS Wiki
ethzasl_ptam/Tutorials/camera_calibration - ROS Wiki
ethzasl_ptam/Tutorials/remote_ptam - ROS Wiki
thinks for your share,help me a lot.
ReplyDelete