I just discover the JumpRobotToLocation command which is want to use to check the minimum distance between the robot and some objects on the cell. Problem is i dont know how to use this command and the help on the SDk doesn't really help.
Could anyone show me an example on how to work with it?
thanks in advance.
Solved! Go to Solution.
The sample below implement JumpToLocation method (it is a little bit different from JumpRobotToLocation, but I believe you'll get what you want), which will jump a robot to a specific location:
TxObjectList robotList = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxRobot))); TxObjectList locList = TxApplication.ActiveDocument.OperationRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxLocationOperation))); TxRobot robot = robotList as TxRobot; TxOlpControllerUtilities utility = new TxOlpControllerUtilities(); ITxRoboticControllerServices services = utility.GetInterfaceImplementationFromController(robot.Controller.Name, typeof(ITxRoboticControllerServices), typeof(TxControllerAttribute), "ControllerName") as ITxRoboticControllerServices; TxJumpToLocationData data = new TxJumpToLocationData(); services.Init(robot); services.JumpToLocation(locList as ITxLocationOperation, data); TxApplication.RefreshDisplay();
Please check if this can help you
If you want to quickly check the distance between any object in a cell the use of the TxTransformation class can measure the distances between objects. I used it to create and take all the measurements for Fanuc DCS models.
If you need some code examples on this let me know.
Is there any way to do a continious measuring of distance? The way i do it right now is just by measuring once the robot has been moved to the Vialocation, so at the end i only get information for the via location and nothing in the path between 2 via location.
In order to use the TxTranformation class to define a transformation you have to use two locatable objects to compare to get a transformation.
There is a way to do what you are looking for. You can measure to the tool tip from the reference frame of you choice. The difficulty you will run into is how do you get the interface you are using to update as the robot is in movement. In order to accomplish that you have to create an event handler in the program that runs while the simulation is playing.
I will give a try to that, do you have any example of event handler that i can look at to get a better understanding of how is works?
Thanks for your help.
I tried this solution on a cell running process simulate from EMs (on version 13) and today i wanted to try it on a .psz file on standalone (on version 13.0.2) but this line is not working.
ITxRoboticControllerServices services = utility.GetInterfaceImplementationFromController(robot.Controller.Name, typeof(ITxRoboticControllerServices), typeof(TxControllerAttribute), "ControllerName") as ITxRoboticControllerServices;
After running that line, "services" is null and thefore when the program tries to execute
I get a Nullexception error code.
Any ideas on how to proceed with this?
Thanks for your help.
public void RegisterMoveForwardStarted(TxSimulationPlayer player)
player.SimulationEventStartedForward += new TxSimulationPlayer_SimulationEventStartedForwardEventHandler(MoveForward);
Then in the form's contructor...
Then the method that fires when the simulation starts.
public void MoveForward(Object sender, TxSimulationPlayer_SimulationEventStartedForwardEventArgs args)
TxSimulationPlayer player = sender as TxSimulationPlayer;
//TxRRSServicesProvider sprcs = new TxRRSServicesProvider(args.Operation.SimulatedObjects);
Look in the .NET .chm for other events like TxSimulationPlayer_SimulationEventStartedForwardEventHandler.
Contruct them like the above and you have a method that fires off when an even happens in Process Simulate.