OOQP 安装和使用

2023-05-16

OOQP 安装和使用

    • 1. 安装
    • 2. 使用

1. 安装

需要先安装 blas 和 ma27

BLAS:

cd my_lib/
wget http://www.netlib.org/blas/blas.tgz
tar zxf blas.tgz
cd BLAS-3.10.0/
gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f
ar r libfblas.a *.o
ranlib libfblas.a
rm -rf *.o     
export BLAS=~/my_lib/BLAS-3.10.0/libfblas.a 

MA27:

cd my_lib/
git clone git://github.com/HITSZ-LeggedRobotics/ma27.git
cd ma27/
bash ./configure CPPFLAGS="-fPIC" CFLAGS="-fPIC" FFLAGS="-fPIC"
sudo make install

OOQP:
在 ma27/src 中复制 libma27.a 文件到 ooqp 文件夹下

cd my_lib/
git clone git://github.com/emgertz/OOQP.git
cd OOQP/
./configure
sudo make
sudo make install

结果:

seivl@seivl-Default-string:~/my_lib/OOQP$ sudo make install
/usr/bin/install -c -d /usr/local/include/ooqp	
/usr/bin/install -c ./include/*.h /usr/local/include/ooqp
/usr/bin/install -c -d /usr/local/lib
/usr/bin/install -c ./lib/*.a /usr/local/lib
if [ -d doc-src ]; then cd doc-src; fi; make
make[1]: Entering directory '/home/seivl/my_lib/OOQP/doc-src'
cd ooqp-userguide; \
pdflatex  ooqp-userguide; \
bibtex ooqp-userguide; \
pdflatex  ooqp-userguide; \
pdflatex  ooqp-userguide
/bin/sh: 2: pdflatex: not found
/bin/sh: 3: bibtex: not found
/bin/sh: 4: pdflatex: not found
/bin/sh: 5: pdflatex: not found
GNUmakefile:42: recipe for target 'ooqp-userguide/ooqp-userguide.pdf' failed
make[1]: *** [ooqp-userguide/ooqp-userguide.pdf] Error 127
make[1]: Leaving directory '/home/seivl/my_lib/OOQP/doc-src'
GNUmakefile:102: recipe for target 'install_docs' failed
make: *** [install_docs] Error 2

2. 使用

  • 例子

  • 主函数 main.cpp

/* OOQP                                                               *
 * Authors: E. Michael Gertz, Stephen J. Wright                       *
 * (C) 2001 University of Chicago. See Copyright Notification in OOQP */
 
#include "QpGenData.h"
#include "QpGenVars.h"
#include "QpGenResiduals.h"
#include "GondzioSolver.h"
#include "QpGenSparseMa27.h"
 
#include <iostream>
#include <string.h>
 
using namespace std;
 
const int nx   = 2;
double    c[]  = { 1.5,  -2 };
 
double  xupp[] = { 20,   0 };
char   ixupp[] = {  1,   0 };
 
double  xlow[] = {  0,   0 };
char   ixlow[] = {  1,   1 };
 
const int nnzQ = 3;
int    irowQ[] = {  0,   1,   1 }; 
int    jcolQ[] = {  0,   0,   1 };
double    dQ[] = {  8,   2,  10 };
 
 
int my         = 0;
double * b     = 0;
int nnzA       = 0;
int * irowA    = 0;
int * jcolA    = 0;
double * dA    = 0;
 
const int mz   = 2;
double clow[]  = { 2,   0 };
char  iclow[]  = { 1,   0 };
 
double cupp[]  = { 0,   6 };
char  icupp[]  = { 0,   1 };
 
const int nnzC = 4;
int   irowC[]  = { 0,   0,   1,   1};
int   jcolC[]  = { 0,   1,   0,   1};
double   dC[]  = { 2,   1,  -1,   2};
 
int main( int argc, char * argv[] )
{
  int usage_ok = 1, quiet = 0;
 
  if( argc > 2 ) usage_ok = 0;
  if( argc == 2 ) {
    if( 0 == strcmp( "--quiet", argv[1] ) ) {
      quiet = 1;
    } else {
      usage_ok = 0;
    }
  } 
  if( !usage_ok ) {
    cerr << "Usage: " <<  argv[0] << " [ --quiet ]\n";
    return 1;
  }
    
  QpGenSparseMa27 * qp 
    = new QpGenSparseMa27( nx, my, mz, nnzQ, nnzA, nnzC );
  
  QpGenData      * prob = (QpGenData * ) qp->copyDataFromSparseTriple(
        c,      irowQ,  nnzQ,   jcolQ,  dQ,
        xlow,   ixlow,  xupp,   ixupp,
        irowA,  nnzA,   jcolA,  dA,     b,
        irowC,  nnzC,   jcolC,  dC,
        clow,   iclow,  cupp,   icupp );
 
  QpGenVars      * vars 
    = (QpGenVars *) qp->makeVariables( prob );
  QpGenResiduals * resid 
    = (QpGenResiduals *) qp->makeResiduals( prob );
  
  GondzioSolver  * s     = new GondzioSolver( qp, prob );
  
  if( !quiet ) s->monitorSelf();
  int ierr = s->solve(prob,vars, resid);
  
  if( ierr == 0 ) {
    cout.precision(4);
    cout << "Solution: \n";
    vars->x->writefToStream( cout, "x[%{index}] = %{value}" );
  } else {
    cout << "Could not solve the problem.\n";
  }
  return ierr;
}
  • CMakeLists.txt
cmake_minimum_required(VERSION 2.8.9)

project(astar)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenCV REQUIRED)

set(AS_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/src/AStar.cpp
)

set(AS_HEADERS
    ${CMAKE_CURRENT_SOURCE_DIR}/include/AStar.h
)
    

include_directories(include 
                    maps
                    "/home/seivl/my_lib/OOQP/include"
)

link_directories("/home/seivl/my_lib/OOQP/lib")

add_executable(main src/main.cpp ${AS_HEADERS} ${AS_SOURCES})

target_link_libraries(main 
                    ${OpenCV_LIBS}
                    ooqpgensparse
                    ooqpsparse
                    ooqpgondzio
                    ooqpbase 
                    blas 
                    ma27 
                    gfortran
)
  • 结果
seivl@seivl-Default-string:~/my_codebase/astar/build$ ./main 

Duality Gap: 24408.2
 *** Iteration 1 *** 
 mu = 1.05983e+06 relative residual norm = 51.3635
 *** sigma = 0.00860914

Duality Gap: 100552
 Number of Corrections = 3 alpha = 0.932017
 *** Iteration 2 *** 
 mu = 91617.7 relative residual norm = 3.49182
 *** sigma = 0.0167391

Duality Gap: 43229
 Number of Corrections = 0 alpha = 1
 *** Iteration 3 *** 
 mu = 8645.81 relative residual norm = 3.49182e-08
 *** sigma = 0.000574057

Duality Gap: 3626.12
 Number of Corrections = 1 alpha = 0.923124
 *** Iteration 4 *** 
 mu = 725.224 relative residual norm = 2.68436e-09
 *** sigma = 0.636176

Duality Gap: 5271.94
 Number of Corrections = 0 alpha = 0.531986
 *** Iteration 5 *** 
 mu = 1054.39 relative residual norm = 1.25632e-09
 *** sigma = 0.00263244

Duality Gap: 691.751
 Number of Corrections = 3 alpha = 0.875319
 *** Iteration 6 *** 
 mu = 138.35 relative residual norm = 1.5664e-10
 *** sigma = 0.619859

Duality Gap: 823.53
 Number of Corrections = 3 alpha = 0.167946
 *** Iteration 7 *** 
 mu = 164.706 relative residual norm = 1.30332e-10
 *** sigma = 0.000274768

Duality Gap: 21.3443
 Number of Corrections = 1 alpha = 0.99906
 *** Iteration 8 *** 
 mu = 4.26886 relative residual norm = 1.22835e-13
 *** sigma = 0.505767

Duality Gap: 74.7201
 Number of Corrections = 0 alpha = 1
 *** Iteration 9 *** 
 mu = 14.944 relative residual norm = 7.10543e-16
 *** sigma = 0.223693

Duality Gap: 35.3068
 Number of Corrections = 0 alpha = 1
 *** Iteration 10 *** 
 mu = 7.06137 relative residual norm = 5.32907e-16
 *** sigma = 0.00165875

Duality Gap: 1.91847
 Number of Corrections = 3 alpha = 0.978992
 *** Iteration 11 *** 
 mu = 0.383694 relative residual norm = 1.02696e-16
 *** sigma = 0.00411975

Duality Gap: 0.0711423
 Number of Corrections = 1 alpha = 0.999296
 *** Iteration 12 *** 
 mu = 0.0142285 relative residual norm = 8.73173e-15
 *** sigma = 3.7001e-05

Duality Gap: 9.98993e-05
 Number of Corrections = 0 alpha = 1
 *** Iteration 13 *** 
 mu = 1.99799e-05 relative residual norm = 7.00043e-16
 *** sigma = 1.73374e-13

Duality Gap: 1.72513e-12
 Number of Corrections = 1 alpha = 1
 *** Iteration 14 *** 
 mu = 2.73377e-13 relative residual norm = 1.79335e-14

 *** SUCCESSFUL TERMINATION ***
Solution: 
x[0] = 0.7625
x[1] = 0.475
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

OOQP 安装和使用 的相关文章

  • Ubuntu Desktop下自动启动终端并运行脚本

    进入桌面后按Alt 43 F2组合键或Win键 xff0c 输入gnome session properties选择出现的那个应用程序 点击 添加 xff0c 输入名称和命令 xff08 注意 xff0c 这里的命令就是一个单纯的shell
  • include头文件的顺序以及双引号和尖括号的区别?

    Include头文件的顺序 对于include的头文件来说 xff0c 如果在文件a h中声明一个在文件b h中定义的变量 xff0c 而不引用b h 那么要在a c文件中引用b h文件 xff0c 并且要先引用b h xff0c 后引用a
  • The manifest must not cotain the following tags:run_depend解决方法

    当你在package xml中 xff0c 添加完run depend后 xff0c 编译出错 xff0c 显示The manifest must not cotain the following tags run depend xff0c
  • Astar算法

    1 什么是Astar算法 xff1f Astar算法是一种图形搜索算法 xff0c 常用于寻路 它是个以广度优先搜索为基础 xff0c 集Dijkstra算法与最佳优先 best fit 算法特点于一身的一种算法 它通过下面这个函数来计算每
  • 十进制转十六进制(C语言)

    输入 xff1a Entern 666 输出 xff1a 29A include 34 stdio h 34 include 34 stdlib h 34 int main void int n a1 count 61 0 j count
  • STM32串口发送数据和接收数据方式总结

    之前写了篇关于ESP8266使用AT指令进行互相通讯的实验 xff0c 在写STM32串口接发数据的程序中 xff0c 觉得有必要将之前学的有关于串口方面的使用经历加以总结 串口发送数据 xff1a 1 串口发送数据最直接的方式就是标准调用
  • fused_adam.so: cannot open shared object file: No such file or directory问题排查与解决

    最近一个同学加载一个新的预训练模型时候碰到了这样一个问题 xff0c 帮他排查解决一下 xff1a File 34 data anaconda3 envs nlp lib python3 6 site packages torch util
  • libcurl第十二课 内存分析

    在实际的测试环境中 xff0c 内存在不断的增长 xff0c 尽管不是很明显 代码申请内存分析 struct Curl multi Curl multi handle int hashsize socket hash int chashsi
  • stm32 esp8266 ota升级-tcp模拟http

    stm32 esp8266 ota系列文章 xff1a stm32 esp8266 ota 快速搭建web服务器之docker安装openresty stm32 esp8266 ota升级 tcp模拟http stm32 esp8266 o
  • vscode配置C环境

    vscode配置C环境 最近感觉基础不太行 xff0c 想重新看下数据结构 xff0c 用c语言重新写一下经典的结构 也不想换编辑器 xff0c 就想用vscode xff0c 刚好github上有一个一键配置c环境的工具 记录一下 配置c
  • 【光线追踪系列一】PPM输出;自定义vec3;光线、简单相机及天空采样

    本次光线追踪系列从基础重新开始 xff0c 主要参照 Ray Tracing in One Weekend xff0c 具体实现代码框架见 https github com RayTracing raytracing github io 本
  • 服务器总线协议_第一章----I2C总线协议入门

    目录 一 概述 二 首先了解一下I2C的I O结构 三 其次了解一下I2C的时序 第一部分 xff1a 起始停止信号简介 第二部分 xff1a I2C的时序部分要求 第三部分 xff1a I2C的一帧数据的格式 四 最终问与答 1 xff0
  • 服务器总线协议_第二章----I2C总线协议进阶

    敬请期待 xff0c 预计8月1日发布 xff0c 需要请加个关注
  • 服务器总线协议_第三章----SVID电源管理协议

    目录 一 概述 二 SVID协议组成方式 三 SVID协议拓扑要求 四 SVID如何判别读写 Master读操作 Master写操作 五 问与答 1 xff09 SVID有没有特殊的要求 xff1f 一 概述 首先先了解一下SVID的全称
  • PM_Sync的作用

    目录 一 先来了解一下PM Sync的全称 xff1a 一 PM Sync简介 PM Sync xff1a Power Management synchronization 同步电源管理 在知道这个信号的作用之前需要先来了解一下 ADR 二
  • si4438使用stm32f103配置调试成功!

    刚拿到si4438时候在网上找了一大波资源 xff0c 发现能使用的并没有多少 xff0c 于是自己配置一发 经过不懈努力配置成功 xff0c 现在将一些配置过程分享给大家 xff01 源码已上传 尽情下载 xff01 1 首先打开工程文件
  • 教你如何使用stm32发送一帧数据(结构体中的数据)

    在这篇文章中我介绍一下如何通过串口发送一帧存在结构体中的数据 通过串口接受一帧数据请参考的我博客中的文章 教你如何使用stm32接收一帧数据 xff01 一 xff1a 在 h首先定义一个结构体 typedef struct uint8 t
  • 浅谈线性稳压电源和开关稳压电源(开关电源)

    目前现有电源主要分为两大类 xff1a 线性稳压电源和开关稳压电源 xff08 开关电源 xff09 线性稳压电源 线性稳压电源经过变压 整流 滤波 稳压实现电源稳压 优点 xff1a 稳定性好 xff0c 瞬态响应速度快 xff0c 可靠
  • c++ #define 用法

    1 用于表示将两个参数连在一起 xff0c 其中宏的 前后空格会被省略 define CONNA a b a b define CONNB a b a b int main string a 61 CONNA 34 one 34 34 tw
  • MySQL第五课 Table has no partition for value

    场景 MySQL由于安全性要求 xff0c 版本升级之后 xff0c 执行插入数据出现Table has no partition for value 错误 已有版本5 7 20 log升级到5 7 26 log 说明 建表过程中 xff0

随机推荐

  • DSP数据安全平台

    数据安全平台 xff08 DSP xff0c Data Security Platforms xff09 的概念来源于Gartner的 2021数据安全技术成熟度曲线 xff0c DSP定义为以数据安全为中心的产品和服务 xff0c 旨在跨
  • c++ 数学库

    链接 link
  • vscode使用restClient实现各种http请求

    vscode使用restClient实现各种http请求 一 xff0c 安装插件 首先 xff0c 我们要在vscode的扩展中 xff0c 搜索rest Client xff0c 然后安装它 xff0c 这里我已经安装过了 安装后 xf
  • K210和STM32串口通信(亲测有效)

    声明 最近想做一个K210数字识别和寻迹 xff0c 方便完成2021年电赛F题 xff0c 完成了数字训练和脱机运行就想赶紧进行一次通信 xff0c 调了好几天 郁闷 xff0b 自闭几天 按照官方的历程看 xff0c 配置的没问题但是会
  • 简单Rabbitmq 发送消息和接收消息

    简单Rabbitmq 发送消息和接收消息 1 先在Rabbitmq配置文件中预先创建好交换器 xff0c 队列 xff0c 路由等信息 2 创建生产者发送消息 64 Autowired private RabbitTemplate rabb
  • Elasticsearch(ES6)------(4) ES设置用户名密码访问

    Elasticsearch ES xff08 1 xff09 下载 安装 43 kibana 下载 xff08 2 xff09 本机多节点启动 43 ElasticSearch head插件使用 xff08 3 xff09 索引 文档概念和
  • Elasticsearch(ES6) --根据条件修改字段值

    POST index name doc update by query 34 query 34 34 match 34 34 version 34 34 12 22 34 34 script 34 34 inline 34 34 ctx s
  • redis限流使用lua脚本

    lua脚本 xff0c 计数器限流 5秒内限流10次 64 param key 64 return public boolean acquire String key long now 61 System currentTimeMillis
  • ES6分页from+size、search_after两种查询

    1 from 43 size 分页查询 64 RequestMapping value 61 34 get 34 method 61 RequestMethod GET public BaseResponse lt List lt Obje
  • 使用activiti总结--bpmn画流程图

    假期结束 xff0c 赶紧总结一下前几天使用的Activiti工作流的一些方法 简单介绍一下Activiti Activiti一套完整的方便的业务流程管理 xff08 BPM xff09 框架 xff0c 它是覆盖了业务流程管理 工作流 服
  • clock函数 使用以及问题

    使用 clock 函数是一个计算程序运行时间 xff08 其实简略的理解为占用CPU的使用时间 xff09 其实如果使用sleep函数 xff0c 程序是放弃CPU的使用权 xff0c 直到某个时间的到来 xff0c 当然就不会存在占用CP
  • 使用activiti总结--发布,办理,查询

    接上一篇文章 xff0c 使用创建好的流程图 xff0c 总结一下activiti发布到查询使用的方法和测试代码 流程图 1 引用配置文件 activiti cfg xml xff0c 不引用或者引用失败的话在创建流引擎的时候会报空指针异常
  • Could not open JDBC Connection for transaction

    操做 xff1a 访问20次数据库没问题 xff0c 超过20次调用后报如下错误 详细报错 xff1a org springframework transaction CannotCreateTransactionException Cou
  • 【可信计算】第八次课:可信软件栈编程开发

    TPM2开源软件包 目前在github上TPM2开源软件一共包含六个项目tpm2 tools tpm2 tss tpm2 pkcs11 tpm2 tss engine tpm2 abrmd tpm2 totp 1 tpm2 tools 这一
  • 国赛----可见光室内定位

    初期试探 拿到题目后 xff0c 反复读了题目 首先队内结合网上资料形成了两种方案 xff0c 原理相同就是利用光信号到达的强度来定位 两者差距在于算法不同而已 xff0c 一种利用计算得出位置 xff0c 另一种就是经过测量得到一种位置与
  • 各种Arduino外部中断程序

    一 中断 Interrupt 的基本概念 中断 xff08 Interrupt xff09 是计算机的一个重要概念 xff0c 现代计算机普遍采用中断技术 什么是中断呢 xff1f CPU执行时原本是按程序指令一条一条向下顺序执行的 但如果
  • PX4通过参数脚本给飞控导入参数

    PX4通过参数脚本给飞控导入参数 先找一架正常能飞的无人机连接地面站 在参数页面右上角点击工具 gt 保存到文件 保存的时候文件名注明参数的相关信息 然后将需要加载参数的无人机连接至地面站 xff0c 注意需要加载参数的无人机必须和保存的参
  • 深蓝 运动规划

    文章目录 CH1 Introduction一 Motion Planning 概念二 Front end xff1a Path finding1 Search based methods2 Sampling based methods3 K
  • 接收机/DTU 安装调试 读取gps数据

    文章目录 一 整体连接图二 DTU配置三 接收机设置 在这里记录一下 xff0c 实验室平台上 xff0c 安装gps接收机和配置的一些步骤 一 整体连接图 二 DTU配置 首先 DTU 需要通过 COM 口和电脑端连接 xff0c 注意这
  • OOQP 安装和使用

    OOQP 安装和使用 1 安装2 使用 1 安装 需要先安装 blas 和 ma27 BLAS xff1a span class token builtin class name cd span my lib span class toke