17 #include <glog/logging.h> 24 const char* function_name =
"TangoRosNodelet::TangoSetup3DRConfig()";
29 const char* resolution =
"resolution";
30 double t3dr_resolution_param;
33 *t3dr_resolution = t3dr_resolution_param;
36 LOG(ERROR) << function_name <<
", Tango3DR_Config_setDouble " 37 << resolution <<
" error: " << result;
40 const char* generate_color =
"generate_color";
43 LOG(ERROR) << function_name <<
", Tango3DR_Config_setBool " 44 << generate_color <<
" error: " << result;
47 const char* use_floorplan =
"use_floorplan";
50 LOG(ERROR) << function_name <<
", Tango3DR_Config_setBool " 51 << use_floorplan <<
" error: " << result;
54 const char* use_space_clearing =
"use_space_clearing";
55 bool t3dr_use_space_clearing;
59 t3dr_use_space_clearing);
61 LOG(ERROR) << function_name <<
", Tango3DR_Config_setBool " 62 << use_space_clearing <<
" error: " << result;
65 const char* min_num_vertices =
"min_num_vertices";
66 int t3dr_min_num_vertices;
70 t3dr_min_num_vertices);
72 LOG(ERROR) << function_name <<
", Tango3DR_Config_setInt32 " 73 << min_num_vertices <<
" error: " << result;
76 const char* update_method =
"update_method";
77 int t3dr_update_method;
83 LOG(ERROR) << function_name <<
", Tango3DR_Config_setInt32 " 84 << update_method <<
" error: " << result;
87 const char* max_voxel_weight =
"max_voxel_weight";
88 int t3dr_max_voxel_weight;
92 t3dr_max_voxel_weight);
94 LOG(ERROR) << function_name <<
", Tango3DR_Config_setInt32 " 95 << max_voxel_weight <<
" error: " << result;
98 const char* floorplan_max_error =
"floorplan_max_error";
99 double t3dr_floorplan_max_error;
103 t3dr_floorplan_max_error);
105 LOG(ERROR) << function_name <<
", Tango3DR_Config_setDouble " 106 << floorplan_max_error <<
" error: " << result;
111 if (*t3dr_context ==
nullptr) {
112 LOG(ERROR) << function_name <<
", Tango3DR_ReconstructionContext_create error: " 113 "Unable to create 3DR context.";
118 *t3dr_context, t3dr_color_camera_intrinsics);
120 LOG(ERROR) << function_name <<
", Unable to set color calibration.";
127 TangoSupport_PointCloudManager* point_cloud_manager,
128 TangoSupport_ImageBufferManager* image_buffer_manager,
139 last_point_cloud->
points);
142 if (image_buffer_manager !=
nullptr) {
144 &last_color_image_buffer);
146 t3dr_image.
width = last_color_image_buffer->
width;
151 last_color_image_buffer->
format);
152 t3dr_image.
data = last_color_image_buffer->
data;
156 &t3dr_image, last_camera_color_pose,
157 t3dr_updated_indices);
159 LOG(ERROR) <<
"Tango3DR_updateFromPointCloud failed with error code " 168 double time_offset,
const std::string& base_frame_id,
169 visualization_msgs::MarkerArray* mesh_marker_array) {
170 for (
size_t i = 0; i < t3dr_updated_indices.
num_indices; ++i) {
174 t3dr_context, t3dr_updated_indices.
indices[i], &tango_mesh);
176 LOG(ERROR) <<
"Tango3DR_extractMeshSegment failed.";
180 LOG(INFO) <<
"Empty mesh extracted.";
184 visualization_msgs::Marker mesh_marker;
186 tango_mesh, time_offset, base_frame_id, &mesh_marker);
190 LOG(ERROR) <<
"Tango3DR_Mesh_destroy failed with error code: " 193 if (mesh_marker.points.empty()) {
194 LOG(INFO) <<
"Empty mesh marker.";
197 mesh_marker_array->markers.push_back(mesh_marker);
203 double time_offset,
const std::string& base_frame_id,
204 double t3dr_resolution, uint8_t threshold,
205 nav_msgs::OccupancyGrid* occupancy_grid) {
214 time_offset, base_frame_id, t3dr_resolution, threshold, occupancy_grid);
216 LOG(ERROR) <<
"Tango3DR_extractFullFloorplanImage failed with error" 222 LOG(ERROR) <<
"Tango3DR_ImageBuffer_destroy failed with error " 227 LOG(ERROR) <<
"Tango3DR_updateFullFloorplan failed with error "
struct _Tango3DR_Config * Tango3DR_Config
float Tango3DR_Vector4[4]
void ExtractMeshAndConvertToMarkerArray(const Tango3DR_ReconstructionContext &t3dr_context, const Tango3DR_GridIndexArray &t3dr_updated_indices, double time_offset, const std::string &base_frame_id, visualization_msgs::MarkerArray *mesh_marker_array)
const int32_t TANGO_3DR_DEFAULT_MAX_VOXEL_WEIGHT
Tango3DR_Status Tango3DR_Config_destroy(Tango3DR_Config config)
Tango3DR_Status Tango3DR_extractFullFloorplanImage(const Tango3DR_ReconstructionContext context, Tango3DR_FloorplanLayer layer, Tango3DR_Vector2 *origin, Tango3DR_ImageBuffer *image)
Tango3DR_Status Tango3DR_extractMeshSegment(const Tango3DR_ReconstructionContext context, const Tango3DR_GridIndex grid_index, Tango3DR_Mesh *mesh)
const bool TANGO_3DR_DEFAULT_USE_SPACE_CLEARING
Tango3DR_Status TangoSetup3DRConfig(const ros::NodeHandle &node_handle, double *t3dr_resolution, Tango3DR_ReconstructionContext *t3dr_context, Tango3DR_CameraCalibration *t3dr_color_camera_intrinsics)
const std::string TANGO_3DR_UPDATE_METHOD_PARAM_NAME
Tango3DR_Status Tango3DR_Config_setInt32(Tango3DR_Config config, const char *key, int32_t value)
float Tango3DR_Vector2[2]
Tango3DR_Status Tango3DR_updateFullFloorplan(const Tango3DR_ReconstructionContext context)
const std::string TANGO_3DR_FLOORPLAN_MAX_ERROR_PARAM_NAME
const int32_t TANGO_3DR_DEFAULT_UPDATE_METHOD
Tango3DR_GridIndex * indices
Tango3DR_Status Tango3DR_updateFromPointCloud(Tango3DR_ReconstructionContext context, const Tango3DR_PointCloud *cloud, const Tango3DR_Pose *cloud_pose, const Tango3DR_ImageBuffer *color_image, const Tango3DR_Pose *color_image_pose, Tango3DR_GridIndexArray *updated_indices)
Tango3DR_Status Tango3DR_Config_setDouble(Tango3DR_Config config, const char *key, double value)
TangoErrorType TangoSupport_getLatestImageBuffer(TangoSupport_ImageBufferManager *manager, TangoImageBuffer **image_buffer)
const std::string TANGO_3DR_MIN_NUM_VERTICES_PARAM_NAME
Tango3DR_Status Tango3DR_ReconstructionContext_setColorCalibration(const Tango3DR_ReconstructionContext context, const Tango3DR_CameraCalibration *calibration)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Tango3DR_Status Tango3DR_Mesh_destroy(Tango3DR_Mesh *mesh)
TangoImageFormatType format
bool ExtractFloorPlanImageAndConvertToOccupancyGrid(const Tango3DR_ReconstructionContext &t3dr_context, double time_offset, const std::string &base_frame_id, double t3dr_resolution, uint8_t threshold, nav_msgs::OccupancyGrid *occupancy_grid)
const std::string TANGO_3DR_MAX_VOXEL_WEIGHT_PARAM_NAME
const std::string TANGO_3DR_USE_SPACE_CLEARING_PARAM_NAME
const double TANGO_3DR_DEFAULT_FLOORPLAN_MAX_ERROR
Tango3DR_ImageFormatType format
Tango3DR_Config Tango3DR_Config_create(Tango3DR_ConfigType config_type)
Tango3DR_Status Tango3DR_ImageBuffer_destroy(Tango3DR_ImageBuffer *image)
Tango3DR_Status Tango3DR_Config_setBool(Tango3DR_Config config, const char *key, bool value)
struct _Tango3DR_ReconstructionContext * Tango3DR_ReconstructionContext
Tango3DR_Vector4 * points
void toOccupancyGrid(const Tango3DR_ImageBuffer &image_grid, const Tango3DR_Vector2 &origin, double time_offset, const std::string &base_frame_id, double resolution, uint8_t threshold, nav_msgs::OccupancyGrid *occupancy_grid)
world coordinates (x: right, y: up).
void toMeshMarker(const Tango3DR_GridIndex &grid_index, const Tango3DR_Mesh &tango_mesh, double time_offset, const std::string &base_frame_id, visualization_msgs::Marker *mesh_marker)
const int32_t TANGO_3DR_DEFAULT_MIN_NUM_VERTICES
void UpdateMesh(const Tango3DR_ReconstructionContext &t3dr_context, TangoSupport_PointCloudManager *point_cloud_manager, TangoSupport_ImageBufferManager *image_buffer_manager, Tango3DR_Pose *last_camera_depth_pose, Tango3DR_Pose *last_camera_color_pose, Tango3DR_GridIndexArray *t3dr_updated_indices)
Tango3DR_ReconstructionContext Tango3DR_ReconstructionContext_create(const Tango3DR_Config context_config)
const double TANGO_3DR_DEFAULT_RESOLUTION
const std::string TANGO_3DR_RESOLUTION_PARAM_NAME
TANGO_3DR_CONFIG_RECONSTRUCTION