Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.
How to solve the problem of reading robot data and new time? For example, get the 6-axis Angle value
XiaoEr
✭
How to solve the problem of reading robot data and new time?
For example, get the 6-axis Angle value synchronously.
Timer control card
0
Comments
-
Hi XiaoEr
You want to log the axis values at a given pace.
I propose creating an RobotStudio add-in.
Here is a dirty function I've created to read the values on joint value change, I hope at least it's a start for you
Good luck!
/Oskarpublic static void ReadJoints() { if (recording) return; mech = Station.ActiveStation.ActiveTask.Mechanism; td.delta_t *= Simulator.SimulationSpeed; mech.GetJointLimits(out td.jointLowerLimits, out td.jointUpperLimits); td.axisTranslations = new double[mech.Children.Count()][]; foreach (var child2 in mech.Children) { var child = child2 as IMechanismLink; Matrix4 ct = child.CorrectionTransform; if (child2.Name.StartsWith("Link") && child2.Name.Length == 5){ //TODO: less crappy link identification int linkId = child2.Name.ElementAt(4) - 49; td.axisTranslations[linkId] = ct.Translation.ToArray(); } } double[] jValues = mech.GetJointValues(); String jValues_text = String.Join(" | ", jValues.Select(j => Math.Round(j,2).ToString())); Logger.AddMessage("rs-addin: " +jValues_text); mech.JointValuesChanged += JointValuesHandler; recording = true; } private static void JointValuesHandler(object sender, EventArgs e) { double[] jValues = mech.GetJointValues(); if(DateTime.Now.Subtract(LastTimeStamp) > TimeSpan.FromSeconds(td.delta_t)) { jointList.Push(jValues); LastTimeStamp = DateTime.Now; } }
0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 15 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 365 IRC5
- 84 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 854 RAPID Programming
- 37 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings
