当前位置: 首页>>代码示例>>Golang>>正文


Golang ros.SerializeMessageField函数代码示例

本文整理汇总了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
}
开发者ID:ppg,项目名称:rosgo,代码行数:30,代码来源:DiagnosticStatus.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:33,代码来源:FollowJointTrajectoryGoal.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:29,代码来源:Joy.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:30,代码来源:FollowJointTrajectoryFeedback.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:25,代码来源:Mesh.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:29,代码来源:JointTrajectory.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:26,代码来源:GridCells.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:57,代码来源:LaserScan.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:TwistStamped.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:LookupTransformResult.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:AddTwoInts.srv.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:GoalID.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:TF2Error.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:Transform.msg.go

示例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
}
开发者ID:ppg,项目名称:rosgo,代码行数:11,代码来源:GripperCommand.msg.go


注:本文中的github.com/ppg/rosgo/ros.SerializeMessageField函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。