Read/Write array of robtarget with PCSDK
How can you read/write to a large array of robtargets in the PCSDK?
Whenever I try to access an array of > 6 robtargets, the following exception gets thrown:
ABB.Robotics.Controllers.ControllerBufferOverflowException: The amount of data is to large to fulfill the request. Here an example of my code (if I change the testRobs array to {7} and add two more positions, the exception will be thrown):
==Rapid Variable===
PERS robtarget testRobs{5}:=[ [[0,0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],
[[1,0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],
[[2,0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],
[[3,0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],
[[4,0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]];
==C# Code===
ABB.Robotics.Controllers.RapidDomain.RapidData arr = controller.Rapid.GetRapidData("T_ROB1", "sVars", "testRobs");
if (arr.IsArray)
{ ArrayData ad = (ArrayData)arr.Value;int aRank = ad.Rank; int len1 = ad.Length;
ArrayModes am = ad.Mode;Debug.WriteLine("Rank: " + aRank);
Debug.WriteLine("Len: " + len1);
Debug.WriteLine("Mode: " + am.ToString());
int i = 0; for (i = 0; i < len1; i++)
{string a = "[[" + i + ",0,0],[0.218963,0.314159,2.75,-0.0510062],[-1,0,-1,0],[8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09]]";
ad[i].FillFromString(a); Debug.WriteLine(a); }using (Mastership.Request(controller.Rapid))
{ arr.Value = ad; } }Comments
-
The formatting stinks... sorry. It seems to be a packet size/timing issue. It seems like the max robtarget array size is indeed limited.0
-
Dear Friend: There are a method can solve your problem,that is : read the data file form robot to local computer and then analys the data file ,get the array data of your need ,if any problem please contact with me with hesitate Martin-jie.zhang@cn.abb.com from china0
-
Formatting support back on the forum but still not perfect for code. I formatted the initial post a bit.0
-
I have the same problem, too. Are there any solution???
0 -
Hello,
have you tried to use the method "ReadItem" or "WriteItem"?
Example:
The following example updates the data of a RECORD in an array by using ReadItem and WriteItem:ABB.Robotics.Controllers.RapidDomain.RapidData arr = controller.Rapid.GetRapidData("T_ROB1", "sVars", "testRobs");
/BR
if (arr.IsArray)
{
//Update the 6. item in the array
UserDefined ud = (UserDefined)arr.ReadItem(6))
using (UserDefined ud = (UserDefined)arr.ReadItem(6))
{
//set new sync position
ud.Components[1].FillFromString(Position.ToString());
//Update the Rapid array
arr.WriteItem(ud, 6);
}
}
Micky
0 -
Micky said:Hello,
have you tried to use the method "ReadItem" or "WriteItem"?
Example:
The following example updates the data of a RECORD in an array by using ReadItem and WriteItem:ABB.Robotics.Controllers.RapidDomain.RapidData arr = controller.Rapid.GetRapidData("T_ROB1", "sVars", "testRobs");
/BR
if (arr.IsArray)
{
//Update the 6. item in the array
UserDefined ud = (UserDefined)arr.ReadItem(6))
using (UserDefined ud = (UserDefined)arr.ReadItem(6))
{
//set new sync position
ud.Components[1].FillFromString(Position.ToString());
//Update the Rapid array
arr.WriteItem(ud, 6);
}
}
Micky
Do you need Request Mastership to change the variable?0 -
Hello Baijun,
as described in the "PC SDK Application manual" on the website:
http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html%2ffa1e625e-74df-4847-9f55-72a51661e34f.htm
you have to request mastership of the RAPID domain if you want to modify RAPID data.
To read RAPID data you need to log on to the controller.
/BR
Micky
0
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