RobotStudio event

RAB 5.08 questions

Hi,

I'm experementing with my first project in RAB 5.08 . I'm making som small projects to experiment with the different technologies that are involved. I manage to get my applications running in VFPU 5.08. I also manage to connect an ABB Label with a Rapid data using a apidDataBindingSource.

I however get problems when I try to directly read a num data from the controller. In the top of the application I have added:


Imports
ABB.Robotics.Controllers.RapidDomain

then I have an ABB Button and an ABB Label. In the button click event I have the following code:

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

  Dim MyData As RapidData

  MyData = AeroController.Rapid.GetRapidData("T_ROB1", "MainMod", "nCurrHeight")

End Sub

I have also tried:


MyData = AeroController.Rapid.GetTask(
"T_ROB1").GetModule("MainMod").GetRapidData("nCurrHeight")

and


TextBox3.Text = AeroController.Rapid.GetRapidData(
"T_ROB1", "MainMod", "nCurrHeight").ToString()

But I always get problems when running this in the VFPU. I get an error stating that:

"Object reference not set to an instance of an object"

The data I read is declared as a PERS num data.

Does anyone have an idea about this.

/Per M

 

 

 

Comments

  • Have you done a debug-step-through to see on which exact row you are getting the error?
    If not then I really recommend this.

    What I think is happening is that you declare MyData inside the button_click sub so it is only "alive" in that sub, then you try to manipulate it outside of the sub and that is when you get the reference error.

    Here you have a short example of a bool read/write that I just threw together for you on how to read/write to a bool. The principle is the same for num and strings.

    2007-06-07_163428_TpsViewBoolReadWrite.zip