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

news2024/9/20 20:36:41

李群控制器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); // 检查误差是否小于阈值
}

0605cd1a4d4f544b3e576356c04790ed.png

2792fe167dee8f04038401f452a35a36.png

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控制器)

控制器具有以下形式

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

ac3813215d1fc9cc00cb1a46fb8984f0.png

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

7b2d8d7465c56f697c12259603782c48.png

X.inverse()

Composition

38bec0880cad2f4fde2270c1a57e0125.png

X * Y                  
X.compose(Y)

Hat

9386baf0ace62c6fef678be358c4f0c6.png

w.hat()

Act on vector

b7b5c94b6c9cf516a4c929eb21e5eaa4.png

X.act(v)

Retract to group element

5d3554c4ad5fccf7a3b760293a11c620.png

w.exp()

Lift to tangent space

e143d7704c7b36e40d51d512f2f0c4bc.png

X.log()

Manifold Adjoint

7020866e7cfc25590682d7371667ed6c.png

X.adj()

Tangent adjoint

8076bd99f55f300ad49238d34fc95eba.png

w.smallAdj()

Composed Operation

Manifold right plus

4c979af5bb9f20a2fd66a20eba5054d0.png

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

Manifold left plus

fb05b91f1e3cc62ca6508e39c06795a1.png

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

Manifold right minus

110e4c0634bc0c6c3e02231cd71175d6.png

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

Manifold left minus

518bdbdb43057bf09c376e25aa6084f3.png

X.lminus(Y)

Between

3737a0e002e8dee137fdbdff7e40536d.png

X.between(Y)

Inner Product

50ce559da178943bb1cdecf1a2d5e63d.png

w.inner(t)

Norm

a31f2fec875817d021e9b4e9405e7326.png

w.weightedNorm()                  
w.squaredWeightedNorm()

e33fd604c9a8d3071907e5f14a2aef32.png

参考网址:
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  机器人状态估计的微观李理论

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/902679.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

用 Python 算法预测银行客户行为实战案例

这是一份kaggle上的银行的数据集&#xff0c;研究该数据集可以预测客户是否认购定期存款y。这里包含20个特征。 1. 分析框架 2. 数据读取&#xff0c;数据清洗 # 导入相关包 import numpy as np import pandas as pd # 读取数据 data pd.read_csv(./1bank-additional-full.…

谈谈通信工程专业

目录 1.什么是通信工程 2.通信工程学什么 3.通信工程就业方向 4.通信工程发展前景 1.什么是通信工程 通信工程是一门工程学科&#xff0c;它涉及到设计、建设和管理通信系统以及相关设备和技术的应用。通信工程主要关注的是信息的传输、交换和处理&#xff0c;旨在实现可靠…

vue初始化没反应可以换个位置

本来 这个 在最后初始化没反应 &#xff0c;换到 中间就可以了 created() {this.model Object.assign({}, {});this.loadTreeData();this.initColumnsSetting()},

Postman返回了一个html页面

问题记录 调用公司的测试环境接口&#xff0c;从浏览器控制台接口处cCopy as cURL(cmd)&#xff0c;获取完整的请求内容&#xff0c;然后导入postman发起请求 提测时发现返回一个html页面&#xff0c;明显是被请求在网管处被拦截了&#xff0c;网关返回的这个报错html页面 …

第18集丨Vue脚手架的默认配置

目录 一、查看默认配置1.1 在此系统中禁止执行脚本1.2 错误解决方案1.3 执行成功生成的配置项 二、关闭语法检查 一、查看默认配置 Vue脚手架隐藏了所有 webpack 相关的配置&#xff0c;若想查看具体的 webpak 配置&#xff0c;请执行&#xff1a;vue inspect > output.js …

基于javaweb的社区疫情防控系统

摘 要 随着当今网络的发展&#xff0c;时代的进步&#xff0c;各行各业也在发生着变化&#xff0c;于是网络已经逐步进入人们的生活&#xff0c;给我们生活或者工作提供了新的方向新的可能。 本毕业设计的内容是设计实现一个springboot框架的社区疫情防控系统。它是以java语…

使用 HTML、CSS 和 JavaScript 创建实时 Web 编辑器

使用 HTML、CSS 和 JavaScript 创建实时 Web 编辑器 在本文中&#xff0c;我们将创建一个实时网页编辑器。这是一个 Web 应用程序&#xff0c;允许我们在网页上编写 HTML、CSS 和 JavaScript 代码并实时查看结果。这是学习 Web 开发和测试代码片段的绝佳工具。我们将使用ifram…

第十五章:联邦学习攻防实战

代码 联邦学习的后门攻击案例 联邦学习的模型压缩案例 联邦学习的差分隐私案例 联邦学习的同态加密案例 联邦学习的参数稀疏化案例

../../ 目录遍历

在web功能设计中,很多时候我们会要将需要访问的文件定义成变量&#xff0c;从而让前端的功能便的更加灵活。 当用户发起一个前端的请求时&#xff0c;便会将请求的这个文件的值(比如文件名称)传递到后台&#xff0c;后台再执行其对应的文件。 在这个过程中&#xff0c;如果后…

无涯教程-PHP - Cookies

Cookies是存储在客户端计算机上的文本文件。 识别用户涉及三个步骤- 服务器脚本将一组cookie发送到浏览器。如姓名&#xff0c;年龄或身份证等。浏览器将此信息存储在本地计算机上&#xff0c;以备将来使用。下次浏览器向Web服务器发送任何请求时&#xff0c;它将向服务器发送…

网盘传文件限速严重,来试试ssh内网穿透创建的公网到本地http服务器吧

title: 网盘传文件限速严重&#xff0c;来试试ssh内网穿透创建的公网到本地http服务器吧 如果你被国内某度网盘的火星传输速度折磨&#xff0c;可以搞一个固定IP的服务器&#xff0c;传输文件会变得简单&#xff0c;通过ssh转发&#xff0c;我们可以让接受者通过浏览器直接下载…

C++ string模拟实现

目录 模拟实现string的结构接口函数的实现构造函数和析构函数迭代器的实现operator[]reserve和resize三种尾插函数insertfinderasesubstr赋值重载拷贝构造比较大小流提取&#xff0c;流插入 完整代码 模拟实现string的结构 前面我们知道了string的结构比较复杂&#xff0c;这里…

将 Pandas 换为交互式表格的 Python 库

Pandas是我们日常处理表格数据最常用的包&#xff0c;但是对于数据分析来说&#xff0c;Pandas的DataFrame还不够直观&#xff0c;所以今天我们将介绍4个Python包&#xff0c;可以将Pandas的DataFrame转换交互式表格&#xff0c;让我们可以直接在上面进行数据分析的操作。 Piv…

阿里云ECS服务器安装PostgreSQL

1. 概述 PostgreSQL是一个功能强大的开源数据库&#xff0c;它支持丰富的数据类型和自定义类型&#xff0c;其提供了丰富的接口&#xff0c;可以自行扩展其功能&#xff0c;支持使用流行的编程语言编写自定义函数 PostgreSQL数据库有如下优势&#xff1a; PostgreSQL数据库时…

浅尝OpenResty

文章目录 1. 写在前面2. 下载安装openresty2.1 下载Openresty2.2 设置nginx启动 3. 嵌入lua脚本4. 实践5. 小结 1. 写在前面 当一个域名中衍生出多个服务的时候&#xff0c;如果想要保持对外服务始终是一个域名&#xff0c;则需要通过nginx反向代理来实现。如果在转发的时候需…

Pixar、Adobe 和苹果等成立 OpenUSD 联盟推行 3D 内容开放标准

导读Pixar、Adobe、Apple、Autodesk 与 NVIDIA 联手 Linux 基金会旗下的联合开发基金会&#xff08;JDF&#xff09;宣布建立 OpenUSD 联盟&#xff08;AOUSD&#xff09;以推行 Pixar 创建的通用场景描述技术的标准化、开发、进化和发展。 联盟寻求通过推进开放式通用场景描述…

[附源码]计算机毕业设计-JAVA火车票订票管理系统-springboot-论-文-ppt

PPT论文 文章目录 前言一、主要技术javaMysql数据库JSP技术 二、系统设计三、功能截图总结 前言 本论文主要论述了如何使用JAVA语言开发一个火车订票管理系统 &#xff0c;本系统将严格按照软件开发流程进行各个阶段的工作&#xff0c;采用B/S架构&#xff0c;面向对象编程思想…

走嵌入式还是纯软件?学长告诉你怎么选

最近有不少理工科的本科生问我&#xff0c;未来是走嵌入式还是纯软件好&#xff0c;究竟什么样的同学适合学习嵌入式呢&#xff1f;在这里我整合一下给他们的回答&#xff0c;根据自己的经验提供一些建议。 嵌入式领域也可以分为单片机方向、Linux方向和安卓方向。如果你的专业…

魏副业而战:闲鱼卖货怎么取得更大的成就

我是魏哥&#xff0c;与其躺平&#xff0c;不如魏副业而战&#xff01; 社群成员小H又办证了&#xff0c;他想干什么&#xff1f; 这是他办了的第3个证了&#xff0c;这就意味这他有9家闲鱼店铺了。 之前有跟他聊过闲鱼卖货&#xff0c;想要在闲鱼上取得更大的成就&#xff…

【zabbix企业级监控】

目录 Zabbix Zabbix特点 实验环境准备 Server端 agent端 server端 配置阿里云yum源 启动LAMP对应服务 准备java环境 源码安装zabbix Mariadb数据库授权 创建zabbix程序用户并授权防止权限报错 修改zabbix配置文件 配置php与apache web安装zabbix Zabbix页面优化…