My Project 1.0
Holistic Fusion: A Generic Framework for Multimodal Sensor Fusion
Loading...
Searching...
No Matches
ExcavatorStaticTransforms.cpp
Go to the documentation of this file.
1/*
2Copyright 2024 by Julian Nubert, Robotic Systems Lab, ETH Zurich.
3All rights reserved.
4This file is released under the "BSD-3-Clause License".
5Please see the LICENSE file that has been included as part of this package.
6 */
7
8// Implementation
10
11// ROS
12#include <ros/ros.h>
13
14// Workspace
16
17namespace excavator_se {
18
19ExcavatorStaticTransforms::ExcavatorStaticTransforms(const std::shared_ptr<ros::NodeHandle> privateNodePtr)
21 std::cout << YELLOW_START << "StaticTransformsTf" << GREEN_START << " Initializing static transforms..." << COLOR_END << std::endl;
22}
23
25 // Print to console --------------------------
26 std::cout << YELLOW_START << "StaticTransformsTf" << COLOR_END << " Looking up transforms in TF-tree." << std::endl;
27 std::cout << YELLOW_START << "StaticTransformsTf" << COLOR_END << " Transforms between the following frames are required:" << std::endl;
28 std::cout << YELLOW_START << "StaticTransformsTf" << COLOR_END << " " << lidarFrame_ << ", " << leftGnssFrame_ << ", " << rightGnssFrame_
29 << ", " << cabinFrame_ << ", " << imuFrame_ << ", " << baseLinkFrame_ << std::endl;
30 std::cout << YELLOW_START << "StaticTransformsTf" << COLOR_END << " Waiting for up to 100 seconds until they arrive..." << std::endl;
31
32 // Temporary variable
33 static tf::StampedTransform transform;
34
35 // Look up transforms ----------------------------
36 // Sleep before subscribing, otherwise sometimes dying in the beginning of rosbag
37 ros::Rate rosRate(10);
38 rosRate.sleep();
39
40 // Imu to Cabin Link ---
41 listener_.waitForTransform(imuFrame_, cabinFrame_, ros::Time(0), ros::Duration(100.0));
42 listener_.lookupTransform(imuFrame_, cabinFrame_, ros::Time(0), transform);
43 // I_Cabin
45 std::cout << YELLOW_START << "CompslamEstimator" << COLOR_END
46 << " Translation I_Cabin: " << rv_T_frame1_frame2(imuFrame_, cabinFrame_).translation() << std::endl;
47 // Cabin_I
49
50 // Imu to Base Link ---
51 listener_.waitForTransform(imuFrame_, baseLinkFrame_, ros::Time(0), ros::Duration(1.0));
52 listener_.lookupTransform(imuFrame_, baseLinkFrame_, ros::Time(0), transform);
53 // I_Cabin
55 std::cout << YELLOW_START << "CompslamEstimator" << COLOR_END
56 << " Translation I_Base: " << rv_T_frame1_frame2(imuFrame_, baseLinkFrame_).translation() << std::endl;
57 // Cabin_I
59
60 // Imu to LiDAR Link ---
61 std::cout << YELLOW_START << "StaticTransformsTf" << COLOR_END << " Waiting for transform for 10 seconds." << std::endl;
62 listener_.waitForTransform(imuFrame_, lidarFrame_, ros::Time(0), ros::Duration(1.0));
63 listener_.lookupTransform(imuFrame_, lidarFrame_, ros::Time(0), transform);
64 // I_Lidar
66 std::cout << YELLOW_START << "CompslamEstimator" << COLOR_END
67 << " Translation I_Lidar: " << rv_T_frame1_frame2(imuFrame_, lidarFrame_).translation() << std::endl;
68 // Lidar_I
70
71 // Imu to GNSS Left Link ---
72 listener_.waitForTransform(imuFrame_, leftGnssFrame_, ros::Time(0), ros::Duration(1.0));
73 listener_.lookupTransform(imuFrame_, leftGnssFrame_, ros::Time(0), transform);
74 // I_GnssL
76 std::cout << YELLOW_START << "CompslamEstimator" << COLOR_END
77 << " Translation I_GnssL: " << rv_T_frame1_frame2(imuFrame_, leftGnssFrame_).translation() << std::endl;
78 // GnssL_I
80
81 // Imu to GNSS Right Link ---
82 listener_.waitForTransform(imuFrame_, rightGnssFrame_, ros::Time(0), ros::Duration(1.0));
83 listener_.lookupTransform(imuFrame_, rightGnssFrame_, ros::Time(0), transform);
84 // I_GnssR
86 std::cout << YELLOW_START << "CompslamEstimator" << COLOR_END
87 << " Translation I_GnssR: " << rv_T_frame1_frame2(imuFrame_, rightGnssFrame_).translation() << std::endl;
88 // GnssL_I
90
91 std::cout << YELLOW_START << "StaticTransformsTf" << GREEN_START << " Transforms looked up successfully." << COLOR_END << std::endl;
92 return true;
93}
94
95} // namespace excavator_se
#define COLOR_END
#define GREEN_START
#define YELLOW_START
ExcavatorStaticTransforms(const std::shared_ptr< ros::NodeHandle > privateNodePtr)
Eigen::Isometry3d & lv_T_frame1_frame2(const std::string &frame1, const std::string &frame2)
const Eigen::Isometry3d & rv_T_frame1_frame2(const std::string &frame1, const std::string &frame2) const
void tfToIsometry3(const tf::Transform &tf_T, Eigen::Isometry3d &T)