![RobotStudio event](https://new.abb.com/images/librariesprovider89/default-album/robotstudio-webinar-arc-welding.jpg)
Problem when modify robtarget through C#
![ctkhai](https://secure.gravatar.com/avatar/3d17b93d7b8c20d6208ff9b66b714c13/?default=https%3A%2F%2Fus.v-cdn.net%2F5020483%2Fuploads%2Fdefaultavatar%2FK2266OAKOLNC.jpg&rating=g&size=200)
ctkhai
✭
Dear All,
I'm doing a project which using C# to communicate with robot. I need to change the coordinate of the robot according of the input from customer. This is my first project with the pc sdk. Now I can read robtarget value and change "pos" value. But when I write back to rapid data it come out "An argument specified by the client is not valid for this type of operation." Please advice. Thanks
Here is my code:
scanner.Scan();
ControllerInfoCollection controllers = scanner.Controllers;
controller = new Controller(controllers[0]);
RobTarget rt = new RobTarget();
RapidData rp = controller.Rapid.GetRapidData("T_ROB1", "MainModule", "pA2");
if (controller.OperatingMode == ControllerOperatingMode.Auto)
{
using (Mastership m = Mastership.Request(controller.Rapid))
{
rt = (RobTarget)rp.Value;
rt.FillFromString2("[[342.7,120,289.71],[0.593903,-0.243372,-0.657579,-0.394511],[0,-1,2,0],[8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09,8.999999E+09]]");
rp.Value = rt; //Error here
}
}
else
{
MessageBox.Show("Automatic mode is required.");
}
}
catch (System.InvalidOperationException ex)
{
MessageBox.Show("Mastership is held by another client. " + ex.Message);
}
catch (System.Exception ex)
{
MessageBox.Show("Unexpected error occurred: " + ex.Message);
}
0
Answers
-
De RobTarget "pA2" has to be PERS and not CONST, is that the case?1
Categories
- All Categories
- 5.5K RobotStudio
- 397 UpFeed
- 18 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 319 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 804 RAPID Programming
- 4 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings