Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting same error as previous person - segmentation fault #2

Open
edfang1 opened this issue Jan 9, 2024 · 2 comments
Open

Getting same error as previous person - segmentation fault #2

edfang1 opened this issue Jan 9, 2024 · 2 comments

Comments

@edfang1
Copy link

edfang1 commented Jan 9, 2024

Will get a segmentation fault if the 921600 default baud rate is used. If i change the baud rate to anything else, get a lot of junk head_type errors that just scroll. Faster if you use the IMU - so some data is flowing.

Tried replacing all the 921600 to something else like 460800, rebuilt but data still shows the same. Not sure what else to try. Followed the directions on a clean workspace build and colcon build. So obviously connecting with the correct ttyUSBX port - but just cant seem to get the proper data. Running on 22.04

[WARN] [1704763714.999857018] [imu_node]: head_type error: m
[WARN] [1704763715.419389586] [imu_node]: head_type error: y
[WARN] [1704763715.669497928] [imu_node]: head_type error:
[WARN] [1704763715.699406065] [imu_node]: head_type error: m
[WARN] [1704763715.769009148] [imu_node]: head_type error: m
[WARN] [1704763715.849610289] [imu_node]: head_type error: m
[WARN] [1704763715.868508425] [imu_node]: head_type error: m

@edfang1 edfang1 changed the title Getting same error as previous person. Getting same error as previous person - segmentation fault Jan 9, 2024
@edfang1
Copy link
Author

edfang1 commented Jan 16, 2024

As a follow up, its segmentation faulting on this line in imu_node.cpp
imu_data.orientation_covariance[0] = imu_mag_cov[0];

Not sure why, but it seems to be on that line.
If the baud rate is lowered to 460800, garbage (probably mismatched baud rates) text comes out - but it does not segmentation fault. . But 921600 is immediately faults when it hits that line.

@Onicc
Copy link

Onicc commented Oct 16, 2024

The issue arises because the following vectors:

std::vector<double> imu_mag_cov;
std::vector<double> imu_gyro_cov;
std::vector<double> imu_accel_cov;

are being used without having assigned any values.

Solution:
Modify lines 53 to 55 in imu_node.cpp of the repository here as follows:

imu_mag_cov = this->get_parameter("imu_mag_covVec").as_double_array();
imu_gyro_cov = this->get_parameter("imu_gyro_covVec").as_double_array();
imu_accel_cov = this->get_parameter("imu_accel_covVec").as_double_array();

This will ensure that the vectors are properly initialized with the values from the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants