Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opcua 模块更新至 2.1 #56

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 3rdparty/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ apriltag 描述 用于定位的视觉基准系统
CMake 选项 BUILD_APRILTAG 开启后可构建此模块(默认开启)
WITH_APRILTAG 启用该选项来为 tag_detector 模块提供 apriltag 支持


open62541 描述 OPC UA 的开源 C++ 实现
许可与版权 open62541 由 MPL-2.0 license 许可证覆盖,参见 open62541/LICENSE
官网主页 open62541.org
CMake 选项 BUILD_OPEN62541 开启后可下载并构建此模块(默认关闭)
WITH_OPEN62541 启用该选项来为 opcua 模块提供 open62541 支持
19 changes: 8 additions & 11 deletions cmake/FindHikSDK.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set(MVCAM_SDK_PATH "$ENV{MVCAM_SDK_PATH}")
if(MVCAM_SDK_PATH STREQUAL "")
set(mvcam_sdk_path "$ENV{MVCAM_SDK_PATH}")
if(mvcam_sdk_path STREQUAL "")
set(HikSDK_FOUND FALSE)
return()
endif()

# add the include directories path
find_path(
HikSDK_INCLUDE_DIR
HikSDK_INCLUDE_DIRS
NAMES "MvCameraControl.h"
PATHS "${MVCAM_SDK_PATH}/include"
PATHS "${mvcam_sdk_path}/include"
NO_DEFAULT_PATH
)

Expand All @@ -28,20 +28,17 @@ else()
endif()

find_library(
HikSDK_LIB
HikSDK_LIBS
NAMES "libMvCameraControl.so"
PATHS "${MVCAM_SDK_PATH}/lib/${ARCH_HIKLIB}"
PATHS "${mvcam_sdk_path}/lib/${ARCH_HIKLIB}"
NO_DEFAULT_PATH
)

mark_as_advanced(ARCH_HIKLIB HikSDK_INCLUDE_DIR HikSDK_LIB)

set(HikSDK_INCLUDE_DIRS "${HikSDK_INCLUDE_DIR}")
set(HikSDK_LIBS "${HikSDK_LIB}")
mark_as_advanced(ARCH_HIKLIB HikSDK_INCLUDE_DIRS HikSDK_LIBS)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
HikSDK
REQUIRED_VARS HikSDK_LIB HikSDK_INCLUDE_DIR
REQUIRED_VARS HikSDK_LIBS HikSDK_INCLUDE_DIRS
)
11 changes: 4 additions & 7 deletions cmake/FindMvSDK.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# add the include directories path
find_path(
MvSDK_INCLUDE_DIR
MvSDK_INCLUDE_DIRS
NAMES "CameraApi.h"
PATHS "/usr/include"
NO_DEFAULT_PATH
)

# add libraries
find_library(
MvSDK_LIB
MvSDK_LIBS
PATHS "/lib"
NAMES "libMVSDK.so"
NO_DEFAULT_PATH
)

mark_as_advanced(MvSDK_INCLUDE_DIR MvSDK_LIB)

set(MvSDK_INCLUDE_DIRS "${MvSDK_INCLUDE_DIR}")
set(MvSDK_LIBS "${MvSDK_LIB}")
mark_as_advanced(MvSDK_INCLUDE_DIRS MvSDK_LIBS)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
MvSDK
REQUIRED_VARS MvSDK_LIB MvSDK_INCLUDE_DIR
REQUIRED_VARS MvSDK_LIBS MvSDK_INCLUDE_DIRS
)
11 changes: 4 additions & 7 deletions cmake/FindOPTCameraSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@ set(OPTCameraSDK_root_path "/opt/OPT/OPTCameraDemo")

# add the include directories path
find_path(
OPTCameraSDK_INCLUDE_DIR
OPTCameraSDK_INCLUDE_DIRS
NAMES "OPTApi.h"
PATHS "${OPTCameraSDK_root_path}/include"
NO_DEFAULT_PATH
)

# add libraries
find_library(
OPTCameraSDK_LIB
OPTCameraSDK_LIBS
NAMES "libOPTSDK.so"
PATHS "${OPTCameraSDK_root_path}/lib"
NO_DEFAULT_PATH
)

mark_as_advanced(OPTCameraSDK_INCLUDE_DIR OPTCameraSDK_LIB)

set(OPTCameraSDK_INCLUDE_DIRS "${OPTCameraSDK_INCLUDE_DIR}")
set(OPTCameraSDK_LIBS "${OPTCameraSDK_LIB}")
mark_as_advanced(OPTCameraSDK_INCLUDE_DIRS OPTCameraSDK_LIBS)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
OPTCameraSDK
REQUIRED_VARS OPTCameraSDK_LIB OPTCameraSDK_INCLUDE_DIR
REQUIRED_VARS OPTCameraSDK_LIBS OPTCameraSDK_INCLUDE_DIRS
)
11 changes: 4 additions & 7 deletions cmake/FindOPTLightCtrl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@ set(OPTLightCtrl_root_path "/opt/OPT/OPTController")

# add the include directories path
find_path(
OPTLightCtrl_INCLUDE_DIR
OPTLightCtrl_INCLUDE_DIRS
NAMES "OPTController.h"
PATHS "${OPTLightCtrl_root_path}/include"
NO_DEFAULT_PATH
)

# add libraries
find_library(
OPTLightCtrl_LIB
OPTLightCtrl_LIBS
NAMES "libOPTController.so"
PATHS "${OPTLightCtrl_root_path}/lib"
NO_DEFAULT_PATH
)

mark_as_advanced(OPTLightCtrl_INCLUDE_DIR OPTLightCtrl_LIB)

set(OPTLightCtrl_INCLUDE_DIRS "${OPTLightCtrl_INCLUDE_DIR}")
set(OPTLightCtrl_LIBS "${OPTLightCtrl_LIB}")
mark_as_advanced(OPTLightCtrl_INCLUDE_DIRS OPTLightCtrl_LIBS)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
OPTLightCtrl
REQUIRED_VARS OPTLightCtrl_LIB OPTLightCtrl_INCLUDE_DIR
REQUIRED_VARS OPTLightCtrl_LIBS OPTLightCtrl_INCLUDE_DIRS
)
9 changes: 3 additions & 6 deletions cmake/FindOrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ endif()

# add the include directories path
find_path(
Ort_INCLUDE_DIR
Ort_INCLUDE_DIRS
PATHS "${ort_root_path}/include/onnxruntime"
NAMES "onnxruntime_cxx_api.h"
NO_DEFAULT_PATH
)

# add libraries
find_library(
Ort_LIB
Ort_LIBS
NAMES "libonnxruntime.so"
PATHS "${ort_root_path}/lib"
NO_DEFAULT_PATH
)

set(Ort_INCLUDE_DIRS "${Ort_INCLUDE_DIR}")
set(Ort_LIBS "${Ort_LIB}")

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
Ort
REQUIRED_VARS Ort_LIB
REQUIRED_VARS Ort_LIBS Ort_INCLUDE_DIRS
)
10 changes: 5 additions & 5 deletions cmake/RMVLModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ endmacro(rmvl_compile_definitions _target)
# ----------------------------------------------------------------------------
# 将指定路径下的所有文件安装至特定目标
# 用法:
# rmvl_install_directories(<directory> [DST_LIB])
# rmvl_install_directories(<directory> [DESTINATION])
# 示例:
# rmvl_install_directories(include/rmvl)
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -82,8 +82,8 @@ endfunction(rmvl_install_directories)
# 示例:
# rmvl_add_module(
# my_module # 需要生成的模块 (文件夹名)
# EXTRA_HEADER xxx_h # 参与构建的其余头文件目录
# EXTRA_SOURCE xxx_src # 参与构建的其余头文件目录
# EXTRA_HEADER xxx_h # 参与构建的除 include 文件夹以外的其余头文件目录
# EXTRA_SOURCE xxx_src # 参与构建的除 src 文件夹以外的其余源文件目录
# DEPENDS core # 依赖的 RMVL 模块 (文件夹名)
# EXTERNAL ${OpenCV_LIBS} # 依赖的第三方目标库
# )
Expand All @@ -95,7 +95,6 @@ macro(rmvl_add_module _name)
cmake_parse_arguments(MD "${options}" "" "${multi_args}" ${ARGN})

# Module information
unset(the_module)
set(the_module rmvl_${_name})
set(
RMVL_MODULE_${the_module}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}"
Expand Down Expand Up @@ -202,7 +201,8 @@ macro(rmvl_add_module _name)
set(RMVL_MODULES_INTERFACE ${RMVL_MODULES_INTERFACE} "${the_module}" CACHE INTERNAL "List of RMVL interface modules marked for export" FORCE)
endif(NOT MD_INTERFACE)
set(RMVL_MODULES_BUILD ${RMVL_MODULES_BUILD} "${the_module}" CACHE INTERNAL "List of RMVL modules included into the build" FORCE)
endif(BUILD_${the_module})
endif()
unset(the_module)
endmacro(rmvl_add_module _name)

# ----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion cmake/RMVLUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro(rmvl_check_cxx result src standard)
try_compile(
${result}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/cpp${standard}
SOURCES ${CMAKE_CURRENT_LIST_DIR}/check/${src}
SOURCES ${PROJECT_SOURCE_DIR}/cmake/check/${src}
COMPILE_DEFINITIONS "${standard}"
)

Expand All @@ -25,6 +25,7 @@ macro(rmvl_check_cxx result src standard)
set(${result} "" CACHE INTERNAL "Test ${result}")
message(STATUS "Performing Test ${result} - Failed")
endif()
unset(build_args)
endmacro()

set(RMVL_BUILD_INFO_STR "" CACHE INTERNAL "")
Expand Down
6 changes: 2 additions & 4 deletions cmake/templates/para_generator_header.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/**
* @file @target_name@.@header_ext@
* @author RoboMaster Vision Community
* @author RMVL Community
* @brief @class_name@ module header file (Generated by CMake automatically)
* @version 1.0
* @date @year@-@month@-@day@
*
* @copyright Copyright @year@ (c), RoboMaster Vision Community
* @copyright Copyright @year@ (c), RMVL Community
*
*/

Expand Down
6 changes: 2 additions & 4 deletions cmake/templates/para_generator_module.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/**
* @file @[email protected]
* @author RoboMaster Vision Community
* @author RMVL Community
* @brief @module_name@ header file (Generated by CMake automatically)
* @version 1.0
* @date @year@-@month@-@day@
*
* @copyright Copyright @year@ (c), RoboMaster Vision Community
* @copyright Copyright @year@ (c), RMVL Community
*
*/

Expand Down
6 changes: 2 additions & 4 deletions cmake/templates/para_generator_source.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/**
* @file @[email protected]
* @author RoboMaster Vision Community
* @author RMVL Community
* @brief @class_name@ module source file (Generated by CMake automatically)
* @version 1.0
* @date @year@-@month@-@day@
*
* @copyright Copyright @year@ (c), RoboMaster Vision Community
* @copyright Copyright @year@ (c), RMVL Community
*
*/

Expand Down
16 changes: 7 additions & 9 deletions doc/tutorials/modules/core/runge_kutta.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

可写成一阶方程组的形式,令\f$x_1=x,\quad x_2=\dot x\f$,有

\f[\left\{\begin{align}
\dot x_1&=x_2\\
\f[\def\mat#1#2{\begin{bmatrix}#1\\#2\end{bmatrix}}
\left\{\begin{align}\dot x_1&=x_2\\
\dot x_2&=-\frac kmx_1-\frac cmx_2+\frac1mp(t)
\end{align}\right.\tag{1-2}\f]

Expand Down Expand Up @@ -206,7 +206,7 @@ k_2&=f\left(t_n+\frac h2,x_n+\frac h2k_1\right)\end{align}\tag{3-7}\f]
\f[\left\{\begin{align}x_{n+1}&=x_n+h(\lambda_1k_1+\lambda_2k_2)\\k_1&=f(t_n+p_1h,x_n+h(a_{11}
k_1+a_{12}k_2))\\k_2&=f(t_n+p_2h,x_n+h(a_{21}k_1+a_{22}k_2))\end{align}\right.\tag{3-8}\f]

令\f$\pmb p=(p_1,p_2)T,\quad\pmb\lambda=(\lambda_1,\lambda_2),\quad
令\f$\pmb p=\mat{p_1}{p_2},\quad\pmb\lambda=(\lambda_1,\lambda_2),\quad
R=\begin{bmatrix}a_{11}&a_{12}\\a_{21}&a_{22}\end{bmatrix}\f$,则

\f[\begin{array}{c|c}\pmb p&R\\\hline&\pmb\lambda\end{array}=\begin{array}{c|cc}p_1&
Expand Down Expand Up @@ -272,7 +272,7 @@ RMVL 的相关类请参考 rm::RungeKutta

**解答**

① 数值解
<span style="color: orange">**① 数值解**</span>

使用中点公式:

Expand Down Expand Up @@ -395,12 +395,11 @@ l_2&=f_2(t_n+\frac h2,x_{1_n}+\frac h2k_1,x_{2_n}+\frac h2l_1)\end{align}\f]

因此,在\f$t=1\f$时,\f$x\approx(0.587286,-0.219401)^T\f$

② 精确解
<span style="color: orange">**② 精确解**</span>

对待求的初值问题写成矩阵形式

\f[\dot X=\begin{bmatrix}0&2\\-1&-3\end{bmatrix}X+\begin{bmatrix}1\\0
\end{bmatrix}t,\quad X(0)=\begin{bmatrix}1\\-1\end{bmatrix}\f]
\f[\dot X=\begin{bmatrix}0&2\\-1&-3\end{bmatrix}X+\mat10t,\quad X(0)=\mat1{-1}\f]

由矩阵分析的知识,可以知道,对于形如\f[\dot X=AX+B(t)\tag{a}\f]的矩阵微分方程,其解为

Expand Down Expand Up @@ -430,8 +429,7 @@ l_2&=f_2(t_n+\frac h2,x_{1_n}+\frac h2k_1,x_{2_n}+\frac h2l_1)\end{align}\f]

可以算出

\f[\def\mat#1#2{\begin{bmatrix}#1\\#2\end{bmatrix}}
e^{At}X(0)=\mat00e^{-t}+\mat1{-1}e^{-2t}=\mat1{-1}e^{-2t}\tag{f}\f]
\f[e^{At}X(0)=\mat00e^{-t}+\mat1{-1}e^{-2t}=\mat1{-1}e^{-2t}\tag{f}\f]

同理有

Expand Down
11 changes: 6 additions & 5 deletions modules/camera/src/hik_camera/hik_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ bool HikCamera::isOpened() const { return _impl->isOpened(); }
bool HikCamera::reconnect() { return _impl->reconnect(); }

//! MV_CC_PIXEL_CONVERT_PARAM 的初始化变量
static MV_CC_PIXEL_CONVERT_PARAM MV_CC_PIXEL_CONVERT_PARAM_Init = {0, 0, PixelType_Gvsp_Undefined, nullptr, 0, PixelType_Gvsp_Undefined, nullptr, 0, 0, {0}};
static const MV_CC_PIXEL_CONVERT_PARAM MV_CC_PIXEL_CONVERT_PARAM_Init =
{0, 0, PixelType_Gvsp_Undefined, nullptr, 0, PixelType_Gvsp_Undefined, nullptr, 0, 0, {0}};

HikCamera::Impl::Impl(CameraConfig init_mode, std::string_view serial) noexcept
: _grab_mode(init_mode.grab_mode), _retrieve_mode(init_mode.retrieve_mode), _serial(serial) { _opened = open(); }
Expand Down Expand Up @@ -145,11 +146,11 @@ static inline cv::ColorConversionCodes pixelType2CVType(MvGvspPixelType pixel_ty
bool HikCamera::Impl::retrieve(cv::OutputArray image, RetrieveMode flag) noexcept
{
// --------------------- 前置信息准备 ---------------------
auto &frame_info = _p_out.stFrameInfo;
const auto &frame_info = _p_out.stFrameInfo;
// 当前格式
auto pixel_type = frame_info.enPixelType;
// 单通道标志位集合
std::unordered_set<MvGvspPixelType> mono_set =
static std::unordered_set<MvGvspPixelType> mono_set =
{PixelType_Gvsp_Mono1p, PixelType_Gvsp_Mono2p, PixelType_Gvsp_Mono4p,
PixelType_Gvsp_Mono8, PixelType_Gvsp_Mono8_Signed,
PixelType_Gvsp_Mono10, PixelType_Gvsp_Mono10_Packed,
Expand All @@ -171,7 +172,7 @@ bool HikCamera::Impl::retrieve(cv::OutputArray image, RetrieveMode flag) noexcep
// MV_CC_ConvertPixelType
if (flag == RetrieveMode::SDK)
{
MV_CC_PIXEL_CONVERT_PARAM cvt_param = MV_CC_PIXEL_CONVERT_PARAM_Init;
MV_CC_PIXEL_CONVERT_PARAM cvt_param{MV_CC_PIXEL_CONVERT_PARAM_Init};
cvt_param.nWidth = frame_info.nWidth; // 图像宽
cvt_param.nHeight = frame_info.nHeight; // 图像高
cvt_param.pSrcData = _p_out.pBufAddr; // 输入数据缓存
Expand Down Expand Up @@ -221,7 +222,7 @@ bool HikCamera::Impl::read(cv::OutputArray image) noexcept
retrieve(image, _retrieve_mode);
else
{
WARNING_("No data in getting image buffer");
WARNING_("hik - No data in getting image buffer");
reconnect();
}
// 释放图像缓存
Expand Down
2 changes: 1 addition & 1 deletion modules/ml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rmvl_add_module(
if(WITH_ONNXRUNTIME)
find_package(Ort)
endif()

set(BUILD_rmvl_ort_INIT ${WITH_ONNXRUNTIME})

rmvl_add_module(
Expand Down
Loading
Loading