Пример #1
0
    /// <summary>
    /// Sends a message to the simulation to apply an external force at 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, GazeboUtility.UnityPositionToGazebo(position), GazeboUtility.UnityPositionToGazebo(force), duration);

        ROSBridge.Instance.Publish(RoboyForcePublisher.GetMessageTopic(), msg);

        //Debug.Log(msg.ToYAMLString());
    }
Пример #2
0
    public void CreatePages(int motorCount, int pagesCount, RoboyPart roboyPart)
    {
        if (pagesCount < 1)
        {
            Debug.Log("Pages count cannot be smaller than 1!");
            return;
        }

        int motorCountLeft = motorCount;

        for (int i = 0; i < pagesCount; i++)
        {
            UIPanelPage panelPage = Instantiate(UIPanelPagePrefab, Vector3.zero, Quaternion.identity);
            panelPage.transform.SetParent(transform, false);
            panelPage.CreateGraphRenderers(motorCountLeft, i, PanelMode, roboyPart);
            PanelPages.Add(panelPage);
            panelPage.gameObject.SetActive(false);
            motorCountLeft = motorCountLeft - 4;
        }
    }
Пример #3
0
    //public void Initialize(List<float> values)
    //{
    //    transform.GetComponentsInChildren()
    //}

    public void CreateGraphRenderers(int motorCountLeft, int currentPage, ModeManager.Panelmode panelMode, RoboyPart roboyPart)
    {
        int motorsToCreate = Mathf.Min(4, motorCountLeft);

        for (int i = 0; i < motorsToCreate; i++)
        {
            GraphRenderer graphRenderer = Instantiate(GraphRendererPrefab, Vector3.zero, Quaternion.identity);
            graphRenderer.transform.SetParent(transform, false);

            string motorIndex = "Motor" + (i + currentPage * 4);

            graphRenderer.TextForValueName.text = motorIndex;

            //Debug.Log(motorIndex);

            graphRenderer.Initialize(roboyPart.Categories[panelMode].Motors[motorIndex].Values, 30, 0f);
            graphRenderer.Play();

            GraphRenderers.Add(graphRenderer);
        }
    }