• No results found

Development environment

© Copyri ght 200 7 - 2009 ABB . All ri ghts res erved.

2.4. Development environment

Overview

This section presents an overview of the development environment used to create RAB applications for PC or the FlexPendant. In either case, you program and debug the application using Microsoft Visual Studio 2005 or 2008.

Microsoft .NET and Microsoft Visual Studio

Microsoft Visual Studio is supported by the .NET Framework. A core component of the .NET Framework is the common language runtime (CLR). It manages code execution, threads and memory, while also enforcing type safety.

Another major component is the Base Class Library, which is a comprehensive, object- oriented collection of reusable types. To become a skilled .NET programmer it is essential to learn the functionality offered by the Base Class Library.

It is not in the scope of this manual to teach how to use Visual Studio. For this purpose Msdn (Microsoft Developer Network) at http://msdn.microsoft.com is a useful source of

information. NOTE!

From RAB 5.11 Visual Studio 2008 is also supported. See Conversion of VS 2005 projects to Visual Studio 2008 on page 33 for information about upgrading an existing RAB project to Visual Studio 2008.

Visual design support and data binding

The most significant improvement of Robot Application Builder with Visual Studio 2005 was the visual design support for FlexPendant applications. Thanks to enhanced abilities of the .NET Compact Framework 2.0. for building user interfaces, FlexPendant specific controls are available in the Visual Studio toolbox since RAB 5.08.

Another very useful feature of .NET CF 2.0 is data binding, which allows you to connect a

RapidDataBindingSource or a SignalBindingSource to a GUI control without having to write a single line of code. (Except the Dispose call when the binding sources are no longer needed.)

2.4. Development environment © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved.

Choosing a programming language

Together with Visual Basic, C# is the most widely used.NET language.

C# is an object-oriented language derived from C, with some features from C++, Java and Visual Basic. It was designed for .NET and offers the power and richness of C++ along with the productivity of Visual Basic. Both PC and FlexPendant SDK are implemented using C#. As for FlexPendant SDK applications only C# and Visual Basic are supported. As for PC SDK applications, on the other hand, any of the .NET languages can be used. ABB support, however, is offered only in C# and Visual Basic. Likewise, in this manual there are code samples in C# and Visual Basic, but none in J# or Visual C++.

At run-time it does not matter which language you have used, as compiled .NET code is language independent. The source code compiles from a high-level language into

Intermediate Language (IL), which is then executed, at runtime, by the Common Language Runtime. This makes it possible to use different programming languages, even within the same application. See Definitions on page 18 for further explanation of .NET terms. NOTE!

It is presumed that you are already a .NET programmer. If not, you need to start by learning the programming language to be used. There are numerous books teaching C# and Visual Basic.

Integration with Visual Studio

When Robot Application Builder is installed on your computer, it is integrated with Visual Studio. You will notice when starting a new project, for example, that the project type /Smart Device/FlexPendant is available in the New Project window. When using the wizard to create a FlexPendant project, common SDK references are added to the project and some code is auto generated.

The visual design support for the FlexPendant will be accessible from the Toolbox in VS and work the same way as the design support for an ordinary Windows application. As for a PC application you use the standard design support. As you will see, using RAB is quite intuitive for a developer used to Visual Studio programming.

NOTE!

The help module is not integrated with the Visual Studio Help function. Pressing F1 when pointing at code, for example, will open the Visual Studio Programmer’s Reference or the .NET Framework Class Library for the specific language and topic. If your problem is RAB- related this will not help you.

TIP!

Depending on what kind of application you are working at, locate the FP SDK or PC SDK Reference. You will find it by clicking Windows’ Start button, then pointing at Programs > ABB Industrial IT > Robotics IT > Robot Application Builder 5.xx. Keep the reference file open while programming, as you will be needing it all the time.

2.5. Two development models - virtual and real © Copyri ght 200 7 - 2009 ABB . All ri ghts res erved.

2.5. Two development models - virtual and real

About this section

When trying out a custom application, you can either use a virtual robot controller or a real robot system. This section provides information on how to use both development models. Virtual robot technology

The virtual IRC5 of ABB’s RobotStudio allows the IRC5 controller software to execute on a PC, and supports RAB application developers with a purely virtual environment to be used for development, test and debug.

When you start the virtual IRC5 in RobotStudio, a virtual robot cabinet along with a virtual FlexPendant will appear on the PC screen.

As a real robot controller is normally not readily at hand for application development, virtual technology is very valuable.

Requirements for virtual environment

The following software components must be installed to develop, test and debug using the virtual environment:

• ABB RobotStudio (including the virtual IRC5 and RobotStudio Online)

• ABB Robot Application Builder

• Microsoft Visual Studio 2005 or 2008

Controller option PC Interface or FlexPendant Interface may not be needed in the virtual environment.

Requirements for real environment

The following software components must be installed to develop, test and debug using a real robot controller:

• ABB RobotStudio (RobotStudio Online is needed to create the robot system)

• ABB Robot Application Builder

• Microsoft Visual Studio 2005 or 2008

• Controller option PC Interface or FlexPendant Interface

• Network connection between PC and robot controller

For information about how to set up the network, see How to set up your PC to robot communication on page 27.

Virtual test and debug

Using the virtual environment a FlexPendant application executes on the Virtual FlexPendant as an assembly (dll). You start the application from the ABB menu of the Virtual FlexPendant just like you start it on the real FlexPendant.

A PC application, on the other hand, will run as an independent executable (exe). Using the virtual environment it targets the virtual IRC5 instead of a real robot controller.

Debugging is easy using the virtual IRC5 and Visual Studio. You attach the application process to Visual Studio, set a break point in the code and step through it as it executes. See

Debugging the virtual FlexPendant on page 282 for further information.