Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
PidParams.py
Go to the documentation of this file.
1 ###############################################################################
2 #
3 # Module: Laelaps.PidParams.py
4 #
5 # Package: RoadNarrows Laelaps Robotic Mobile Platform Package
6 #
7 # Link: https://github.com/roadnarrows-robotics/laelaps
8 #
9 # File: PidParams.py
10 #
11 ## \file
12 ##
13 ## $LastChangedDate: 2016-02-02 13:47:13 -0700 (Tue, 02 Feb 2016) $
14 ## $Rev: 4293 $
15 ##
16 ## \brief PID parameters classes.
17 ##
18 ## \author Robin Knight (robin.knight@roadnarrows.com)
19 ##
20 ## \par Copyright
21 ## \h_copy 2015-2017. RoadNarrows LLC.\n
22 ## http://www.roadnarrows.com\n
23 ## All Rights Reserved
24 ##
25 # @EulaBegin@
26 #
27 # Permission is hereby granted, without written agreement and without
28 # license or royalty fees, to use, copy, modify, and distribute this
29 # software and its documentation for any purpose, provided that
30 # (1) The above copyright notice and the following two paragraphs
31 # appear in all copies of the source code and (2) redistributions
32 # including binaries reproduces these notices in the supporting
33 # documentation. Substantial modifications to this software may be
34 # copyrighted by their authors and need not follow the licensing terms
35 # described here, provided that the new terms are clearly indicated in
36 # all files where they apply.
37 #
38 # IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39 # OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40 # PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41 # DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42 # EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43 # THE POSSIBILITY OF SUCH DAMAGE.
44 #
45 # THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47 # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48 # "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49 # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50 #
51 # @EulaEnd@
52 #
53 ###############################################################################
54 
55 import sys
56 import os
57 import time
58 import math
59 
60 PidKDiv = float(0x010000)
61 PidKMin = 0.0
62 PidKMax = float(2**31)
63 
64 # ------------------------------------------------------------------------------
65 # Class VelPidParams
66 # ------------------------------------------------------------------------------
67 
69  def __init__(self):
70  self.m_Kp = 0.0
71  self.m_Ki = 0.0
72  self.m_Kd = 0.0
73  self.m_maxQpps = 0
74  self.m_maxAccel = 0.0
75 
76  def setFromRawCtlrVals(self, Kp, Ki, Kd, maxQpps):
77  self.m_Kp = Kp/PidKDiv
78  self.m_Ki = Ki/PidKDiv
79  self.m_Kd = Kd/PidKDiv
80  self.m_maxQpps = maxQpps