CameraFollowMode.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OctoMap - An Efficient Probabilistic 3D Mapping
3  * Framework Based on Octrees
4  * http://octomap.github.io
5  *
6  * Copyright (c) 2009-2014, K.M. Wurm and A. Hornung, University of Freiburg
7  * All rights reserved. License for the viewer octovis: GNU GPL v2
8  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9  *
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  * for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see http://www.gnu.org/licenses/.
23  */
24 
26 #include <iostream>
27 
28 #define CAMERA_PATH_ID 13
29 #define ROBOT_TRAJECTORY_ID 14
30 
32 : QObject(), m_scan_graph(graph), m_current_scan(1), m_current_cam_frame(1), m_number_cam_frames(0),
33  m_followRobotTrajectory(false) {
34 }
35 
37 }
38 
39 
40 void CameraFollowMode::jumpToFrame(unsigned int frame) {
42  if(frame <= m_scan_graph->size()) {
43  m_current_scan = frame;
45  emit changeCamPose(pose);
46  }
47  } else {
48  m_current_cam_frame = frame;
50  }
51 }
52 
56  //emit appendCurrentToCameraPath(ROBOT_TRAJECTORY_ID);
58  for(unsigned int i = m_start_frame; i <= m_scan_graph->size(); i++) {
59  octomap::ScanNode* scanNode = m_scan_graph->getNodeByID(i-1);
60  if (scanNode)
62  else{
63  std::cerr << "Error in " << __FILE__ << ":" << __LINE__ <<" : invalid node ID "<< i-1 << std::endl;
64  }
65  }
67  } else {
70  }
71 }
72 
76 }
77 
78 
80  m_scan_graph = graph;
81  emit scanGraphAvailable(true);
82 }
83 
85  if(id == CAMERA_PATH_ID || id == ROBOT_TRAJECTORY_ID) {
86  emit stopped();
87  }
88 }
89 
90 void CameraFollowMode::cameraPathFrameChanged(int id, int current_camera_frame) {
92  m_current_scan = m_start_frame + current_camera_frame;
94  } else {
95  m_current_cam_frame = m_start_frame + current_camera_frame;
97  }
98 }
99 
106 }
107 
110 }
111 
116  else m_current_cam_frame++;
119 }
120 
122  if(m_number_cam_frames>0) {
126  }
127 }
128 
130  m_followRobotTrajectory = false;
133 }
134 
136  if(m_scan_graph) {
140  }
141 }
size_t size() const
CameraFollowMode(octomap::ScanGraph *graph=NULL)
void deleteCameraPath(int id)
unsigned int m_number_cam_frames
#define ROBOT_TRAJECTORY_ID
void cameraPathStopped(int id)
void playCameraPath(int id, int start_frame)
void frameChanged(unsigned int frame)
ScanNode * getNodeByID(unsigned int id)
void appendToCameraPath(int id, const octomath::Pose6D &pose)
octomap::ScanGraph * m_scan_graph
void updateCameraPath(int id, int frame)
void setScanGraph(octomap::ScanGraph *graph)
unsigned int m_start_frame
void jumpToCamFrame(int id, int frame)
void stopCameraPath(int id)
void changeNumberOfFrames(unsigned count)
#define CAMERA_PATH_ID
void addCurrentToCameraPath(int id, int frame)
unsigned int m_current_scan
void changeCamPose(const octomath::Pose6D &pose)
unsigned int m_current_cam_frame
void jumpToFrame(unsigned int frame)
void cameraPathFrameChanged(int id, int current_camera_frame)
virtual ~CameraFollowMode()
void scanGraphAvailable(bool available)


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:24