00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010 00005 * Ivan Dryanovski <ivan.dryanovski@gmail.com> 00006 * William Morris <morris@ee.ccny.cuny.edu> 00007 * Stéphane Magnenat <stephane.magnenat@mavt.ethz.ch> 00008 * Radu Bogdan Rusu <rusu@willowgarage.com> 00009 * 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions 00014 * are met: 00015 * 00016 * * Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * * Redistributions in binary form must reproduce the above 00019 * copyright notice, this list of conditions and the following 00020 * disclaimer in the documentation and/or other materials provided 00021 * with the distribution. 00022 * * Neither the name of Willow Garage, Inc. nor the names of its 00023 * contributors may be used to endorse or promote products derived 00024 * from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00027 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00028 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00029 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00030 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00031 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00032 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00033 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00034 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00035 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00036 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00037 * POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 */ 00040 00041 #include "kinect_camera/kinect.h" 00042 00043 /* ---[ */ 00044 int 00045 main (int argc, char **argv) 00046 { 00047 // Init ROS 00048 ros::init (argc, argv, "kinect_node"); 00049 00050 ros::NodeHandle comm_nh ("camera"); // for topics, services 00051 ros::NodeHandle param_nh ("~"); // for parameters 00052 00053 // Read the device_id parameter from the server 00054 int device_id; 00055 param_nh.param ("device_id", device_id, argc > 1 ? atoi (argv[1]) : 0); 00056 00057 // Create the KinectDriver object 00058 kinect_camera::KinectDriver k (comm_nh, param_nh); 00059 if (!k.init (device_id)) 00060 return (-1); 00061 k.start (); 00062 00063 ros::Duration r (0.0001); 00064 while (ros::ok () && k.ok ()) 00065 { 00066 ros::spinOnce (); 00067 r.sleep (); 00068 } 00069 00070 return (0); 00071 } 00072 /* ]--- */ 00073