ProgramPositionEventArgs problem in PC SDK.
Hello eveybody!
I have ProgramPositionEventArgs Problem.
My development environment is,
OS : Windows 10
Develop Tool : Visual Studio 2015
ABBRobot : IRB 120
SDK version : RobotStudio 6.07
My code is,
public event ChangePosition_Delegate CP_Delegate = null;
private event EventHandler<ProgramPositionEventArgs> progpos_events;
ControllerInfoCollection controllers = scanner.Controllers;
...
I have ProgramPositionEventArgs Problem.
My development environment is,
OS : Windows 10
Develop Tool : Visual Studio 2015
ABBRobot : IRB 120
SDK version : RobotStudio 6.07
My code is,
public event ChangePosition_Delegate CP_Delegate = null;
private event EventHandler<ProgramPositionEventArgs> progpos_events;
this.scanner = new NetworkScanner();
this.scanner.Scan();
progpos_events = new EventHandler<ProgramPositionEventArgs>(this.PositionChangeEvent);ControllerInfoCollection controllers = scanner.Controllers;
...
tRob = controller.Rapid.GetTask("T_ROB1");
tRob.ProgramPointerChanged += progpos_events;
public void PositionChangeEvent(object sender, ProgramPositionEventArgs _position)
{
CP_Delegate(_position.Time.Millisecond.ToString());
}
then,
What is the program problem,
ProgramPosition event continue to occur...
ABB Robot move not! but, don't stop event.
Help me. please!
then,
What is the program problem,
ProgramPosition event continue to occur...
ABB Robot move not! but, don't stop event.
Help me. please!
0
Comments
-
Hi,maybe you have to use the Invoke method, like as follows:public void PositionChangeEvent(object sender, ProgramPositionEventArgs _position){if (this.InvokeRequired)
{
this.Invoke(new ProgramPositionEventHandler(PositionChangeEvent), sender, _position);
return;
}CP_Delegate(_position.Time.Millisecond.ToString());}Best regardsMicky
1 -
It's not clear what issue you are facing. If you just want to process time/position whenever the program pointer changes, below would be a cleaner approach-
public delegate void ChangePosition_Delegate(string input); public class MonitorProgramPosition { private Controller _robot; private ChangePosition_Delegate CP_Delegate = delegate (string input) { Console.WriteLine(input); }; // Just print input to console for testing // Event handler public void PositionChangeEvent(object sender, ProgramPositionEventArgs e) { CP_Delegate(e.Time.Millisecond.ToString()); } // Connect to controller and subscribe to event public MonitorProgramPosition(Guid robotGUID) { _robot = new Controller(robotGUID); _robot.Rapid.GetTask("T_ROB1").ProgramPointerChanged += PositionChangeEvent; } // Just keeps program open till any button is pressed public void Wait() { Console.ReadLine(); _robot.Rapid.GetTask("T_ROB1").ProgramPointerChanged -= PositionChangeEvent; _robot.Logoff(); _robot.Dispose(); } } class Program { static void Main(string[] args) { var ppMonitor = new MonitorProgramPosition(Guid.Parse(<YourRobotGUID>)); ppMonitor.Wait(); } }<br>
0 -
Thank you! Micky, DeepakP. I will try!0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings