new algorithm - quaterions <-> rpy
there are some algorithms in dccl fo utm to lat/long, rad-to-degree, modemid-to-name.
I suggest quaterions to/from raw, pitch, roll.
Heres the conversion code (from libbot - svn co https:/
void
bot_roll_
{
double roll = rpy[0], pitch = rpy[1], yaw = rpy[2];
double halfroll = roll / 2;
double halfpitch = pitch / 2;
double halfyaw = yaw / 2;
double sin_r2 = sin (halfroll);
double sin_p2 = sin (halfpitch);
double sin_y2 = sin (halfyaw);
double cos_r2 = cos (halfroll);
double cos_p2 = cos (halfpitch);
double cos_y2 = cos (halfyaw);
q[0] = cos_r2 * cos_p2 * cos_y2 + sin_r2 * sin_p2 * sin_y2;
q[1] = sin_r2 * cos_p2 * cos_y2 - cos_r2 * sin_p2 * sin_y2;
q[2] = cos_r2 * sin_p2 * cos_y2 + sin_r2 * cos_p2 * sin_y2;
q[3] = cos_r2 * cos_p2 * sin_y2 - sin_r2 * sin_p2 * cos_y2;
}
void
bot_quat_
{
double roll_a = 2 * (q[0]*q[1] + q[2]*q[3]);
double roll_b = 1 - 2 * (q[1]*q[1] + q[2]*q[2]);
rpy[0] = atan2 (roll_a, roll_b);
double pitch_sin = 2 * (q[0]*q[2] - q[3]*q[1]);
rpy[1] = asin (pitch_sin);
double yaw_a = 2 * (q[0]*q[3] + q[1]*q[2]);
double yaw_b = 1 - 2 * (q[2]*q[2] + q[3]*q[3]);
rpy[2] = atan2 (yaw_a, yaw_b);
}
Blueprint information
- Status:
- Not started
- Approver:
- toby schneider
- Priority:
- Low
- Drafter:
- toby schneider
- Direction:
- Needs approval
- Assignee:
- Maurice Fallon
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by