00001 /* 00002 * Software License Agreement (Apache License) 00003 * 00004 * Copyright (c) 2014, Southwest Research Institute 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 00020 #include <industrial_extrinsic_cal/observation_scene.h> 00021 #include <boost/shared_ptr.hpp> 00022 00023 00024 using boost::shared_ptr; 00025 00026 namespace industrial_extrinsic_cal 00027 { 00028 00029 00030 void ObservationScene::addObservationToScene(ObservationCmd new_obs_cmd) 00031 { 00032 // this next block of code maintains a list of the cameras in a scene 00033 bool camera_already_in_scene = false; 00034 BOOST_FOREACH(ObservationCmd command, observation_command_list_) 00035 { 00036 BOOST_FOREACH(shared_ptr<Camera> camera, cameras_in_scene_) 00037 { 00038 if (camera->camera_name_ == new_obs_cmd.camera->camera_name_) 00039 { 00040 camera_already_in_scene = true; 00041 } 00042 } 00043 } 00044 if (!camera_already_in_scene) 00045 { 00046 cameras_in_scene_.push_back(new_obs_cmd.camera); 00047 } 00048 // end of code block to maintain list of cameras in scene 00049 00050 // add observation 00051 observation_command_list_.push_back(new_obs_cmd); 00052 } 00053 00054 void ObservationScene::addCameraToScene(boost::shared_ptr<Camera> camera_in_scene) 00055 { 00056 cameras_in_scene_.push_back(camera_in_scene); 00057 ROS_DEBUG_STREAM("Added camera "<<camera_in_scene->camera_name_<<" to cameras_in_scene list of size: "<<cameras_in_scene_.size()); 00058 } 00059 00060 void ObservationScene::populateObsCmdList(boost::shared_ptr<Camera> camera, boost::shared_ptr<Target> target, Roi roi) 00061 { 00062 ObservationCmd current_obs_cmd; 00063 current_obs_cmd.camera=camera; 00064 current_obs_cmd.target=target; 00065 current_obs_cmd.roi=roi; 00066 00067 observation_command_list_.push_back(current_obs_cmd); 00068 } 00069 00070 }//end namespace industrial_extrinsic_cal