My Project 1.0
Holistic Fusion: A Generic Framework for Multimodal Sensor Fusion
Loading...
Searching...
No Matches
ImuIntegrator.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
11namespace imu_integrator {
12
13ImuIntegrator::ImuIntegrator(std::shared_ptr<ros::NodeHandle> privateNodePtr) : holistic_fusion::HolisticFusionRos(privateNodePtr) {
14 std::cout << YELLOW_START << "ImuIntegrator" << GREEN_START << " Setting up." << COLOR_END << std::endl;
15
16 std::cout << YELLOW_START << "ImuIntegrator" << GREEN_START << " Set up successfully." << COLOR_END << std::endl;
17}
18
19// Overridden imuCallback
20void ImuIntegrator::imuCallback(const sensor_msgs::Imu::ConstPtr& imuMsgPtr) {
21 sensor_msgs::Imu::Ptr imuMsgPtrCopy = boost::make_shared<sensor_msgs::Imu>(*imuMsgPtr);
22 imuMsgPtrCopy->angular_velocity.x = imuMsgPtr->angular_velocity.x * M_PI / 180.0;
23 imuMsgPtrCopy->angular_velocity.y = imuMsgPtr->angular_velocity.y * M_PI / 180.0;
24 imuMsgPtrCopy->angular_velocity.z = imuMsgPtr->angular_velocity.z * M_PI / 180.0;
25
27
29 std::cout << YELLOW_START << "ImuIntegrator" << GREEN_START
30 << " Imu attitude is now initialized: " << holistic_fusion::HolisticFusion::areRollAndPitchInited() << COLOR_END << std::endl;
33 staticTransformsPtr_->getImuFrame());
34 std::cout << YELLOW_START << "ImuIntegrator" << GREEN_START << " Set initial yaw and position to zero." << COLOR_END << std::endl;
35 }
36}
37
38} // namespace imu_integrator
#define COLOR_END
#define GREEN_START
#define YELLOW_START
virtual void imuCallback(const sensor_msgs::Imu::ConstPtr &imuPtr)
HolisticFusionRos(const std::shared_ptr< ros::NodeHandle > &privateNodePtr)
bool initYawAndPositionInWorld(const double yaw_W_frame1, const Eigen::Vector3d &W_t_W_frame2, const std::string &frame1, const std::string &frame2)
std::shared_ptr< StaticTransforms > staticTransformsPtr_
void imuCallback(const sensor_msgs::Imu::ConstPtr &imuPtr) override
ImuIntegrator(std::shared_ptr< ros::NodeHandle > privateNodePtr)