![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 93
huluwabeforewinter
★★★★★
展开
-
leecode每日一题77-组合
题目描述给定两个整数 n 和 k,返回 1 … n 中所有可能的 k 个数的组合。示例:输入: n = 4, k = 2输出:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ]解析以 n=4, k=2 为例,选出组合的第一个数时,我们有 4 种选择,如下图。选出第二个数时,本来有 4 种选择,但有的选择和上一个选择相同,有的选择会产生重复的组合,比如 [1,2] 和 [2,1]。这些选择应该被修剪掉,原创 2020-12-20 11:16:04 · 427 阅读 · 1 评论 -
leecode每日一题417. Pacific Atlantic Water Flow (Medium)
这里写自定义目录标题题目示例求解题目的理解代码题目给定一个 m x n 的非负整数矩阵来表示一片大陆上各个单元格的高度。“太平洋”处于大陆的左边界和上边界,而“大西洋”处于大陆的右边界和下边界。规定水流只能按照上、下、左、右四个方向流动,且只能从高到低或者在同等高度上流动。请找出那些水流既可以流动到“太平洋”,又能流动到“大西洋”的陆地单元的坐标。提示:输出坐标的顺序不重要m 和 n 都小于150示例给定下面的 5x5 矩阵: 太平洋 ~ ~ ~ ~ ~原创 2020-12-19 16:29:31 · 164 阅读 · 2 评论 -
c++ 随机数
使用方法:产生一定范围随机数的通用表示公式要取得[a,b)的随机整数,使用(rand() % (b-a))+ a; 要取得[a,b]的随机整数,使用(rand() % (b-a+1))+ a; 要取得(a,b]的随机整数,使用(rand() % (b-a))+ a + 1; 通用公式:a + rand() % n;其中的a是起始值,n是整数的范围。 要取得a到b之间的随机整数,另一种...原创 2020-02-04 16:47:17 · 154 阅读 · 0 评论 -
proj的安装与使用
官网下载地址:https://proj.org/download.html官网git 地址:https://github.com/OSGeo/PROJ.git (下载比较慢)ubuntu16下的安装:$ cd ~/Download$ git clone https://github.com/OSGeo/PROJ.git(多种尝试,发现下载都很慢,不知道是不是资源问题)#...原创 2019-12-29 11:39:47 · 11514 阅读 · 1 评论 -
【ACADO 使用】纵向控制的简单应用
纵向控制的简单应用(考虑延时delay=0.6s)。#include <acado_toolkit.hpp>#include <acado_gnuplot.hpp>int main(){ USING_NAMESPACE_ACADO DifferentialState s,v,a; Control u_a; Parameter ...原创 2019-12-26 14:53:57 · 1823 阅读 · 0 评论 -
robot_pose_ekf 的安装与使用
robot_pose_ekf环境安装:https://github.com/ros-planning/robot_pose_ekf使用参考:https://www.ncnynl.com/archives/201708/1909.htmlhttp://wiki.ros.org/robot_pose_ekfhttps://blog.csdn.net/shenghuaijing3314/a...原创 2019-12-26 07:51:30 · 3309 阅读 · 1 评论 -
navigation 环境安装
ros-planning/navigation代码库:https://github.com/ros-planning/navigationnavigation环境安装############################################################################### 下载与编译##################...原创 2019-12-26 07:51:06 · 1096 阅读 · 0 评论 -
Octomap库的安装与使用
介绍官网:https://octomap.github.ioROS octomap wiki:http://wiki.ros.org/octomap介绍:https://www.cnblogs.com/gaoxiang12/p/5041142.html高翔git 学习:https://github.com/gaoxiang12/octomap_tutor安装ubuntu...原创 2019-12-09 05:20:10 · 3108 阅读 · 0 评论 -
CppAD
CppAD: A Package for Differentiation of C++ Algorithms源代码:https://github.com/coin-or/CppAD说明文档:https://coin-or.github.io/CppAD/doc/cppad.htm#Features.Base%20Type简单例子:https://coin-or.github.io/Cp...原创 2019-12-05 10:47:55 · 3470 阅读 · 0 评论 -
ACADO 参考学习资料
1)http://docs.ros.org/indigo/api/acado/html/index.html2)http://www.syscop.de/files/2015ss/numopt/e10_ACADO.pdf3)http://acado.sourceforge.net/doc/pdf/acado_manual.pdf原创 2019-12-04 22:26:34 · 1463 阅读 · 1 评论 -
IPOPT 求解优化问题示例
求解模型状态变量 $ x = [x_1,x_2,x_3,x_4]^\mathrm{T}$目标函数 $ f(x) = x_1 * x_4 * (x_1 + x_2+ x_3) + x_3$约束条件:$ g_1(x) = x_1 * x_2 * x_3 * x_4 \ge 25 $; $ g_2(x) = x^2_1 + x^2_2 + x^2_3 + x^2_4 = 40 $求解代码...原创 2019-12-04 15:27:22 · 6592 阅读 · 7 评论 -
OMPL 实现 2D RRTstar
RRT 实现 2D RRT star 的例子,注释后续添加。参考:http://ompl.kavrakilab.org/optimalPlanningTutorial.html主要3个文件:rrtstar.cpp CMakeLists.txt plot_rrtstar.py其中rrtstar.cpp如下:#include <ompl/base/SpaceI...原创 2019-12-04 08:24:53 · 1286 阅读 · 0 评论 -
Ubuntu 下 OMPL 的安装与使用
OMPL 库的简介:OMPL(The Open Motion Planning Library) 运动规划库。可以实现以PRM(Probabilistic Roadmap Method) 和 RRT为基础的各种基于概率的规划算法。如PRM系列(Lazy PRM/PRM*/LazyPRM* 、SPARS(SPARS2)、RRT系列(RRT/RRT Connect/RRT*等)、EST、KPIE...原创 2019-12-03 06:47:48 · 5429 阅读 · 2 评论 -
ubuntu 环境下 IPOPT 安装与使用
安装 Ipopt$ wget https://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.7.zip $ unzip Ipopt-3.12.7.zip $ rm Ipopt-3.12.7.zip$ cd Ipopt-3.12.7$ ./configure......configure: Main configuration o...原创 2019-12-02 17:07:34 · 13861 阅读 · 2 评论 -
error: ‘const class google::protobuf::FileOptions’ has no member named ‘has_php_namespace’;
1)protobuf --> 3.5.02)cd grpcRef:https://www.jianshu.com/p/725c45353c9dhttps://blog.csdn.net/mou_it/article/details/79846066 make clean make HAS_SYSTEM_PROTOBUF=false原创 2019-11-30 12:15:12 · 1678 阅读 · 0 评论 -
leecode每日一题01- Binary Tree Level Order Traversal [Medium]
关于二叉树的遍历查找。Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 ...原创 2018-10-28 21:53:42 · 109 阅读 · 0 评论 -
leecode每日一题02- same tree[easy]
题目:Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Ex...原创 2018-10-28 22:10:34 · 144 阅读 · 0 评论 -
leecode每日一题03-subtree of another tree
题目描述:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of th...原创 2018-10-29 09:11:55 · 143 阅读 · 4 评论 -
C++ 恼人的multiple definition of X链接错误
1. 错误原因首先查了一下C&C++从源代码编译到可执行文件的过程:1)预处理将伪指令(宏定义、条件编译、和引用头文件)和特殊符号进行处理2)编译过程通过词法分析、语法分析等步骤生成汇编代码的过程,过程中还会进行优化3)汇编过程将汇编代码翻译为目标机器指令的过程(.o文件,至少包含代码段和数据段)4)链接程序将所有需要用到的目标代码(变量函数或其他库文件等)装配到一个整...原创 2018-12-10 13:28:26 · 553 阅读 · 0 评论 -
delete-non-virtual-dtor 问题解决办法
编译过程中出现如下警告: warning: deleting object of abstract class type ‘CAN_driver’ which has non-virtual destructor will cause undefined behaviour [-Wdelete-non-virtual-dtor] delete veh_CAN;其中代码结构大致如下...原创 2018-12-11 08:44:20 · 5251 阅读 · 0 评论 -
leecode每日一题04 N-ary Tree Level Order Traversal
Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example, given a 3-ary tree: We should return its level order traver...原创 2019-01-05 12:08:35 · 113 阅读 · 0 评论 -
leecode每日一题05 Leaf-Similar Trees
Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence.For example, in the given tree above, the leaf value sequence is (6, 7, 4...原创 2019-01-05 20:28:07 · 122 阅读 · 0 评论 -
C++ stl accumulate 函数的理解
首先看一个例程://eg.1vector<int> vi{1, 2, 3};cout << accumulate(vi.begin(), vi.end(), 0); // 6可以看出accumulate 有三个参数:第一个是起点;第二个是终点,第三个是初始值。 // eg.2 int ptotal; ptotal = accumul...原创 2018-09-15 11:18:12 · 844 阅读 · 0 评论