コード例 #1
0
    /// <summary>
    /// Initializes RobotLinks and sets a boolean to its Visuals dictionary,
    /// telling whether the model of individual visual was already imported (is type of box, cylinder, capsule)
    /// or not yet (is mesh - is going to be continually imported from ColladaImporter).
    /// </summary>
    public void LoadLinks()
    {
        // Get all UrdfLink components in builded Robot
        foreach (UrdfLink link in RobotModelGameObject.GetComponentsInChildren <UrdfLink>())
        {
            // Get all UrdfVisuals of each UrdfLink
            GameObject visualsGameObject          = link.gameObject.GetComponentInChildren <UrdfVisuals>().gameObject;
            Dictionary <UrdfVisual, bool> visuals = new Dictionary <UrdfVisual, bool>();
            // Traverse each UrdfVisual and set a boolean indicating whether its visual is already loaded (is of some basic type - box, cylinder, capsule)
            // or is going to be loaded by ColladaImporter (in case its type of mesh)
            foreach (UrdfVisual visual in visualsGameObject.GetComponentsInChildren <UrdfVisual>())
            {
                visuals.Add(visual, visual.GeometryType == GeometryTypes.Mesh ? false : true);
                // hide visual if it is mesh.. mesh will be displayed when fully loaded
                visual.gameObject.SetActive(visual.GeometryType == GeometryTypes.Mesh ? false : true);
            }

            UrdfJoint        urdfJoint   = link.GetComponent <UrdfJoint>();
            JointStateWriter jointWriter = null;
            if (urdfJoint != null)
            {
                if (urdfJoint.JointType != UrdfJoint.JointTypes.Fixed)
                {
                    jointWriter = urdfJoint.transform.AddComponentIfNotExists <JointStateWriter>();
                    Joints.Add(urdfJoint.JointName, link.gameObject.name);
                }
            }
            Links.Add(link.gameObject.name, new RobotLink(link.gameObject.name, urdfJoint, jointWriter, visuals, is_base_link: link.IsBaseLink));
        }
    }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     writer = GetComponentInParent <JointStateWriter>();
     if (writer == null)
     {
         Debug.Log("No Writer Component found in Module " + transform.parent.name);
     }
 }
コード例 #3
0
ファイル: RobotLink.cs プロジェクト: ZdenekM/arcor2_editor
 public RobotLink(string link_name, UrdfJoint urdf_joint, JointStateWriter joint_writer, Dictionary <UrdfVisual, bool> visuals_gameObject = null, bool is_base_link = false)
 {
     LinkName    = link_name;
     UrdfJoint   = urdf_joint;
     jointWriter = joint_writer;
     Visuals     = visuals_gameObject ?? new Dictionary <UrdfVisual, bool>();
     IsBaseLink  = is_base_link;
 }
コード例 #4
0
 public RobotLink(string link_name, UrdfJoint urdf_joint, JointStateWriter joint_writer, JointStateReader joint_reader, Dictionary <UrdfVisual, bool> visuals_gameObject = null, Dictionary <UrdfCollision, bool> collisions_gameObject = null, bool is_base_link = false, float scale = 1f)
 {
     LinkName    = link_name;
     UrdfJoint   = urdf_joint;
     jointWriter = joint_writer;
     jointReader = joint_reader;
     Visuals     = visuals_gameObject ?? new Dictionary <UrdfVisual, bool>();
     Collisions  = collisions_gameObject ?? new Dictionary <UrdfCollision, bool>();
     IsBaseLink  = is_base_link;
     LinkScale   = scale;
 }
コード例 #5
0
    void Start()
    {
        Register();

        yawWriter = yaw.GetComponent <JointStateWriter>();
        if (yawWriter == null)
        {
            Debug.Log("No Writer Component found in Module " + transform.parent.name);
        }

        pitchWriter = pitch.GetComponent <JointStateWriter>();
        if (pitchWriter == null)
        {
            Debug.Log("No Writer Component found in Module " + transform.parent.name);
        }
    }
コード例 #6
0
    void Start()
    {
        Register();

        leftWriter = leftHand.GetComponent <JointStateWriter>();
        if (leftWriter == null)
        {
            Debug.Log("No Writer Component found in Module " + transform.parent.name);
        }

        rightWriter = rightHand.GetComponent <JointStateWriter>();
        if (rightWriter == null)
        {
            Debug.Log("No Writer Component found in Module " + transform.parent.name);
        }
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     joint    = GetComponent <JointStateWriter>();
     newState = 0.0f;
 }