I'm current workin on an EKF for an carlike robot and I'm not sure how to transform the IMU accelerometer data to offset the roll, pitch and yaw and get the acceleration with respect to the ground. I'm only computing the x,y position of the robot and the yaw of this vehicle.
If you are only computing the x, y and yaw (as I understand, these are the degrees of freedom of the robot) then: 1. The yaw acceleration is just what you measure 2. x and y acceleration is what you measure but rotated by the yaw angle (e.g phi) around the z axis. So you just need to rotate it back to the world frame. you can do it with this rotation matrix multiplied by the x, y vector:
(cos(phi), sin(phi); -sin(phi), cos(phi)) * (x, y)
I dont understand what do you mean by:
transform the IMU accelerometer data to offset the roll, pitch and yaw
Assuming the ground is flat and the IMU z axis is in the same direction of the world z axis (perpendicular to the gound), you shouldn't have changes in the roll and pitch.
If you do want to take them into account, you should take the roll, pitch and yaw angles and transform your measurements with one of the methods stated here.
Usually, in robotics, the Quaternions are used for this purpose.