Write a Robtarget Help !!!
Dim c As New Controller()
Dim motion As MotionSystem = c.MotionSystem
Dim mech As MechanicalUnit = motion.GetActiveMechanicalUnit()
Dim robP As RobTarget
robP = mech.GetPosition(CoordinateSystemType.WorkObject)
Dim rdRobtarget As RapidData = c.Rapid.GetRapidData("T_ROB1", "SrvSysInit", "ptest")
Dim rtValue As RobTarget = DirectCast(rdRobtarget.Value, RobTarget)
rdRobtarget.WriteItem(robP)
i want to change ptest robtarget position to my current robtarget position but always an error not change my ptest robtarget what is the problem please help
0
Comments
-
Please post the error text.
Lennart H0 -
error code isobject reference not set to an instance of an objectSee the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
Message: Object reference not set to an instance of an object.System.NullReferenceException: Object reference not set to an instance of an object.
at ABB.Robotics.Controllers.RapidDomain.UserDefined.FillFromString(String newValue)
<--ABB.Robotics.InternalException at FillFromString in ABB.Robotics.Controllers.RapidDomain.UserDefined
at ABB.Robotics.Dcl.ExceptionHelp.ReThrowException(String objStr, String method, Exception exception, String[] additionalinfo)
at ABB.Robotics.Dcl.ExceptionHelp.GenerateException(String objStr, String method, Exception exception, String[] additionalinfo)
at ABB.Robotics.Dcl.ExceptionHelp.GenerateException(Object obj, String method, Exception exception, String[] additionalinfo)
at ABB.Robotics.Dcl.ExceptionHelp.GenerateException(Object obj, String method, Exception exception)
at ABB.Robotics.Controllers.RapidDomain.RapidData.ReadItem(Int32[] index)0 -
Are you trying to write to a RobTarget stored in an array? I put you the question because the WriteItem method is used when writing to a specific RobTarget that is stored in an array of RobTargets.
If this is not the case please find below code (C#) that will read the current position of the manipulator and then writes the data to a RobTarget variable.
m_MotionSystem = this.controller.MotionSystem;
m_MechanicalUnit = m_MotionSystem.ActiveMechanicalUnit;
RobTarget CurrPos = new RobTarget();
RobTarget rt = new RobTarget();
RapidData rd = this.controller.Rapid.GetRapidData("T_ROB1", "sample", "pTest");
CurrPos=m_MechanicalUnit.GetPosition(CoordinateSystemType.WorkObject);
rt=(ABB.Robotics.Controllers.RapidDomain.RobTarget)rd.Value;
rt = CurrPos;
this.m_master = Mastership.Request(this.controller.Rapid);
rd.Value = rt;
this.m_master.Dispose();Lennart H0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings