【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

这篇具有很好参考价值的文章主要介绍了【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

李群控制器SO(3)测试

测试代码是一个用于控制 SO(3) 空间中的系统的比例控制器。它通过计算控制策略来使当前状态逼近期望状态。该控制器使用比例增益 kp 进行参数化,然后进行一系列迭代以更新系统状态,最终检查状态误差是否小于给定的阈值。这个控制器用于姿态控制等应用。以下为测试源码:

#include <catch2/catch.hpp>
#include <manif/manif.h>
#include <LieGroupControllers/ProportionalController.h>
#include <LieGroupControllers/ProportionalDerivativeController.h>
using namespace LieGroupControllers;
int main()
{
    manif::SO3d desiredState, state;
    desiredState.setRandom();
    state.setRandom();
    std::cout << "当前姿态:\n"<<
        state.rotation() << std::endl;


    std::cout << "目标姿态:\r\n"<< desiredState.rotation() << std::endl;
    auto feedForward = Eigen::Vector3d::Zero();


    // 实例化控制器
    ProportionalControllerSO3d controller;
    constexpr double kp = 10;
    controller.setGains(kp);//设置控制器增益
    controller.setDesiredState(desiredState);//设置期望状态
    controller.setFeedForward(feedForward);//设置前馈


    //测试控制器
    constexpr double dT = 0.01;// 时间步长 秒  控制周期0.01s
    constexpr std::size_t numberOfIteration = 1e3; // 迭代次数1000
    for (std::size_t i = 0; i < numberOfIteration; i++)
    {
        controller.setState(state);// 设置当前状态
        controller.computeControlLaw(); // 计算控制策略
        auto controlOutput = controller.getControl();// 获取控制输出


        //传播系统的动态 Propagate the dynamics of the system.
        //首先,我们获取控制输出,这在这个特定情况下是惯性坐标系中的角速度 First of all we get the control output. In this particular case is the angular velocity
        // expressed in the inertial frame.
        // 然后使用 Manifold 左加运算符 Then the Manifold left plus operator is used
        // state = controlOutputDT  + state 应该理解为
        // state_k+1 = exp(omega * dT) * state_k
        manif::SO3d::Tangent controlOutputDT = controlOutput.coeffs() * dT;
        std::cout << "第" << i << "次控制角度增量(瞬时控制角速度*dt):" << controlOutputDT << std::endl;
        state = controlOutputDT + state;


    }
    std::cout << "Test Over!调节时间10秒\n";
    std::cout << "最终姿态:\r\n" << state.rotation() << std::endl;
    std::cout << "姿态误差:\r\n" << desiredState.rotation() - state.rotation() << std::endl;


    // 检查误差
    //auto error = state.compose(desiredState.inverse()).log(); // 计算误差:  最终姿态坐标系在期望姿态坐标系中的姿态矩阵表示 取log
    //REQUIRE(error.coeffs().norm() < 1e-4); // 检查误差是否小于阈值
}

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

LIE-GROUP-CONTROLLERS  

包含专为李群设计的控制器的纯头文件 C++ 库

库背后的一些理论  

The library aims to contain some controllers designed in lie groups. The library depends only on Eigen and manif.

该库旨在包含一些以李群理论为基础设计的控制器。 该库仅依赖于 Eigen 和 manif。

All the controllers defined in lie-group-controllers have in common that they inherit from a templated base class (CRTP). It allows one to write generic code abstracting the controller details. This follows the structure of manif and Eigen.

lie-group-controllers 中定义的所有控制器都有一个共同点,即它们都继承自模板化基类 (CRTP)。它允许人们编写抽象控制器细节的通用代码。这遵循 manif 和 Eigen 的结构。

The library implements two controllers:

该库实现了两个控制器:

Proportional Controller (P controller)

比例控制器(P控制器)

Proportional Derivative Controller (PD controller)

比例微分控制器(PD控制器)

控制器具有以下形式

平凡化                      比例控制器                             比例微分控制器

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

where X and X are elements of a Lie group.  is the group operator. ψ represents an element in the Lie algebra of the Lie group whose coordinates are expressed in .

其中 X 和 Xᵈ 是李群的元素。∘ 是群算子。ψ 表示李群李代数中的一个元素,其坐标用ℝⁿ 表示。

The controllers support all the groups defined in manif. Namely:

控制器支持 manif.h 中定义的所有群。即:

ℝ(n): Euclidean space with addition.

SO(2): rotations in the plane.

SE(2): rigid motion (rotation and translation) in the plane.

SO(3): rotations in 3D space.

SE(3): rigid motion (rotation and translation) in 3D space.

ℝ(n):带加法的欧几里得空间。

SO(2):平面内的旋转。

SE(2):平面内的刚性运动(旋转和平移)。

SO(3):3D 空间中的旋转。

SE(3):3D 空间中的刚性运动(旋转和平移)。

SE_2(3):3D 空间中的扩展位姿(旋转、平移和速度),(据我所知)由文章https://arxiv.org/pdf/1410.1465.pdf引入。注意:此处的实现与文章中的开发略有不同。

Bundle<>:允许将流形束作为单个李群进行操作。在参考论文https://arxiv.org/abs/1812.01537的第四节中称为复合流形。

其他李群可以而且将会被添加,欢迎贡献。

Please you can find further information in

请您在以下位置找到更多信息:

Modern Robotics: Mechanics, Planning, and Control,
Kevin M. Lynch and Frank C. Park,
Cambridge University Press, 2017,
ISBN 9781107156302

基本使用

The library implements proportional and proportional derivative controllers on Lie groups. What follows are two simple snippets that you can follow to build and use such controllers. For sake of simplicity, only controllers in SO(3) are shown. The very same applies to the other Lie groups

该库在李群上实现比例和比例微分控制器。 下面是两个简单的片段,您可以按照它们来构建和使用此类控制器。为了简单起见,仅示出了SO(3)中的控制器。这同样适用于其他李群

比例控制器 SO(3)   

//设置随机初始状态和零前馈 
//set random initial state and zero feedforward
// manif::SO3d是一个三维旋转矩阵类,用于表示三维空间中的旋转
manif::SO3d desiredState, state;
desiredState.setRandom();
state.setRandom();//随机设置旋转矩阵的值
Eigen::Vector3d feedForward = Eigen::Vector3d::Zero();//创建一个零向量


//创建控制器 create the controller.
ProportionalControllerSO3d controller;// 一个比例控制器,用于计算控制律


// 如果您想使用正确的普通控制器In case you want to use the right trivialized controller
// ProportionalControllerTplSO3d<Trivialization::Right> controller;// 一个右平凡化的比例控制器, 它与上面提到的比例控制器类似,但使用了不同的数学方法来计算控制律


//设置比例增益 set the proportional gain 
const double kp = 10;
controller.setGains(kp);// 设置比例增益


//设置所需的状态、前馈和状态 set the desired state, the feed-forward, and the state
controller.setDesiredState(desiredState);// 设置期望状态
controller.setFeedForward(feedForward);// 设置前馈
controller.setState(state);// 设置状态


//计算控制律 compute the control law
controller.computeControlLaw();
const auto& controlOutput = controller.getControl();

比例微分控制器SO(3)  

// set random initial state and zero feedforward设置了随机的初始状态和零前馈
manif::SO3d desiredState, state;
desiredState.setRandom();
state.setRandom();
manif::SO3d::Tangent stateDerivative = Eigen::Vector3d::Zero();
manif::SO3d::Tangent desiredStateDerivative = Eigen::Vector3d::Zero();
Eigen::Vector3d feedForward = Eigen::Vector3d::Zero();


// create the controller.
ProportionalDerivativeControllerSO3d controller;//一个比例微分控制器,用于计算控制律


// In case you want to use the right trivialized controller
// ProportionalDerivativeControllerTplSO3dcontroller;//如果您想使用正确的普通控制器.这是一个右平凡化的比例导数控制器。它与上面提到的比例导数控制器类似,但使用了不同的数学方法来计算控制律


// set the proportional and the derivative gains
//设置比例增益和微分增益
constdouble kp =10;
constdouble kd =2* std::sqrt(kp);
controller.setGains(kp, kd);


// set the desired state, its derivative, the feed-forward, and the state设置所需的状态、其微分、前馈和状态
controller.setDesiredState(desiredState, desiredStateDerivative);
controller.setFeedForward(feedForward);
controller.setState(state, stateDerivative);


//计算控制律 compute the control law
controller.computeControlLaw();
constauto& controlOutput = controller.getControl();//获取控制输出

依赖库  

manif  https://github.com/artivis/manif/tree/devel 

Eigen3 https://gitlab.com/libeigen/eigen/-/tree/3.4.1?ref_type=heads 

cmake

构建库  

git clone https://github.com/GiulioRomualdi/lie-group-controllers.git
cd lie-group-controllers
mkdir build && cd build
cmake ../
cmake --build .
[sudo] cmake --build . --target install

 If you want to enable tests set the BUILD_TESTING option to ON.

在您的项目中使用李群控制器  

在您的项目中使用李群控制器

lie-group-controllers 提供原生 CMake 支持,使该库可以在 CMake 项目中轻松使用。请添加到您的 CMakeLists.txt

project(foo)
find_package(LieGroupControllers REQUIRED)
add_executable(${PROJECT_NAME} src/foo.cpp)
target_link_libraries(${PROJECT_NAME}LieGroupControllers::LieGroupControllers)

manif可用操作

manif 是一个李理论库,用于针对机器人应用的状态估计。它被开发为带有 Python 3 包装器的纯标头 C++11 库。        

Available Operations  

https://github.com/artivis/manif/tree/devel

Operation

Code

Base Operation

Inverse

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.inverse()

Composition

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X * Y                  
X.compose(Y)

Hat

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w.hat()

Act on vector

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.act(v)

Retract to group element

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w.exp()

Lift to tangent space

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.log()

Manifold Adjoint

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.adj()

Tangent adjoint

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w.smallAdj()

Composed Operation

Manifold right plus

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X + w                  
X.plus(w)                  
X.rplus(w)

Manifold left plus

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w + X                  
w.plus(X)                  
w.lplus(X)

Manifold right minus

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X - Y                  
X.minus(Y)                  
X.rminus(Y)

Manifold left minus

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.lminus(Y)

Between

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

X.between(Y)

Inner Product

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w.inner(t)

Norm

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

w.weightedNorm()                  
w.squaredWeightedNorm()

【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...

参考网址:
https://github.com/ami-iit/lie-group-controllers  李群控制器源网址

https://www.youtube.com/watch?v=nHOcoIyJj2o&ab_channel=InstitutdeRob%C3%B2ticaiInform%C3%A0ticaIndustrial%2CCSIC-UPC  (视频)机器人专家的李理论Lie theory for the roboticist

https://arxiv.org/abs/1812.01537  机器人状态估计的微观李理论文章来源地址https://www.toymoban.com/news/detail-662377.html

到了这里,关于【李群李代数】李群控制器(lie-group-controllers)介绍——控制 SO(3) 空间中的系统的比例控制器Demo...的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 14-k8s控制器资源-rs控制器replicasets

            replicaset副本控制器,简称:rs控制器;         用法:与rc控制器“几乎”相同;         能力:可以指定pod的副本始终存活,相比于rc控制器;支持标签匹配,也支持标签表达式         注意:不论是rc还是rs资源,都是通过“标签”惊醒匹配pod的,如果有同样

    2024年02月21日
    浏览(52)
  • 13-k8s的控制器资源-rc控制器replicationcontrollers

            replicationcontrollers控制器资源,简称:rc控制器;         简单理解,rc控制器就是控制相同的pod副本数量;         使用rc控制器资源创建pod,就可以设定创建pod的数量; [root@k8s231 rc]# vim rc.yaml apiVersion: v1 kind: ReplicationController metadata:   name: rc01 spec:   #控制pod的副本

    2024年02月20日
    浏览(53)
  • 【进口控制器替代】基于Zynq-7020 FPGA的NI 8槽CompactRIO控制器

    667 MHz双核CPU,512 MB DRAM,1 GB存储容量,Zynq-7020 FPGA,更宽工作温度范围,8槽CompactRIO控制器 cRIO-9068是一款坚固耐用的无风扇嵌入式控制器,可用于高级控制和监测应用。这款软件设计控制器搭载FPGA、运行NI Linux Real-Time操作系统的实时处理器以及嵌入式用户界面功能。cRIO-906

    2024年01月25日
    浏览(52)
  • Spring MVC学习随笔-控制器(Controller)开发详解:控制器跳转与作用域(一)

    学习视频:孙哥说SpringMVC:结合Thymeleaf,重塑你的MVC世界!|前所未有的Web开发探索之旅 3.流程跳转 在web.xml里添加Servlet然后执行 可以看到通过url拼接可以获取传递的数据 四种跳转指的是:在SpringMVC中控制器与JSP或者控制器与控制器之间的跳转。 Controller - - forward — JSP Co

    2024年02月05日
    浏览(47)
  • JMeter 逻辑控制之IF条件控制器

    JMeter-5.4.1 添加While Controller 右键线程组-添加-逻辑控制器-While控制器 添加后,面板如下 仅Expression值为true,才会执行位于其下的操作 最好勾选(默认配置)Interpret Condition as Variable Expression?,这样Expression输入框可以有两种输入选择: 输入一个值为true 或者false的变量 比如,如果

    2024年02月02日
    浏览(49)
  • 自抗扰(ADRC)控制原理及控制器设计

    自抗扰控制是在PID控制算法基础上进行改进的新型控制方法,它具有不依赖于控制对象模型、不区分系统内外扰的结构特点。常用的自抗扰控制器主要由 跟踪微分器 (Tracking Differentiator,TD)、 扩张状态观测器 (Extended State Observer,ESO)和 非线性状态误差反馈控制率 (Non

    2024年01月18日
    浏览(44)
  • Kubernetes 准入控制器

    Kubernetes 极大地提高了当今生产中后端集群的速度和可管理性。由于灵活、可扩展、易用,Kubernetes 已成为容器编排的事实标准。Kubernetes 还提供了一系列保护功能。而 Admission Controllers(准入控制器) 是一组安全相关的插件,启用后能进一步使用 Kubernetes 更高级的安全功能。

    2024年02月06日
    浏览(36)
  • 07.资源控制器

    学习要点: 1.资源控制器 本节课我们来开始学习控制器的快捷方法:资源控制器。 一.资源控制器 1. 声明:资源控制器是某个特定场景下的产物,完全理解需要 PHP 项目基础; 2. 比如开发过博客系统,留言帖子系统之类,具有类似思维,否则你懂的..; 3. 只是学习了 PHP 基

    2024年02月04日
    浏览(28)
  • PID 控制器

    本文参考: 从不懂到会用!PID从理论到实践~_哔哩哔哩_bilibili 目录 1.PID控制器入门 1.1.PID控制器的引入 1.2.PID控制器适用系统 1.3.PID控制器宏观意义 2.PID控制器的必备知识 2.1.控制系统概述 2.2.参数详解 2.3.连续与离散信号 3.PID控制算法 3.1.PID公式解释(抽象派) 3.2.PID公式解释

    2024年02月07日
    浏览(39)
  • Pod控制器

    Pod时k8s的最小管理单元,按照Pod创建方式可分为两类: 自助式:k8s直接创建Pod,Pod删除后就销毁,不会重建 控制器创建:k8s通过控制器创建Pod,删除后会自动重建,满足用户需求 不同场景下k8s控制器使用: ReplicationController:比较原始的pod控制器,已经被废弃,由ReplicaSet替代

    2024年02月07日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包