25 #include <glog/logging.h> 27 #include <dynamic_reconfigure/config_tools.h> 28 #include <dynamic_reconfigure/server.h> 29 #include <geometry_msgs/PoseStamped.h> 32 #include <std_msgs/Int8.h> 38 std::vector<std::string> SplitCommaSeparatedString(
const std::string& comma_separated_string) {
39 std::vector<std::string> output;
40 std::stringstream ss(comma_separated_string);
42 std::string string_element;
43 while (std::getline(ss, string_element,
',')) {
44 output.push_back(string_element);
53 void OnPoseAvailableRouter(
void* context,
const TangoPoseData* pose) {
64 void OnPointCloudAvailableRouter(
void* context,
77 void OnFrameAvailableRouter(
void* context,
TangoCameraId camera_id,
89 double xu,
double yu,
double w,
double w_inverse,
double two_tan_w_div_two,
90 double* xd,
double* yd) {
91 double ru =
sqrt(xu * xu + yu * yu);
92 constexpr
double epsilon = 1e-7;
93 if (w < epsilon || ru < epsilon) {
97 double rd_div_ru = std::atan(ru * two_tan_w_div_two) * w_inverse / ru;
108 void ComputeWarpMapsToRectifyFisheyeImage(
109 const sensor_msgs::CameraInfo& fisheye_camera_info,
110 cv::Mat* cv_warp_map_x, cv::Mat* cv_warp_map_y) {
111 const double fx = fisheye_camera_info.K[0];
112 const double fy = fisheye_camera_info.K[4];
113 const double cx = fisheye_camera_info.K[2];
114 const double cy = fisheye_camera_info.K[5];
115 const double w = fisheye_camera_info.D[0];
117 const double fy_inverse = 1.0 / fy;
118 const double fx_inverse = 1.0 / fx;
119 const double w_inverse = 1 / w;
120 const double two_tan_w_div_two = 2.0 * std::tan(w * 0.5);
124 for(
int iu = 0; iu < fisheye_camera_info.height; ++iu) {
125 for (
int ju = 0; ju < fisheye_camera_info.width; ++ju) {
126 double xu = (ju - cx) * fx_inverse;
127 double yu = (iu - cy) * fy_inverse;
129 ApplyFovModel(xu, yu, w, w_inverse, two_tan_w_div_two, &xd, &yd);
130 double jd = cx + xd * fx;
131 double id = cy + yd * fy;
132 cv_warp_map_x->at<
float>(iu, ju) = jd;
133 cv_warp_map_y->at<
float>(iu, ju) =
id;
139 std::string GetCurrentDateAndTime() {
140 std::time_t currentTime;
141 struct tm* currentDateTime;
142 std::time(¤tTime);
143 currentDateTime = std::localtime(¤tTime);
144 int day = currentDateTime->tm_mday;
145 int month = currentDateTime->tm_mon + 1;
146 int year = currentDateTime->tm_year + 1900;
147 int hour = currentDateTime->tm_hour;
148 int min = currentDateTime->tm_min;
149 int sec = currentDateTime->tm_sec;
150 std::ostringstream oss;
151 oss << year <<
"-" << month <<
"-" << day <<
"_" << hour <<
"-" << min <<
"-" << sec;
155 double GetBootTimeInSecond() {
156 struct timespec res_boot;
157 clock_gettime(CLOCK_BOOTTIME, &res_boot);
158 return res_boot.tv_sec + (double) res_boot.tv_nsec / 1e9;
165 bool SaveTangoAreaDescription(
const std::string& map_name,
166 std::string& map_uuid, std::string& message) {
171 LOG(ERROR) <<
"Error while saving area description, error: " << result;
172 message =
"Could not save the map. " 173 "Did you allow the app to use area learning?";
179 LOG(ERROR) <<
"Error while trying to access area description metadata, error: " << result;
180 message =
"Could not access map metadata";
185 LOG(ERROR) <<
"Error while trying to change area description metadata, error: " << result;
186 message =
"Could not set the name of the map";
191 LOG(ERROR) <<
"Error while saving new area description metadata, error: " << result;
192 message =
"Could not save map metadata";
197 LOG(ERROR) <<
"Error while trying to free area description metadata, error: " << result;
198 message =
"Could not free map metadata";
201 map_uuid =
static_cast<std::string
>(map_tango_uuid);
208 bool GetCurrentADFUuid(
const TangoConfig& tango_config, std::string& adf_uuid) {
210 const char* config_load_area_description_UUID =
"config_load_area_description_UUID";
212 tango_config, config_load_area_description_UUID, current_adf_uuid,
215 LOG(ERROR) <<
"TangoConfig_getString " 216 << config_load_area_description_UUID <<
" error: " << result;
219 adf_uuid = std::string(current_adf_uuid);
224 void SetDefaultValueIfParamDoesNotExist(
227 if (!node_handle.
hasParam(param_name)) {
228 node_handle.
setParam(param_name, default_value);
232 void GetParamValueAndSetDefaultValueIfParamDoesNotExist(
234 T default_value, T& param_value) {
235 if (node_handle.
hasParam(param_name)) {
236 node_handle.
getParam(param_name, param_value);
238 param_value = default_value;
239 node_handle.
setParam(param_name, default_value);
243 void InvertTransformStamped(
const geometry_msgs::TransformStamped& a_T_b,
244 geometry_msgs::TransformStamped* b_T_a) {
245 geometry_msgs::Transform a_T_b_msg = a_T_b.transform;
249 geometry_msgs::Transform b_T_a_msg =
tf2::toMsg(b_T_a_tf);
250 b_T_a->transform = b_T_a_msg;
251 b_T_a->header = a_T_b.header;
252 b_T_a->header.frame_id = a_T_b.child_frame_id;
253 b_T_a->child_frame_id = a_T_b.header.frame_id;
259 t3dr_context_(nullptr), point_cloud_manager_(nullptr),
260 image_buffer_manager_(nullptr), new_point_cloud_available_for_t3dr_(false) {}
264 const uint32_t queue_size = 1;
265 const bool latching =
true;
268 queue_size, latching);
297 tango_ros_messages::TangoConnect::Response>(
303 SetDefaultValueIfParamDoesNotExist(
305 SetDefaultValueIfParamDoesNotExist(
307 SetDefaultValueIfParamDoesNotExist(
309 SetDefaultValueIfParamDoesNotExist(
312 SetDefaultValueIfParamDoesNotExist(
314 SetDefaultValueIfParamDoesNotExist(
334 SetDefaultValueIfParamDoesNotExist(
336 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
338 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
340 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
342 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
344 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
346 int t3dr_occupancy_grid_threshold =
348 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
node_handle_,
352 t3dr_occupancy_grid_threshold);
354 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
358 GetParamValueAndSetDefaultValueIfParamDoesNotExist(
369 const uint32_t queue_size = 1;
370 const bool latching =
true;
387 queue_size, latching);
390 queue_size, latching);
392 LOG(ERROR) <<
"Error while creating color image transport publishers" << e.what();
418 queue_size, latching);
421 queue_size, latching);
423 LOG(ERROR) <<
"Error while creating fisheye image transport publishers" << e.what();
435 time_t current_time = time(NULL);
436 time_t end = current_time + 10;
437 while (current_time < end) {
443 current_time = time(NULL);
446 LOG(ERROR) <<
"Error, could not get a first valid pose.";
470 if (enable_3dr_mesh_ || enable_3dr_occupancy_grid_) {
480 const char* function_name =
"TangoRosNodelet::TangoSetupConfig()";
484 LOG(ERROR) << function_name <<
", TangoService_getConfig error.";
489 const char* config_enable_motion_tracking =
"config_enable_motion_tracking";
492 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 493 << config_enable_motion_tracking <<
" error: " << result;
498 const char* config_enable_learning_mode =
"config_enable_learning_mode";
501 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 502 << config_enable_learning_mode <<
" error: " << result;
505 if (!create_new_map) {
506 bool enable_drift_correction =
false;
507 int localization_mode;
510 if (localization_mode == LocalizationMode::ONLINE_SLAM) {
511 enable_drift_correction =
true;
513 const char* config_enable_drift_correction =
"config_enable_drift_correction";
516 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 517 << config_enable_drift_correction <<
" error: " << result;
521 std::string map_uuid_to_load =
"";
523 const char* config_load_area_description_UUID =
"config_load_area_description_UUID";
526 LOG(ERROR) << function_name <<
", TangoConfig_setString " 527 << config_load_area_description_UUID <<
" error: " << result;
532 const char* config_enable_auto_recovery =
"config_enable_auto_recovery";
535 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 536 << config_enable_auto_recovery <<
" error: " << result;
539 const char* config_enable_depth =
"config_enable_depth";
543 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 544 << config_enable_depth <<
" error: " << result;
547 const char* config_depth_mode =
"config_depth_mode";
550 LOG(ERROR) << function_name <<
", TangoConfig_setInt " 551 << config_depth_mode <<
" error: " << result;
554 const char* config_enable_color_camera =
"config_enable_color_camera";
558 LOG(ERROR) << function_name <<
", TangoConfig_setBool " 559 << config_enable_color_camera <<
" error: " << result;
562 std::string datasets_path;
564 const char* config_datasets_path =
"config_datasets_path";
567 LOG(ERROR) << function_name <<
", TangoConfig_setString " 568 << config_datasets_path <<
" error: " << result;
571 std::string dataset_uuid;
573 const char* config_experimental_load_dataset_UUID =
"config_experimental_load_dataset_UUID";
576 LOG(ERROR) << function_name <<
", TangoConfig_setString " 577 << config_experimental_load_dataset_UUID <<
" error: " << result;
581 int32_t max_point_cloud_elements;
582 const char* config_max_point_cloud_elements =
"max_point_cloud_elements";
584 &max_point_cloud_elements);
586 LOG(ERROR) << function_name <<
", Failed to query maximum number of point cloud elements.";
591 LOG(ERROR) << function_name <<
", Failed to create point cloud manager.";
599 const char* function_name =
"TangoRosNodelet::TangoConnect()";
609 LOG(ERROR) << function_name
610 <<
", TangoService_connectOnPoseAvailable error: " << result;
616 LOG(ERROR) << function_name
617 <<
", TangoService_connectOnPointCloudAvailable error: " << result;
621 int android_api_level;
623 if (android_api_level < 24) {
627 LOG(ERROR) << function_name
628 <<
", TangoService_connectOnFrameAvailable TANGO_CAMERA_FISHEYE error: " << result;
632 LOG(WARNING) <<
"Android API Level is 24 or more, Fisheye camera data is not available";
639 LOG(ERROR) << function_name
640 <<
", TangoService_connectOnFrameAvailable TANGO_CAMERA_COLOR error: " << result;
646 LOG(ERROR) << function_name <<
", TangoService_connect error: " << result;
654 std_msgs::Int8 tango_status_msg;
663 LOG(WARNING) <<
"Already connected to Tango service.";
723 std::vector<geometry_msgs::TransformStamped> tf_transforms;
731 geometry_msgs::TransformStamped device_T_imu;
737 tf_transforms.push_back(device_T_imu);
757 geometry_msgs::TransformStamped camera_depth_T_laser_message;
759 tf_transforms.push_back(camera_depth_T_laser_message);
837 laser_scan_.ranges.assign(ranges_size, std::numeric_limits<double>::infinity());
853 LOG(WARNING) <<
"Could not find a valid pose at time " 854 << point_cloud->
timestamp <<
" for the depth camera.";
899 LOG(ERROR) <<
"Failed to create image buffer manager.";
909 LOG(WARNING) <<
"Could not find a valid pose at time " 910 << buffer->
timestamp <<
" for the color camera.";
1059 cv::Mat fisheye_image_gray;
1060 cv::cvtColor(
fisheye_image_, fisheye_image_gray, cv::COLOR_YUV420sp2GRAY);
1064 cv_bridge_fisheye_image.
image = fisheye_image_gray;
1067 sensor_msgs::Image fisheye_image_msg;
1068 cv_bridge_fisheye_image.
toImageMsg(fisheye_image_msg);
1075 cv_bridge_fisheye_image.
header, cv_bridge_fisheye_image.
encoding,
1096 cv::Mat color_image_rgb;
1097 cv::cvtColor(
color_image_, color_image_rgb, cv::COLOR_YUV420sp2RGBA);
1101 cv_bridge_color_image.
image = color_image_rgb;
1104 sensor_msgs::Image color_image_msg;
1105 cv_bridge_color_image.
toImageMsg(color_image_msg);
1134 &t3dr_updated_indices);
1138 visualization_msgs::MarkerArray mesh_marker_array;
1144 &t3dr_updated_indices);
1146 LOG(ERROR) <<
"Tango3DR_GridIndexArray_destroy failed with error code: " 1149 if (mesh_marker_array.markers.empty()) {
1150 LOG(INFO) <<
"Empty mesh array!";
1181 dynamic_reconfigure::Server<tango_ros_native::PublisherConfig> server;
1182 dynamic_reconfigure::Server<tango_ros_native::PublisherConfig>::CallbackType callback =
1184 server.setCallback(callback);
1190 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1195 const tango_ros_messages::TangoConnect::Request& request,
1196 tango_ros_messages::TangoConnect::Response& response) {
1197 switch (request.request) {
1198 case tango_ros_messages::TangoConnect::Request::CONNECT:
1202 case tango_ros_messages::TangoConnect::Request::DISCONNECT:
1207 case tango_ros_messages::TangoConnect::Request::RECONNECT:
1213 LOG(ERROR) <<
"Did not understand request " <<
static_cast<int>(request.request)
1214 <<
", valid requests are (CONNECT: " 1215 << tango_ros_messages::TangoConnect::Request::CONNECT
1217 << tango_ros_messages::TangoConnect::Request::DISCONNECT
1219 << tango_ros_messages::TangoConnect::Request::RECONNECT
1221 response.message =
"Did not understand request.";
1228 const tango_ros_messages::GetMapName::Request &req,
1229 tango_ros_messages::GetMapName::Response &res) {
1234 const tango_ros_messages::GetMapUuids::Request& req,
1235 tango_ros_messages::GetMapUuids::Response& res) {
1238 res.map_names.resize(res.map_uuids.size());
1239 auto map_uuids_it = res.map_uuids.begin();
1240 auto map_names_it = res.map_names.begin();
1241 for (; map_uuids_it != res.map_uuids.end() && map_names_it != res.map_names.end();
1242 ++map_uuids_it, ++map_names_it) {
1249 const tango_ros_messages::SaveMap::Request& req,
1250 tango_ros_messages::SaveMap::Response& res) {
1251 bool save_localization_map = req.request & tango_ros_messages::SaveMap::Request::SAVE_LOCALIZATION_MAP;
1252 bool save_occupancy_grid = req.request & tango_ros_messages::SaveMap::Request::SAVE_OCCUPANCY_GRID;
1254 if (save_localization_map) {
1255 res.localization_map_name = req.map_name;
1256 if (!SaveTangoAreaDescription(res.localization_map_name, res.localization_map_uuid, res.message)) {
1257 res.success =
false;
1261 res.message +=
"\nLocalization map " + res.localization_map_uuid +
1262 " successfully saved with name " + res.localization_map_name;
1263 }
else if (save_occupancy_grid) {
1264 if (!GetCurrentADFUuid(
tango_config_, res.localization_map_uuid)) {
1265 res.message +=
"\nCould not get current localization map uuid.";
1266 res.success =
false;
1270 if (save_occupancy_grid) {
1271 std::string occupancy_grid_directory;
1274 res.occupancy_grid_name = req.map_name;
1275 if (!res.localization_map_uuid.empty()) {
1277 geometry_msgs::TransformStamped start_of_service_T_area_description;
1279 geometry_msgs::PoseStamped stamped_origin;
1282 geometry_msgs::PoseStamped stamped_origin_in_area_description;
1284 start_of_service_T_area_description);
1285 occupancy_grid_.info.origin = stamped_origin_in_area_description.pose;
1290 res.occupancy_grid_name, res.localization_map_uuid, occupancy_grid_directory,
occupancy_grid_)) {
1291 res.message +=
"\nCould not save occupancy grid " + res.occupancy_grid_name
1292 +
" in directory " + occupancy_grid_directory;
1293 res.success =
false;
1296 res.message +=
"\nOccupancy grid successfully saved with name " 1297 + res.occupancy_grid_name +
" in directory " + occupancy_grid_directory;
1298 if (res.localization_map_uuid.empty()) {
1299 res.message +=
"\nThe occupancy grid has been saved without localization map uuid. " 1300 "This means it will not be aligned when loaded later.";
1308 tango_ros_messages::LoadOccupancyGrid::Response& res) {
1309 nav_msgs::OccupancyGrid occupancy_grid;
1310 std::string occupancy_grid_directory;
1314 std::string map_uuid;
1317 req.name, occupancy_grid_directory, &occupancy_grid, &map_uuid)) {
1318 LOG(ERROR) <<
"Error while loading occupancy grid from file.";
1319 res.message =
"Could not load occupancy grid from file " + req.name
1320 +
" in directory " + occupancy_grid_directory;
1321 res.aligned =
false;
1322 res.success =
false;
1323 res.localization_map_uuid =
"";
1326 res.localization_map_uuid = map_uuid;
1327 res.message =
"Occupancy grid " + req.name +
" successfully loaded from " + occupancy_grid_directory;
1329 std::string current_map_uuid;
1331 res.message +=
"\nCould not get current localization map uuid.";
1332 res.aligned =
false;
1333 res.success =
false;
1336 if (current_map_uuid.empty()) {
1337 res.message +=
"\nThe occupancy grid is not aligned because " 1338 "no localization map is currently used.";
1339 res.aligned =
false;
1341 if (map_uuid.empty()) {
1342 res.message +=
"\nThe occupancy grid is not aligned because " 1343 "its localization map uuid is empty.";
1344 res.aligned =
false;
1346 if (map_uuid.compare(current_map_uuid) != 0) {
1347 res.message +=
"\nThe occupancy grid is not aligned because " 1348 "it does not correspond to the localization map currently used.";
1349 res.aligned =
false;
1353 if (map_uuid.empty()) {
1359 occupancy_grid.info.map_load_time = occupancy_grid.header.stamp;
1368 LOG(ERROR) <<
"Error while retrieving all available map UUIDs, error: " << result;
1371 if (c_uuid_list == NULL || c_uuid_list[0] ==
'\0') {
1372 LOG(WARNING) <<
"No area description file available.";
1375 LOG(INFO) <<
"UUID list: " << c_uuid_list;
1376 uuid_list = SplitCommaSeparatedString(std::string(c_uuid_list));
1386 LOG(ERROR) <<
"Error while trying to access area description metadata, error: " << result;
1391 LOG(ERROR) <<
"Error while trying to get area description metadata, error: " << result;
1394 map_name = std::string(value);
1397 LOG(ERROR) <<
"Error while trying to free area description metadata, error: " << result;
1399 LOG(INFO) <<
"Successfully retrieved map name: " << map_name <<
" from uuid " << map_uuid;
const std::string GET_MAP_UUIDS_SERVICE_NAME
const uint8_t TANGO_3DR_OCCUPANCY_GRID_DEFAULT_THRESHOLD
uint8_t t3dr_occupancy_grid_threshold_
TangoErrorType TangoSupport_freeImageBufferManager(TangoSupport_ImageBufferManager *manager)
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
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)
char TangoUUID[TANGO_UUID_LEN]
std_msgs::Header fisheye_image_header_
const int32_t TANGO_3DR_DEFAULT_MAX_VOXEL_WEIGHT
bool LoadOccupancyGridFromFiles(const std::string &map_name, const std::string &map_directory, nav_msgs::OccupancyGrid *occupancy_grid, std::string *map_uuid)
void toPointCloud2(const TangoPointCloud &tango_point_cloud, double time_offset, sensor_msgs::PointCloud2 *point_cloud)
TangoErrorType TangoService_connectOnFrameAvailable(TangoCameraId id, void *context, void(*onFrameAvailable)(void *context, TangoCameraId id, const TangoImageBuffer *buffer))
void toTango3DR_Pose(const TangoPoseData &tango_pose_data, Tango3DR_Pose *t3dr_pose)
TangoSupport_ImageBufferManager * image_buffer_manager_
const float LASER_SCAN_ANGLE_MIN
ros::Publisher area_description_T_start_of_service_publisher_
void TangoConfig_free(TangoConfig config)
void publish(const boost::shared_ptr< M > &message) const
std::shared_ptr< image_transport::ImageTransport > image_transport_
bool SaveOccupancyGridToFiles(const std::string &map_name, const std::string &map_uuid, const std::string &map_directory, const nav_msgs::OccupancyGrid &occupancy_grid)
TangoErrorType TangoConnect()
std::atomic_bool run_threads_
image_transport::Publisher fisheye_rectified_image_publisher_
Tango3DR_Pose last_camera_color_pose_
TangoErrorType TangoConfig_getString(TangoConfig config, const char *key, char *value, size_t size)
ros::ServiceServer get_map_uuids_service_
double laser_scan_min_height_
image_transport::CameraPublisher fisheye_camera_publisher_
const std::string DATASET_DIRECTORY_PARAM_NAME
std::thread publish_thread
bool SaveMapServiceCallback(const tango_ros_messages::SaveMap::Request &req, tango_ros_messages::SaveMap::Response &res)
ros::ServiceServer tango_connect_service_
const std::string AREA_DESCRIPTION_FRAME_ID_PARAM_NAME
uint32_t getNumSubscribers() const
TangoErrorType TangoAreaDescriptionMetadata_get(TangoAreaDescriptionMetadata metadata, const char *key, size_t *value_size, char **value)
TangoErrorType TangoService_connectOnPointCloudAvailable(void(*TangoService_onPointCloudAvailable)(void *context, const TangoPointCloud *cloud),...)
const std::string ENABLE_DEPTH_PARAM_NAME
double laser_scan_min_range_
const std::string OCCUPANCY_GRID_DIRECTORY_PARAM_NAME
ros::Publisher mesh_marker_publisher_
const std::string LASER_SCAN_FRAME_ID
const std::string LOCALIZATION_MAP_UUID_PARAM_NAME
const bool TANGO_3DR_DEFAULT_USE_SPACE_CLEARING
const std::string PUBLISH_POSE_ON_TF_PARAM_NAME
TangoSupport_PointCloudManager * point_cloud_manager_
const std::string ENABLE_COLOR_CAMERA_PARAM_NAME
bool GetMapUuidsServiceCallback(const tango_ros_messages::GetMapUuids::Request &req, tango_ros_messages::GetMapUuids::Response &res)
TangoErrorType TangoService_connectOnPoseAvailable(uint32_t count, const TangoCoordinateFramePair *frames, void(*TangoService_onPoseAvailable)(void *context, const TangoPoseData *pose),...)
ros::ServiceServer get_map_name_service_
void toLaserScan(const TangoPointCloud &tango_point_cloud, double time_offset, double min_height, double max_height, double min_range, double max_range, const tf::Transform &point_cloud_T_laser, sensor_msgs::LaserScan *laser_scan)
Tango3DR_Status Tango3DR_GridIndexArray_destroy(Tango3DR_GridIndexArray *grid_index_array)
double laser_scan_max_height_
image_transport::Publisher color_rectified_image_publisher_
const std::string COLOR_MESH_TOPIC_NAME
const std::string TANGO_3DR_OCCUPANCY_GRID_THRESHOLD_PARAM_NAME
void TangoService_disconnect()
TangoCoordinateFrameType base
const std::string CONNECT_SERVICE_NAME
bool LoadOccupancyGridServiceCallback(const tango_ros_messages::LoadOccupancyGrid::Request &req, tango_ros_messages::LoadOccupancyGrid::Response &res)
ros::ServiceServer save_map_service_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
const std::string STATIC_OCCUPANCY_GRID_TOPIC_NAME
Tango3DR_Status TangoSetup3DRConfig(const ros::NodeHandle &node_handle, double *t3dr_resolution, Tango3DR_ReconstructionContext *t3dr_context, Tango3DR_CameraCalibration *t3dr_color_camera_intrinsics)
void doTransform(const T &data_in, T &data_out, const geometry_msgs::TransformStamped &transform)
TANGO_COORDINATE_FRAME_CAMERA_COLOR
const std::string TANGO_3DR_UPDATE_METHOD_PARAM_NAME
TANGO_COORDINATE_FRAME_START_OF_SERVICE
Tango3DR_Status Tango3DR_clear(Tango3DR_ReconstructionContext context)
sensor_msgs::PointCloud2 point_cloud_
uint32_t getNumSubscribers() const
std::shared_ptr< camera_info_manager::CameraInfoManager > color_camera_info_manager_
void PublishStaticTransforms()
bool tango_data_available_
const std::string SAVE_MAP_SERVICE_NAME
const std::string COLOR_IMAGE_TOPIC_NAME
ros::NodeHandle & getMTPrivateNodeHandle() const
nav_msgs::OccupancyGrid occupancy_grid_
const std::string TANGO_3DR_FLOORPLAN_MAX_ERROR_PARAM_NAME
TangoErrorType TangoService_getAreaDescriptionUUIDList(char **uuid_list)
TangoCoordinateFramePair frame
const int32_t TANGO_3DR_DEFAULT_UPDATE_METHOD
sensor_msgs::CameraInfo color_camera_info_
void rectifyImage(const cv::Mat &raw, cv::Mat &rectified, int interpolation=cv::INTER_LINEAR) const
const std::string CREATE_NEW_MAP_PARAM_NAME
TangoErrorType TangoConfig_setString(TangoConfig config, const char *key, const char *value)
std::mutex data_available_mutex
cv::Mat color_image_rect_
TangoErrorType TangoAreaDescriptionMetadata_free(TangoAreaDescriptionMetadata metadata)
Tango3DR_Pose last_camera_depth_pose_
TangoErrorType TangoService_getAreaDescriptionMetadata(const TangoUUID uuid, TangoAreaDescriptionMetadata *metadata)
const std::string DATASET_DEFAULT_DIRECTORY
geometry_msgs::TransformStamped area_description_T_start_of_service_
const std::string USE_TF_STATIC_PARAM_NAME
Tango3DR_CameraCalibration t3dr_color_camera_intrinsics_
void PublishFisheyeImage()
void publish(const sensor_msgs::Image &message) const
TangoErrorType TangoConfig_setBool(TangoConfig config, const char *key, bool value)
void OnPointCloudAvailable(const TangoPointCloud *point_cloud)
const std::string TANGO_3DR_MIN_NUM_VERTICES_PARAM_NAME
ros::Publisher tango_status_publisher_
TangoErrorType TangoSupport_updateImageBuffer(TangoSupport_ImageBufferManager *manager, const TangoImageBuffer *image_buffer)
geometry_msgs::TransformStamped device_T_camera_depth_
TangoConfig tango_config_
TangoStatus tango_status_
void * TangoAreaDescriptionMetadata
bool fisheye_camera_available_
PublishThread fisheye_image_thread_
bool fromCameraInfo(const sensor_msgs::CameraInfo &msg)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
TANGO_COORDINATE_FRAME_AREA_DESCRIPTION
image_transport::CameraPublisher color_camera_publisher_
std::thread ros_spin_thread_
TANGO_COORDINATE_FRAME_CAMERA_FISHEYE
TANGO_COORDINATE_FRAME_IMU
TangoErrorType TangoService_getPoseAtTime(double timestamp, TangoCoordinateFramePair frame, TangoPoseData *pose)
TangoImageFormatType format
TANGO_COORDINATE_FRAME_CAMERA_DEPTH
PublishThread mesh_thread_
void fromMsg(const A &, B &b)
const float LASER_SCAN_TIME_INCREMENT
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_STATUS_TOPIC_NAME
const std::string TANGO_3DR_USE_SPACE_CLEARING_PARAM_NAME
TangoErrorType TangoConfig_getInt32(TangoConfig config, const char *key, int32_t *value)
std::atomic_bool new_point_cloud_available_for_t3dr_
const std::string AREA_DESCRIPTION_T_START_OF_SERVICE_TOPIC_NAME
sensor_msgs::CameraInfo fisheye_camera_info_
const std::string START_OF_SERVICE_T_DEVICE_TOPIC_NAME
void UpdateAndPublishTangoStatus(const TangoStatus &status)
const double TANGO_3DR_DEFAULT_FLOORPLAN_MAX_ERROR
cv::Mat fisheye_image_rect_
void toTransformStamped(const TangoPoseData &pose, double time_offset, const std::string &base_frame_id, const std::string &target_frame_id, geometry_msgs::TransformStamped *transform)
const std::string GET_MAP_NAME_SERVICE_NAME
std::string toFrameId(const TangoCoordinateFrameType &tango_frame_type)
TangoCoordinateFrameType target
double min(double a, double b)
void OnFrameAvailable(TangoCameraId camera_id, const TangoImageBuffer *buffer)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
ros::Publisher occupancy_grid_publisher_
ros::Publisher point_cloud_publisher_
TANGO_COORDINATE_FRAME_DEVICE
TangoErrorType TangoSetupConfig()
const float LASER_SCAN_ANGLE_MAX
Tango3DR_Status Tango3DR_ReconstructionContext_destroy(Tango3DR_ReconstructionContext context)
geometry_msgs::TransformStamped device_T_camera_fisheye_
TangoErrorType TangoService_getCameraIntrinsics(TangoCameraId camera_id, TangoCameraIntrinsics *intrinsics)
TangoPoseStatusType status_code
TangoConfig TangoService_getConfig(TangoConfigType config_type)
const std::string LASER_SCAN_TOPIC_NAME
void OnPoseAvailable(const TangoPoseData *pose)
sensor_msgs::LaserScan laser_scan_
PublishThread color_image_thread_
PublishThread laser_scan_thread_
void toCameraInfo(const TangoCameraIntrinsics &camera_intrinsics, sensor_msgs::CameraInfo *camera_info)
const std::string DATASET_UUID_PARAM_NAME
const std::string FISHEYE_RECTIFIED_IMAGE_TOPIC_NAME
const std::string START_OF_SERVICE_FRAME_ID_PARAM_NAME
const std::string LOCALIZATION_MODE_PARAM_NAME
const std::string ENABLE_3DR_MESH_PARAM_NAME
const std::string POINT_CLOUD_TOPIC_NAME
image_geometry::PinholeCameraModel color_camera_model_
const std::string OCCUPANCY_GRID_DEFAULT_DIRECTORY
TangoErrorType TangoAreaDescriptionMetadata_set(TangoAreaDescriptionMetadata metadata, const char *key, size_t value_size, const char *value)
double laser_scan_max_range_
void toTango3DR_CameraCalibration(const TangoCameraIntrinsics &camera_intrinsics, Tango3DR_CameraCalibration *t3dr_camera_intrinsics)
uint32_t getNumSubscribers() const
TangoErrorType TangoService_saveAreaDescription(TangoUUID *uuid)
TangoErrorType TangoService_connect(void *context, TangoConfig config)
ros::Publisher static_occupancy_grid_publisher_
Tango3DR_ReconstructionContext t3dr_context_
bool GetAvailableMapUuidsList(std::vector< std::string > &uuid_list)
std::condition_variable data_available
bool getParam(const std::string &key, std::string &s) const
std::string area_description_frame_id_
ros::ServiceServer load_occupancy_grid_service_
ros::Publisher start_of_service_T_device_publisher_
geometry_msgs::TransformStamped device_T_camera_color_
const float LASER_SCAN_SCAN_TIME
const std::string FISHEYE_IMAGE_TOPIC_NAME
std_msgs::Header color_image_header_
void DynamicReconfigureCallback(PublisherConfig &config, uint32_t level)
TangoErrorType TangoSupport_createImageBufferManager(TangoImageFormatType format, int width, int height, TangoSupport_ImageBufferManager **manager)
bool enable_color_camera_
const int32_t TANGO_3DR_DEFAULT_MIN_NUM_VERTICES
static void transformStampedTFToMsg(const StampedTransform &bt, geometry_msgs::TransformStamped &msg)
TangoErrorType TangoService_saveAreaDescriptionMetadata(const TangoUUID uuid, TangoAreaDescriptionMetadata metadata)
tf::TransformBroadcaster tf_broadcaster_
bool enable_3dr_occupancy_grid_
bool GetMapNameServiceCallback(const tango_ros_messages::GetMapName::Request &req, tango_ros_messages::GetMapName::Response &res)
std::shared_ptr< camera_info_manager::CameraInfoManager > fisheye_camera_info_manager_
PublishThread point_cloud_thread_
const std::string COLOR_RECTIFIED_IMAGE_TOPIC_NAME
bool hasParam(const std::string &key) const
const std::string ENABLE_3DR_OCCUPANCY_GRID_PARAM_NAME
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)
ros::NodeHandle node_handle_
ros::Publisher laser_scan_publisher_
ROSCPP_DECL void spinOnce()
const float LASER_SCAN_ANGLE_INCREMENT
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
tf::StampedTransform camera_depth_T_laser_
geometry_msgs::TransformStamped start_of_service_T_device_
const double TANGO_3DR_DEFAULT_RESOLUTION
const int NUMBER_OF_STATIC_TRANSFORMS
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
TangoErrorType OnTangoServiceConnected()
std::string start_of_service_frame_id_
bool GetMapNameFromUuid(const std::string &map_uuid, std::string &map_name)
const std::string LOAD_OCCUPANCY_GRID_SERVICE_NAME
const std::string OCCUPANCY_GRID_TOPIC_NAME
const std::string TANGO_3DR_RESOLUTION_PARAM_NAME
TangoErrorType ConnectToTangoAndSetUpNode()
sensor_msgs::ImagePtr toImageMsg() const
bool TangoConnectServiceCallback(const tango_ros_messages::TangoConnect::Request &request, tango_ros_messages::TangoConnect::Response &response)
PublishThread device_pose_thread_
TangoErrorType TangoConfig_setInt32(TangoConfig config, const char *key, int32_t value)
tf2_ros::StaticTransformBroadcaster tf_static_broadcaster_