/// <summary> /// Initializes a new instance of the Robot class with attached external axes. /// </summary> /// <param name="name"> The name. </param> /// <param name="meshes"> The base and links meshes defined in the world coorindate space. </param> /// <param name="internalAxisPlanes"> The internal axes planes defined in the world coorindate space. </param> /// <param name="internalAxisLimits"> The internal axes limit. </param> /// <param name="basePlane"> The position and orientation of the robot base in the world coordinate space. </param> /// <param name="mountingFrame"> The tool mounting frame definied in the world coordinate space. </param> /// <param name="tool"> The Robot Tool. </param> /// <param name="externalAxes"> The attached external axes. </param> public Robot(string name, List <Mesh> meshes, List <Plane> internalAxisPlanes, List <Interval> internalAxisLimits, Plane basePlane, Plane mountingFrame, RobotTool tool, List <ExternalAxis> externalAxes) { // Robot related fields _name = name; _meshes = meshes; _internalAxisPlanes = internalAxisPlanes; _internalAxisLimits = internalAxisLimits; _basePlane = basePlane; _mountingFrame = mountingFrame; // Tool related fields _tool = tool.Duplicate(); // Make a deep copy since we transform it later _meshes.Add(GetAttachedToolMesh()); CalculateAttachedToolPlane(); // External axis related fields _externalAxes = externalAxes; _externalAxisPlanes = new List <Plane>(); _externalAxisLimits = new List <Interval>(); UpdateExternalAxisFields(); // Transform Robot Tool to Mounting Frame Transform trans = Transform.PlaneToPlane(_tool.AttachmentPlane, _mountingFrame); _tool.Transform(trans); // Set kinematics _inverseKinematics = new InverseKinematics(new RobotTarget("init", Plane.WorldXY), this); _forwardKinematics = new ForwardKinematics(this); }
/// <summary> /// Initializes a new instance of the Robot Tool class by duplicating an existing Robot Tool instance. /// </summary> /// <param name="robotTool"> The Robot Tool instance to duplicate. </param> /// <param name="duplicateMesh"> Specifies whether the meshes should be duplicated. </param> public RobotTool(RobotTool robotTool, bool duplicateMesh = true) { _referenceType = robotTool.ReferenceType; _name = robotTool.Name; _attachmentPlane = new Plane(robotTool.AttachmentPlane); _toolPlane = new Plane(robotTool.ToolPlane); _robotHold = robotTool.RobotHold; _mass = robotTool.Mass; _centerOfGravity = new Plane(robotTool.CenterOfGravity); _centerOfGravityPosition = new Point3d(robotTool.CenterOfGravityPosition); _centerOfGravityOrientation = robotTool.CenterOfGravityOrientation; _inertia = new Vector3d(robotTool.Inertia); _position = new Point3d(robotTool.Position); _orientation = robotTool.Orientation; if (duplicateMesh == true) { _mesh = robotTool.Mesh.DuplicateMesh(); } else { } //_mesh = new Mesh(); } }
private List <Interval> _externalAxisLimits; // The external axis limit #endregion #region (de)serialization /// <summary> /// Protected constructor needed for deserialization of the object. /// </summary> /// <param name="info"> The SerializationInfo to extract the data from. </param> /// <param name="context"> The context of this deserialization. </param> protected Robot(SerializationInfo info, StreamingContext context) { _name = (string)info.GetValue("Name", typeof(string)); _meshes = (List <Mesh>)info.GetValue("Meshes", typeof(List <Mesh>)); _internalAxisPlanes = (List <Plane>)info.GetValue("Internal Axis Planes", typeof(List <Plane>)); _internalAxisLimits = (List <Interval>)info.GetValue("Internal Axis Limits", typeof(List <Interval>)); _basePlane = (Plane)info.GetValue("Base Plane", typeof(Plane)); _mountingFrame = (Plane)info.GetValue("Mounting Frame", typeof(Plane)); _tool = (RobotTool)info.GetValue("RobotTool", typeof(RobotTool)); _toolPlane = (Plane)info.GetValue("Tool Plane", typeof(Plane)); _externalAxes = (List <ExternalAxis>)info.GetValue("External Axis", typeof(List <ExternalAxis>)); _externalAxisPlanes = (List <Plane>)info.GetValue("External Axis Planes", typeof(List <Plane>)); _externalAxisLimits = (List <Interval>)info.GetValue("External Axis Limits", typeof(List <Interval>)); _inverseKinematics = new InverseKinematics(new RobotTarget("init", Plane.WorldXY), this); _forwardKinematics = new ForwardKinematics(this); }
/// <summary> /// Initializes a new instance of the Robot class by duplicating an existing Robot instance. /// </summary> /// <param name="robot"> The Robot instance to duplicate. </param> public Robot(Robot robot) { // Robot related fields _name = robot.Name; _meshes = robot.Meshes.ConvertAll(mesh => mesh.DuplicateMesh()); // This includes the tool mesh _internalAxisPlanes = new List <Plane>(robot.InternalAxisPlanes); _internalAxisLimits = new List <Interval>(robot.InternalAxisLimits); _basePlane = new Plane(robot.BasePlane); _mountingFrame = new Plane(robot.MountingFrame); // Tool related fields _tool = robot.Tool.Duplicate(); _toolPlane = new Plane(robot.ToolPlane); // External axis related fields _externalAxes = new List <ExternalAxis>(robot.ExternalAxes); //TODO: make deep copy _externalAxisPlanes = new List <Plane>(robot.ExternalAxisPlanes); _externalAxisLimits = new List <Interval>(robot.ExternalAxisLimits); // Kinematics _inverseKinematics = new InverseKinematics(robot.InverseKinematics.Movement.Duplicate(), this); _forwardKinematics = new ForwardKinematics(this, robot.ForwardKinematics.HideMesh); }
/// <summary> /// Returns a predefined ABB Robot preset. /// </summary> /// <param name="preset"> The Robot preset type. </param> /// <param name="positionPlane"> The position and orientation of the Robot in world coordinate space. </param> /// <param name="tool"> The Robot Tool. </param> /// <param name="externalAxes"> The external axes attached to the Robot. </param> /// <returns></returns> public static Robot GetRobotPreset(RobotPreset preset, Plane positionPlane, RobotTool tool, List <ExternalAxis> externalAxes = null) { // Check Robot Tool data if (tool == null) { tool = new RobotTool(); } // Check External Axes if (externalAxes == null) { externalAxes = new List <ExternalAxis>() { }; } else if (preset == RobotPreset.EMPTY) { return(new Robot()); } if (preset == RobotPreset.IRB1100_4_0475) { return(IRB1100_4_0475.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1100_4_058) { return(IRB1100_4_058.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB120_3_058) { return(IRB120_3_058.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1200_5_090) { return(IRB1200_5_090.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1200_7_070) { return(IRB1200_7_070.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1300_10_115) { return(IRB1300_10_115.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1300_11_090) { return(IRB1300_11_090.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1300_7_140) { return(IRB1300_7_140.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB140_6_081) { return(IRB140_6_081.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1600_X_120) { return(IRB1600_X_120.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1600_X_145) { return(IRB1600_X_145.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB1660ID_X_155) { return(IRB1660ID_X_155.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB2600_12_185) { return(IRB2600_12_185.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB2600_X_165) { return(IRB2600_X_165.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB2600ID_15_185) { return(IRB2600ID_15_185.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB2600ID_8_200) { return(IRB2600ID_8_200.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB4600_20_250) { return(IRB4600_20_250.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB4600_40_255) { return(IRB4600_40_255.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB4600_X_205) { return(IRB4600_X_205.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6620_150_220) { return(IRB6620_150_220.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6640_235_255) { return(IRB6640_235_255.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6650_125_320) { return(IRB6650_125_320.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6650_200_275) { return(IRB6650_200_275.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6650S_125_350) { return(IRB6650S_125_350.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6650S_200_300) { return(IRB6650S_200_300.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6650S_90_390) { return(IRB6650S_90_390.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_150_320) { return(IRB6700_150_320.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_155_285) { return(IRB6700_155_285.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_175_305) { return(IRB6700_175_305.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_200_260) { return(IRB6700_200_260.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_205_280) { return(IRB6700_205_280.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_235_265) { return(IRB6700_235_265.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_245_300) { return(IRB6700_245_300.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6700_300_270) { return(IRB6700_300_270.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6790_205_280) { return(IRB6790_205_280.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB6790_235_265) { return(IRB6790_235_265.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB7600_150_350) { return(IRB7600_150_350.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB7600_325_310) { return(IRB7600_325_310.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB7600_340_280) { return(IRB7600_340_280.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB7600_400_255) { return(IRB7600_400_255.GetRobot(positionPlane, tool, externalAxes)); } else if (preset == RobotPreset.IRB7600_500_255) { return(IRB7600_500_255.GetRobot(positionPlane, tool, externalAxes)); } else { throw new Exception("Could not find the data of the defined Robot preset type."); } }