Skip to content

Support ENU #33

@jordanjohnp

Description

@jordanjohnp

Thanks for your excellent work on 'minimu9-ahrs'. I'm creating a ROS driver from it and it's basically working, especially if I use 'fuse_gyro_only()'. But when running with 'fuse_default()', the robot appears upside down (in the ROS rviz visualizer). Also, rotations of the robot about the x-axis sees changes in the z-axis (in the visualization).

ROS uses ENU, whereas minimu9-ahrs uses NED. So I tried changing the code like this (see "// JJ"):

/*
  doesn't work...
  we want East North Up (ENU), but existing is NED... how to convert?
*/
matrix rotation_from_compass(const vector & acceleration, const vector & magnetic_field)
{
  vector up = acceleration; // JJ - removed negation
  vector east = up.cross(magnetic_field); // actually it's magnetic east
  vector north = east.cross(up);

  east.normalize();
  north.normalize();
  up.normalize();

  matrix r;
  r.row(0) = east; // JJ - swapped these
  r.row(1) = north;
  r.row(2) = up;
  return r;
}

Could you offer some advice about how I should change the code to support ENU?

Thanks for any hints!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions