RobotStudio event

Array problem?

guds
guds
edited December 2015 in Developer Tools
I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.

The code below is to set the value of a Num Array in the controller.

These codes work fine with pcsdk.5.10, however, it just don't work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).

No error or exception appear but the values in controller remain unchanged.

I think these codes are very similar to those in the pcsdk example document.

Does anyone has an idea about what is going on?

                Num rapidNum1;
                Num rapidNum2;

                RapidData rd = controller.Rapid.GetTask("T_ROB1").GetModule("MainModule).GetRapidData("varArray1);
                ArrayData ad = (ArrayData)rd.Value;

                rapidNum1.Value = 123.45;
                rapidNum2.Value = 678.90;

                ad[0] =rapidNum1;
                ad[1] =rapidNum2;

                rd.Value= ad;

Comments

  • Hi

    Did you mouseover the variable in RAPID and checked 'Current value' from the mouseover dialog, sometimes the visual value is not refreshed.

    /Pavel
  • guds
    guds
    edited December 2015
    Hi,

    Thanks for your reply.  

    Yes, on flexpendent I always press "Refresh" button before visually reading the value to avoid this problem.

    And in PC environment (VS2012) I can always read the corresponding value after changing the value in flexpendent.

    So I assume that  "rd.value=xxxx" works for Num and String but doesn't work for Array in pcsdk.6.02.01???
  • For editing an array, I use the WriteItem method. In your case it will be something like:

    rd.WriteItem(rapidNum1, 0);
    rd.WriteItem(rapidNum2, 1);

    To be sure your array is defined as PERS? Maybe you can try if this is a solution...
  • guds said:
    I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.

    The code below is to set the value of a Num Array in the controller.

    These codes work fine with pcsdk.5.10, however, it just don't work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).

    No error or exception appear but the values in controller remain unchanged.

    I think these codes are very similar to those in the pcsdk example document.

    Does anyone has an idea about what is going on?

                    Num rapidNum1;
                    Num rapidNum2;

                    RapidData rd = controller.Rapid.GetTask("T_ROB1").GetModule("MainModule).GetRapidData("varArray1);
                    ArrayData ad = (ArrayData)rd.Value;

                    rapidNum1.Value = 123.45;
                    rapidNum2.Value = 678.90;

                    ad[0] =rapidNum1;
                    ad[1] =rapidNum2;

                    rd.Value= ad;

    Hi,guds
         To read RAPID data you need to log on to the controller. To modify RAPID data you must also request mastership of the Rapid domain.
    You could look here 
    http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm 
  • guds said:
    I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.

    The code below is to set the value of a Num Array in the controller.

    These codes work fine with pcsdk.5.10, however, it just don't work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).

    No error or exception appear but the values in controller remain unchanged.

    I think these codes are very similar to those in the pcsdk example document.

    Does anyone has an idea about what is going on?

                    Num rapidNum1;
                    Num rapidNum2;

                    RapidData rd = controller.Rapid.GetTask("T_ROB1").GetModule("MainModule).GetRapidData("varArray1);
                    ArrayData ad = (ArrayData)rd.Value;

                    rapidNum1.Value = 123.45;
                    rapidNum2.Value = 678.90;

                    ad[0] =rapidNum1;
                    ad[1] =rapidNum2;

                    rd.Value= ad;

    Hi,guds
         To read RAPID data you need to log on to the controller. To modify RAPID data you must also request mastership of the Rapid domain.
    You could look here 
    http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm