public UrdfNode(UrdfNode parent, Link link, RosSharp.Urdf.Joint joint) { _children = new List <UrdfNode>(); _parent = parent; _link = link; _joint = joint; }
/// <summary> /// <para>SetParent</para> /// Sets the parent of this node. /// </summary> /// <param name="parent"> /// Fully specified UrdfNode to be the parent. /// Cannot be the same node you are calling the /// function from. /// </param> /// <returns> /// True if the parent was successfully set, /// false if otherwise. /// </returns> public bool SetParent(UrdfNode parent) { // Cant set a node with the same link as a parent // of itself if (this._link == parent._link) { return(false); } this._parent = parent; return(true); }
/// <summary> /// <para>AddChild</para> /// Adds a child node to this node. /// </summary> /// <param name="child"> /// Fully defined UrdfNode to be /// added as the child. /// </param> public void AddChild(UrdfNode child) { _children.Add(child); }
/// <summary> /// <para>HasChild</para> /// Tests to see whether or not this node has a specific child. /// </summary> /// <param name="node">UrdfNode containing the node in question.</param> /// <returns>True if node is a child, false if not</returns> public bool HasChild(UrdfNode node) { return(_children.Contains(node)); }