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.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