public List <IO.Swagger.Model.Joint> GetJoints() { if (RobotModel == null) { // if urdf model is still loading, return empty joint list if (modelLoading) { return(new List <IO.Swagger.Model.Joint>()); } else { throw new RequestFailedException("Model not found for this robot."); } } else { return(RobotModel.GetJoints()); } }
/// <summary> /// Checks if the joint names in joints corresponds to the joint names in RobotModel. /// </summary> /// <param name="joints"></param> /// <returns>True if joints have equal names, false if not.</returns> public bool CheckJointsAreValid(List <IO.Swagger.Model.Joint> joints) { if (RobotModel != null) { List <string> receivedJoints = new List <string>(); foreach (IO.Swagger.Model.Joint joint in joints) { receivedJoints.Add(joint.Name); } foreach (string jointName in RobotModel.Joints.Keys) { receivedJoints.Remove(jointName); } if (receivedJoints.Count != 0) { Debug.LogError("Received wrong joints: " + string.Join(",", joints) + " .. but expected: " + string.Join(",", RobotModel.GetJoints())); Notifications.Instance.ShowNotification("Received wrong joints!", "Received:" + string.Join(",", joints) + ".. but expected: " + string.Join(",", RobotModel.GetJoints())); return(false); } else { return(true); } } else { //Debug.LogError("Trying to set joint values, but robot urdf model is not loaded nor assigned."); } return(false); }