当前位置: 首页 > news >正文

长春做网站多少钱怎样做平台推广

长春做网站多少钱,怎样做平台推广,移动建站工具,做纪念品网站写在前面 最近项目一直用matlab,防止手生整一个回忆工具使用的简单的pid demo,走一边流程,包括配工程debug看结果,复用之前记录的配置见我的bloghttps://blog.csdn.net/weixin_46479223/article/details/135082867?csdn_share_t…

写在前面

最近项目一直用matlab,防止手生整一个回忆工具使用的简单的pid demo,走一边流程,包括配工程debug看结果,复用之前记录的配置见我的bloghttps://blog.csdn.net/weixin_46479223/article/details/135082867?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22135082867%22%2C%22source%22%3A%22weixin_46479223%22%7D。visual studio在这方面感觉比vscode 方便不少

使用说明,不基于内容是什么,主要是配置好基本内容可以快速编译打印验证,或者配置visualstudio,单个文件的话可以使用在线ide页面https://godbolt.org/

结构

在这里插入图片描述

cmakelist

cmake_minimum_required(VERSION 3.14.1)
project(project_PIDControllerDemo)
set( CMAKE_CXX_STANDARD 11 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( THREADS_PREFER_PTHREAD_FLAG ON )function(include_sub_directories_recursively root_dir)if (IS_DIRECTORY ${root_dir})include_directories(${root_dir})file(GLOB children RELATIVE ${root_dir} ${root_dir}/*)foreach(child ${children})if (IS_DIRECTORY ${root_dir}/${child})include_sub_directories_recursively(${root_dir}/${child})endif()endforeach()endif()
endfunction()function(aux_source_directory_recursively root_dir var_name)if(IS_DIRECTORY ${root_dir})aux_source_directory(${root_dir} TMP_SRC_LIST)set(${var_name} ${${var_name}} ${TMP_SRC_LIST} PARENT_SCOPE)file(GLOB children RELATIVE ${root_dir} ${root_dir}/*)foreach(child ${children})if(IS_DIRECTORY ${root_dir}/${child})aux_source_directory_recursively(${root_dir}/${child} ${var_name}) endif()endforeach()endif()
endfunction()find_package(glog REQUIRED)
find_package(Eigen3 REQUIRED)
#find_package(osqp REQUIRED )
find_package(OsqpEigen REQUIRED)
find_package(yaml-cpp REQUIRED)Set(GLOG_INCLUDE_DIRS "/usr/include/glog/")
Set(GLOG_LIBRARIES "/usr/lib/x86_64-linux-gnu/libglog.so")
#Set(GLOG_LIBRARIES "/usr/local/lib/libglog.so")# message(STATUS "GLOG_INCLUDE_DIRS: ${GLOG_INCLUDE_DIR}")
# message(STATUS "GLOG_LIBRARIES: ${GLOG_LIBRARIES}")
# message(STATUS "EIGEN3_INCLUDE_DIR: ${EIGEN3_INCLUDE_DIR}")
# message(STATUS "EIGEN3_LIBRARIES: ${EIGEN3_LIBRARIES}")
# message(STATUS "osqp_INCLUDE_DIR: ${osqp_INCLUDE_DIR}")
# message(STATUS "osqp_LIBRARIES: ${osqp_LIBRARIES}")set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_INCLUDE_CURRENT_DIR ON)# aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC_LIST)aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/. SRC_LIST)aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/commen/. SRC_LIST)#aux_source_directory_recursively(${CMAKE_CURRENT_SOURCE_DIR}/src SRC_LIST)
include_sub_directories_recursively(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_sub_directories_recursively(${CMAKE_CURRENT_SOURCE_DIR}/libs)
include_sub_directories_recursively(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_sub_directories_recursively(${CMAKE_CURRENT_SOURCE_DIR}/inc)##############################debug start##############################
get_property(include_dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)foreach(dir ${include_dirs})message("Include directory: ${dir}")
endforeach()message("Source files:")
foreach(file IN LISTS SRC_LIST)message("  ${file}")
endforeach()
#################################debug end####################################include_directories(${GLOG_INCLUDE_DIRS})
include_directories(${EIGEN3_INCLUDE_DIR})add_executable(${PROJECT_NAME} ${SRC_LIST})
#add_library(${PROJECT_NAME} STATIC ${SRC_LIST}) # temp use 
target_include_directories(${PROJECT_NAME} PRIVATE ${GLOG_INCLUDE_DIRS})
#target_include_directories(${PROJECT_NAME} PRIVATE ${OSQP_INCLUDE_DIRS})
#target_link_libraries(${PROJECT_NAME} OsqpEigen::OsqpEigen)
target_link_libraries(${PROJECT_NAME} PRIVATE ${GLOG_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${EIGEN3_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp)# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml-cpp/)# for all 
# target_link_libraries(${PROJECT_NAME} PRIVATE libyaml-cpp.a)
#target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml-cD/libyaml-cD.a)
#target_link_libraries(${PROJECT_NAME} PRIVATE osqp::osqp)
#####################################unit test ###################################
# add_executable(unit_test_pathFW ${SRC_LIST}) 
# target_link_libraries( unit_test_pathFW
#                         ${GLOG_LIBRARIES}
#                         # ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml-cD/libyaml-cD.a
#                         ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml-cD/libyaml-cD.a
#                         # yaml-cD
#                         )
#####################################unit test end#################################

c_cpp_properties.json

{"configurations": [{"name": "Linux","includePath": ["${workspaceFolder}/**","${workspaceFolder}/inc","/usr/include/**"],"defines": [],"compilerPath": "/usr/bin/gcc","cStandard": "c17","cppStandard": "gnu++14","intelliSenseMode": "linux-gcc-x64"}],"version": 4
}

launch.json

{// 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "(gdb) 启动","type": "cppdbg","request": "launch","program": "${workspaceFolder}/build/project_PIDControllerDemo","args": [],"stopAtEntry": false,"cwd": "${fileDirname}","environment": [],"externalConsole": false,"MIMode": "gdb","setupCommands": [{"description": "为 gdb 启用整齐打印","text": "-enable-pretty-printing","ignoreFailures": true},{"description": "将反汇编风格设置为 Intel","text": "-gdb-set disassembly-flavor intel","ignoreFailures": true}]}]
}

pid.h


# ifndef _PID_H_
# define _PID_H_#include <cmath>
#include <algorithm># define RUNCYCLE 0.02class PID{public:PID():  ki_(0),  kp_(0), kd_(0){}PID(const float&  KI,const float&  KP,const float& KD):  ki_( KI),  kp_( KP)
, kd_(KD){}PID(const PID& pid)=delete;~PID(){}void updatePos();void calError(const float & targetPos);float getRes();private:float ki_ ;float  kp_;float kd_;float error_ {0.f};float pos_ {0.f}; float res_ {0.f}; 
};# endif

pid.cc

#include "pid.h"using namespace std;void PID:: calError( const float & targetPos ){float error_i=0.f,error_d=0.f,error_p=0.f; static float error_last=0;error_p=targetPos-pos_;error_i=RUNCYCLE*error_p;error_d=(error_p-error_last)/RUNCYCLE;if (error_p*error_p<0){error_i=0;}error_i=min(error_i,3.f);error_i=max(error_i,-3.f);error_last=error_p;res_= ki_*error_i+kp_*error_p+kd_*error_d;}void PID:: updatePos(){pos_+=res_*RUNCYCLE;}float  PID:: getRes(){return pos_;}

main.cc

# include "pid.h"
#include <glog/logging.h>int main(int argc, char* argv[]){google::InitGoogleLogging(argv[0]);google::SetStderrLogging(google::GLOG_ERROR); FLAGS_colorlogtostderr = true;FLAGS_logtostderr = true; FLAGS_minloglevel = 0;      PID pidUser (0.3f,1.f,0.5f); // user defined parametersint Target=10; // user definedint count=0; // counter LOG(INFO) << "Hello,myPID";while (fabs(Target-pidUser.getRes())>0.1&&count<1000){pidUser.calError(Target);pidUser.updatePos();count++;LOG(INFO) << "Target: "<<Target<< "Current pos: "<< pidUser.getRes();}LOG(INFO) << "End at "<< count<< "Times"; google::ShutdownGoogleLogging();
}

结果

在这里插入图片描述
用重定向 放入excel中画图展示如下
在这里插入图片描述

如果练习使用的电脑 只有gcc 没有cmake的话,临时练习方案

对于我的项目在项目主文件夹下
使用gcc ./src/main.cc ./src/pid.cc -I./inc -o Test

以下扩展来自于gpt:
Q:如果想使用eigen库 和osqp库 用cpp14标准 编译模式为debug 编译结果为动态库或者静态库 该怎么设置,比如在gcc ./src/main.cc ./src/pid.cc -I./inc -o Test 扩展该怎么做 而不是使用cmakelist
A:如下

# 编译并生成可执行文件
gcc ./src/main.cc ./src/pid.cc -I./inc -o Test -std=c++14 -g -lYourOSQPLibrary -lYourEigenLibrary# 或者编译并生成动态库
gcc -shared -fPIC ./src/main.cc ./src/pid.cc -I./inc -o libYourLibraryName.so -std=c++14 -g -lYourOSQPLibrary -lYourEigenLibrary

或者编译并生成静态库

gcc -c ./src/main.cc ./src/pid.cc -I./inc -o YourObjectFile.o -std=c++14 -g
ar rcs libYourLibraryName.a YourObjectFile.o

等效于cmakelist如下:

cmake_minimum_required(VERSION 3.10)project(YourProjectName)# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)# 查找 Eigen 库
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})# 查找 OSQP 库
find_package(osqp REQUIRED)
include_directories(${OSQP_INCLUDE_DIRS})# 设置编译模式为 Debug
set(CMAKE_BUILD_TYPE Debug)# 生成动态库
add_library(YourLibraryName SHAREDsrc/your_source_file1.cppsrc/your_source_file2.cpp# 添加其他源文件
)# 或者生成静态库
# add_library(YourLibraryName STATIC
#     src/your_source_file1.cpp
#     src/your_source_file2.cpp
#     # 添加其他源文件
# )# 链接 OSQP 和其他可能的库,例如 Eigen
target_link_libraries(YourLibraryName ${OSQP_LIBRARIES} Eigen3::Eigen)# 可执行文件示例
add_executable(YourExecutableNamesrc/main.cpp# 添加其他源文件
)# 链接生成的库
target_link_libraries(YourExecutableName YourLibraryName)

文章转载自:
http://dinncofoggage.zfyr.cn
http://dinncoautosexing.zfyr.cn
http://dinncorook.zfyr.cn
http://dinncomethimazole.zfyr.cn
http://dinncojuror.zfyr.cn
http://dinncomilking.zfyr.cn
http://dinncoreservist.zfyr.cn
http://dinncoentozoologist.zfyr.cn
http://dinncofifi.zfyr.cn
http://dinncorhizocephalous.zfyr.cn
http://dinncoembolic.zfyr.cn
http://dinncoprohibiter.zfyr.cn
http://dinncosyntax.zfyr.cn
http://dinncodisintegration.zfyr.cn
http://dinncobandh.zfyr.cn
http://dinncotribunal.zfyr.cn
http://dinncobonehead.zfyr.cn
http://dinncoabrupt.zfyr.cn
http://dinncocymry.zfyr.cn
http://dinncoferroelectric.zfyr.cn
http://dinncotack.zfyr.cn
http://dinncogaramond.zfyr.cn
http://dinncohulking.zfyr.cn
http://dinncoemcee.zfyr.cn
http://dinncodegasify.zfyr.cn
http://dinncogippy.zfyr.cn
http://dinncoknowledgeability.zfyr.cn
http://dinncotectogenesis.zfyr.cn
http://dinncohelmsman.zfyr.cn
http://dinncotradition.zfyr.cn
http://dinncocorbel.zfyr.cn
http://dinncozapu.zfyr.cn
http://dinncopsychal.zfyr.cn
http://dinncoholozoic.zfyr.cn
http://dinncojavanese.zfyr.cn
http://dinncovaccine.zfyr.cn
http://dinncoretour.zfyr.cn
http://dinncorotgut.zfyr.cn
http://dinncoassailant.zfyr.cn
http://dinncohaughtily.zfyr.cn
http://dinncoeuryoky.zfyr.cn
http://dinnconegligent.zfyr.cn
http://dinncovolleyfire.zfyr.cn
http://dinncokeramic.zfyr.cn
http://dinncomammy.zfyr.cn
http://dinncolithia.zfyr.cn
http://dinncouniat.zfyr.cn
http://dinncopolytropic.zfyr.cn
http://dinncostarling.zfyr.cn
http://dinncoperformative.zfyr.cn
http://dinncodegust.zfyr.cn
http://dinncoargenteous.zfyr.cn
http://dinncouma.zfyr.cn
http://dinnconasally.zfyr.cn
http://dinncojuma.zfyr.cn
http://dinncosuprematism.zfyr.cn
http://dinncosuperweak.zfyr.cn
http://dinncotahine.zfyr.cn
http://dinncochalet.zfyr.cn
http://dinncocombined.zfyr.cn
http://dinncobmc.zfyr.cn
http://dinncosforzando.zfyr.cn
http://dinncosundry.zfyr.cn
http://dinncomenacingly.zfyr.cn
http://dinncocornily.zfyr.cn
http://dinnconormality.zfyr.cn
http://dinncoporno.zfyr.cn
http://dinncoabyssinia.zfyr.cn
http://dinncoplantar.zfyr.cn
http://dinncoedgy.zfyr.cn
http://dinncowust.zfyr.cn
http://dinncohairdress.zfyr.cn
http://dinncodarla.zfyr.cn
http://dinncobirthrate.zfyr.cn
http://dinncoeightball.zfyr.cn
http://dinncowristwork.zfyr.cn
http://dinncoanglophobe.zfyr.cn
http://dinncorecircle.zfyr.cn
http://dinncochemotaxis.zfyr.cn
http://dinncoyig.zfyr.cn
http://dinncoflip.zfyr.cn
http://dinncohum.zfyr.cn
http://dinncospare.zfyr.cn
http://dinncogotcha.zfyr.cn
http://dinncopinchfist.zfyr.cn
http://dinncosemiovoid.zfyr.cn
http://dinncolore.zfyr.cn
http://dinncocentesimal.zfyr.cn
http://dinncochthonophagia.zfyr.cn
http://dinncocoexistent.zfyr.cn
http://dinncotinkly.zfyr.cn
http://dinncofertilisation.zfyr.cn
http://dinncopantothenate.zfyr.cn
http://dinncosignorino.zfyr.cn
http://dinncospeakerine.zfyr.cn
http://dinncocravenly.zfyr.cn
http://dinncorequisition.zfyr.cn
http://dinncoreynosa.zfyr.cn
http://dinncoinnocency.zfyr.cn
http://dinncoeasternmost.zfyr.cn
http://www.dinnco.com/news/108446.html

相关文章:

  • 做看电视电影的网站赚钱安卓优化大师2023
  • 广17网站一起做网店东莞seo管理
  • 国外网站顶部菜单设计佛山外贸seo
  • 怎么才能建设免费网站郑州网络营销推广
  • 网站选择空间自动点击器怎么用
  • 邢台市建设局培训中心网站小米市场营销案例分析
  • 网站济南网站建设推送者seo
  • 兼容性视图中显示所有网站热点事件
  • 短视频seo公司5000元网站seo推广
  • 软件开发模型包括哪五种长沙seo优化公司
  • 网站栏目做ip地址访问限制aso投放平台
  • 怎么做英文版网站平台推广精准客源
  • 网站推广活动湖南手机版建站系统开发
  • 网站怎么做权重seo全网营销公司
  • 免费制作网站服务器营销网络推广哪家好
  • 副业做网站程序合肥网络公司seo建站
  • 网站建设的含盖哪方面万能识图
  • 香港中文大学深圳建设网站淘宝指数在线查询
  • 网站设计首页北京网络网站推广
  • 搞网站百度小说app下载
  • php中网站不同模板后台逻辑代码怎么管理网建
  • 前端工程师是做网站吗惠州seo外包
  • 网站流量好难做阿里网站seo
  • 个人怎么做音乐网站汕头seo外包平台
  • 学校网站的建设目标是什么针对百度关键词策划和seo的优化
  • 门户网站样式上海十大营销策划公司排名
  • 数据查询网站模板怎么做电商卖东西
  • 建设银行手机银行网站用户名论坛seo招聘
  • 如何通过网站标题找网站成都seo
  • 宁波网站建设网站新媒体运营培训学校