Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ali/simple planning simulator with disturbance generator #573

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
77c92de
Started to implement standalone control_toolbox.
boyali May 13, 2022
8a784c5
Reproduced the linking problem.
boyali May 13, 2022
0735ca9
Solved the linking problem.
boyali May 13, 2022
a110033
Solved fvisibility setting and will use in other packages.
boyali May 15, 2022
253ae2a
Syncronized with the other repos that uses the ACT.
boyali May 25, 2022
2e385c8
Syncronized with the other repos that uses the ACT.
boyali May 25, 2022
27cd1ec
Version txt is added.
boyali May 25, 2022
e5f404d
Tustin Bilinear discretization is added.
boyali May 30, 2022
8df1702
ACT is separated into the headers. Started balancing algorithm.
boyali May 30, 2022
4fa6606
Implemented matrix balancing.
boyali May 30, 2022
3b1197d
Balancing finished, comparing with others.
boyali May 30, 2022
0834ee9
Balancing finished: lapack diag subtraction is enabled.
boyali May 30, 2022
dfd9735
Balancing finalized:integrating into the ss methods.
boyali May 30, 2022
03f80b8
Automatic discretization is added to tf2ss.
boyali May 30, 2022
428a674
Automatic balancing is added to tf2ss.
boyali May 30, 2022
1051e5c
Balancing permutation method signature is added.
boyali May 31, 2022
410de74
Introduced the signal builder methods.
boyali May 31, 2022
031da29
Triangle wave implementation is changed.
boyali Jun 1, 2022
2ae4255
Added tffactor_zero initializaiton.
boyali Jun 1, 2022
ae7fb8e
added F inversion.
boyali Jun 1, 2022
c409aca
added TF from tf_factor construciton.
boyali Jun 1, 2022
6f2fb8c
Implementing TF*TF multiplication.
boyali Jun 1, 2022
32c4e51
Implementing TF*TF LAZY evaluation implemented.
boyali Jun 1, 2022
4578522
COmpleted TF TF multiplication.
boyali Jun 1, 2022
0939f02
std vector is overloaded. A TF multiplication bug is removed.
boyali Jun 2, 2022
135e18e
std vector is overloaded
boyali Jun 2, 2022
064b1b2
Completed: std vector is overloaded.
boyali Jun 2, 2022
8a3c933
Swapped when taking tf.inv().
boyali Jun 2, 2022
e7bbc70
Improved code * vector overloading.
boyali Jun 3, 2022
b3f3597
Improved TF * TF mult adding num den constants.
boyali Jun 3, 2022
9a32bc2
implemented ss system getter. PSSim needs to change.
boyali Jun 3, 2022
64df004
state space getters A(), B() .. are implemented.
boyali Jun 3, 2022
7f2fee2
explicit is removed from tf2ss
boyali Jun 3, 2022
9eb3435
static gain guard is put in the state space models.
boyali Jun 3, 2022
97abb49
Returning by a constant reference in tf2ss.
boyali Jun 3, 2022
721225a
Returning by a constant reference reverted in tf2ss.
boyali Jun 3, 2022
d87c450
implementing templated ss: before changing tf2ss default constructor.
boyali Jun 4, 2022
a9bc806
matrix printing improved.
boyali Jun 4, 2022
20de455
cleaning up tf2ss.
boyali Jun 4, 2022
0b6b7af
Changed tf2ss to have a single system matrix, instead of separate [A,…
boyali Jun 4, 2022
9bc87e2
Changed tf2ss after change make ups
boyali Jun 4, 2022
f15977a
Added a discrete system matrix simulation method into the tf2ss.
boyali Jun 4, 2022
e5ccddd
Added tf2ss parameter update method.
boyali Jun 5, 2022
bfd74d6
Added tf2ss simulateOneStep template for compile time eigen matrices.
boyali Jun 5, 2022
5db1153
Added tf2ss simulateOneStep template for compile time eigen matrices.…
boyali Jun 5, 2022
fe40cb8
Verifying with q-filters.
boyali Jun 5, 2022
2983dd6
Verifying with q-filters.
boyali Jun 5, 2022
4dfdc5f
Verified sinusoidal signal productions.
boyali Jun 5, 2022
9180e79
Balancing code block is changed.
boyali Jun 5, 2022
06c3d02
Another simulateOneStep method is added.
boyali Jun 5, 2022
77a30ef
Another simulateOneStep method is added.
boyali Jun 5, 2022
5829c65
Get order is fixed.
boyali Jun 5, 2022
59175a7
Get order is fixed.
boyali Jun 5, 2022
c0403f2
Get order is fixed.
boyali Jun 5, 2022
f711252
Reverting sysMATABCD -> separate A, B, C, D.
boyali Jun 6, 2022
26d1a5f
Balancing C, B part is being implemented.
boyali Jun 6, 2022
5f3822c
Balancing C, B part is being implemented.
boyali Jun 6, 2022
5039825
removed an infinite loop bug.
boyali Jun 6, 2022
9f4078d
ci: add sync-upstream.yaml (#4)
kenji-miyake Jan 29, 2022
7c73be6
ci(sync-upstream): update settings (#19)
kenji-miyake Mar 3, 2022
8abdf24
Added the autoware_control_toolbox and copied vehicle model for distu…
boyali Mar 4, 2022
ed347f1
Disturbance generator is added.
boyali Mar 4, 2022
b65c8f7
Copied vehicle model is tested.
boyali Mar 4, 2022
ffe1825
Input queue related code sections are removed from the vehicle distur…
boyali Mar 4, 2022
50af46f
Restarted.
boyali Mar 6, 2022
a1bcf10
IDisturbanceCollection disturbance_collection_ is added to the inter…
boyali Mar 6, 2022
665534f
Disturbance Parameters are added to yaml file.
boyali Mar 6, 2022
716f5ab
Disturbance collection is integrated.
boyali Mar 6, 2022
a830a2c
Fully integrated, but initially engaged.
boyali Mar 6, 2022
5939290
disturbance msg is added and tested.
boyali Mar 6, 2022
272a121
disturbance plots are completed.
boyali Mar 7, 2022
1675a74
ReadMe is updated.
boyali Mar 7, 2022
c6fe2db
ReadMe is updated.
boyali Mar 7, 2022
46e49ca
After the PR - geared_dist model header and cpp are added.
boyali Mar 7, 2022
ef5d52f
Geared Vehicle Model with disturbance is integrated with the simulator.
boyali Mar 7, 2022
a82f59e
Geared Vehicle Model is tested with the disturbance generator.
boyali Mar 7, 2022
6a38edb
Geared Vehicle Model is tested with the disturbance generator.
boyali Mar 7, 2022
b93b6bc
Slope is added to the plotjuggler and core.
boyali Mar 7, 2022
be677af
Started to implement TIME-VARYING DEADZONE disturbance.
boyali Mar 7, 2022
9c37450
progressed in Deadzon. Improved the code navigation in dist generator…
boyali Mar 8, 2022
1fa2482
progressed in Deadzone. Implemented getDeadzone
boyali Mar 8, 2022
ab0a5dc
Some clang-tidy and MISRA corrections.
boyali Mar 8, 2022
210c198
Parameters added for the deadzone.
boyali Mar 8, 2022
a0f7557
Deadzone is put in the disturbance collection. Ready to integrate wit…
boyali Mar 8, 2022
28a535a
Put use_steering_input_delay option in the parameters.
boyali Mar 9, 2022
a8adc0d
Put use_acceleration_input_delay option in the parameters.
boyali Mar 9, 2022
9b397be
Put use_road_slope_disturbance option in the parameters.
boyali Mar 9, 2022
582d240
Put use_deadzone_disturbance option in the parameters.
boyali Mar 9, 2022
c7ab167
Disturbance message structure is implemented.
boyali Mar 9, 2022
bc1052b
Deadzone is completed, will check deadzone function implementation.
boyali Mar 9, 2022
2e67ef3
Deadzone description is added to the MD file.
boyali Mar 9, 2022
8e3bfcb
Deadzone function is amended.
boyali Mar 9, 2022
a87c6ab
Autoware_Control_Toolbox is separately implemented.
boyali May 15, 2022
ee40a29
Autoware_Control_Toolbox is separately implemented.
boyali May 23, 2022
c03756c
utils in ACT changed to act_utils
boyali May 23, 2022
3637295
Rebased on to the ACT, delay model continuous time update -> discrete…
boyali May 31, 2022
7559481
Rebased on to the improved ACT.
boyali Jun 3, 2022
e6a8638
Virtual destructors added to the disturbance interfaces.
boyali Jun 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ACT is separated into the headers. Started balancing algorithm.
  • Loading branch information
boyali committed May 30, 2022
commit 8df170244c0b262de2b4cfa1d1d9b2756493e130
7 changes: 7 additions & 0 deletions control/autoware_control_toolbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,21 @@ set(CONTROL_LIB_SOURCE
src/utils_act/act_utils_eigen.cpp
src/autoware_control_toolbox.cpp
src/tf_algebra.cpp
src/utils_act/state_space.cpp
src/utils_act/transfer_functions.cpp
src/utils_act/balance.cpp
)

set(CONTROL_LIB_HEADERS
include/utils_act/act_definitions.hpp
include/autoware_control_toolbox.hpp
include/utils_act/act_utils.hpp
include/utils_act/balance.hpp
include/utils_act/act_utils_eigen.hpp
include/visibility_control.hpp
include/tf_algebra.hpp
include/utils_act/state_space.hpp
include/utils_act/transfer_functions.hpp
)

set(CONTROL_LIB_INCLUDE_DIRS
Expand Down
122 changes: 7 additions & 115 deletions control/autoware_control_toolbox/include/autoware_control_toolbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,127 +24,19 @@
#include <iomanip>
#include <limits>
#include <boost/optional.hpp>
#include "utils_act/act_utils_eigen.hpp"

// Library headers
#include "visibility_control.hpp"
#include "tf_algebra.hpp"
#include "utils_act/act_utils_eigen.hpp"
#include "utils_act/act_definitions.hpp"
#include "utils_act/balance.hpp"
#include "utils_act/transfer_functions.hpp"
#include "utils_act/state_space.hpp"

namespace ns_control_toolbox
{


/**
* @brief Transfer Function representation in descending power of Laplace variable "s".
* [s^n, s^{n-1} ... s^0]
* @param Nn : size of the numerator array.
* @param Nd : size of the denominator array
* */

// For visibility we can set for each object : __attribute__((visibility("default"))) class_name
struct ACT_PUBLIC tf
{
// Constructors.
tf() : num_{ 1. }, den_{ 1. }
{
}

// Constructor from non-empty numerator and denominator std::vectors.
tf(std::vector<double> num, std::vector<double> den)
: num_{ std::move(num) }, den_{ std::move(den) }
{

ns_utils::stripVectorZerosFromLeft(num_); // remove zeros from the left.
ns_utils::stripVectorZerosFromLeft(den_);
}


// Member functions.
/**
* @brief : Creates a string stream object of polynomial representation of given the vector,
* */
static size_t getPolynomialStringAndSize(std::vector<double> const& num_or_den,
std::ostringstream& string_stream);


void print() const;

[[nodiscard]] std::vector<double> num() const
{
return num_;
}

[[nodiscard]] std::vector<double> den() const
{
return den_;
}

private:

// Data members
std::vector<double> num_; // <-@brief numerator
std::vector<double> den_; // <-@brief denominator
};

/**
* @brief tf2ss Converts a transfer function representation in to a state-space form.
* We assume the system is SISO type.
*
* */

struct ACT_PUBLIC tf2ss
{

// Constructors
tf2ss();

explicit tf2ss(tf const& sys_tf);

tf2ss(std::vector<double> const& num, std::vector<double> const& den);


// Public methods
// Currently only Tustin - Bilinear discretization is implemented.
void discretisize(double const& Ts);

void print() const;

void print_discrete_system() const;

// Data members
// Continuous time state-space model
Eigen::MatrixXd A_{};
Eigen::MatrixXd B_{};
Eigen::MatrixXd C_{};
Eigen::MatrixXd D_{};

// Discrete time state-space model
Eigen::MatrixXd Ad_{};
Eigen::MatrixXd Bd_{};
Eigen::MatrixXd Cd_{};
Eigen::MatrixXd Dd_{};


private:
/**
* @brief Compute the system continuous time system matrices
* */

void computeSystemMatrices(std::vector<double> const& num,
std::vector<double> const& den);


};

/**
* @param Td : time delay value in seconds.
* @param N : Order of Pade approximation.
* */
tf ACT_PUBLIC pade(double const& Td, size_t const& order);

/**
* @bried see pade()
* @refitem Golub and Van Loan, Matrix Computations, 4rd edition, Chapter 9., Section 9.3.1 pp 530
* */
tf ACT_PUBLIC padecoeff(double const& Td, size_t const& order);

} // namespace ns_control_toolbox
#endif // AUTOWARE_CONTROL_TOOLBOX_HPP_
13 changes: 9 additions & 4 deletions control/autoware_control_toolbox/include/tf_algebra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@
#include <iomanip>
#include <limits>
#include <boost/optional.hpp>
#include "utils_act/act_utils_eigen.hpp"
#include "utils_act/act_utils.hpp"
#include "visibility_control.hpp"

// BOOST POLYNOMIAL
#include <boost/math/tools/polynomial.hpp>

// Library headers
#include "utils_act/act_utils_eigen.hpp"
#include "utils_act/act_utils.hpp"
#include "visibility_control.hpp"
#include "utils_act/act_definitions.hpp"
#include "utils_act/transfer_functions.hpp"
#include "utils_act/state_space.hpp"


namespace ns_control_toolbox
{
double constexpr EPS = std::numeric_limits<double>::epsilon();


//using namespace boost::math;
using boost_polynomial = boost::math::tools::polynomial<double>; // for polynomial
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2021 - 2022 Autoware Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef AUTOWARE_CONTROL_TOOLBOX_ACT_DEFINITIONS_HPP
#define AUTOWARE_CONTROL_TOOLBOX_ACT_DEFINITIONS_HPP

#include <limits>

namespace ns_control_toolbox
{
constexpr auto EPS = std::numeric_limits<double>::epsilon();
} // namespace ns_control_toolbox

#endif //AUTOWARE_CONTROL_TOOLBOX_ACT_DEFINITIONS_HPP
Loading