Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/check_segment_8py_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 02:39:16 2016
Кодировка:
lsst.tcc: python/tcc/mov/checkSegment.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
checkSegment.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 import tcc.base
4 from .pathSegment import PathSegment
5 
6 __all__ = ["checkSegment"]
7 
8 def checkSegment(pA, vA, pB, vB, dt, doPos, doVel, doAccel, doJerk, axisLim):
9  """!Check a suggested path segment of constant jerk
10 
11  @param[in] pA position of starting point at time t = 0
12  @param[in] vA velocity of starting point at time t = 0
13  @param[in] pB position of ending point at time t = dt
14  @param[in] vB velocity of ending point at time t = dt
15  @param[in] dt duration of motion
16  @param[in] doPos log test position?
17  @param[in] doVel log test velocity?
18  @param[in] doAccel log test acceleration?
19  @param[in] doJerk log test jerk?
20  @param[in] axisLim axis limits (a tcc.base.AxisLim)
21 
22  @return errCode: one of the tcc.base.AxisErr_* constants defined in basics.h
23 
24  @todo: make this a method of PathSegment
25 
26  Error Conditions:
27  If min and max position, max velocity, etc. cannot be computed
28  for the path, errCode is set to tcc.base.AxisErr_CannotCompute.
29 
30  If a limit would be exceeded along the path, errCode is set appropriately.
31  Note: limits are checked in this order:
32  minpos, maxpos, vel, accel, jerk
33  and checking terminates at the first failure.
34 
35  Warnings:
36  Even if you request that position limits be checked, some paths
37  will be accepted that have points outside the allowed region. See Details.
38 
39  Position and velocity limits are not checked with strict accuracy,
40  but instead the limits are padded with a small fudge factor. See Details.
41 
42  Details:
43  In handling position limits, we must allow motion from out of bounds
44  towards being in bounds. Hence this routine allows paths with points
45  outside the position limits in some circumstances. Specifically:
46 
47  If the beginning position of the path is outside the allowed limits,
48  AND if the extreme pos. of the path is FURTHER outside the allowed limits,
49  ONLY :is the path considered unacceptable due to position limits.
50 
51  History:
52  2013-12-06 ROwen Converted from mov_checkPath.for
53  """
54  # compute min and max position (if requested), max |velocity|,
55  # initial acceleration, and constant jerk along the path
56  try:
57  segment = PathSegment(pA=pA, vA=vA, pB=pB, vB=vB, dt=dt, doPos=doPos)
58  except RuntimeError:
59  return tcc.base.AxisErr_CannotCompute
60 
61  # check the various limits, as requested
62  if doPos:
63  # check position limits; expand the limit to include the starting position
64  # so we can move back out if we exceed a limit
65  if segment.pMin < min(axisLim.minPos, pA):
66  return tcc.base.AxisErr_MinPos
67 
68  if segment.pMax > max(axisLim.maxPos, pA):
69  return tcc.base.AxisErr_MaxPos
70 
71  if doVel and abs(segment.vPeak) > axisLim.vel:
72  return tcc.base.AxisErr_MaxVel
73 
74  if doAccel and abs(segment.aPeak) > axisLim.accel:
75  return tcc.base.AxisErr_MaxAccel
76 
77  if doJerk and abs(segment.j) > axisLim.jerk: # jerk is constant along the path
78  return tcc.base.AxisErr_MaxJerk
79 
80  return tcc.base.AxisErr_OK
def checkSegment
Check a suggested path segment of constant jerk.
Definition: checkSegment.py:8