jackal / jackal_robot

Robot packages for Jackal
65 stars 59 forks source link

The imu (raw) has a bias in the x component #72

Open mllofriu opened 1 year ago

mllofriu commented 1 year ago

Please provide the following information:

To Reproduce Provide the steps to reproduce:

  1. run jackal bringup
  2. let the robot be still
  3. ros2 topic echo /imu/data_raw --csv
  4. plot with R
require('reshape2')

read_csv_and_groom <-function(path, cols_to_select, source) 
{
  data <- read.csv(path, header = FALSE)
  data <- data[,cols_to_select]
  colnames(data) <- c('ts', 'ns','x', 'y', 'z')
  data$ns <- as.integer(data$ns)
  data$ts <- as.integer(data$ts)
  # transform secs rel to start
  data$ts <- data$ts - data$ts[1]
  # keep only milliseconds
  data$ms <- data$ns / 1e6
  print(data$ns)
  print(data$ms)
  data$ms <- data$ts * 1e3 + data$ms

  data <- melt(data, na.rm = TRUE, id.vars = 'ms', measure.vars = c('x', 'y', 'z'))
  data$source <- source

  data
}

imu <- read_csv_and_groom('~/Downloads/imu.csv', c(1,2,29,30,31), 'imu')
mag <- read_csv_and_groom('~/Downloads/mag.csv', c(1,2,4,5,6), 'mag')

all <- rbind(imu, mag)

require('ggplot2')
ggplot(all[all$source == 'imu',], aes(x = ms)) +
  geom_point(aes(y = value, color=interaction(source, variable))) 
tonybaltovski commented 1 year ago

The accelerometer when stationary is measuring the force of gravity. If the platform is not perfectly aligned with Earth's gravity vector it could have X or Y direction offsets. Is the Jackal started on a flat surface? Does the filtered data have the same offset?

mllofriu commented 1 year ago

The jackal is started in a flat surface. It's just running on the floor.

The z component seems close to the expected value for the gravity, so I wouldn't expect a significant component in x or y (unless that is not to scale).

By 'filtered output' do you mean the madgwick filter? Does that correct for a potential offset of the imu_link?

marco-ambrosio commented 1 year ago

I would like to add that the data published on /Imu/data_raw are without covariance, thus standard filter implemented in ROS can do pretty nothing on them