Documentation
¶
Overview ¶
This package defines a number of helper structs and methods for managing poses and 3D math.
Index ¶
- type Pose
- type Rotation
- func (r *Rotation) Clear()
- func (r *Rotation) FromRollPitchYaw(roll, pitch, yaw float64)
- func (r Rotation) Inverse() Rotation
- func (r Rotation) Multiply(other Rotation) Rotation
- func (r *Rotation) Normalize()
- func (r *Rotation) Rotate(vec Vector3) Vector3
- func (r *Rotation) ToRollPitchYaw() (roll, pitch, yaw float64)
- func (r *Rotation) UnmarshalXMLAttr(attr xml.Attr) error
- func (r *Rotation) W() float64
- func (r *Rotation) X() float64
- func (r *Rotation) Y() float64
- func (r *Rotation) Z() float64
- type Vector3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pose ¶
type Pose struct {
// 3D position of a quantity (e.g., a link) in the URDF
Position Vector3 `xml:"xyz,attr"`
// Rotation of the quantity (e.g., a link) in the URDF
Rotation Rotation `xml:"rpy,attr"`
}
Pose is an object which exactly represents a pose according to the URDF specification.
It uses the xml struct tags so that you can take advantage of the xml encoding/decoding features (e.g., xml.Marhsal, xml.Unmarshal) to easily read or write URDFs. No need to write any additional functions.
type Rotation ¶
type Rotation [4]float64
Rotation is an array of four elements representing the rotation of a quantity as a quaternion. We assume that the order of elements is x,y,z,w.
TODO(Kwesi): Investigate turning this into a struct with explicitly labeled values for x,y,z,w.
func NewRotation ¶
Creates a new Rotation by defining the x,y,z,w values of the quaternion.
func (*Rotation) FromRollPitchYaw ¶
Defines the Rotation object as the quaternion that is equivalent to the provided roll, pitch, yaw values. (Q: Are these Euler angles?)
Assume roll (x), pitch (y) and yaw (z) are angles in radians.
func (*Rotation) ToRollPitchYaw ¶
Converts the current rotation into the roll-pitch-yaw values.
The returned values are in radians.
func (*Rotation) UnmarshalXMLAttr ¶
UnmarshalXMLAttr parses the values from an "attribute" in an URDF tag and stores the result (if possible) into the current rotation.
An example of a tag that would take advantage of this method is the following:
<origin rpy="0 0 3.141592653589793" xyz="0 -0.0306011 0.054904"/>
This method should not be called directly by the user. It is used to implement an interface from the encoding/xml package.
type Vector3 ¶
type Vector3 [3]float64
An array of three elements which can be used in the decoding or encoding of 3D vectors in a URDF.
func NewVector3 ¶
Defines a new vector using three input values.
func (Vector3) MarshalXMLAttr ¶
MarshalXMLAttr returns an xml attribute that can be easily encoded into a new URDF file.
This method should not normally be called by users. It is used to implement some important interfaces in encoding/xml, and thus is mainly used by encoding/xml when you call those methods (e.g., when you call xml.Marshal()).
func (*Vector3) UnmarshalXMLAttr ¶
UnmarshalXMLAttr updates the current vector using the values obtained from the attributes of an xml tag.
For example, the following tag contains a quantity that would be decoded using this method:
<origin rpy="0 0 3.141592653589793" xyz="0 -0.0306011 0.054904"/>
Note: This method should not be normally called by users. It is defined so that this type implements an interface from encoding/xml. Usually, it is called by the methods from encoding/xml that need it (e.g., xml.Unmarshal).