public override string ToString() { StringBuilder builder = new StringBuilder(); builder.Append("<P,"); builder.Append(this.PoseId); int numberOfJoints = Joints.Max(j => j.ServoId) + 1; for (int i = 0; i < numberOfJoints; i++) { var joint = this.Joints.Where(j => j.ServoId == i).FirstOrDefault(); if (joint == null) { builder.Append(",-1,0"); } else { builder.AppendFormat(",{0:F4},{1}", joint.Angle, joint.Duration); } } builder.Append(">"); return(builder.ToString()); }