Array problem?
guds
✭
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;
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;
0
Comments
-
Hi
Did you mouseover the variable in RAPID and checked 'Current value' from the mouseover dialog, sometimes the visual value is not refreshed.
/Pavel0 -
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???0 -
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...
0 -
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;
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.htm0 -
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;
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.htm0
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