Skip to content

Commit e229d60

Browse files
committed
feat: update
1 parent 53193fe commit e229d60

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

include/am_utils/imu_delta_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class ImuDelta
1515

1616
void updateImu(const sensor_msgs::msg::Imu::SharedPtr &src, sensor_msgs::msg::Imu &res);
1717

18+
void updateImu(const sensor_msgs::msg::Imu &src, sensor_msgs::msg::Imu &res);
19+
1820
void initialize(const geometry_msgs::msg::Quaternion &q);
1921

2022
void reset();

src/am_utils/imu_delta_class.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ ImuDelta::~ImuDelta()
1515

1616
void ImuDelta::updateImu(const sensor_msgs::msg::Imu::SharedPtr &src, sensor_msgs::msg::Imu &res)
1717
{
18+
updateImu(*src, res);
19+
}
1820

19-
initialize(src->orientation);
21+
void ImuDelta::updateImu(const sensor_msgs::msg::Imu &src, sensor_msgs::msg::Imu &res)
22+
{
23+
initialize(src.orientation);
2024

21-
res.header = src->header;
25+
res.header = src.header;
2226
double roll = 0.0, pitch = 0.0, yaw = 0.0;
23-
am::Rotate::getRPY(src->orientation, roll, pitch, yaw);
27+
am::Rotate::getRPY(src.orientation, roll, pitch, yaw);
2428
if(use_original_roll_)
2529
{
2630
roll = am::Rotate::wrap_pi(roll - init_roll_);
@@ -32,7 +36,7 @@ void ImuDelta::updateImu(const sensor_msgs::msg::Imu::SharedPtr &src, sensor_msg
3236

3337
yaw = am::Rotate::wrap_pi(yaw - init_yaw_);
3438

35-
res = *src;
39+
res = src;
3640
res.orientation = am::Rotate::toQuaternionMsg(roll, pitch, yaw);
3741
}
3842

0 commit comments

Comments
 (0)