예제 #1
0
    /// <summary>
    /// Sends a message to the simualation to apply an external force on a certain position.
    /// </summary>
    /// <param name="roboyPart">The roboypart where the force should be applied.</param>
    /// <param name="position">The relative position of the force to the roboypart.</param>
    /// <param name="force">The direction and the amount of force relative to roboypart.</param>
    /// <param name="duration">The duration for which the force should be applied.</param>
    public void ReceiveExternalForce(RoboyPart roboyPart, Vector3 position, Vector3 force, int duration)
    {
        ROSBridgeLib.custom_msgs.ExternalForceMsg msg =
            new ROSBridgeLib.custom_msgs.ExternalForceMsg(roboyPart.gameObject.name, unityPositionToGazebo(position), unityPositionToGazebo(force), duration);

        m_Ros.Publish(RoboyPosePublisher.GetMessageTopic(), msg);

        //Debug.Log(msg.ToYAMLString());
    }
예제 #2
0
 public static string ToYAMLString(ROSBridgeLib.custom_msgs.ExternalForceMsg msg)
 {
     return(msg.ToYAMLString());
 }