Tag Archives: algorithm

[Solved] Hikvision SDK: NET_DVR_GetDVRConfig failed Device does not support this function

Problem:

I have written some code based on Hikvision’s sdk for controlling the camera. One section of the program is mainly used to get NVR channel configuration information

The codes is as below:
I use the function NET_DVR_GetDVRConfig

#include  #include "HCNetSDK.h" int main() { NET_DVR_Init(); //Set connection time and reconnect time NET_DVR_SetConnectTime(2000, 1); NET_DVR_SetReconnect(10000, true); // 注册设备 LONG lUserID; //Login parameters, including device address, login user, password, etc. NET_DVR_USER_LOGIN_INFO struLoginInfo = { 0 }; struLoginInfo.bUseAsynLogin = 0; //同步登录方式 strcpy(struLoginInfo.sDeviceAddress, "192.168.20.106"); //设备IP地址 struLoginInfo.wPort = 8000; //设备服务端口 strcpy(struLoginInfo.sUserName, "admin"); //设备登录用户名 strcpy(struLoginInfo.sPassword, "111111hk"); //设备登录密码 //设备信息, 输出参数 NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = { 0 }; lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40); if (lUserID < 0) { printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); NET_DVR_Cleanup(); return -1; } NET_DVR_IPPARACFG_V40 ipcfg; DWORD bytesReturned = 0; ipcfg.dwSize = sizeof(NET_DVR_IPPARACFG_V40); int iGroupNO = 0; bool resCode = NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_IPPARACFG_V40, iGroupNO, &ipcfg, sizeof(NET_DVR_IPPARACFG_V40), &bytesReturned); if (! resCode) { DWORD code = NET_DVR_GetLastError(); std::cout << "NET_DVR_GetDVRConfig failed " << NET_DVR_GetErrorMsg((LONG*)(&code)) << std::endl; NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return -1; } std::cout << "设备组 " << ipcfg.dwGroupNum << " 数字通道个数 " << ipcfg.dwDChanNum << " 起始通道 " << ipcfg.dwStartDChan << std::endl << std::endl; for (int i = 0; i < ipcfg.dwDChanNum; i++) { NET_DVR_PICCFG_V30 channelInfo; bytesReturned = 0; channelInfo.dwSize = sizeof(NET_DVR_PICCFG_V30); int channelNum = i + ipcfg.dwStartDChan; NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_PICCFG_V30, channelNum, &channelInfo, sizeof(NET_DVR_PICCFG_V30), &bytesReturned); std::cout <<"通道号 "<< channelNum << "\t通道名称 " << channelInfo.sChanName; std::cout << "\t用户名 " << ipcfg.struIPDevInfo[i].sUserName << "\t密码 " << ipcfg.struIPDevInfo[i].sPassword; std::cout << "\t设备ID " << (int)ipcfg.struIPDevInfo[i].szDeviceID; std::cout << "\tip地址 " << ipcfg.struIPDevInfo[i].struIP.sIpV4 << "\t端口 " << ipcfg.struIPDevInfo[i].wDVRPort << std::endl; } //释放SDK资源 NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return 0; } 

The code was running ok, but when migrating to another machine, something went wrong.
Report the error: NET_DVR_GetDVRConfig failed Device does not support this function

Note the phrase:
If the number of IP channels supported by the device is greater than 0, then the remote parameter configuration interface NET_DVR_GetDVRConfig can be used.
This means that to use this function, you need to check the number of IP channels supported by the device first.
Also, the manual gives a sample program (check first, then call)
The sample procedure is as follows.
ps: there is a point I want to spit, the manual on the ET_DVR_GetDVRConfig function explanation, there is no mention of this issue, causing me to look for a long time to find here to write. Since this function is not supported by all devices, then the norm should be written to check first, then call.

#include  #include  #include "Windows.h" #include "string.h" #include "HCNetSDK.h" using namespace std; void main() { int i=0; BYTE byIPID,byIPIDHigh; int iDevInfoIndex, iGroupNO, iIPCh; DWORD dwReturned = 0; //--------------------------------------- // 初始化 NET_DVR_Init(); //设置连接时间与重连时间 NET_DVR_SetConnectTime(2000, 1); NET_DVR_SetReconnect(10000, true); //--------------------------------------- // 注册设备 LONG lUserID; //Login parameters, including device address, login user, password, etc. NET_DVR_USER_LOGIN_INFO struLoginInfo = {0}; struLoginInfo.bUseAsynLogin = 0; //同步登录方式 strcpy(struLoginInfo.sDeviceAddress, "192.0.0.64"); //设备IP地址 struLoginInfo.wPort = 8000; //设备服务端口 strcpy(struLoginInfo.sUserName, "admin"); //设备登录用户名 strcpy(struLoginInfo.sPassword, "abcd1234"); //设备登录密码 //设备信息, 输出参数 NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0}; lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40); if (lUserID < 0) { printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); NET_DVR_Cleanup(); return; } printf("The max number of analog channels: %d\n",struDeviceInfoV40.struDeviceV30.byChanNum); //模拟通道个数 printf("The max number of IP channels: %d\n", struDeviceInfoV40.struDeviceV30.byIPChanNum + struDeviceInfoV40.struDeviceV30.byHighDChanNum * 256);//IP通道个数 //获取IP通道参数信息 NET_DVR_IPPARACFG_V40 IPAccessCfgV40; memset(&IPAccessCfgV40, 0, sizeof(NET_DVR_IPPARACFG)); iGroupNO=0; if (! NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_IPPARACFG_V40, iGroupNO, &IPAccessCfgV40, sizeof(NET_DVR_IPPARACFG_V40), &dwReturned)) { printf("NET_DVR_GET_IPPARACFG_V40 error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } else { for (i=0;i<IPAccessCfgV40.dwDChanNum;i++) { switch(IPAccessCfgV40.struStreamMode[i].byGetStreamType) { case 0: //直接从设备取流 if (IPAccessCfgV40.struStreamMode[i].uGetStream.struChanInfo.byEnable) { byIPID=IPAccessCfgV40.struStreamMode[i].uGetStream.struChanInfo.byIPID; byIPIDHigh=IPAccessCfgV40.struStreamMode[i].uGetStream.struChanInfo.byIPIDHigh; iDevInfoIndex=byIPIDHigh*256 + byIPID-1-iGroupNO*64; printf("IP channel no.%d is online, IP: %s\n", i+1, IPAccessCfgV40.struIPDevInfo[iDevInfoIndex].struIP.sIpV4); } break; case 1: //从流媒体取流 if (IPAccessCfgV40.struStreamMode[i].uGetStream.struPUStream.struStreamMediaSvrCfg.byValid) { printf("IP channel %d connected with the IP device by stream server.\n", i+1); printf("IP of stream server: %s, IP of IP device: %s\n",IPAccessCfgV40.struStreamMode[i].uGetStream.\ struPUStream.struStreamMediaSvrCfg.struDevIP.sIpV4, IPAccessCfgV40.struStreamMode[i].uGetStream.\ struPUStream.struDevChanInfo.struIP.sIpV4); } break; default: break; } } } //配置IP通道5; iIPCh=4; //支持自定义协议 NET_DVR_CUSTOM_PROTOCAL struCustomPro; if (! NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_CUSTOM_PRO_CFG, 1, &struCustomPro, sizeof(NET_DVR_CUSTOM_PROTOCAL), &dwReturned)) //获取自定义协议1 { printf("NET_DVR_GET_CUSTOM_PRO_CFG error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } struCustomPro.dwEnabled=1; //启用主码流 struCustomPro.dwEnableSubStream=1; //启用子码流 strcpy((char *)struCustomPro.sProtocalName,"Protocal_RTSP"); //自定义协议名称:Protocal_RTSP,最大16字节 struCustomPro.byMainProType=1; //主码流协议类型: 1- RTSP struCustomPro.byMainTransType=2; //主码流传输协议: 0-Auto, 1-udp, 2-rtp over rtsp struCustomPro.wMainPort=554; //主码流取流端口 strcpy((char *)struCustomPro.sMainPath,"rtsp://192.168.1.65/h264/ch1/main/av_stream");//主码流取流URL struCustomPro.bySubProType=1; //子码流协议类型: 1-RTSP struCustomPro.bySubTransType=2; //子码流传输协议: 0-Auto, 1-udp, 2-rtp over rtsp struCustomPro.wSubPort=554; //子码流取流端口 strcpy((char *)struCustomPro.sSubPath,"rtsp://192.168.1.65/h264/ch1/sub/av_stream");//子码流取流URL if (! NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_CUSTOM_PRO_CFG, 1, &struCustomPro, sizeof(NET_DVR_CUSTOM_PROTOCAL))) //设置自定义协议1 { printf("NET_DVR_SET_CUSTOM_PRO_CFG error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } printf("Set the custom protocol: %s\n", "Protocal_RTSP"); NET_DVR_IPC_PROTO_LIST m_struProtoList; if (! NET_DVR_GetIPCProtoList(lUserID, &m_struProtoList)) //Get the front-end protocols supported by the device { printf("NET_DVR_GetIPCProtoList error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } IPAccessCfgV40.struIPDevInfo[iIPCh].byEnable=1; //启用 for (i = 0; i<m_struProtoList.dwProtoNum; i++) { if(strcmp((char *)struCustomPro.sProtocalName,(char *)m_struProtoList.struProto[i].byDescribe)==0) { IPAccessCfgV40.struIPDevInfo[iIPCh].byProType=m_struProtoList.struProto[i].dwType; //选择自定义协议 break; } } //IPAccessCfgV40.struIPDevInfo[iIPCh].byProType=0; //厂家私有协议 strcpy((char *)IPAccessCfgV40.struIPDevInfo[iIPCh].struIP.sIpV4,"192.168.1.65"); //前端IP设备的IP地址 IPAccessCfgV40.struIPDevInfo[iIPCh].wDVRPort=8000; //前端IP设备服务端口 strcpy((char *)IPAccessCfgV40.struIPDevInfo[iIPCh].sUserName,"admin"); //前端IP设备登录用户名 strcpy((char *)IPAccessCfgV40.struIPDevInfo[iIPCh].sPassword,"12345"); //前端IP设备登录密码 IPAccessCfgV40.struStreamMode[iIPCh].byGetStreamType=0; IPAccessCfgV40.struStreamMode[iIPCh].uGetStream.struChanInfo.byChannel=1; IPAccessCfgV40.struStreamMode[iIPCh].uGetStream.struChanInfo.byIPID=(iIPCh+1)%256; IPAccessCfgV40.struStreamMode[iIPCh].uGetStream.struChanInfo.byIPIDHigh=(iIPCh+1)/256; //IP通道配置,包括添加、删除、修改IP通道等 if (! NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_IPPARACFG_V40, iGroupNO, &IPAccessCfgV40, sizeof(NET_DVR_IPPARACFG_V40))) { printf("NET_DVR_SET_IPPARACFG_V40 error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } else { printf("Set IP channel no.%d, IP: %s\n", iIPCh+1, IPAccessCfgV40.struIPDevInfo[iIPCh].struIP.sIpV4); } //注销用户 NET_DVR_Logout(lUserID); //释放SDK资源 NET_DVR_Cleanup(); return; } 

[Solved] leetcode Common Error: :runtime error: member access within misaligned address 0xbebebebebebebebe for type ‘str

Common mistakes of brush force buckle:

runtime error: member access within misaligned address 0xbebebebebebebebe for type ‘struct TreeNode’, which requires 8 byte alignment [TreeNode.c]
0xbebebebebebebebe: note: pointer points here

 


cause:
when we access a variable, it contains an unassigned pointer. Pointers that are defined but not assigned are called wild pointers. The direction of the wild pointer is unknown, which has unknown consequences for the program, and the citation is a big problem. Therefore, C language strictly opposes the wild pointer.

In this topic, use

TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));

The root->left and root->right pointers are not assigned initial values or set to NULL, resulting in an error when assigning values to left and right later.

This can be solved by adding two statements.

TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));
root->left = NULL;	// Here's the problem!!! A null pointer without an assignment must be set to NULL
root->right = NULL;	// 

This is the correct code:

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

typedef struct TreeNode TreeNode;


TreeNode* CreatTree(int* preorder,int* inorder,int l1,int r1,int l2,int r2){
    if(l1 > r1 || l2 > r2){      // Return NULL
        printf("%d",1);
        return NULL;
    }
    TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));
    root->left = NULL;	// Here's the problem!!! A null pointer without an assignment must be set to NULL
    root->right = NULL;	// 
    int i;
    root->val = preorder[l1];
    
    for(i=l2;inorder[i]!=root->val;i++);
    int lLen = i - l2;
    int rLen = r2 - i;
    if(lLen > 0){
        root->left = CreatTree(preorder,inorder,l1+1,l1+lLen,l2,l2+lLen-1);
    }
    
    if(rLen > 0){
        root->right = CreatTree(preorder,inorder,r1-rLen+1,r1,r2-rLen+1,r2);
    }
    return root;

}


struct TreeNode* buildTree(int* preorder, int preorderSize, int* inorder, int inorderSize){
    TreeNode* root = CreatTree(preorder,inorder,0,preorderSize-1,0,inorderSize-1);
    return root;
}

[Solved] Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

Problem description

Failed to get convolution algorithm. This is probably because cuDNN failed to initialize


Cause analysis:

Insufficient GPU memory

Solution:

1.kill -9 PID_*
2. Dynamically allocate GPU memory:

from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession

config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)

How to Solve LeetCode Error: AddressSanitizer:DEADLYSIGNAL

LeetCode Error: AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL

AddressSanitizer:DEADLYSIGNAL
42ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00000034e832 bp 0x7ffdffb45790 sp 0x7ffdffb45540 T0)
42The signal is caused by a READ memory access.
42Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used.
#3 0x7f75a82060b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
AddressSanitizer can not provide additional info.
42ABORTING

 

class Solution {
public:
    bool isValid(string s) {
          int n = s.size();
          if(n % 2 == 1){
              return false;
          }
          unordered_map<char, char> pairs = {
              {')','('},//key value
              {']','['},
              {'}','{'}
          };
          stack<char> stk;
          for(char ch:s){
              if(pairs.count(ch)){//Intrinsically check whether the pairs have elements with the given key ch
                  if(stk.top() != pairs[ch] || stk.empty()){
                      return false;
                  }
                  stk.pop();
              }else{
                  stk.push(ch);
              }
          }
          return stk.empty();
    }
};

Error reporting:

modification:

if(stk.empty() || stk.top() != pairs[ch])

[Solved] VINS-MONO: integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’

The following problems are encountered when compiling vins-mono with catkin,

In file included from /usr/local/include/ceres/internal/parameter_dims.h:37,
                 from /usr/local/include/ceres/internal/autodiff.h:151,
                 from /usr/local/include/ceres/autodiff_cost_function.h:130,
                 from /usr/local/include/ceres/ceres.h:37,
                 from /home/matthew/projects/vinsmono/src/VINS-Mono/camera_model/src/calib/CameraCalibration.cc:20:
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:46: error: wrong number of template arguments (3, should be 1)
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                                              ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:49: error: expected unqualified-id before ‘>’ token
   64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
      |                                                 ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:21: error: ‘integer_sequence’ is not a member of ‘std’
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:51: error: wrong number of template arguments (4, should be 1)
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                                                   ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:71:54: error: expected unqualified-id before ‘>’ token
   71 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
      |                                                      ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:21: error: ‘integer_sequence’ is not a member of ‘std’
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:59: error: wrong number of template arguments (6, should be 1)
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                                                           ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:78:62: error: expected unqualified-id before ‘>’ token
   78 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
      |                                                              ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:21: error: ‘integer_sequence’ is not a member of ‘std’
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:41: error: wrong number of template arguments (2, should be 1)
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                                         ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
   60 | struct SumImpl;
      |        ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:85:42: error: expected unqualified-id before ‘>’ token
   85 | struct SumImpl<std::integer_sequence<T, N>> {
      |                                          ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:21: error: ‘integer_sequence’ is not a member of ‘std’
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:38: error: template argument 1 is invalid
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                                      ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:91:39: error: expected unqualified-id before ‘>’ token
   91 | struct SumImpl<std::integer_sequence<T>> {
      |                                       ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:31: error: ‘integer_sequence’ is not a member of ‘std’
  135 |                          std::integer_sequence<T, N, Ns...>,
      |                               ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:31: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: error: template argument 3 is invalid
  135 |                          std::integer_sequence<T, N, Ns...>,
      |                                                           ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: error: type/value mismatch at argument 4 in template parameter list for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:135:59: note:   expected a type, got ‘N’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:39: error: ‘integer_sequence’ is not a member of ‘std’
  146 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
      |                                       ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:146:57: error: wrong number of template arguments (3, should be 4)
  146 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
      |                                                         ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:130:8: note: provided for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
  130 | struct ExclusiveScanImpl;
      |        ^~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:53: error: ‘integer_sequence’ is not a member of ‘std’
  160 |       typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;
      |                                                     ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:53: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:160:70: error: template argument 4 is invalid
  160 |       typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;

After checking, it is generally caused by the incompatibility between Ceres-solver and eigen3. You can’t use the latest version of Ceres when running vins-mono.

I had no choice but to uninstall the previous version 2.0.0 first.

sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
sudo rm -r /usr/local/share/Ceres

Then download version 1.14.0 here,

http://ceres-solver.org/ceres-solver-1.14.0.tar.gz

wget ceres-solver.org/ceres-solver-1.14.0.tar.gz
https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver-1.14.0
mkdir build
cd build
cmake ..
make -j4
make test
sudo make install

Compile ceres_curve_fiiting
CD to ceres_curve_fiiting folder

 mkdir build
 cd build
 cmake ..
 make
 ./curve_fitting

Compilation finished!

error while loading shared libraries: libmetis.so [How to Solve]

Running LIO-SAM reported the following error:

lio_sam/lio_sam_imuPreintegration: error while loading shared libraries: libmetis.so: cannot open shared object file: No such file or directory

 

Solution:

Use the following code to install:

sudo apt-get install libparmetis-dev

Problem solved successfully

[Solved] Visual studio 2022 error LNK2019: unable to resolve external symbol for

Visual studio 2022 error reporting template:

1>*. Obj: error LNK2019: unresolved external symbol “… Void _cdecl…” (..), Function “…” (…?..) The symbol is referenced in

Detailed errors are as follows:

Generation started...
1>------ Generation has started: Project: BIOP, Configuration:Debug x64 ------
1>pRein.cpp
1>run_models.obj : error LNK2019: Unresolved external symbol "private: void __cdecl bTama::initiate(int,int,int,int)" (?initiate@bTama@@AEAAXHHHH@Z),Function "public: __cdecl bTama::bTama(void)" (??0bTama@@QEAA@XZ) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: void __cdecl bTama::insert(struct IntervalSub)" (?insert@bTama@@QEAAXUIntervalSub@@@Z),Function "void __cdecl run_btama_backward1(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_backward1@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: bool __cdecl bTama::deleteSubscription(struct IntervalSub)" (?deleteSubscription@bTama@@QEAA_NUIntervalSub@@@Z),Function "void __cdecl run_btama_backward1(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_backward1@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: void __cdecl bTama::forward_match_accurate(struct Pub const &,int &,class std::vector<struct IntervalSub,class std::allocator<struct IntervalSub> > const &)" (?forward_match_accurate@bTama@@QEAAXAEBUPub@@AEAHAEBV?$vector@UIntervalSub@@V?$allocator@UIntervalSub@@@std@@@std@@@Z),函数 "void __cdecl run_btama_forward(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_forward@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: void __cdecl bTama::backward1_match_accurate(struct Pub const &,int &,class std::vector<struct IntervalSub,class std::allocator<struct IntervalSub> > const &)" (?backward1_match_accurate@bTama@@QEAAXAEBUPub@@AEAHAEBV?$vector@UIntervalSub@@V?$allocator@UIntervalSub@@@std@@@std@@@Z),Function "void __cdecl run_btama_backward1(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_backward1@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: void __cdecl bTama::backward2_match_accurate(struct Pub const &,int &,class std::vector<struct IntervalSub,class std::allocator<struct IntervalSub> > const &)" (?backward2_match_accurate@bTama@@QEAAXAEBUPub@@AEAHAEBV?$vector@UIntervalSub@@V?$allocator@UIntervalSub@@@std@@@std@@@Z),Function "void __cdecl run_btama_backward2(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_backward2@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>run_models.obj : error LNK2019: Unresolved external symbol "public: int __cdecl bTama::calMemory(void)" (?calMemory@bTama@@QEAAHXZ),Function "void __cdecl run_btama_backward1(class intervalGenerator const &,class std::unordered_map<int,bool,struct std::hash<int>,struct std::equal_to<int>,class std::allocator<struct std::pair<int const ,bool> > >)" (?run_btama_backward1@@YAXAEBVintervalGenerator@@V?$unordered_map@H_NU?$hash@H@std@@U?$equal_to@H@2@V?$allocator@U?$pair@$$CBH_N@std@@@2@@std@@@Z) Referenced in
1>D:\codes\BIOP\x64\Debug\BIOP.exe : fatal error LNK1120: 7 unresolved external commands
1>The operation to generate the project "BIOP.vcxproj" has been completed-failed.
========== Generation: 0 success, 1 failure, 0 latest, 0 skip ==========

reason:
After adding a new file on another computer or another operating system, submitting it to GitHub, and then returning to the current computer to pull the code, the new file is not imported into the VS project

Solution:
Add the newly created file to the current project, “head/source file→ \rightarrow→Add to→ \rightarrow→Existing items”

ADS1.2 Error: cannot obtain license [How to Solve]

The error is as follows

Modify the license content under the licenses file:
modify it to the following content.

#
# Generated on 2021-dec-1 by licwizard
#
PACKAGE ads armlmd 1.200 E32F0DE5161D COMPONENTS="armasm compiler bats armulate axd adwu fromelf armlink codewarrior armsd"
INCREMENT ads armlmd 1.200 permanent uncounted 612C53EF47C7 HOSTID=ANY ISSUER="Full License by armer, only for educational purpose!" ck=0
FEATURE Win32_CWIDE_Unlimited metrowks 4.2 permanent uncounted D8C287BC5B1B HOSTID=ANY

[Solved] fatal error: cuda_runtime.h: No such file or directory

Background

Today, I want to run a yolact model, but in the process of training, I need a DCN network model. This requires CUDA to compile relevant files, but an error is reported. The main errors are:

	cuda_runtime.h: No such file or directory

I spent an afternoon reading a lot of blogs, but I didn’t solve it. Later I knew why. In fact, the solution is also very simple, that is, add some folder paths of CUDA installation directory to environment variables. The following are the solutions for the windows operating system:

Add the following two paths to the environment variable path:

	C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin
	C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\lib\x64

Basically, everyone’s default installation path is this. You only need to replace v11.0 according to their installed CUDA version number.

Pytorch Error: runtimeerror: expected scalar type double but found float

The reason for this problem may be that the data type of tensor is wrong, it may be the wrong type of input X in the backpropagation, or the wrong data type in the training and testing process. If it is the backpropagation process, it depends on which layer of neural network has the problem, and add x = x.to (torch. Float32) in front of which layer, For example, this problem occurs in the first layer of neural network. For example, this problem occurs in the first layer of convolution. The solution is as follows:

If this problem occurs in the training or test model, the solution is as follows:

It is also possible that the type of labels is wrong during training or testing. The solutions are as follows:

[Solved] Gurobi–Error code: 10005. Unable to retrieve attribute solved ‘Pi‘

Gurobi code

Question code:

I wanted to get the dual space of variables,

double[] dual=model.get(GRB.DoubleAttr.Pi,model.getConstrs());

Error code: 10005. Unable to retrieve attribute ‘Pi’

The reason is that in gurobi, binary variables and integer variables have no dual space. Change integer to continuous, as follows: