Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
Motion.java
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // MLPI - <Motion.java>
3 // -----------------------------------------------------------------------
4 // Copyright (c) 2012 Bosch Rexroth. All rights reserved.
5 // Redistribution and use in source and binary forms of this MLPI software
6 // (SW) provided to you, with or without modification, are permitted
7 // without prior approval provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code of SW must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form of SW must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // 3. User recognizes and acknowledges that it acquires no right,
17 // title or interest in or to any of the names or trademarks used in
18 // connection with the SW ("names") by virtue of this License and waives
19 // any right to or interest in the names. User recognizes and acknowledges
20 // that names of companies or names or products of companies displayed
21 // in the documentation of SW to indicate the interoperability of products
22 // with the SW are the names of their respective owners. The use of such
23 // names in the documentation of SW does not imply any sponsorship,
24 // approval, or endorsement by such companies of this product.
25 //
26 // 4. Modified code versions, i.e. any addition to or deletion from
27 // the substance or structure of the original code of the SW running
28 // the MLPI must be plainly marked as such and must not be misrepresented
29 // as being original SW.
30 //
31 // 5. The SW may only be used in connection with a Bosch Rexroth product.
32 //
33 // THIS INFORMATION IS PROVIDED BY BOSCH REXROTH CORPORATION "AS IS"
34 // AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING
35 // (BUT NOTLIMITED TO) ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
36 // FITNESS FOR ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WHILE THE
37 // INFORMATION PROVIDED IS BELIEVED TO BE ACCURATE, IT MAY INCLUDE
38 // ERRORS OR INACCURACIES.
39 // SUBJECT TO COMPULSORY STATUTORY PROVISIONS OF THE GERMAN LAW AS
40 // THE APPLICABLE LAW FOR THIS LICENSE BOSCH REXROTH CORPORATION WILL
41 // NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM THE USE OF
42 // THE SOFTWARE DISTRIBUTED HEREUNDER, INCLUDING BUT NOT LIMITED TO
43 // DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, AND CONSEQUENTIAL DAMAGES.
44 // -----------------------------------------------------------------------
45 //
55 //
56 // -----------------------------------------------------------------------
57 package com.boschrexroth.mlpi;
58 
59 import java.util.Vector;
60 
61 
66 public class Motion extends MlpiComponent {
67  /*
68  * Enums
69  */
82  public enum AxisType
83  {
84  AXISTYPE_VIRTUAL (0),
85  AXISTYPE_REAL (1),
86  AXISTYPE_ENCODER (2),
87  AXISTYPE_LINK (3),
88  AXISTYPE_CONTROLLER (4);
89 
90  private int _code;
91  int getCode() { return _code; }
92  AxisType(int code) { this._code = code; }
93  static AxisType valueOf(int code) {
94  for (AxisType value : values()) {
95  if (code == value.getCode()) return value;
96  }
97  return null;
98  }
99  }
100 
111  public enum SyncDirection
112  {
113  SYNC_SHORTESTWAY (0),
114  SYNC_CATCHUP (1),
115  SYNC_SLOWDOWN (2);
116 
117  private int _code;
118  int getCode() { return _code; }
119  SyncDirection(int code) { this._code = code; }
120  static SyncDirection valueOf(int code) {
121  for (SyncDirection value : values()) {
122  if (code == value.getCode()) return value;
123  }
124  return null;
125  }
126  }
127 
139  public enum SyncType
140  {
141  SYNC_RAMPIN_SHORTESTWAY (0),
142  SYNC_RAMPIN_CATCHUP (1),
143  SYNC_RAMPIN_SLOWDOWN (2),
144  SYNC_DIRECT (3);
145 
146  private int _code;
147  int getCode() { return _code; }
148  SyncType(int code) { this._code = code; }
149  static SyncType valueOf(int code) {
150  for (SyncType value : values()) {
151  if (code == value.getCode()) return value;
152  }
153  return null;
154  }
155  }
156 
168  public enum StartMode
169  {
170  STARTMODE_ABSOLUTE (0),
171  STARTMODE_RELATIVE (1),
172  STARTMODE_ABSOLUTE_RAMPIN (2),
173  STARTMODE_RELATIVE_RAMPIN (3);
174 
175  private int _code;
176  int getCode() { return _code; }
177  StartMode(int code) { this._code = code; }
178  static StartMode valueOf(int code) {
179  for (StartMode value : values()) {
180  if (code == value.getCode()) return value;
181  }
182  return null;
183  }
184  }
185 
196  {
197  EXECUTE_CYCLIC (0),
198  EXECUTE_SINGLE (1);
199 
200  private int _code;
201  int getCode() { return _code; }
202  ProfileExecutionMode(int code) { this._code = code; }
203  static ProfileExecutionMode valueOf(int code) {
204  for (ProfileExecutionMode value : values()) {
205  if (code == value.getCode()) return value;
206  }
207  return null;
208  }
209  }
210 
223  public enum ProfileStartPoint
224  {
225  SLAVE_ORIGIN_MASTER_ORIGIN (0),
226  SLAVE_CURRENT_MASTER_CURRENT (1),
227  SLAVE_ORIGIN_MASTER_CURRENT (2),
228  SLAVE_CURRENT_MASTER_ORIGIN (3),
229  SLAVE_RELATIVE_MASTER_ORIGIN (4);
230 
231  private int _code;
232  int getCode() { return _code; }
233  ProfileStartPoint(int code) { this._code = code; }
234  static ProfileStartPoint valueOf(int code) {
235  for (ProfileStartPoint value : values()) {
236  if (code == value.getCode()) return value;
237  }
238  return null;
239  }
240  }
241 
261  public enum AxisMode
262  {
263  AXIS_MODE_ACTIVE (0),
264  AXIS_MODE_PARKING (1),
265  AXIS_MODE_DEACTIVATED (2),
266  AXIS_MODE_ACTIVE_DECOUPLED (3),
267  AXIS_MODE_PARKING_DECOUPLED (4),
268  AXIS_MODE_DEACTIVATED_DECOUPLED (5),
269  AXIS_MODE_ACTIVE_PARAMETERIZATION (8),
270  AXIS_MODE_PARKING_PARAMETERIZATION (9),
271  AXIS_MODE_DEACTIVATED_PARAMETERIZATION (10),
272  AXIS_MODE_ACTIVE_DECOUPLED_PARAMETERIZATION (12),
273  AXIS_MODE_PARKING_DECOUPLED_PARAMETERIZATION (13),
274  AXIS_MODE_DEACTIVATED_DECOUPLED_PARAMETERIZATION(14);
275 
276  private int _code;
277  int getCode() { return _code; }
278  AxisMode(int code) { this._code = code; }
279  static AxisMode valueOf(int code) {
280  for (AxisMode value : values()) {
281  if (code == value.getCode()) return value;
282  }
283  return null;
284  }
285  }
286 
290  public enum CamTableId
291  {
292  CAM_TABLE_1 (1),
293  CAM_TABLE_2 (2),
294  CAM_TABLE_3 (3),
295  CAM_TABLE_4 (4),
296  CAM_TABLE_5 (5),
297  CAM_TABLE_6 (6),
298  CAM_TABLE_7 (7),
299  CAM_TABLE_8 (8),
300  CAM_TABLE_9 (9),
301  CAM_TABLE_10 (10),
302  CAM_TABLE_11 (11),
303  CAM_TABLE_12 (12),
304  CAM_TABLE_13 (13),
305  CAM_TABLE_14 (14),
306  CAM_TABLE_15 (15),
307  CAM_TABLE_16 (16),
308  CAM_TABLE_17 (17),
309  CAM_TABLE_18 (18),
310  CAM_TABLE_19 (19),
311  CAM_TABLE_20 (20),
312  CAM_TABLE_21 (21),
313  CAM_TABLE_22 (22),
314  CAM_TABLE_23 (23),
315  CAM_TABLE_24 (24),
316  CAM_TABLE_25 (25),
317  CAM_TABLE_26 (26),
318  CAM_TABLE_27 (27),
319  CAM_TABLE_28 (28),
320  CAM_TABLE_29 (29),
321  CAM_TABLE_30 (30),
322  CAM_TABLE_31 (31),
323  CAM_TABLE_32 (32),
324  CAM_TABLE_33 (33),
325  CAM_TABLE_34 (34),
326  CAM_TABLE_35 (35),
327  CAM_TABLE_36 (36),
328  CAM_TABLE_37 (37),
329  CAM_TABLE_38 (38),
330  CAM_TABLE_39 (39),
331  CAM_TABLE_40 (40),
332  CAM_TABLE_41 (41),
333  CAM_TABLE_42 (42),
334  CAM_TABLE_43 (43),
335  CAM_TABLE_44 (44),
336  CAM_TABLE_45 (45),
337  CAM_TABLE_46 (46),
338  CAM_TABLE_47 (47),
339  CAM_TABLE_48 (48),
340  CAM_TABLE_49 (49),
341  CAM_TABLE_50 (50),
342  CAM_TABLE_51 (51),
343  CAM_TABLE_52 (52),
344  CAM_TABLE_53 (53),
345  CAM_TABLE_54 (54),
346  CAM_TABLE_55 (55),
347  CAM_TABLE_56 (56),
348  CAM_TABLE_57 (57),
349  CAM_TABLE_58 (58),
350  CAM_TABLE_59 (59),
351  CAM_TABLE_60 (60),
352  CAM_TABLE_61 (61),
353  CAM_TABLE_62 (62),
354  CAM_TABLE_63 (63),
355  CAM_TABLE_64 (64),
356  CAM_TABLE_65 (65),
357  CAM_TABLE_66 (66),
358  CAM_TABLE_67 (67),
359  CAM_TABLE_68 (68),
360  CAM_TABLE_69 (69),
361  CAM_TABLE_70 (70),
362  CAM_TABLE_71 (71),
363  CAM_TABLE_72 (72),
364  CAM_TABLE_73 (73),
365  CAM_TABLE_74 (74),
366  CAM_TABLE_75 (75),
367  CAM_TABLE_76 (76),
368  CAM_TABLE_77 (77),
369  CAM_TABLE_78 (78),
370  CAM_TABLE_79 (79),
371  CAM_TABLE_80 (80),
372  CAM_TABLE_81 (81),
373  CAM_TABLE_82 (82),
374  CAM_TABLE_83 (83),
375  CAM_TABLE_84 (84),
376  CAM_TABLE_85 (85),
377  CAM_TABLE_86 (86),
378  CAM_TABLE_87 (87),
379  CAM_TABLE_88 (88),
380  CAM_TABLE_89 (89),
381  CAM_TABLE_90 (90),
382  CAM_TABLE_91 (91),
383  CAM_TABLE_92 (92),
384  CAM_TABLE_93 (93),
385  CAM_TABLE_94 (94),
386  CAM_TABLE_95 (95),
387  CAM_TABLE_96 (96),
388  CAM_TABLE_97 (97),
389  CAM_TABLE_98 (98),
390  CAM_TABLE_99 (99),
391  CAM_TABLE_100 (100);
392 
393  private int _code;
394  int getCode() { return _code; }
395  CamTableId(int code) { this._code = code; }
396  static CamTableId valueOf(int code) {
397  for (CamTableId value : values()) {
398  if (code == value.getCode()) return value;
399  }
400  return null;
401  }
402  }
403 
404  /*
405  * Structs
406  */
417  public static class AxisRef
418  {
419  public AxisRef(int axisNo) {
420  this.axisNo = (short) axisNo;
421  this.controlNo = 0;
422  }
423  public AxisRef(short axisNo) {
424  this.axisNo = axisNo;
425  this.controlNo = 0;
426  }
427  public AxisRef(int controlNo, int axisNo) {
428  this.axisNo = (short) axisNo;
429  this.controlNo = (short) controlNo;
430  }
431  public AxisRef(short controlNo, short axisNo) {
432  this.axisNo = axisNo;
433  this.controlNo = controlNo;
434  }
435  public short controlNo;
436  public short axisNo;
437  }
438 
451  public static class AxisInformation
452  {
453  public AxisRef axis = new AxisRef(0);
454  public int deviceAddress;
455  public AxisType axisType;
456  public String name;
457  }
458 
475  public static class AxisValues
476  {
477  public double actualPosition;
478  public double actualVelocity;
479  public double actualAcceleration;
480  public double actualTorque;
481  public int state;
482  public int stateExtended;
483  public int diagnosisNumber;
484  public int condition;
485  }
486 
500  public static class AxisUnits
501  {
502  public String position;
503  public String velocity;
504  public String acceleration;
505  public String jerk;
506  public String torque;
507  }
508 
521  public static class AxisStatus
522  {
523  public long state;
524  public int stateExtended;
525  public int diagnosisNumber;
526  public int condition;
527  }
528  /*
529  * Fields
530  */
531  Vector<Axis> _axes = new Vector<Axis>();
532 
533  /*
534  * Methods
535  */
536  Motion(MlpiHandle connection) {
537  super(connection);
538  }
539 
551  public Axis axes(short axisNo) {
552  return axes((int)axisNo);
553  }
554  public synchronized Axis axes(int axisNo) {
555  Axis axis = null;
556  if (axisNo > 0) {
557  if (axisNo <= _axes.size()) {
558  axis = _axes.get(axisNo-1);
559  }
560  if (axis == null) {
561  axis = new Axis(getConnectionHandleObject(), new AxisRef(axisNo));
562  if (axisNo > _axes.size()) {
563  for (int i=_axes.size(); i<axisNo; i++){
564  _axes.add(null);
565  }
566  }
567  _axes.set(axisNo-1, axis);
568  }
569  }
570  else {
571  throw new RuntimeException("Logical axis number '" + axisNo + "' out of minimum range.");
572  }
573  return axis;
574  }
575 
594  public native AxisInformation[] getConfiguredAxes();
595 
630  public native AxisValues[] getAxisValues(AxisRef[] axes);
631 
645  public native AxisUnits[] getAxisUnits(AxisRef[] axes);
646 
676  public native AxisStatus[] getAxisStatus(AxisRef[] axes);
677 }
678 
679 
This enumeration defines the method with which synchronization takes place.
Definition: Motion.java:168
This enumeration defines how the flex profile is executed.
Definition: Motion.java:195
This class defines the axis through the definition of control and axis number.
Definition: Motion.java:417
Structure containing units of an axis as strings. You may want to use this structure to read all unit...
Definition: Motion.java:500
This enumeration defines the available cam numbers. The cams actually available depend on the hardwar...
Definition: Motion.java:290
native AxisUnits[] getAxisUnits(AxisRef[] axes)
Axis axes(short axisNo)
Definition: Motion.java:551
Structure containing status information about an axis. These values do change as soon as the axis is ...
Definition: Motion.java:521
This enumeration defines the direction and type in which synchronization takes place. Only for FlexProfile!
Definition: Motion.java:139
This enumeration defines the type of axis.
Definition: Motion.java:82
This enumeration defines the state of an axis. When disabled, the device connected to the axis cannot...
Definition: Motion.java:261
Structure containing operation information about an axis. These values do change as soon as the axis ...
Definition: Motion.java:475
native AxisValues[] getAxisValues(AxisRef[] axes)
This enumeration defines the direction in which synchronization takes place.
Definition: Motion.java:111
native AxisStatus[] getAxisStatus(AxisRef[] axes)
This enumeration defines the method of how a flex profile interprets the start point.
Definition: Motion.java:223
Class definition of the MotionLib.
Definition: Motion.java:66
native AxisInformation[] getConfiguredAxes()
This class defines information about a configured axis. These values do not change, once the axis is in operation mode.
Definition: Motion.java:451