Problem when modify robtarget through C#
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
- 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