Hello everyone,
I was following tutorial in the PC SDK Manual and I want to read the current TCP pose in C# with the following:
public void Read_Current_Pose()
{
NetworkScanner scanner = new NetworkScanner(); scanner.Scan();
Controller acontroller = new Controller(scanner.Controllers[0].SystemId);
acontroller.Logon(UserInfo.DefaultUser);
MotionSystem aMotionSystem = acontroller.MotionSystem;
MechanicalUnitCollection aMechCol = acontroller.MotionSystem.MechanicalUnits;
MechanicalUnit aMechUnit = acontroller.MotionSystem.ActiveMechanicalUnit;
try
{
if (acontroller.OperatingMode == ControllerOperatingMode.Auto)
{
using (Mastership m = Mastership.Request(acontroller.Rapid))
{
RobTarget CurrPos = acontroller.MotionSystem.ActiveMechanicalUnit.GetPosition(CoordinateSystemType.WorkObject);
RapidData rd = acontroller.Rapid.GetRapidData(“T_ROB1”, “Module1”, “rbt”)
CurrPos = (RobTarget)rd.Value;
Console.WriteLine(CurrPos);
}
}
}
}
I wrote rbt:= CRobT(\Tool:=MyTool \WObj:=wobj0); from RAPID but I am not sure if that is the way to write it to get pose. I want to get the current TCP matrix, but when I printed the output it was not was I expected, as I got this output : [[1587.428550103,-522.655533591,0],[0,0,1,0],[-1,1,-2,0],[9E9,9E9,9E9,9E9,9E9,9E9]];. Please what am I doing wrong?
Any help will be appreciated. Thank you.
David