Error creating PC SDK manual example
Comments
-
Hi there,
Well... Are you missing a using/reference?
Here try out this sample, its BasicScanApp, built in Visual Studio 2012 with PC SDK 5.60:
Rebuild it and run it and see if that works. If it does go back to your code and see over your references and your using statements.
John
Developer Center2 -
Thank you JohnYour application worked, I had the same references and still my application does not run, not to worry though I have used the example you gave me as a starting point.I have added a STOP button to the example and followed the PCSDK manual pg74-76 to change a RAPID bool variable from false to true:ABB.Robotics.Controllers.RapidDomain.Bool rapidBool;
ABB.Robotics.Controllers.RapidDomain.RapidData rd = controller.Rapid.GetRapidData("T_ROB1", "MainModule", "halt");
rapidBool.Value = false;
if (rd.Value is ABB.Robotics.Controllers.RapidDomain.Bool)
{
using (Mastership m = Mastership.Request(controller.Rapid))
{
rd.Value = rapidBool;
}
}however I get an error 'use of unassigned local variable 'rapidBool''My RAPID module does the following:Move to home positionWHILE (rapidBool=true) DOPath_10ENDWHILEMove to home positionI have attached the project too.Many Thanks0 -
Hi MechatronicsStudent,
You get that error because rapidBool declaration doesn't include the New keyword and thus is not instantiated by the constructor. You can do that in Visual Basic where it is done behind the scenes but you cannot do that in C#. This is your line:
ABB.Robotics.Controllers.RapidDomain.Bool rapidBool;
That is only an empty pointer of a specifc type, it does not contain an instantiated object. This is how the line should look like:
ABB.Robotics.Controllers.RapidDomain.Bool rapidBool = new ABB.Robotics.Controllers.RapidDomain.Bool();
Please see this MSDN article on constructors in C#.
http://msdn.microsoft.com/en-us/library/ace5hbzh.aspx
John
Developer Center0
Categories
- All Categories
- 5.5K RobotStudio
- 395 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)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings