hiwad-aziz / ros2_mpu9250_driver

A ROS2 driver for an MPU9250 sensor.
MIT License
15 stars 14 forks source link

message frequency #5

Open saghavart opened 1 year ago

saghavart commented 1 year ago

Hi. I am unable to change IMU message frequency. I've tried to update frequency from config file, also I've updated the wall timer from src. But frequency is around 160 Hz and does not change

slowrunner commented 11 months ago

Did you try (this gets 10 Hz /imu topic):

  std::chrono::duration<int64_t, std::milli> frequency = 1000ms / 10;
  //    1000ms / this->get_parameter("gyro_range").as_int();

probably the better is to change to:

std::chrono::duration<int64_t, std::milli> frequency = 
      1000ms / this->get_parameter("frequency").as_int();

and be sure to change mpu9250.yaml to your desired /imu topic frequency:

...
frequency: 10 # [Hz]