本文整理汇总了Golang中github.com/ppg/rosgo/ros.SerializeMessageField函数的典型用法代码示例。如果您正苦于以下问题:Golang SerializeMessageField函数的具体用法?Golang SerializeMessageField怎么用?Golang SerializeMessageField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SerializeMessageField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Serialize
func (m *DiagnosticStatus) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "byte", &m.Level); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "string", &m.Name); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "string", &m.Message); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "string", &m.HardwareID); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Values)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Values {
if err = ros.SerializeMessageField(w, "KeyValue", &elem); err != nil {
return err
}
}
return
}
示例2: Serialize
func (m *FollowJointTrajectoryGoal) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "trajectory_msgs/JointTrajectory", &m.Trajectory); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.PathTolerance)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.PathTolerance {
if err = ros.SerializeMessageField(w, "JointTolerance", &elem); err != nil {
return err
}
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.GoalTolerance)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.GoalTolerance {
if err = ros.SerializeMessageField(w, "JointTolerance", &elem); err != nil {
return err
}
}
if err = ros.SerializeMessageField(w, "duration", &m.GoalTimeTolerance); err != nil {
return err
}
return
}
示例3: Serialize
func (m *Joy) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Axes)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Axes {
if err = ros.SerializeMessageField(w, "float32", &elem); err != nil {
return err
}
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Buttons)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Buttons {
if err = ros.SerializeMessageField(w, "int32", &elem); err != nil {
return err
}
}
return
}
示例4: Serialize
func (m *FollowJointTrajectoryFeedback) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.JointNames)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.JointNames {
if err = ros.SerializeMessageField(w, "string", &elem); err != nil {
return err
}
}
if err = ros.SerializeMessageField(w, "trajectory_msgs/JointTrajectoryPoint", &m.Desired); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "trajectory_msgs/JointTrajectoryPoint", &m.Actual); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "trajectory_msgs/JointTrajectoryPoint", &m.Error); err != nil {
return err
}
return
}
示例5: Serialize
func (m *Mesh) Serialize(w io.Writer) (err error) {
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Triangles)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Triangles {
if err = ros.SerializeMessageField(w, "MeshTriangle", &elem); err != nil {
return err
}
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Vertices)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Vertices {
if err = ros.SerializeMessageField(w, "geometry_msgs/Point", &elem); err != nil {
return err
}
}
return
}
示例6: Serialize
func (m *JointTrajectory) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.JointNames)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.JointNames {
if err = ros.SerializeMessageField(w, "string", &elem); err != nil {
return err
}
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Points)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Points {
if err = ros.SerializeMessageField(w, "JointTrajectoryPoint", &elem); err != nil {
return err
}
}
return
}
示例7: Serialize
func (m *GridCells) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.CellWidth); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.CellHeight); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Cells)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Cells {
if err = ros.SerializeMessageField(w, "geometry_msgs/Point", &elem); err != nil {
return err
}
}
return
}
示例8: Serialize
func (m *LaserScan) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.AngleMin); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.AngleMax); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.AngleIncrement); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.TimeIncrement); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.ScanTime); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.RangeMin); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float32", &m.RangeMax); err != nil {
return err
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Ranges)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Ranges {
if err = ros.SerializeMessageField(w, "float32", &elem); err != nil {
return err
}
}
// Write size little endian
err = binary.Write(w, binary.LittleEndian, uint32(len(m.Intensities)))
if err != nil {
return fmt.Errorf("could not write array length: %s", err)
}
for _, elem := range m.Intensities {
if err = ros.SerializeMessageField(w, "float32", &elem); err != nil {
return err
}
}
return
}
示例9: Serialize
func (m *TwistStamped) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Header", &m.Header); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "Twist", &m.Twist); err != nil {
return err
}
return
}
示例10: Serialize
func (m *LookupTransformResult) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "geometry_msgs/TransformStamped", &m.Transform); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "tf2_msgs/TF2Error", &m.Error); err != nil {
return err
}
return
}
示例11: Serialize
func (m *AddTwoIntsRequest) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "int32", &m.A); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "int32", &m.B); err != nil {
return err
}
return
}
示例12: Serialize
func (m *GoalID) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "time", &m.Stamp); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "string", &m.ID); err != nil {
return err
}
return
}
示例13: Serialize
func (m *TF2Error) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "uint8", &m.Error); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "string", &m.ErrorString); err != nil {
return err
}
return
}
示例14: Serialize
func (m *Transform) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "Vector3", &m.Translation); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "Quaternion", &m.Rotation); err != nil {
return err
}
return
}
示例15: Serialize
func (m *GripperCommand) Serialize(w io.Writer) (err error) {
if err = ros.SerializeMessageField(w, "float64", &m.Position); err != nil {
return err
}
if err = ros.SerializeMessageField(w, "float64", &m.MaxEffort); err != nil {
return err
}
return
}