當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。