How can I read from running robot with the C#? From RobotStudion/controller.
EugeneB
✭
How can I read from running robot with the C#? From RobotStudion/controller. I can connect to it but I can not read from it. I would like to read some information with C# when it's running - which program is running, logs, errors.
0
Best Answer
-
Hello Eugene
you will find detailed description in the API reference at the follwoing link:
http://developercenter.robotstudio.com/pcsdk/api_reference
Follow the menu on the left side --> Manual / using the PC SDK / Event log domain
The event log is descibed in the API reference in the following namespace "ABB.Robotics.Controllers.EventLogDomain"
On this website you will fond source code examples and tutorials and small Visual Studio projects
Regards
Micky
1
Answers
-
Hi,
you have to use the PC-SDK.
Detailed information and tutorials could be found on the following web site:
http://developercenter.robotstudio.com/pcsdk/gettingstarted
BR
Micky
0 -
The things which you are wanting to see are available from robotstudio if you connect it to the controller.Lee Justice0
-
Thanks Micky.
How can I read logs? Can you help me out with this? Which class/methods I should use?
I'm an entry level with the C#, I'll apritiate0 -
Thanks Micky.
How can I read logs? Can you help me out with this? Which class/methods I should use?
I'm an entry level with the C#, I'll apritiate0 -
Thanks Micky.
How can I read logs? Can you help me out with this? Which class/methods I should use?
I'm an entry level with the C#, I'll appreciate any help.0 -
Mike,
How can I use EventLog class from ABB.Robotics.Controllers.EventLogDomain namespace to print all or some events from the controller which was found on the network with the NetworkScanner?0 -
Hi,
enclosed you will find an example how to read all elogs from a connected controller and shows the error number and the title in a list view.
You have to connect and login to the connected controller (_ctrl) before you could read the elogs.
It is also possible to read only one category instead of all. In this case you have to user the methode ".GetCategory(CategoryType.Common);" to read only the commen elogs
private void ReadELogAll()
{
EventLog log = _ctrl.EventLog;
lsvELog.Items.Clear();
var categories = log.GetCategories();
foreach (var cat in categories)
{
foreach (EventLogMessage emsg in cat.Messages)
{
var item = new ListViewItem((emsg.CategoryId * 10000 + emsg.Number).ToString());
item.SubItems.Add(emsg.Title);
lsvELog.Items.Add(item);
}
cat.Dispose();
}
}
0 -
Mike,
Thank you for your response.
Questions.
In your code isvELog.Items.Clea(); - What is a isvELog? Is it an object of the class? I have an error on it.
var item = new ListViewItem((emsg.CategoryId * 10000 + emsg.Number).ToString()); - What is ListViewItem? I have an error on it. Is it an object of the class? I have an error on it.
Thank you so much for your help.
Eugene0 -
Hi,
lsvELog is an instance of a listview for windows forms
this.lsvELog = new System.Windows.Forms.ListView();
See documentation: https://msdn.microsoft.com/en-us/library/system.windows.forms.listview(v=vs.110).aspx
ListViewItem is an item element of the list view and an instance of the folliwng class System.Windows.Forms.ListViewItem
See documentation
https://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem(v=vs.110).aspx
You could remove the listview related stuff and show the data from the elog collection where ever you want.
Br
Micky
0 -
Micky,
You know how can I pull info from the controller about which module is started running and when it started and stopped?
0 -
Micky,
At this point, I'm trying to print everything on the console, not using windows form. So I can see how it's working, and after that, I will start exploring further.
How can I print on the console app?
I really appreciate your help Micky.
Eugene0 -
Micky,
I think I figured it out.
I have another question.
How can I pull info from the controller about which module is started running and when it started?
Thank you very much,
0 -
Hello Eugene,
here is a program example which give you all the requested answers:
private static void RobotTest(ControllerInfo ctrlinfo)
{
_ctrl = ControllerFactory.CreateFrom(ctrlinfo);
//Login to the controller
_ctrl.Logon(UserInfo.DefaultUser);
System.Console.WriteLine("Login as 'Default User'");
Console.WriteLine("Operating mode: \t" + _ctrl.OperatingMode.ToString());
Console.WriteLine("State:\t\t\t" + _ctrl.State.ToString());
Console.WriteLine("Execution status:\t" + _ctrl.Rapid.ExecutionStatus.ToString());
Console.WriteLine("");
if (_ctrl.Rapid.ExecutionStatus == ExecutionStatus.Running)
Console.WriteLine("Program is running");
if (_ctrl.Rapid.ExecutionStatus == ExecutionStatus.Stopped)
Console.WriteLine("Program is stopped");
Console.WriteLine("");
//Book events to get info if an status changes
_ctrl.OperatingModeChanged += _ctrl_OperatingModeChanged;
_ctrl.StateChanged += _ctrl_StateChanged;
_ctrl.Rapid.ExecutionStatusChanged += Rapid_ExecutionStatusChanged;
using (ABB.Robotics.Controllers.RapidDomain.Task tsk = _ctrl.Rapid.GetTask("T_ROB1"))
{
//Use event for program pointer changed to get the information which routine is executed
tsk.ProgramPointerChanged += Tsk_ProgramPointerChanged;
//Position of the program pointer
var pp = tsk.ProgramPointer;
Console.WriteLine("Program pointer: \t\tModule: {0}, Routine: {1}", pp.Module, pp.Routine);
Console.WriteLine("");
Console.ReadLine();
}
}
private static void Tsk_ProgramPointerChanged(object sender, ProgramPositionEventArgs e)
{
Console.WriteLine("Tsk_ProgramPointerChanged: \tModule: {0}, Routine: {1}", e.Position.Module, e.Position.Routine);
Console.WriteLine("");
}
private static void Rapid_ExecutionStatusChanged(object sender, ABB.Robotics.Controllers.RapidDomain.ExecutionStatusChangedEventArgs e)
{
Console.WriteLine("Rapid_ExecutionStatusChanged: \t" + e.Status.ToString());
Console.WriteLine("");
}
private static void _ctrl_StateChanged(object sender, StateChangedEventArgs e)
{
Console.WriteLine("_ctrl_StateChanged: \t\t" + e.NewState.ToString());
Console.WriteLine("");
}
private static void _ctrl_OperatingModeChanged(object sender, OperatingModeChangeEventArgs e)
{
Console.WriteLine("_ctrl_OperatingModeChanged: \t" + e.NewMode.ToString());
Console.WriteLine("");
}
/BR
Micky
1 -
Micky,
Thank you so much for all your help.
Maybe you can help me with this too.
With pc sdk on the windows form - how can I give an operator option to select the program to run? I know it must be associated with PartData. How can I set up this?
And another one. How can I make TPReadFK or UIMsgBox with pc sdk on the windows form to inform operators about something, and give them the option to select from?
With your help, I start to understand/learn little by little pc sdk.
Thank you Micky.0 -
Question 1: th pc sdk on the windows form - how can I give an operator option to select the program to run? I know it must be associated with PartData.I assume you are http:// using the option "Production Manager" because its uses the partdata.As you should know from the manual, you could define a plc interface in the PROC.CFG of the robot.That means, you could use a group input for the program number and an input as start signal to select a partdata for executing.1. Define a virtual group input with Access level "ALL" in the EIO.CFG2. Defina a virtual digital input with Access level "ALL" in the EIO.CFG3. Assign the signal name of the group input as "PLC group in signal" in the PROC.CFG (Production Manager ApI Commands)of the "Production Manager" System parameter4. Assign digital input as start signal "RunPart in signal" in the PROC.CFG (Production Manager ApI Commands) of the "Production Manager" System parameter5. Define partdata mit valid program numbers in your program.Pleaser refer the manual of the "Production Manager" (chapter 4.1.4, page 64) or the manual "Systemparameters" if you need additional help6. In your PC program you search all "partdata" declaration in the robot controller task (e.g. "T_ROB1") by using the method "SearchRapidSymbol"You will find a example on the following website7. You create a RapidData for each found rapid symbol in the array. Use the scope array to get the task, module and data name.8. Read the userdefined data (partdata) from the RapidData, see examples on following website:9. Read the description of the partdata and the program code from the user defined data10. If you are use a listview to present your data to the customer add the text in the "item.Text" and the program number in the "item.tag" property11. If user selects an item in the list view, get the program number from the tag property of the selected item and cast it to an unsigned integer value (uint)12. Set the program number to previously created virtual group input signalSee manual on the following website http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/455b4712-8d1d-499b-90ef-72a2e4209563.htm
13. Set the digital signal "RunPart" to 1.14. If program of the robot is not running you must start it15. Your selected partdata program on the robot should start running.Do not forget to dispose all RapidSymbol, RapidData and Signal as you do not need it any longer.0 -
Question: How can I make TPReadFK or UIMsgBox with pc sdk on the windows form to inform operators about something, and give them the option to select from?
Please read the following description on the
http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/ae435101-731d-4fb3-be77-96e70b9aff19.htm
0 -
Thanks Micky
I will try this.0 -
Micky,
Can I do all of those Production Manager ApI Commands inside RobotStudio?
0 -
Hello,yes, you can use RobotStudio to configure the system parameters (Node "Configuration" in the treeview of the ribbon "Controller" of the active controllerEverything is described in the manual of the Production Manager in chapter 4.1.BRMicky0
-
Hi Micky,
Maybe you have an example of the pc sdk for user selection which program to run? And/or basic pack&go set up and 100% functional for start developing pc sdk? When I start working on some projects like this one is much faster/better for me to understand from an example. My robot studio pack&go set up not working proparly and I can not start working on my GUI. I'm stuck.0 -
Hi,in the developer center of the SDK you will find several YouTube videos and program examples which describes in detail how you could start.A possible concept how to select and start a program is described above.Maybe you should hire a specialist who can do the programming for you./BRMicky
0 -
That's the point. I would like to learn and know how to do it my self.
I did not figure it out how to set up RobotStudio properly. And after that, I need to figure it out about pc sdk set up. I need little help with that.0 -
Micky,
Maybe you know how can I pull a variable from the module with C#? I need to make an instance of RapidData class and use the GetRapidData
(RapidData rd = controller.Rapid.GetRapidData("T_ROB1", "ModuleName","variableName")) or I need to do something else?0 -
Hello,You can get an example in this experimental SmartComponent:If you've got remarks on it, you (and other) can make issue before I post it to RobotApps.
0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings