Skip to content

Commit 7c96fcc

Browse files
authored
initial implementation of differential flatness module (#324)
No comments in 7 days, so assuming this is ok (adds optional functionality).
1 parent b5aaf4a commit 7c96fcc

10 files changed

Lines changed: 1329 additions & 0 deletions

File tree

control/flatsys/__init__.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# flatsys/__init__.py: flat systems package initialization file
2+
#
3+
# Copyright (c) 2019 by California Institute of Technology
4+
# All rights reserved.
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions
8+
# are met:
9+
#
10+
# 1. Redistributions of source code must retain the above copyright
11+
# notice, this list of conditions and the following disclaimer.
12+
#
13+
# 2. Redistributions in binary form must reproduce the above copyright
14+
# notice, this list of conditions and the following disclaimer in the
15+
# documentation and/or other materials provided with the distribution.
16+
#
17+
# 3. Neither the name of the California Institute of Technology nor
18+
# the names of its contributors may be used to endorse or promote
19+
# products derived from this software without specific prior
20+
# written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALTECH
26+
# OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29+
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32+
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33+
# SUCH DAMAGE.
34+
#
35+
# Author: Richard M. Murray
36+
# Date: 1 Jul 2019
37+
38+
r"""The :mod:`control.flatsys` package contains a set of classes and functions
39+
that can be used to compute trajectories for differentially flat systems.
40+
41+
A differentially flat system is defined by creating an object using the
42+
:class:`~control.flatsys.FlatSystem` class, which has member functions for
43+
mapping the system state and input into and out of flat coordinates. The
44+
:func:`~control.flatsys.point_to_point` function can be used to create a
45+
trajectory between two endpoints, written in terms of a set of basis functions
46+
defined using the :class:`~control.flatsys.BasisFamily` class. The resulting
47+
trajectory is return as a :class:`~control.flatsys.SystemTrajectory` object
48+
and can be evaluated using the :func:`~control.flatsys.SystemTrajectory.eval`
49+
member function.
50+
51+
"""
52+
53+
# Basis function families
54+
from .basis import BasisFamily
55+
from .poly import PolyFamily
56+
57+
# Classes
58+
from .systraj import SystemTrajectory
59+
from .flatsys import FlatSystem
60+
from .linflat import LinearFlatSystem
61+
62+
# Package functions
63+
from .flatsys import point_to_point

control/flatsys/basis.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# basis.py - BasisFamily class
2+
# RMM, 10 Nov 2012
3+
#
4+
# The BasisFamily class is used to specify a set of basis functions for
5+
# implementing differential flatness computations.
6+
#
7+
# Copyright (c) 2012 by California Institute of Technology
8+
# All rights reserved.
9+
#
10+
# Redistribution and use in source and binary forms, with or without
11+
# modification, are permitted provided that the following conditions
12+
# are met:
13+
#
14+
# 1. Redistributions of source code must retain the above copyright
15+
# notice, this list of conditions and the following disclaimer.
16+
#
17+
# 2. Redistributions in binary form must reproduce the above copyright
18+
# notice, this list of conditions and the following disclaimer in the
19+
# documentation and/or other materials provided with the distribution.
20+
#
21+
# 3. Neither the name of the California Institute of Technology nor
22+
# the names of its contributors may be used to endorse or promote
23+
# products derived from this software without specific prior
24+
# written permission.
25+
#
26+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALTECH
30+
# OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
33+
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36+
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37+
# SUCH DAMAGE.
38+
39+
40+
# Basis family class (for use as a base class)
41+
class BasisFamily:
42+
"""Base class for implementing basis functions for flat systems.
43+
44+
A BasisFamily object is used to construct trajectories for a flat system.
45+
The class must implement a single function that computes the jth
46+
derivative of the ith basis function at a time t:
47+
48+
:math:`z_i^{(q)}(t)` = basis.eval_deriv(self, i, j, t)
49+
50+
"""
51+
def __init__(self, N):
52+
"""Create a basis family of order N."""
53+
self.N = N # save number of basis functions

0 commit comments

Comments
 (0)