Initial commit
This commit is contained in:
commit
a4e596c3aa
234 changed files with 81101 additions and 0 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"cmake.sourceDirectory": "E:/car/dev_ws/src/orbbec_camera"
|
||||
}
|
||||
BIN
MobaXterm_25.2_CN.zip
Normal file
BIN
MobaXterm_25.2_CN.zip
Normal file
Binary file not shown.
BIN
MobaXterm_25.2_CN/CygUtils.plugin
Normal file
BIN
MobaXterm_25.2_CN/CygUtils.plugin
Normal file
Binary file not shown.
BIN
MobaXterm_25.2_CN/CygUtils64.plugin
Normal file
BIN
MobaXterm_25.2_CN/CygUtils64.plugin
Normal file
Binary file not shown.
406
MobaXterm_25.2_CN/MobaXterm.ini
Normal file
406
MobaXterm_25.2_CN/MobaXterm.ini
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
[Misc]
|
||||
PasswordsInRegistry=0
|
||||
LocalShell=Bash (32位)
|
||||
NewTabPosition=1
|
||||
SingleClickToRunMacros=0
|
||||
LastSession= 10.217.155.242 (root)| #109#0% 10.217.155.242%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
SessionP=330918199908
|
||||
StorePasswords=Never
|
||||
RightClickAction=1
|
||||
RightClickAssigned=1
|
||||
DefTextEditor=<Moba文本编辑器>
|
||||
LogFileFormat=
|
||||
StoreSSHKeysPassphrases=0
|
||||
BackupIni=1
|
||||
LogTerminalActivity=0
|
||||
LogType=0
|
||||
LogFolder=
|
||||
SkinSat=36
|
||||
XAuto=1
|
||||
XKeepAlive=1
|
||||
BackspaceSendsBS=1
|
||||
BSisBS=1
|
||||
BoldAsFont=0
|
||||
WinPath=1
|
||||
ConfirmExit=0
|
||||
PromptType=2
|
||||
WarnBeforePasteMultipleLines=0
|
||||
TransTerm=0
|
||||
TransDetachedTabs=0
|
||||
X11SharedClipboard2=1
|
||||
X11OpenGL=0
|
||||
X11DisplayMode=0
|
||||
X11AccessControl2=0
|
||||
X11DisplayOffset=0
|
||||
X11ScreenNumber=1
|
||||
X11Keyboard=0
|
||||
X11DpiMode=拉伸
|
||||
X11Version=MobaX
|
||||
AdvTermSettings=
|
||||
HomeDir=<Temp 目录>
|
||||
SlashDir=<Temp 目录>
|
||||
DefaultHome=<主页 (固定)>
|
||||
DefaultNewTab=<终端>
|
||||
ReplaceHomeTab=0
|
||||
NoTabClose=0
|
||||
AllowMultiInstances=0
|
||||
|
||||
[Passwords]
|
||||
mobauser@mobaserver=
|
||||
|
||||
[Macros_1]
|
||||
SubRep=originbot
|
||||
ImgNum=41
|
||||
|
||||
[Macros_2]
|
||||
SubRep=origincar
|
||||
ImgNum=41
|
||||
|
||||
[Macros_3]
|
||||
SubRep=originman
|
||||
ImgNum=41
|
||||
动作模仿节点=em:/_@5TIVp5QfuyIpgNPtzlPpVeImCJSXe/2nXjanYTInmY42K3T56GtMZTteDNctq5tO7bGnyKUXtEygnM66MHbEoadj6keHw+TPKMUHVfJhXLa1frsWZ/RtRgnze8gb1RqyR+ofz2fcYWyHOEbRsqajXK3vvrehiT/SGkpcM17ZPvEaTqhhdcMFmN4hFvGHP61W+oSx3H4JWkq9qjDv1tshkA3TAT6h6ZrGgbYRTXRcRcWAu79mewS5Xyc8TVCEWckAZ/aHNUYq5fvUP2Q0YN7M2AQeuN4BWspec=
|
||||
视觉巡线=em:/_@tv64pFTv7TbUCHwqz6X26YAZedCuYFITsV3MLPT2fXG5bu5KXv8lWe/fPcCPTx6Gnn9ABCxCZOVcCVu4Ux4E9E198sU8Hw/OlJ8ST3RLchxw4Cf8gms2QEeRe3bpGVCbk8yBsBYSxDdBIY2CM=
|
||||
网页=em:/_@eVPtVTf1MxvhBA711KOfN8Gfrt13vBL7kzsQQqo5DzO6deIrYViQMswPNsgQAoJ6snnm2kCBxsWcbYS+5Ybu03xJhbbW2Op002bIGSOzKxwWMnWIBb71qkWl7HYqhBG5lhNmiUFgEoxcoVW5S8Hb8NMPQ6bVgw
|
||||
语音交互=em:/_@WP5zmHEzp3nIFvGhtBTNceYxdeYVdrdzOzR2jg+19kvBb1QmXNGMaeN3mo+yISeCIdSUNyqPy6W88WOyMflLZtc9Ob4V2juA+c0M3gUtscUZ0x6qFnIYQmHs08gGCt+svgEo0d4AmuBZ/jejx+41brGRWnqtTsN7i7
|
||||
语音交互(运动)=em:/_@PKl435owHAgtJgPMj1ttDrb8d5aw3Me7Zk4olkD6HuP3UTDM8A6wRe3t2Ki+yrTvQUadGimEh92CDEY2sPg2sbXGuCOj/G3OkAffF3MfVsmLjjSD6jIu8cjRcPtn+YmbDtC1hONi2dGbdQQs9zz/9EMMVmLM1LfyKL
|
||||
|
||||
[WindowPos_HUANG_3200_2000]
|
||||
CompactMode=0
|
||||
MonitorCount=1
|
||||
Left=-13
|
||||
Top=-13
|
||||
Width=3226
|
||||
Height=1930
|
||||
Maximized=1
|
||||
SidebarVisible=1
|
||||
SidebarWidth=437
|
||||
|
||||
[SSH]
|
||||
SFTPShowDotFiles=1
|
||||
SFTPAsciiMode=0
|
||||
MonitorHost=1
|
||||
MonitorCPU=1
|
||||
MonitorRAM=1
|
||||
MonitorNetUp=1
|
||||
MonitorNetDown=1
|
||||
MonitorProcesses=0
|
||||
MonitoFDs=0
|
||||
MonitorUptime=1
|
||||
MonitorUsers=1
|
||||
MonitorPartitions=1
|
||||
MonitorNfsPartitions=0
|
||||
MonitorNetstat=0
|
||||
StrictHostKeyChecking=0
|
||||
BrowserSortType=0
|
||||
BrowserSortReverse=0
|
||||
RemoteMonitoring=1
|
||||
LastDownDir_31554@HUANG=C:\Users\31554\Desktop
|
||||
UseInternalMobAgent=0
|
||||
UseExternalPageant=1
|
||||
ValidateEachAgentRequest=0
|
||||
MobAgentKeys=
|
||||
DisplaySSHBanner=1
|
||||
UseNewMoTTY=1
|
||||
GwUse2factor=0
|
||||
AutoStartSSHGUI=1
|
||||
SSHKeepAlive2=0
|
||||
EnableSFTP=1
|
||||
ScpPreservesDates=0
|
||||
UseGSSAPI=1
|
||||
KrbDomain=
|
||||
GSSAPICustomLib=
|
||||
GSSAPILibNumber=0
|
||||
DefaultLoginName=
|
||||
|
||||
[Display]
|
||||
SidebarRight=0
|
||||
C10Checked=1
|
||||
C11Checked=1
|
||||
C12Checked=1
|
||||
C13Checked=0
|
||||
C14Checked=0
|
||||
VisibleTabNum=1
|
||||
VisibleTabClose=1
|
||||
MenuAndButtons=2
|
||||
BtnType2=2
|
||||
S3Checked=0
|
||||
DisableQuickConnect=0
|
||||
CustomDPI_3200_192=0
|
||||
IconsTheme=0
|
||||
RoundedTabs=1
|
||||
GraphicCache=1
|
||||
|
||||
[Recently started]
|
||||
16=用户会话\COM5 (Silicon Labs CP210x USB to UART Bridge (COM5)) (3)
|
||||
15=用户会话\COM5 (Silicon Labs CP210x USB to UART Bridge (COM5)) (4)
|
||||
14=用户会话\COM5 (Silicon Labs CP210x USB to UART Bridge (COM5))
|
||||
13=用户会话\COM14 (USB-SERIAL CH340 (COM14))
|
||||
12=用户会话\COM5 (Silicon Labs CP210x USB to UART Bridge (COM5)) (5)
|
||||
11=用户会话\COM14 (USB-SERIAL CH340 (COM14)) (2)
|
||||
10=用户会话\ubuntu.lan
|
||||
9=用户会话\COM14 (USB-SERIAL CH340 (COM14)) (1)
|
||||
8=用户会话\192.168.0.3 (root)
|
||||
7=用户会话\192.168.127.10 (root)
|
||||
6=用户会话\COM6 (USB-SERIAL CH340 (COM6))
|
||||
5=用户会话\192.168.0.105 (root)
|
||||
4=用户会话\10.162.10.242 (root)
|
||||
3=用户会话\COM8 (USB-SERIAL CH340 (COM8))
|
||||
2=用户会话\COM7 (USB-SERIAL CH340 (COM7))
|
||||
1=用户会话\ 10.217.155.242 (root)
|
||||
|
||||
[CustomIcons]
|
||||
-3=iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAKx0lEQVR42s1aCViU1Rp+ZweGnWGTMlDKXCuNrOtFLQmsvHVLQVFIkFRQECwEzQx9DMubJuGCpqRZRkAuCOPgrZTAzADJbiAg1i2UfRcYtpn57/ePo3fYBxzN8zyH/2z/Od97zjvfec/54TAMA72H7GwzpKdvAsMsoNwV8PlBWL++QN/DnDp1Chy9A7h4cTTS0nZTyp0iR1PaCguLYCxc+BUkkvb7F8CZM48gK+sLSj2pZfytUAdr67UICDgIkUh5/wHIzR0NqTSRUlMGaNVGcT7WrZNCKFTdPwCys0dBJttHqVl9zHxvEBJJCObPP3KndNIfgE2bXqW/SRT5Or5RB0vLNVi58hC4XOavA9DaCojFgErFwfbtUZDLI6nUQMe3b9IpPFxGfSjuPYDz551w6dIEeHmlExW6UFFhhqSkCDQ2siB4OoOwsQmlPg7Dyqrj3gHIyHBGZuYJ8vNWMDVdidWrj6nLm5oMERMTQqktQwBRDzOzMISFfX5vAOTlOSM19QClZmhKGojHnli16nsyRIG2NgHi4t5Fc/NbVGeo80rw+T4ICUmjCem8ewAyM0U4e/Y4pWb38DaNRIVgokISUYGlkzkSE4NoRcZo2rlRHDFI782wtfUk73SaNj39A8gkQya3tMB4+/ZQym6lKOzRpAZGRkuwZk2aOieXC6BU8tQADh60QkNDDKXnDjDEaUycOD958tUOT8eIdr0CyLsG59Rf8A75l8+XO1ZesDv5ZSRRJIKqRD2aNpBHeZE8y4VenaSmjiH6ySjl1KOGpUwKM3qUT+bzgom5NelxYq7pR97OG46bCa077hhARgmcv7+CA2AwnbKVJiZYPc+iVDby5OEVNMMbe4EQi9cRgA96dVReboj9+z+hlE+Pmq/g4vLW6cfLzQvqzx3SyJAmG9HIyFccww6ZCCw7hw3g/O9w+rYQqdRkvFZxNc8QSyKndckEW7eEUZ41VqAFwIsAJPcBwAAHDuwlz7VYq/Q7jB37ctoz1SOvNOWeo7yVVl2LAKLFIRP2HRsWgIulcE77FXto5t36kAfXiE4BbziU/eggS2TpFHkbhEh0DEuWLKIfdXce19cLcOTIWnpuoBw76HGMGeOX+SxnQm6NjF2ZJ/ryTqZ8yfK5TuFJFiK7Dp0BnL2ChzNLcIiGeWYAbVNFdArzsr4ufSA5fhnlozV0kpMn8ifpfJTkQnfVWVlpgc8+i0B7+yiizZvSSX8YFzdmf6kxvr9x6q1FD66d5xRx0JBvohgUQPYfcJTlI4WSk3RwBNW0Er7vzFR+w3t/yxqSFJs13ok0BhYhKipF3UomE8DDo4v2C3WW2bKFm75Y8khhw3n2x26myz7BVXHnr5q4P43L4TH9Asj5E6NO5SOOZv55HVTlrVDKNUDgYtvSH0Z+8/UajXdiQYQSgFh1i127NhO4i/D2TqUzgbK+s4yfUhob3tBe9d5QZIeFwG7lK46hCZYi+/ZeAM4QbbJKkEDGTx6C8bf3AKJTiLd9RZp9wicsnd6nGKEFYA+qqwVwc1uB6dO71HK0vczs8NUNaxio3h7CeHVWwhGRC52jDgq4ItVtALmlGC39FV+S8U/dgaiuZOkU6SLPMIiLDUNHRx0BOKiuiY/3UQn5yd/OUjkV1GQIVkyIKxDxjNQHmriikGB6jGNBtCmavehpTpE7wDhylk5B43fLvjt9Vsn56b+MmawAiWS8+zBmvme4JjHAopVjrp1HYaEp3N0bbu8nVQkP59WcZgWbs5nQJuifI0NPWBk4dN2qVzIKTlZV8qQrTdlbW7oaPAajk0T4wIqmPKMEzqZUJoZItEoPxqsDj4sC93GY+pSj+od8O2zP94ujAZZpZve6h0OA73gL14ye7yf8Hu1cIS/J72OX7xE4xYWZZdGcjalMJeVs9Xgv0fj0KDztMQ7F2oUf5ftdpsfYW5uUh8Mbi8Zb/P1kXx3s+NU/m+EwLoOM016YeT2JBUA6Da76sp5muXTaSDwxaxLp/O4AZBoVqwapAXCqrz6oLetepw4yVBMBOMR5L4UZr+DiJ1YE6MF+xlAAn5CZSDAUodsGs+fnpW7tgq6jlDSlqBLzTP+19NEdb2v7dTakX9vveLnph6LBKEQvZVzOvB6o9kKxZ+DXIMe2HlpkqKHZyhibg6f9EYO2tLmQ13XBLuqoukYRYV/fvqg+ufTT4FZVEysAjdlNUM5tnxPsvDHfXGjbVg45p7Qi+8ELtSd3qzjMnIFtR9EUicdrrXlmRWoAtS0wSMqFT00LYodwitIOKgcLrPd8NHevWac0kPKsNoqCvWYfqNkVDVVH/nXBxJQT5cf8O9HO7hMmrEywEN446WTyRMlPTI2FoP6Gq+Zeid+v8Rxkutp6LneRvFTcbSPrUID3QTpepGTiEEEwpBBCI1zzD4haTqwlh7hOI+xCtQDsgaJuHjjCwDbLgJS9hRG+DA+7tGir1HinwTxhvqudl+eTkheKONS0l5ToVIK7Pwv+tCJbdaTTDVtTRAdOvfoR6o+wrnijZmbRB4AgSpVRDKgWe3x/ouyr4BZl4ybKG+kySRR/mSzx8J5p5100oJhj6ZSQA+/6VuweZCUYezOs8xqbs8+881QwTUi4ljCroEO6H6zX//um5Nu1HMq6WI1GqgbP5M1ywWPHk68d8VFyVdu0QPdLmxl2C4KmWM0u1ElOq+iVzVLMGYBObKerNjxXvJfbmLieslHdbqLFUz1h+nw6bWuazlVcVES/Ts94DVXq6OGnsouUfvyfZUuITjsHmKyr02xfe3Gq9cslQzrQtHaCf/hH+Fc3q09cltreZoQ5ov0nF+7gNyWxOubdbpKYKzwMW28/wLF7x13lNqjdn0Cp5zQlLJ2WVhjOyEirSAluVjZs7EEndpJypkhmL55hu6BoWEfKulaIPr8Ar6Y27NPMEGNjirXe43I+Me9Kp+OkarXGr2vtZOJ5sAs/2nvNanloPByL9uYV2owlOq2uFLocTfgz3ptWIkZDJ9b4czPtFgZOtnK/fMe3EtEyvKZQIl7AR9Tbz16NQ92RCBpgU59anisOgG34p73KO8uFqI3fA44qoEdNLTii1xXWIaf3XA5dpuAotpGHqXnKZo77NJu5JXq5VrnRBiEdMR9xe6joNwN5IutNNmhkb+/AFX4LC995ED7Q1H3jP+MMedbXlHqsj7fKwTVaUSac8o207LjfWGvX71xtvYr1fzNXsdOB9p48StkM0KoLPNMdsPR9D3xJ883bohR7tF3aTav28gAnsFoYjQiu4bskW4sf1+njx/DuRqs+XACVPK7fFfh/YF1eluaH+RJFi4H9POdPiJ+ZTd6rWFdThgdA2SBCQ+JidFVt12iaOxaAFM/B2DUAJs+V3JvrdeUNIWp2zgGj+GKY2qnbRQhMPfwhfvryvf9CUx3jC2VTTI99Yigz/xsZ/g8CUPTXfGJS1BGdkl6HovrjoQpA9YW3ybNLYTy9ZLjD6+cjn6qVj6ptLwxRxV6iH+tCiP9WeCdD6/E7sYqDmt1+UNR/OIiKZQcrINp4Dpc2dwkAS6daA/JOi+i5s18BqKaNWyCMpxXpY0j9/6sB08lF5fsv9UOnQpjMepWML9bTDc5d+mcPpoNHmscXiho6neEh9rAHDudnGE0N0gdtegGQSqXQe+i4IkJrLntN6Kb+7MTlxMHcu1jfw+Tk5OB/a2nAbUagr2kAAAAASUVORK5CYII=
|
||||
|
||||
[SSH_Hostkeys]
|
||||
ssh-ed25519@22:192.168.110.161=0x4e3d7b58df136ac2c3d2abb43117263102953ba5959f9fdf8c7aace8fd421d0b,0x57f73a00e16aba771fb816ffebc2c45163a4b4cacb31981090f8ab6382befd6a
|
||||
ssh-ed25519@22:114.55.66.216=0x26c8205425648231589d409720bf22614767e15fc4a1b1d3b5162d90f2d1cbce,0x335b934b87d8623ae0d8e99a24045e5c46f4d5440773da217676607a32bb0e4e
|
||||
sha256-ssh-ed25519@22:114.55.66.216=9e:66:16:ba:92:a8:d2:92:52:e8:91:52:4b:fd:1d:35:ec:66:a7:63:07:f6:7c:64:23:a5:c4:ef:50:50:bc:25
|
||||
ssh-ed25519@22:192.168.110.92=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.110.92=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:U22.lan=0x408cfe905069023fb775576a0c99df8acc32624116015b504415004f74e80692,0x4ff137c7b5b20c6bc26bdb9b67232327e4c6e26e015092f13a8acf4cb12005d1
|
||||
ssh-ed25519@22:ubuntu.lan=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
ssh-ed25519@22:10.211.90.19=0x408cfe905069023fb775576a0c99df8acc32624116015b504415004f74e80692,0x4ff137c7b5b20c6bc26bdb9b67232327e4c6e26e015092f13a8acf4cb12005d1
|
||||
sha256-ssh-ed25519@22:10.211.90.19=20:da:00:e0:86:02:5f:93:8e:31:fb:4e:8e:af:0d:1c:71:82:1e:9c:5e:6b:6f:c7:4c:5d:e1:da:30:21:9b:c4
|
||||
ssh-ed25519@22:192.168.110.29=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.110.29=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.110.17=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
ssh-ed25519@22:10.211.90.241=0x58c31df98bd1d56f18db08f35fe608c829740c8812d9311f079f22ad29511cb2,0x2afb8cee07d9cd8d07e08f5d319443cc13500ac9538b1aa515ee00594e02d5b
|
||||
ssh-ed25519@22:10.211.90.119=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:10.211.90.119=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.110.123=0x58c31df98bd1d56f18db08f35fe608c829740c8812d9311f079f22ad29511cb2,0x2afb8cee07d9cd8d07e08f5d319443cc13500ac9538b1aa515ee00594e02d5b
|
||||
sha256-ssh-ed25519@22:192.168.110.123=74:0c:c7:09:48:48:ed:fa:22:5c:a3:1e:23:d9:d3:5d:0f:eb:f7:25:a6:6d:cd:12:4c:70:df:2c:47:40:62:10
|
||||
sha256-ssh-ed25519@22:10.211.90.241=74:0c:c7:09:48:48:ed:fa:22:5c:a3:1e:23:d9:d3:5d:0f:eb:f7:25:a6:6d:cd:12:4c:70:df:2c:47:40:62:10
|
||||
ssh-ed25519@22:192.168.110.126=0x58c31df98bd1d56f18db08f35fe608c829740c8812d9311f079f22ad29511cb2,0x2afb8cee07d9cd8d07e08f5d319443cc13500ac9538b1aa515ee00594e02d5b
|
||||
ssh-ed25519@22:192.168.110.216=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
sha256-ssh-ed25519@22:192.168.110.216=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
ssh-ed25519@22:192.168.110.18=0x58c31df98bd1d56f18db08f35fe608c829740c8812d9311f079f22ad29511cb2,0x2afb8cee07d9cd8d07e08f5d319443cc13500ac9538b1aa515ee00594e02d5b
|
||||
sha256-ssh-ed25519@22:192.168.110.18=74:0c:c7:09:48:48:ed:fa:22:5c:a3:1e:23:d9:d3:5d:0f:eb:f7:25:a6:6d:cd:12:4c:70:df:2c:47:40:62:10
|
||||
sha256-ssh-ed25519@22:192.168.110.126=74:0c:c7:09:48:48:ed:fa:22:5c:a3:1e:23:d9:d3:5d:0f:eb:f7:25:a6:6d:cd:12:4c:70:df:2c:47:40:62:10
|
||||
ssh-ed25519@22:10.218.33.190=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
sha256-ssh-ed25519@22:10.218.33.190=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
ssh-ed25519@22:192.168.110.100=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
sha256-ssh-ed25519@22:192.168.110.100=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
ssh-ed25519@22:192.168.127.10=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
ssh-ed25519@22:192.168.110.222=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.110.222=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.110.239=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
sha256-ssh-ed25519@22:192.168.110.239=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
sha256-ssh-ed25519@22:192.168.110.161=3f:82:8e:49:a4:23:e7:71:ea:60:9d:12:f0:47:64:9a:ce:41:a6:2c:6a:4b:16:0b:6f:f5:99:3f:22:38:f8:8c
|
||||
ssh-ed25519@22:10.38.94.230=0x4a2204348c64eb730543972593593d0d4abd75b42dfc32f0d4508e12bdeed7f8,0x691eb210490c331960da49a0f3ebed6a5af3126f1a2866adbd8dfca2b32b39a3
|
||||
sha256-ssh-ed25519@22:10.38.94.230=7d:a3:4a:12:57:18:63:7a:da:8e:26:e3:f3:7b:c9:92:e8:a4:1d:db:c4:0d:5e:2e:87:dc:45:b5:ca:a2:58:10
|
||||
ssh-ed25519@22:192.168.110.233=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.110.233=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.110.155=0x58c31df98bd1d56f18db08f35fe608c829740c8812d9311f079f22ad29511cb2,0x2afb8cee07d9cd8d07e08f5d319443cc13500ac9538b1aa515ee00594e02d5b
|
||||
sha256-ssh-ed25519@22:192.168.110.155=74:0c:c7:09:48:48:ed:fa:22:5c:a3:1e:23:d9:d3:5d:0f:eb:f7:25:a6:6d:cd:12:4c:70:df:2c:47:40:62:10
|
||||
ssh-ed25519@22:10.210.165.246=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:10.210.165.246=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.1.10=0x6ddc8450e6c124a5e7e6356e66b39cd3b6833467cee5ddb5587b83193c568562,0x3c74aa1eec8076c6d1b28ff648d9a0205ca5b1d4397bcf0c0f64b4b601d25c3b
|
||||
sha256-ssh-ed25519@22:192.168.1.10=7a:c1:74:6e:0b:68:64:b0:55:e3:9d:5e:87:30:3a:a7:16:4f:fe:cb:05:1d:d9:28:ce:66:a2:a7:9f:9b:dd:47
|
||||
sha256-ssh-ed25519@22:192.168.110.17=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:10.222.36.229=0x530d603d651cc83599ab24b0640768c3e55a9164117467ae59ccc3c76acbd112,0x3607b648aaef1653fdba9563c2e72f79c6f78558c55052ab2c97c3876f856a22
|
||||
sha256-ssh-ed25519@22:10.222.36.229=84:1d:a7:b1:1c:b5:9d:5c:80:50:7a:2e:3b:f1:b8:c2:4f:34:2a:da:40:5d:a6:e3:62:00:dc:e1:3a:05:b3:53
|
||||
ssh-ed25519@22:10.222.36.190=0x25c9f2cf9367637fc12b232491ea337e7eda9fe880a15b2701a4bd40c5963ab8,0x7f3ffb57b3768fbac15ea488d4a5dd2c5a2ab5e57b1eb2d98b7fa2f4826ffbc8
|
||||
sha256-ssh-ed25519@22:10.222.36.190=ad:d9:22:86:79:4c:29:2f:eb:7a:6a:58:5d:64:b6:48:b9:62:97:ae:08:bb:46:3d:ed:8c:a1:3e:55:71:89:17
|
||||
ssh-ed25519@22:10.92.43.190=0x25c9f2cf9367637fc12b232491ea337e7eda9fe880a15b2701a4bd40c5963ab8,0x7f3ffb57b3768fbac15ea488d4a5dd2c5a2ab5e57b1eb2d98b7fa2f4826ffbc8
|
||||
sha256-ssh-ed25519@22:10.92.43.190=ad:d9:22:86:79:4c:29:2f:eb:7a:6a:58:5d:64:b6:48:b9:62:97:ae:08:bb:46:3d:ed:8c:a1:3e:55:71:89:17
|
||||
ssh-ed25519@22:10.92.43.229=0x530d603d651cc83599ab24b0640768c3e55a9164117467ae59ccc3c76acbd112,0x3607b648aaef1653fdba9563c2e72f79c6f78558c55052ab2c97c3876f856a22
|
||||
sha256-ssh-ed25519@22:10.92.43.229=84:1d:a7:b1:1c:b5:9d:5c:80:50:7a:2e:3b:f1:b8:c2:4f:34:2a:da:40:5d:a6:e3:62:00:dc:e1:3a:05:b3:53
|
||||
ssh-ed25519@22:192.168.137.93=0x4e3d7b58df136ac2c3d2abb43117263102953ba5959f9fdf8c7aace8fd421d0b,0x57f73a00e16aba771fb816ffebc2c45163a4b4cacb31981090f8ab6382befd6a
|
||||
sha256-ssh-ed25519@22:192.168.137.93=3f:82:8e:49:a4:23:e7:71:ea:60:9d:12:f0:47:64:9a:ce:41:a6:2c:6a:4b:16:0b:6f:f5:99:3f:22:38:f8:8c
|
||||
ssh-ed25519@22:10.92.43.19=0x4e3d7b58df136ac2c3d2abb43117263102953ba5959f9fdf8c7aace8fd421d0b,0x57f73a00e16aba771fb816ffebc2c45163a4b4cacb31981090f8ab6382befd6a
|
||||
sha256-ssh-ed25519@22:10.92.43.19=3f:82:8e:49:a4:23:e7:71:ea:60:9d:12:f0:47:64:9a:ce:41:a6:2c:6a:4b:16:0b:6f:f5:99:3f:22:38:f8:8c
|
||||
ssh-ed25519@22:192.168.100.23=0x5097138d4a7a3a99ef80edbbf215439fdff722098f0ffb3a39e09fb2c63490aa,0x3f4928eec8cf0cd2996bc315478a8cbd84d6437f839018c467dd1baf0304bc8d
|
||||
sha256-ssh-ed25519@22:192.168.100.23=e9:39:da:f5:88:0f:9c:59:0a:34:98:c7:35:93:17:8d:10:a3:42:e0:45:13:30:71:e9:6f:c1:e0:53:d4:9a:0d
|
||||
ssh-ed25519@22:192.168.100.24=0x5d27fcfe83e413d03ea1dac57f44e21a220df271274ae193c2da4dfbb68523e6,0x4e43402b238acfbb3dbcd9d8c853f787fbbb1441fc6de168e3893b1d9099230f
|
||||
sha256-ssh-ed25519@22:192.168.100.24=c5:b0:9a:6e:2c:92:e2:3e:7f:79:95:8e:37:97:65:88:94:95:42:85:98:9f:c6:f8:a7:80:c1:98:5d:c4:c3:26
|
||||
ssh-ed25519@22:192.168.110.115=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.110.115=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
ssh-ed25519@22:192.168.0.12=0x315812a72d55b41f72cee2bc4c5ca37f1d9defda7f23701f591a1c94dd216cef,0x26c8ee4a153c46a0b55b650294d526efecfca48641d6cb8de3ddf88938b6e7de
|
||||
sha256-ssh-ed25519@22:192.168.0.12=a5:8e:5c:91:fe:08:34:8f:e2:0d:9a:63:bb:0a:d2:75:65:8a:f9:c9:5d:e2:2c:fa:b1:89:32:af:8b:ac:c2:cb
|
||||
sha256-ssh-ed25519@22:192.168.127.10=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
ssh-ed25519@22:192.168.0.3=0x4fbdeb0cc708bedaad7244d9ccc03a9b5cb295f23736588e66709ddd9c4b8735,0x5ec1cdf861f8c174c9e669cf4bcd8c288d273792c4b772d85bb963292275a928
|
||||
sha256-ssh-ed25519@22:192.168.0.3=1c:01:43:cb:90:3f:5e:c0:aa:55:99:1a:ed:d7:c6:1c:94:95:6b:4f:4e:8a:d9:b7:bc:d1:c3:42:79:ec:af:28
|
||||
ssh-ed25519@22:192.168.0.105=0x375d1796bb113c10bdb35b32081ed46dd897e3df77dc0681dde7b6db9a7ffb6d,0x649881426de5a5e61932ab6e824b2fd0eda5c410fe89f72029cd4e68ee9cf62
|
||||
sha256-ssh-ed25519@22:192.168.0.105=2b:ca:32:12:87:5d:69:9e:24:78:db:b7:f5:ec:40:a8:c2:4b:0c:47:27:72:0a:10:19:c4:4f:43:cf:7c:05:be
|
||||
ssh-ed25519@22:10.162.10.242=0x375d1796bb113c10bdb35b32081ed46dd897e3df77dc0681dde7b6db9a7ffb6d,0x649881426de5a5e61932ab6e824b2fd0eda5c410fe89f72029cd4e68ee9cf62
|
||||
sha256-ssh-ed25519@22:10.162.10.242=2b:ca:32:12:87:5d:69:9e:24:78:db:b7:f5:ec:40:a8:c2:4b:0c:47:27:72:0a:10:19:c4:4f:43:cf:7c:05:be
|
||||
|
||||
[BrowsersFoldersHistory]
|
||||
SessionsList=ssh:root@10.162.10.242|ssh:root@192.168.0.105|ssh:root@192.168.127.10|ssh:root@192.168.0.3|ssh:pleaseaskme@192.168.0.12|ssh:pleaseaskme@192.168.110.222|ssh:root@192.168.110.222|ssh:root@ubuntu.lan|ssh:pleaseaskme@192.168.127.10|ssh:root@192.168.110.115|ssh:ros@192.168.100.24|ssh:ros@192.168.100.23|ssh:pleaseaskme@192.168.100.23|ssh:ros@192.168.110.161|ssh:pleaseaskme@10.92.43.19|ssh:pleaseaskme@192.168.137.93|ssh:ros@10.92.43.229|ssh:ros@10.92.43.190|ssh:pleaseaskme@10.222.36.190|ssh:ros@10.222.36.190|ssh:pleaseaskme@10.222.36.229|ssh:pleaseaskme@192.168.1.10|ssh:@192.168.1.10|ssh:root@192.168.1.10|
|
||||
ssh:ros@192.168.110.161=/home/ros/dev_ws/src/originbot_desktop/originbot_navigation/launch/|/home/ros/dev_ws/src/originbot_desktop/originbot_navigation/config/|/home/ros/dev_ws/src/originbot_desktop/originbot_navigation/param/|/home/ros/dev_ws/src/originbot_desktop/originbot_navigation/maps/|/home/ros/dev_ws/src/originbot_desktop/originbot_navigation/|/home/ros/dev_ws/src/originbot_desktop/|/home/ros/dev_ws/src/|/home/ros/dev_ws/|/home/ros/音乐/|/home/ros/桌面/dev_ws/src/a1_description/|/home/ros/桌面/dev_ws/src/a1_moveit_config/|/home/ros/桌面/|/home/ros/|/home/ros/桌面/dev_ws/src/|/home/ros/桌面/dev_ws/|/home/ros/桌面/dev_ws/src/moveit_controller_server/srv/|
|
||||
ssh:root@192.168.127.10=/mnt/|/tmp/|/userdata/dev_ws/install/|/|/userdata/|/root/|/userdata/dev_ws/src/yahboomcar_voice_ctrl/yahboomcar_voice_ctrl/|/userdata/dev_ws/src/yahboomcar_voice_ctrl/|/userdata/dev_ws/src/originbot/originbot_linefollower/|/userdata/dev_ws/src/|/userdata/dev_ws/|/userdata/dev_ws/src/originbot/|/userdata/dev_ws/src/originbot/originbot_deeplearning/body_tracking/images/|/userdata/dev_ws/src/originbot/originbot_deeplearning/body_tracking/include/|/userdata/dev_ws/src/originbot/originbot_deeplearning/body_tracking/launch/|/userdata/dev_ws/src/originbot/originbot_deeplearning/body_tracking/src/|
|
||||
ssh:pleaseaskme@192.168.1.10=/userdata/dev_ws/install/|/userdata/dev_ws/src/originbot/|/userdata/|/|/userdata/dev_ws/src/|/userdata/dev_ws/|/root/|/userdata/dev_ws/src/integrated_line_follower/config/|/userdata/dev_ws/src/integrated_line_follower/integrated_line_follower/__pycache__/|/userdata/dev_ws/src/integrated_line_follower/integrated_line_follower/config/|/userdata/dev_ws/src/integrated_line_follower/launch/|/userdata/dev_ws/src/integrated_line_follower/resource/|/userdata/dev_ws/src/color_detect_pkg/color_detect_pkg/__pycache__/|/userdata/dev_ws/src/color_detect_pkg/resource/|/userdata/dev_ws/src/color_detect_pkg/test/|/userdata/dev_ws/src/buzzer_control/buzzer_control/|
|
||||
ssh:root@192.168.1.10=/root/|/opt/ros/|/opt/|/|/userdata/dev_ws/install/buzzer_control/lib/|/userdata/dev_ws/install/buzzer_control/|/userdata/dev_ws/install/|/userdata/dev_ws/config/|/userdata/dev_ws/src/buzzer_control/buzzer_control/|/userdata/dev_ws/src/buzzer_control/|/userdata/dev_ws/src/|/userdata/|/userdata/dev_ws/|/userdata/dev_ws/install/buzzer_control/lib/python3.8/site-packages/buzzer_control-0.0.0-py3.8.egg-info/|/userdata/dev_ws/install/buzzer_control/lib/python3.8/site-packages/buzzer_control/__pycache__/|/userdata/dev_ws/install/buzzer_control/lib/python3.8/site-packages/buzzer_control/|
|
||||
ssh:@192.168.1.10=/userdata/dev_ws/install/color_detect_pkg/share/ament_index/resource_index/packages/|/userdata/dev_ws/install/color_detect_pkg/share/ament_index/resource_index/|/userdata/dev_ws/install/color_detect_pkg/share/ament_index/|/userdata/dev_ws/install/color_detect_pkg/share/colcon-core/packages/|/userdata/dev_ws/install/color_detect_pkg/share/colcon-core/|/userdata/dev_ws/install/color_detect_pkg/share/color_detect_pkg/hook/|/userdata/dev_ws/install/color_detect_pkg/share/color_detect_pkg/|/userdata/dev_ws/install/color_detect_pkg/share/|/userdata/dev_ws/install/color_detect_pkg/lib/color_detect_pkg/|/userdata/dev_ws/install/color_detect_pkg/lib/python3.8/site-packages/|/userdata/dev_ws/install/color_detect_pkg/lib/python3.8/|/userdata/dev_ws/install/color_detect_pkg/lib/|/userdata/dev_ws/install/color_detect_pkg/|/userdata/dev_ws/install/|/userdata/dev_ws/src/color_detect_pkg/color_detect_pkg/|/userdata/dev_ws/src/color_detect_pkg/|
|
||||
ssh:pleaseaskme@192.168.127.10=/home/sunrise/Pictures/|/home/sunrise/Music/|/home/sunrise/Downloads/|/home/sunrise/Documents/|/home/sunrise/Desktop/|/root/|/|/home/|/home/sunrise/|
|
||||
ssh:pleaseaskme@10.222.36.229=/home/ros/Desktop/a1x_ros/|/|/home/|/home/ros/Desktop/|/home/ros/|
|
||||
ssh:pleaseaskme@10.222.36.190=/home/ros/Desktop/a1x_ros/install/|/home/ros/Desktop/A1X/|/home/ros/Desktop/a1x_ros/|/home/ros/Desktop/|/home/|/home/ros/|
|
||||
ssh:ros@10.222.36.190=/home/ros/Desktop/a1x_ros/|/home/ros/Desktop/|/home/|/home/ros/|
|
||||
ssh:ros@10.92.43.190=/home/ros/Desktop/a1x_ros/install/|/home/ros/Desktop/a1x_ros/|/home/ros/|
|
||||
ssh:ros@10.92.43.229=/home/ros/Downloads/|/home/ros/Desktop/a1x_ros/install/|/home/ros/Desktop/a1x_ros/|/home/ros/Desktop/A1X/|/home/ros/Desktop/|/home/ros/|
|
||||
ssh:pleaseaskme@192.168.137.93=/home/ros/桌面/|/home/ros/|
|
||||
ssh:pleaseaskme@10.92.43.19=/home/ros/桌面/|/home/ros/音乐/|/home/ros/|
|
||||
ssh:pleaseaskme@192.168.100.23=/home/ros/roslog/|/home/ros/Desktop/|/home/ros/|
|
||||
ssh:ros@192.168.100.23=/home/ros/a1x_ros/|/home/ros/Desktop/|/home/ros/roslog/|/home/ros/|
|
||||
ssh:ros@192.168.100.24=/home/ros/a1x_ros/|/home/ros/|
|
||||
ssh:root@192.168.110.115=/userdata/dev_ws/src/origintank_base/launch/|/userdata/dev_ws/src/origintank_base/|/userdata/dev_ws/src/origintank_bringup/|/userdata/dev_ws/src/|/userdata/dev_ws/|/userdata/|/|/root/|
|
||||
ssh:root@ubuntu.lan=/root/|
|
||||
ssh:root@192.168.110.222=/userdata/dev_ws/src/originbot/|/userdata/dev_ws/src/|/userdata/dev_ws/|/userdata/|/|/root/|
|
||||
ssh:pleaseaskme@192.168.110.222=/boot/overlays/|/boot/|/vendor/|/|/root/|
|
||||
ssh:pleaseaskme@192.168.0.12=/root/|
|
||||
ssh:root@192.168.0.3=/userdata/dev_ws/src/yahboomcar_voice_ctrl/yahboomcar_voice_ctrl/|/userdata/dev_ws/src/yahboomcar_voice_ctrl/|/userdata/dev_ws/src/yahboomcar_nav/|/userdata/dev_ws/src/originbot/|/userdata/dev_ws/src/|/userdata/|/|/root/|/userdata/dev_ws/log/|/userdata/dev_ws/|/userdata/dev_ws/src/originbot/originbot_base/src/|/userdata/dev_ws/src/originbot/originbot_base/include/originbot_base/|/userdata/dev_ws/src/originbot/originbot_base/include/|/userdata/dev_ws/src/originbot/originbot_base/launch/|/userdata/dev_ws/src/originbot/originbot_base/|/userdata/dev_ws/src/originbot/originbot_deeplearning/line_follower_perception/|
|
||||
ssh:root@192.168.0.105=/root/dev_ws/src/supply_station_nav/supply_station_nav/|/root/dev_ws/src/supply_station_nav/resource/|/root/dev_ws/src/supply_station_nav/launch/|/root/dev_ws/src/supply_station_nav/config/|/root/dev_ws/src/supply_station_nav/|/root/dev_ws/scripts/|/root/dev_ws/src/origintank_base/src/|/root/arm_plane_calib/|/root/dev_ws/src/origintank_bringup/launch/|/root/dev_ws/src/origintank_bringup/|/root/dev_ws/src/origintank_base/launch/|/root/dev_ws/src/origintank_base/|/root/dev_ws/src/|/root/dev_ws/|/root/|
|
||||
ssh:root@10.162.10.242=/root/dev_ws/src/supply_station_nav/supply_station_nav/|/root/dev_ws/src/supply_station_nav/|/root/dev_ws/src/lerobot_arm_controller/lerobot_arm_controller/|/root/dev_ws/src/lerobot_arm_controller/|/root/dev_ws/src/|/root/dev_ws/src/supply_pickup_manager/supply_pickup_manager/|/root/dev_ws/src/supply_pickup_manager/resource/|/root/dev_ws/src/supply_pickup_manager/launch/|/root/dev_ws/src/supply_pickup_manager/config/|/root/dev_ws/src/supply_pickup_manager/|/root/dev_ws/src/raw_material_detector/resource/|/root/dev_ws/src/raw_material_detector/raw_material_detector/|/root/dev_ws/src/raw_material_detector/launch/|/root/dev_ws/src/raw_material_detector/config/|/root/dev_ws/src/raw_material_detector/|/root/arm_plane_calib/|
|
||||
|
||||
[WindowPos_HUANG_3200_2000_1920_1080]
|
||||
CompactMode=0
|
||||
MonitorCount=2
|
||||
Left=-13
|
||||
Top=-13
|
||||
Width=3226
|
||||
Height=1930
|
||||
Maximized=1
|
||||
SidebarVisible=1
|
||||
SidebarWidth=519
|
||||
|
||||
[Font]
|
||||
Font2=MobaFont
|
||||
FontIsBold2=0
|
||||
FontHeight2=10
|
||||
FontCharset2=0
|
||||
FontQuality2=3
|
||||
Ligatures=0
|
||||
Charset2=UTF-8
|
||||
LockRowsCols=0
|
||||
LockedCols=80
|
||||
LockedRows=24
|
||||
|
||||
[Colors]
|
||||
Black=30,30,30
|
||||
BoldBlack=128,128,128
|
||||
Red=255,96,96
|
||||
BoldRed=255,128,128
|
||||
Green=14,177,108
|
||||
BoldGreen=24,237,147
|
||||
Yellow=190,190,18
|
||||
BoldYellow=222,220,18
|
||||
Blue=18,150,190
|
||||
BoldBlue=27,186,233
|
||||
Magenta=255,77,255
|
||||
BoldMagenta=255,125,255
|
||||
Cyan=84,204,239
|
||||
BoldCyan=142,221,244
|
||||
White=204,204,204
|
||||
BoldWhite=204,204,204
|
||||
ForegroundColour=236,236,236
|
||||
BackgroundColour=30,30,30
|
||||
CursorColour=180,180,192
|
||||
SyntaxType=1
|
||||
|
||||
[Cursor]
|
||||
CursorType=0
|
||||
CursorBlinks=0
|
||||
|
||||
[PopupConsole]
|
||||
Transparency=16
|
||||
Size=36
|
||||
Sizeable=0
|
||||
Position=3
|
||||
TryToOpenInExplorerFolder=1
|
||||
BackgroundInsteadOfClose=0
|
||||
|
||||
[X11Extension]
|
||||
Composite=1
|
||||
DAMAGE=1
|
||||
RANDR=1
|
||||
XFIXES=1
|
||||
XTEST=1
|
||||
XINERAMA=1
|
||||
|
||||
[EditorWindowPos_3200_2000_192]
|
||||
Left=-13
|
||||
Top=-13
|
||||
Width=3226
|
||||
Height=1930
|
||||
Maximized=1
|
||||
MonitorCount=1
|
||||
|
||||
[WindowPos_DESKTOP-63076PO_1920_1080_4206288_-24]
|
||||
CompactMode=0
|
||||
MonitorCount=2
|
||||
Left=-8
|
||||
Top=-8
|
||||
Width=1936
|
||||
Height=1056
|
||||
Maximized=1
|
||||
SidebarVisible=1
|
||||
SidebarWidth=240
|
||||
|
||||
[WindowPos_DESKTOP-63076PO_1920_1080_1920_1080]
|
||||
CompactMode=0
|
||||
MonitorCount=2
|
||||
Left=-8
|
||||
Top=-8
|
||||
Width=1936
|
||||
Height=1056
|
||||
Maximized=1
|
||||
SidebarVisible=1
|
||||
SidebarWidth=240
|
||||
|
||||
[EditorWindowPos_1920_1080_1920_1080_96]
|
||||
Left=0
|
||||
Top=0
|
||||
Width=1920
|
||||
Height=1040
|
||||
Maximized=0
|
||||
MonitorCount=2
|
||||
|
||||
[MobaTextEditor]
|
||||
FontName3=MobaFanta
|
||||
FontLigatures3=0
|
||||
FontHeight3=-13
|
||||
GutterVisible=1
|
||||
GutterAutosize=1
|
||||
GutterShowLineNumbers=1
|
||||
GutterZeroStart=0
|
||||
GutterLeadingZeros=0
|
||||
GutterFontName=Verdana
|
||||
GutterFontSize=8
|
||||
EdgeColumn=800
|
||||
EdgeColor=16777215
|
||||
ExtraLineSpacing=0
|
||||
TabWidth=2
|
||||
BookmarkKeys=1
|
||||
BookmarksVisible=1
|
||||
Options=39866307
|
||||
WantTabs=1
|
||||
WordWrap=0
|
||||
|
||||
[WindowPos_DESKTOP-63076PO_1920_1080]
|
||||
CompactMode=0
|
||||
MonitorCount=1
|
||||
Left=-8
|
||||
Top=-8
|
||||
Width=1936
|
||||
Height=1056
|
||||
Maximized=1
|
||||
SidebarVisible=1
|
||||
SidebarWidth=298
|
||||
|
||||
[LastInstanceSessions]
|
||||
0=
|
||||
1=用户会话\COM7 (USB-SERIAL CH340 (COM7))
|
||||
|
||||
[Bookmarks]
|
||||
SubRep=
|
||||
ImgNum=42
|
||||
10.217.155.242 (root)= #109#0% 10.217.155.242%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
10.162.10.242 (root)=#109#0%10.162.10.242%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
192.168.0.105 (root)=#109#0%192.168.0.105%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
192.168.0.3 (root)=#109#0%192.168.0.3%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
192.168.127.10=#128#5%192.168.127.10%5900%-1%0%%%%%-1%0%0%%0%%1080%%%0#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
192.168.127.10 (root)=#109#0%192.168.127.10%22%root%%-1%-1%%%%%0%0%0%%%-1%-1%0%0%%1080%%0%0%1%%0%%%%0%-1%-1%0%%#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
COM7 (USB-SERIAL CH340 (COM7))= #131#8%1%1115200%3%0%0%1%2%COM7 (USB-SERIAL CH340 (COM7))#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
COM8 (USB-SERIAL CH340 (COM8))=#131#8%2%1115200%3%0%0%1%2%COM8 (USB-SERIAL CH340 (COM8))#MobaFont%10%0%0%-1%15%236,236,236%30,30,30%180,180,192%0%-1%0%%xterm%-1%0%_Std_Colors_0_%80%24%0%1%-1%<无>%%0%0%-1%0%#0# #-1
|
||||
|
||||
37878
MobaXterm_25.2_CN/MobaXterm.log
Normal file
37878
MobaXterm_25.2_CN/MobaXterm.log
Normal file
File diff suppressed because it is too large
Load diff
BIN
MobaXterm_25.2_CN/MobaXterm_25.2_CN.exe
Normal file
BIN
MobaXterm_25.2_CN/MobaXterm_25.2_CN.exe
Normal file
Binary file not shown.
BIN
MobaXterm_25.2_CN/MobaXterm_backup.zip
Normal file
BIN
MobaXterm_25.2_CN/MobaXterm_backup.zip
Normal file
Binary file not shown.
884
README.md
Normal file
884
README.md
Normal file
|
|
@ -0,0 +1,884 @@
|
|||
# RDK X5 + Gemini 2 + 机械臂抓取工程说明
|
||||
|
||||
- 使用 **RDK X5 + ROS 2 Humble**
|
||||
- 使用 **Orbbec Gemini 2** 深度相机
|
||||
- 使用一套 **普通 USB 相机 + 深度相机 + 底盘 + 机械臂** 的比赛/演示系统
|
||||
- 需要做 **桌面平面抓取标定**、**深度点抓取**、**整车任务联动**
|
||||
|
||||
---
|
||||
|
||||
## 1. 工程整体结构
|
||||
|
||||
### 1.1 目录说明
|
||||
|
||||
```bash
|
||||
├── arm_plane_calib/
|
||||
│ ├── biaodi.png # 标定点示意图/参考图
|
||||
│ ├── collect_plane_calib.py # 平面采样脚本
|
||||
│ ├── fit_plane_calib.py # 拟合脚本
|
||||
│ ├── predict_plane_cmd.py # 点击像素预测舵机命令脚本(只预测、不直接发串口)
|
||||
│ ├── depth_click_to_learm_cmd_node.py # 点击像素后直接预测并下发串口命令
|
||||
│ ├── model.yaml # 拟合得到的模型参数
|
||||
│ ├── samples.yaml # 采样得到的样本数据
|
||||
│ └── readme.md # 原始说明
|
||||
│
|
||||
└── dev_ws/
|
||||
├── README_RDK_X5.md # 原始说明
|
||||
├── scripts/
|
||||
│ └── setup_orbbec_udev.sh # 安装 Orbbec udev 规则
|
||||
└── src/
|
||||
├── depth_target_detector # 深度目标检测
|
||||
├── lerobot_arm_controller # 机械臂控制
|
||||
├── mission_manager # 任务状态机
|
||||
├── orbbec_camera # Gemini 2 驱动
|
||||
├── orbbec_camera_msgs # Orbbec 消息定义
|
||||
├── origintank_base # 底盘驱动
|
||||
├── origintank_bringup # 总启动入口
|
||||
└── signal_board_detector # 普通相机识别信号牌
|
||||
```
|
||||
|
||||
### 1.2 功能分层
|
||||
|
||||
整套工程可以分成两大部分:
|
||||
|
||||
1. **整车/整系统运行部分**:位于 `dev_ws`
|
||||
- 底盘运动
|
||||
- 普通 USB 相机识别信号牌
|
||||
- Gemini 2 深度点检测
|
||||
- 机械臂串口抓取控制
|
||||
- mission_manager 统一调度
|
||||
|
||||
2. **桌面抓取平面标定部分**:位于 `arm_plane_calib`
|
||||
- 鼠标点击图像中的桌面点
|
||||
- 利用深度图和相机内参反算 `x_cam/y_cam/z_cam`
|
||||
- 手动记录该点对应的机械臂命令向量
|
||||
- 用二次多项式建立“相机平面点 -> 舵机命令”的映射
|
||||
- 运行时点击任意目标点,即可预测机械臂舵机命令
|
||||
|
||||
---
|
||||
|
||||
## 2. ROS 2 功能包
|
||||
|
||||
### 2.1 `origintank_base`
|
||||
|
||||
底盘驱动包,负责底盘控制和基础传感器数据发布:
|
||||
|
||||
- `/odom`
|
||||
- `/imu`
|
||||
- `/ultrasonic/front/range`
|
||||
|
||||
### 2.2 `origintank_bringup`
|
||||
|
||||
总启动入口,负责把底盘、普通 USB 相机、Orbbec 相机、深度检测、机械臂控制和任务状态机串起来。
|
||||
|
||||
### 2.3 `signal_board_detector`
|
||||
|
||||
普通 USB 相机识别信号牌,输入通常为:
|
||||
|
||||
- `/image`
|
||||
|
||||
输出识别结果给任务状态机。
|
||||
|
||||
### 2.4 `depth_target_detector`
|
||||
|
||||
基于深度图提取最近目标,发布:
|
||||
|
||||
- `/depth_target/point`
|
||||
- `/depth_target/point3d`
|
||||
- `/depth_target/debug_image`
|
||||
|
||||
其中:
|
||||
|
||||
- `/depth_target/point` 表示目标距离和归一化偏移
|
||||
- `/depth_target/point3d` 表示目标在相机坐标系下的三维点 `(x_cam, y_cam, z_cam)`
|
||||
|
||||
### 2.5 `lerobot_arm_controller`
|
||||
|
||||
机械臂串口控制与抓取流程执行节点。
|
||||
|
||||
主要订阅:
|
||||
|
||||
- `/arm_command`
|
||||
- `/depth_target/point3d`
|
||||
|
||||
主要发布:
|
||||
|
||||
- `/arm/status`
|
||||
- `/arm/debug_target`
|
||||
|
||||
### 2.6 `mission_manager`
|
||||
|
||||
任务状态机,统一调度底盘、识别、抓取等流程。
|
||||
|
||||
默认配置中 `autostart: false`,因此一般需要手动发送启动命令。
|
||||
|
||||
### 2.7 `orbbec_camera` 与 `orbbec_camera_msgs`
|
||||
|
||||
从 Orbbec SDK ROS2 工程中裁剪出来的 Gemini 2 驱动与消息定义,不再依赖系统额外安装的 `ros-humble-orbbec-camera`。
|
||||
- `gemini2.launch.py`
|
||||
- Gemini 2 配置文件
|
||||
- 必要 SDK 源码
|
||||
- 消息与服务定义
|
||||
- udev 规则 `99-obsensor-libusb.rules`
|
||||
|
||||
---
|
||||
|
||||
## 3. 硬件与控制链路
|
||||
|
||||
### 3.1 当前机器已确认的设备映射
|
||||
|
||||
按你现场提供的枚举结果:
|
||||
|
||||
- `lsusb`
|
||||
- Orbbec Gemini 2:`2bc5:0670`
|
||||
- 普通 USB 摄像头:`0c45:6341`
|
||||
- 两个 CH340 串口:`1a86:7523`
|
||||
- `ls /dev/ttyUSB*`
|
||||
- `/dev/ttyUSB0`
|
||||
- `/dev/ttyUSB1`
|
||||
|
||||
结合你的实际接线,当前设备映射建议固定写成:
|
||||
|
||||
| 设备 | 当前接口 |
|
||||
|---|---|
|
||||
| 底盘控制板 | `/dev/ttyUSB0` |
|
||||
| 机械臂控制板 | `/dev/ttyUSB1` |
|
||||
| 普通 USB 相机 | `/dev/video0` |
|
||||
| 深度相机 | `/dev/video1` |
|
||||
|
||||
其中:
|
||||
|
||||
- 机械臂默认波特率:**9600**
|
||||
- 底盘串口仍按底盘驱动配置处理(当前 launch 默认 `B115200`)
|
||||
|
||||
整体链路如下:
|
||||
|
||||
- 底盘运动、编码器、IMU、超声波 -> `origintank_base`
|
||||
- 普通 USB 相机 -> `signal_board_detector`
|
||||
- Gemini 2 深度相机 -> `orbbec_camera`
|
||||
- 深度目标点 `/depth_target/point3d` -> `lerobot_arm_controller`
|
||||
- `mission_manager` 统一调度底盘、识别和抓取
|
||||
|
||||
---
|
||||
|
||||
## 4. 环境与依赖
|
||||
|
||||
### 4.1 系统环境
|
||||
|
||||
建议环境:
|
||||
|
||||
- Ubuntu 22.04
|
||||
- ROS 2 Humble
|
||||
- Python 3
|
||||
|
||||
### 4.2 Python/ROS 依赖
|
||||
|
||||
从当前代码和 `package.xml` 看,至少涉及以下依赖:
|
||||
|
||||
- `rclpy`
|
||||
- `rclcpp`
|
||||
- `sensor_msgs`
|
||||
- `geometry_msgs`
|
||||
- `nav_msgs`
|
||||
- `std_msgs`
|
||||
- `tf2_ros`
|
||||
- `cv_bridge`
|
||||
- `python3-opencv`
|
||||
- `python3-numpy`
|
||||
- `python3-serial`
|
||||
- `yaml`
|
||||
|
||||
如果是单独运行 `arm_plane_calib` 目录下脚本,重点要保证:
|
||||
|
||||
- `cv_bridge`
|
||||
- `opencv-python` 或系统 OpenCV
|
||||
- `numpy`
|
||||
- `PyYAML`
|
||||
- `pyserial`(仅 `depth_click_to_learm_cmd_node.py` 需要)
|
||||
|
||||
---
|
||||
|
||||
## 5. 编译前准备
|
||||
|
||||
### 5.1 安装 Orbbec 的 udev 规则
|
||||
|
||||
在 `dev_ws` 根目录下执行:
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
chmod +x scripts/setup_orbbec_udev.sh
|
||||
./scripts/setup_orbbec_udev.sh
|
||||
```
|
||||
|
||||
如果你的工作目录不是 `~/dev_ws`,请切换到实际的 `dev_ws` 根目录再执行。
|
||||
|
||||
脚本本质上会把:
|
||||
|
||||
- `src/orbbec_camera/scripts/99-obsensor-libusb.rules`
|
||||
|
||||
复制到:
|
||||
|
||||
- `/etc/udev/rules.d/99-obsensor-libusb.rules`
|
||||
|
||||
然后刷新 udev 规则。
|
||||
|
||||
如果 Gemini 2 已插上,建议重新插拔一次。
|
||||
|
||||
### 5.2 编译工作空间
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||
source install/setup.bash
|
||||
```
|
||||
|
||||
### 5.3 内存不足时增加临时 swap
|
||||
|
||||
Orbbec 相关包体积较大,内存不足时可以临时加 8G swap:
|
||||
|
||||
```bash
|
||||
free -h
|
||||
swapon --show
|
||||
|
||||
fallocate -l 8G /swapfile || dd if=/dev/zero of=/swapfile bs=1M count=8192
|
||||
chmod 600 /swapfile
|
||||
mkswap /swapfile
|
||||
swapon /swapfile
|
||||
|
||||
free -h
|
||||
swapon --show
|
||||
```
|
||||
|
||||
编译完成后可关闭:
|
||||
|
||||
```bash
|
||||
swapoff /swapfile
|
||||
rm -f /swapfile
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 整套系统启动方式
|
||||
|
||||
### 6.1 启动整车任务系统
|
||||
|
||||
```bash
|
||||
ros2 launch origintank_bringup rdk_x5_auto_mission.launch.py \
|
||||
cmd_port:=/dev/ttyUSB0 \
|
||||
arm_port:=/dev/ttyUSB1 \
|
||||
usb_video_device:=/dev/video0
|
||||
```
|
||||
|
||||
这里需要把“代码默认值”和“当前机器实际接线”分开看:
|
||||
|
||||
- **当前机器实际接线/枚举**(按你提供的 `ls /dev/ttyUSB*` 与 `lsusb`)
|
||||
- 底盘控制口:**`/dev/ttyUSB0`**
|
||||
- 机械臂控制口:**`/dev/ttyUSB1`**
|
||||
- 普通 USB 相机:**`/dev/video0`**
|
||||
- 深度相机:**`/dev/video1`**
|
||||
- **当前代码默认值**
|
||||
- `rdk_x5_auto_mission.launch.py` 里 `arm_port` 默认值还是 **`/dev/ttyUSB2`**
|
||||
- `lerobot_arm_controller/config/lerobot_arm_controller.yaml` 里 `port` 默认值也是 **`/dev/ttyUSB2`**
|
||||
|
||||
|
||||
### 6.2 默认会启动哪些内容
|
||||
|
||||
默认参数下会启动:
|
||||
|
||||
- 底盘驱动
|
||||
- 普通 USB 相机
|
||||
- Gemini 2
|
||||
- 深度目标检测
|
||||
- 机械臂控制
|
||||
- 任务状态机
|
||||
|
||||
对应开关参数:
|
||||
|
||||
- `use_usb_camera`
|
||||
- `use_orbbec_camera`
|
||||
- `use_depth_detector`
|
||||
- `use_arm_controller`
|
||||
- `use_hobot_usb_cam`
|
||||
|
||||
如果只想局部调试,可以在 launch 参数里关闭对应模块。
|
||||
|
||||
---
|
||||
|
||||
## 7. 单独测试 Gemini 2
|
||||
|
||||
### 7.1 启动 Gemini 2
|
||||
|
||||
```bash
|
||||
ros2 launch origintank_bringup orbbec_gemini2.launch.py
|
||||
```
|
||||
|
||||
这个 launch 本质上是对 `orbbec_camera/launch/gemini2.launch.py` 的封装。
|
||||
|
||||
默认传递的典型参数包括:
|
||||
|
||||
- `camera_name:=camera`
|
||||
- `enable_point_cloud:=false`
|
||||
- `enable_colored_point_cloud:=false`
|
||||
- `depth_registration:=true`
|
||||
|
||||
### 7.2 查看设备
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_devices_node
|
||||
```
|
||||
|
||||
### 7.3 查看深度工作模式
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_depth_work_mode_node
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. 任务控制与关键话题
|
||||
|
||||
### 8.1 手动启动/停止任务
|
||||
|
||||
启动:
|
||||
|
||||
```bash
|
||||
ros2 topic pub --once /mission/start std_msgs/msg/Bool "{data: true}"
|
||||
```
|
||||
|
||||
停止:
|
||||
|
||||
```bash
|
||||
ros2 topic pub --once /mission/start std_msgs/msg/Bool "{data: false}"
|
||||
```
|
||||
|
||||
### 8.2 关键话题总表
|
||||
|
||||
底盘与基础传感器:
|
||||
|
||||
- `/odom`
|
||||
- `/imu`
|
||||
- `/ultrasonic/front/range`
|
||||
|
||||
普通相机与识别:
|
||||
|
||||
- `/image_raw`
|
||||
- `/signal_board/result`
|
||||
|
||||
Gemini 2 深度相关:
|
||||
|
||||
- `/camera/color/image_raw`
|
||||
- `/camera/depth/image_raw`
|
||||
- `/camera/depth/camera_info`
|
||||
- `/depth_target/debug_image`
|
||||
- `/depth_target/point`
|
||||
- `/depth_target/point3d`
|
||||
|
||||
机械臂相关:
|
||||
|
||||
- `/arm_command`
|
||||
- `/arm/status`
|
||||
- `/arm/debug_target`
|
||||
|
||||
任务状态机:
|
||||
|
||||
- `/mission/start`
|
||||
- `/mission_manager/state`
|
||||
|
||||
### 8.3 可先检查的话题
|
||||
|
||||
```bash
|
||||
ros2 topic list
|
||||
ros2 topic echo /camera/depth/camera_info
|
||||
ros2 topic echo /depth_target/point3d
|
||||
ros2 topic echo /arm/status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 需要现场标定/修改的关键配置
|
||||
|
||||
### 9.1 深度目标检测参数
|
||||
|
||||
文件:
|
||||
|
||||
- `src/depth_target_detector/config/depth_target_detector.yaml`
|
||||
|
||||
当前主要参数:
|
||||
|
||||
- `min_depth_m: 0.10`
|
||||
- `max_depth_m: 1.20`
|
||||
- `roi_x_ratio: 0.25`
|
||||
- `roi_y_ratio: 0.25`
|
||||
- `roi_w_ratio: 0.50`
|
||||
- `roi_h_ratio: 0.50`
|
||||
- `nearest_band_m: 0.03`
|
||||
- `min_cluster_pixels: 80`
|
||||
|
||||
含义补充:
|
||||
|
||||
- `roi_*`:只在图像中央某个区域寻找目标,减少边缘干扰
|
||||
- `nearest_band_m`:以最近深度为基准,取一个厚度带做连通域提取
|
||||
- `min_cluster_pixels`:过滤太小的噪声区域
|
||||
|
||||
### 9.2 机械臂控制参数
|
||||
|
||||
文件:
|
||||
|
||||
- `src/lerobot_arm_controller/config/lerobot_arm_controller.yaml`
|
||||
|
||||
当前重点参数:
|
||||
|
||||
- 串口:`port`、`baud_rate`
|
||||
- 抓取动作:`move_time_ms`、`settle_sec`
|
||||
- 安全位与 home 位:`safe_z_cm`、`home_x_cm`、`home_y_cm`、`home_z_cm`
|
||||
- 抓取前/最终高度偏移:`grasp_pre_z_offset_cm`、`grasp_final_z_offset_cm`
|
||||
- 夹爪开合角:`gripper_open_angle_deg`、`gripper_close_angle_deg`
|
||||
- 相机到机械臂外参:
|
||||
- `camera_to_arm_x_m`
|
||||
- `camera_to_arm_y_m`
|
||||
- `camera_to_arm_z_m`
|
||||
- 抓取补偿:
|
||||
- `grasp_forward_extra_m`
|
||||
- `grasp_lateral_extra_m`
|
||||
- `grasp_height_extra_m`
|
||||
- 平台和色块放置点:
|
||||
- `platform_left_*`
|
||||
- `platform_right_*`
|
||||
- `blue_zone_*`
|
||||
- `green_zone_*`
|
||||
|
||||
### 9.3 mission_manager 参数
|
||||
|
||||
文件:
|
||||
|
||||
- `src/mission_manager/config/mission_manager.yaml`
|
||||
|
||||
当前重点参数:
|
||||
|
||||
- `autostart: false`
|
||||
- `approach_speed_mps`
|
||||
- `slope_speed_mps`
|
||||
- `lateral_speed_mps`
|
||||
- `turn_speed_radps`
|
||||
- `yaw_tolerance_deg`
|
||||
- `ultrasonic_stop_distance_m`
|
||||
- `signboard_stop_distance_m`
|
||||
- `board_hold_sec`
|
||||
- `alignment_tolerance`
|
||||
- `max_wait_signal_board_sec`
|
||||
|
||||
---
|
||||
|
||||
## 10. `arm_plane_calib` 的作用与适用场景
|
||||
|
||||
这个目录不是整车运行必须的 ROS 包,而是一组**用于桌面平面抓取快速标定与验证的独立脚本**。
|
||||
后续可根据`arm_plane_calib`来创建一个可正常使用的ROS2功能包
|
||||
---
|
||||
|
||||
## 11. `arm_plane_calib` 各脚本说明
|
||||
|
||||
### 11.1 `collect_plane_calib.py`
|
||||
|
||||
作用:
|
||||
|
||||
- 订阅彩色图、深度图、相机内参
|
||||
- 鼠标点击图像中的标定点
|
||||
- 自动计算点击点的相机坐标 `X_cam, Y_cam, Z_cam`
|
||||
- 终端手动输入该点对应的机械臂命令向量
|
||||
- 自动保存到 `samples.yaml`
|
||||
|
||||
默认参数:
|
||||
|
||||
- `color_topic: /camera/color/image_raw`
|
||||
- `depth_topic: /camera/depth/image_raw`
|
||||
- `camera_info_topic: /camera/depth/camera_info`
|
||||
- `save_path: samples.yaml`
|
||||
- `depth_scale: 0.001`
|
||||
- `min_depth_m: 0.05`
|
||||
- `max_depth_m: 1.50`
|
||||
- `median_kernel: 5`
|
||||
- `target_count: 9`
|
||||
|
||||
|
||||
### 11.2 `fit_plane_calib.py`
|
||||
|
||||
作用:
|
||||
|
||||
- 读取 `samples.yaml`
|
||||
- 用二次多项式最小二乘拟合
|
||||
- 生成 `model.yaml`
|
||||
|
||||
特征向量固定为:
|
||||
|
||||
```text
|
||||
[1, x, y, x², x*y, y²]
|
||||
```
|
||||
|
||||
输出模型包含:
|
||||
|
||||
- `feature_order`
|
||||
- `weights`
|
||||
- `cmd_dim`
|
||||
- `sample_count`
|
||||
- `mae_per_dim`
|
||||
- `rmse_per_dim`
|
||||
- `z_ref_median`
|
||||
|
||||
补充说明:
|
||||
|
||||
- 脚本要求至少 **6 个样本** 才能拟合
|
||||
- 实际建议 **9~16 个样本**
|
||||
- `mae_per_dim` 和 `rmse_per_dim` 可以直接用来判断每个舵机维度拟合得好不好
|
||||
- `z_ref_median` 是采样点深度中位数,可作为参考平面高度
|
||||
|
||||
### 11.3 `predict_plane_cmd.py`
|
||||
|
||||
作用:
|
||||
|
||||
- 运行时点击图像中的任意目标点
|
||||
- 自动取深度、反算相机坐标
|
||||
- 用 `model.yaml` 预测机械臂命令向量
|
||||
- 在终端打印结果
|
||||
|
||||
补充说明:
|
||||
|
||||
- 这个脚本**只预测、不直接发串口**
|
||||
- 当前代码中,模型输出顺序固定按:
|
||||
|
||||
```text
|
||||
6, 5, 4, 3
|
||||
```
|
||||
|
||||
- 但打印时会按你更容易读的顺序输出:
|
||||
|
||||
```text
|
||||
3, 4, 5, 6
|
||||
```
|
||||
|
||||
- 当前只对 3/4/5/6 号舵机做处理,且统一限幅:
|
||||
|
||||
```text
|
||||
servo_min = 125
|
||||
servo_max = 875
|
||||
```
|
||||
|
||||
所以如果你的机械臂舵机顺序或限位不是这样,需要同步改代码。
|
||||
|
||||
### 11.4 `depth_click_to_learm_cmd_node.py`
|
||||
|
||||
作用:
|
||||
|
||||
- 点击图像中的目标点
|
||||
- 自动取深度、预测命令向量
|
||||
- 直接通过串口下发机械臂多舵机运动命令
|
||||
|
||||
它相当于把“预测”和“发命令”合成一步,适合快速联调。
|
||||
|
||||
补充说明:
|
||||
|
||||
- **当前代码默认串口参数**:
|
||||
- `serial_port: /dev/ttyUSB0`
|
||||
- `baud_rate: 9600`
|
||||
- **当前机器实际建议参数**(按你现场接线):
|
||||
- `serial_port: /dev/ttyUSB1`
|
||||
- `baud_rate: 9600`
|
||||
- 默认运动时间:
|
||||
- `move_time_ms: 800`
|
||||
- 默认 `auto_send: true`,点击后会**立刻发送**
|
||||
- 默认舵机顺序:
|
||||
|
||||
```text
|
||||
servo_ids = [6, 5, 4, 3]
|
||||
```
|
||||
|
||||
- 默认舵机限位:
|
||||
|
||||
```text
|
||||
servo_min = [125, 125, 125, 125]
|
||||
servo_max = [875, 875, 875, 875]
|
||||
```
|
||||
|
||||
- 按键行为:
|
||||
- `q`:退出
|
||||
- `s`:对上次结果再次发送一次
|
||||
- `c`:清除上次点击显示
|
||||
|
||||
这里还要特别补一个容易混淆的点:
|
||||
|
||||
- 从 `arm_plane_calib` 目录脚本看,机械臂串口控制默认按 **9600** 处理
|
||||
- 但 `dev_ws/src/lerobot_arm_controller` 当前代码参数里写的是 **115200**
|
||||
- 你现场确认的机械臂默认波特率是 **9600**
|
||||
|
||||
因此,当前文档以你的**实际硬件**为准:机械臂默认波特率按 **9600** 使用。若继续使用 `lerobot_arm_controller`,建议把它的 `baud_rate` 参数同步改成 9600,避免“标定脚本能通、任务系统不通”的情况。
|
||||
|
||||
---
|
||||
|
||||
## 12. 平面标定推荐流程
|
||||
|
||||
### 12.1 准备标定点
|
||||
|
||||
建议在桌面贴 9 个点,组成 3x3:
|
||||
|
||||
```text
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
```
|
||||
|
||||
要求:
|
||||
|
||||
- 尽量铺满机械臂实际抓取区域
|
||||
- 点位不要太挤
|
||||
- 尽量位于同一平面
|
||||
|
||||
### 12.2 启动 Gemini 2
|
||||
|
||||
```bash
|
||||
source /opt/ros/humble/setup.bash
|
||||
source ~/dev_ws/install/setup.bash
|
||||
ros2 launch origintank_bringup orbbec_gemini2.launch.py
|
||||
```
|
||||
|
||||
### 12.3 运行采样脚本
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 collect_plane_calib.py
|
||||
```
|
||||
|
||||
### 12.4 逐点采样
|
||||
|
||||
每个点执行一次:
|
||||
|
||||
1. 鼠标点击图像里的桌面点
|
||||
2. 终端会打印该点的 `X/Y/Z`
|
||||
3. 手动把机械臂末端移动到该点正上方
|
||||
4. 输入该点对应的命令向量
|
||||
|
||||
例如输入:
|
||||
|
||||
```text
|
||||
520,610,430,500
|
||||
```
|
||||
|
||||
当前样例语义是:
|
||||
|
||||
```text
|
||||
按模型顺序:6轴, 5轴, 4轴, 3轴
|
||||
```
|
||||
|
||||
夹爪开合通常不参与平面拟合,抓取时再额外处理。
|
||||
|
||||
### 12.5 自动保存样本
|
||||
|
||||
脚本每记录一个样本都会自动写入 `samples.yaml`。
|
||||
|
||||
采满 9 个点后会自动退出。
|
||||
|
||||
### 12.6 执行拟合
|
||||
|
||||
```bash
|
||||
python3 fit_plane_calib.py samples.yaml model.yaml
|
||||
```
|
||||
|
||||
成功后会输出每维的 MAE / RMSE。
|
||||
|
||||
### 12.7 测试预测
|
||||
|
||||
```bash
|
||||
python3 predict_plane_cmd.py
|
||||
```
|
||||
|
||||
点击图像任意位置,会打印类似:
|
||||
|
||||
```text
|
||||
点击像素: (694, 230)
|
||||
相机坐标: X=0.0267, Y=-0.0681, Z=0.3600
|
||||
预测机械臂命令向量(按模型顺序 6,5,4,3): 501, 874, 385, 393
|
||||
舵机列表: 3:393,4:385,5:874,6:501
|
||||
```
|
||||
|
||||
### 12.8 测试“点击即发命令”
|
||||
|
||||
```bash
|
||||
python3 depth_click_to_learm_cmd_node.py
|
||||
```
|
||||
|
||||
如果串口、波特率、舵机顺序都正确,点击后就会直接下发多舵机运动命令。
|
||||
|
||||
---
|
||||
|
||||
## 13. 样本文件与模型文件格式说明
|
||||
|
||||
### 13.1 `samples.yaml`
|
||||
|
||||
每个样本包含:
|
||||
|
||||
- `u`, `v`:点击像素坐标
|
||||
- `x_cam`, `y_cam`, `z_cam`:相机坐标系下三维点
|
||||
- `arm_cmd`:该点对应的机械臂命令向量
|
||||
|
||||
顶层还包含:
|
||||
|
||||
- `cmd_dim`
|
||||
|
||||
### 13.2 `model.yaml`
|
||||
|
||||
当前模型文件中记录:
|
||||
|
||||
- 特征顺序 `['1', 'x', 'y', 'x2', 'xy', 'y2']`
|
||||
- 权重矩阵 `weights`
|
||||
- 输出维度 `cmd_dim`
|
||||
- 样本数 `sample_count`
|
||||
- `mae_per_dim`
|
||||
- `rmse_per_dim`
|
||||
- `z_ref_median`
|
||||
|
||||
这意味着当前平面拟合实际上是:
|
||||
|
||||
```text
|
||||
cmd = [1, x, y, x², x*y, y²] @ W
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 14. 机械臂串口控制补充说明
|
||||
|
||||
### 14.1 `depth_click_to_learm_cmd_node.py` 中的串口协议
|
||||
|
||||
代码中构造的帧格式为:
|
||||
|
||||
```text
|
||||
55 55 Length CMD Params...
|
||||
```
|
||||
|
||||
多舵机控制使用:
|
||||
|
||||
- `CMD = 0x03`
|
||||
|
||||
参数格式包含:
|
||||
|
||||
- 舵机数量
|
||||
- 运动时间低高字节
|
||||
- 每个舵机的 `id + pulse低字节 + pulse高字节`
|
||||
|
||||
### 14.2 为什么需要注意舵机顺序
|
||||
|
||||
平面拟合得到的只是“命令向量”,它本身并不知道哪一维对应哪一个舵机。
|
||||
|
||||
所以你必须保证以下三者一致:
|
||||
|
||||
1. 采样时你输入 `arm_cmd` 的顺序
|
||||
2. `model.yaml` 的输出维度顺序
|
||||
3. 实际发送串口时的 `servo_ids` 顺序
|
||||
|
||||
只要这三者有一处不一致,就会出现“预测看起来有值,但机械臂动作完全不对”的情况。
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 16. 常见检查项
|
||||
|
||||
### 16.1 相机有画面但点不到有效深度
|
||||
|
||||
优先检查:
|
||||
|
||||
- `/camera/depth/image_raw` 是否正常
|
||||
- `/camera/depth/camera_info` 是否正常
|
||||
- 点击位置是否超出有效深度范围
|
||||
- `depth_scale` 是否正确
|
||||
- `min_depth_m / max_depth_m` 是否设置过窄
|
||||
|
||||
### 16.2 点击后有预测值,但机械臂动作不对
|
||||
|
||||
优先检查:
|
||||
|
||||
- `servo_ids` 顺序是否和采样时输入顺序一致
|
||||
- `servo_min / servo_max` 是否限幅过死
|
||||
- 波特率是否匹配
|
||||
- 串口是否接对
|
||||
- 发送协议是否和控制板一致
|
||||
|
||||
### 16.3 整车能跑,但机械臂不动
|
||||
|
||||
优先检查:
|
||||
|
||||
- `lerobot_arm_controller` 的 `port` 是否正确
|
||||
- 当前运行参数是否已经改成 `/dev/ttyUSB1`(不要沿用代码里的旧默认值 `/dev/ttyUSB2`)
|
||||
- `/depth_target/point3d` 是否真的有数据
|
||||
- `/arm/status` 是否一直停在 `busy` 或没有变化
|
||||
|
||||
### 16.4 编译 Orbbec 包报内存不足
|
||||
|
||||
直接先加 swap,再编译。
|
||||
|
||||
### 16.5 标定效果差
|
||||
|
||||
可优先从这几个方向优化:
|
||||
|
||||
- 采样点从 9 点增加到 12~16 点
|
||||
- 采样区域尽量铺满工作区
|
||||
- 点击点尽量准确
|
||||
- 输入的机械臂命令值保持一致的姿态基准
|
||||
- 保证目标平面高度基本一致
|
||||
|
||||
---
|
||||
|
||||
## 17. 当前工程里需要注意的不一致点
|
||||
|
||||
这里把我在合并时发现的几个容易踩坑的地方单独列出来:
|
||||
|
||||
### 17.1 串口口名要按当前机器枚举,不要只看旧文档
|
||||
|
||||
你当前机器现场枚举已经确认:
|
||||
|
||||
- 底盘:`/dev/ttyUSB0`
|
||||
- 机械臂:`/dev/ttyUSB1`
|
||||
|
||||
但 `dev_ws` 里的部分 launch/config 仍保留着 `/dev/ttyUSB2`。因此:
|
||||
|
||||
- 直接运行时,要么显式传 `arm_port:=/dev/ttyUSB1`
|
||||
- 要么把源码默认值统一改成 `/dev/ttyUSB1`
|
||||
|
||||
### 17.2 机械臂波特率要统一到 9600
|
||||
|
||||
- `arm_plane_calib/depth_click_to_learm_cmd_node.py`:默认 `9600`
|
||||
- `arm_plane_calib/learm_test.py`:默认 `9600`
|
||||
- `lerobot_arm_controller` 当前代码参数:`115200`
|
||||
- 你现场确认的机械臂默认波特率:`9600`
|
||||
|
||||
所以现阶段推荐统一按 **9600** 配置机械臂相关节点。
|
||||
|
||||
### 17.3 相机设备号按当前机器写法
|
||||
|
||||
你当前机器现场信息为:
|
||||
|
||||
- 普通 USB 相机:`/dev/video0`
|
||||
- 深度相机:`/dev/video1`
|
||||
|
||||
不过在 ROS 2 实际运行中,Gemini 2 主要还是通过 `orbbec_camera` 驱动接管,不一定直接依赖 `/dev/video1` 做图像采集入口;`/dev/video1` 更适合作为设备枚举和排障参考。
|
||||
|
||||
### 17.4 `learm_test.py` 实际存在
|
||||
|
||||
之前旧说明里这个文件容易被忽略,但你当前压缩包里**实际有**:
|
||||
|
||||
- `arm_plane_calib/learm_test.py`
|
||||
|
||||
它适合用来做最基础的串口链路与舵机动作联调。
|
||||
---
|
||||
|
||||
## 18. 推荐的最小联调顺序
|
||||
|
||||
如果你要从零开始快速打通,建议按下面顺序:
|
||||
|
||||
1. 单独启动 Gemini 2,确认彩色图/深度图/相机内参正常
|
||||
2. 跑 `collect_plane_calib.py` 采 9~16 个点
|
||||
3. 跑 `fit_plane_calib.py` 生成 `model.yaml`
|
||||
4. 跑 `predict_plane_cmd.py` 看预测值是否合理
|
||||
5. 跑 `depth_click_to_learm_cmd_node.py` 验证点击后是否能直达目标附近
|
||||
6. 再接入 `lerobot_arm_controller`
|
||||
7. 最后再接入 `mission_manager` 做整车联调
|
||||
|
||||
这样排查最快,也最容易把问题切分清楚。
|
||||
|
||||
BIN
arm_plane_calib/biaodi.png
Normal file
BIN
arm_plane_calib/biaodi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
185
arm_plane_calib/collect_plane_calib.py
Normal file
185
arm_plane_calib/collect_plane_calib.py
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import yaml
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import Image, CameraInfo
|
||||
from cv_bridge import CvBridge
|
||||
|
||||
|
||||
class PlaneCalibCollector(Node):
|
||||
def __init__(self):
|
||||
super().__init__('plane_calib_collector')
|
||||
|
||||
self.declare_parameter('color_topic', '/camera/color/image_raw')
|
||||
self.declare_parameter('depth_topic', '/camera/depth/image_raw')
|
||||
self.declare_parameter('camera_info_topic', '/camera/depth/camera_info')
|
||||
self.declare_parameter('save_path', 'samples.yaml')
|
||||
self.declare_parameter('depth_scale', 0.001) # 深度单位转米,常见 mm -> m
|
||||
self.declare_parameter('min_depth_m', 0.05)
|
||||
self.declare_parameter('max_depth_m', 1.50)
|
||||
self.declare_parameter('median_kernel', 5)
|
||||
self.declare_parameter('target_count', 9) # 采满多少个点自动退出
|
||||
|
||||
self.color_topic = self.get_parameter('color_topic').value
|
||||
self.depth_topic = self.get_parameter('depth_topic').value
|
||||
self.camera_info_topic = self.get_parameter('camera_info_topic').value
|
||||
self.save_path = self.get_parameter('save_path').value
|
||||
self.depth_scale = float(self.get_parameter('depth_scale').value)
|
||||
self.min_depth_m = float(self.get_parameter('min_depth_m').value)
|
||||
self.max_depth_m = float(self.get_parameter('max_depth_m').value)
|
||||
self.median_kernel = int(self.get_parameter('median_kernel').value)
|
||||
self.target_count = int(self.get_parameter('target_count').value)
|
||||
|
||||
self.bridge = CvBridge()
|
||||
self.color_img = None
|
||||
self.depth_img = None
|
||||
self.K = None
|
||||
self.samples = []
|
||||
self.should_exit = False
|
||||
|
||||
self.create_subscription(Image, self.color_topic, self.on_color, 10)
|
||||
self.create_subscription(Image, self.depth_topic, self.on_depth, 10)
|
||||
self.create_subscription(CameraInfo, self.camera_info_topic, self.on_info, 10)
|
||||
|
||||
self.window_name = 'plane_calib_click'
|
||||
cv2.namedWindow(self.window_name, cv2.WINDOW_NORMAL)
|
||||
cv2.setMouseCallback(self.window_name, self.on_mouse)
|
||||
|
||||
self.get_logger().info('左键点击标定点,终端输入机械臂命令向量,例如: 500,620,410,530')
|
||||
self.get_logger().info(f'每记录 1 个样本自动保存,采满 {self.target_count} 个样本自动退出')
|
||||
self.get_logger().info('按 q 可手动退出')
|
||||
|
||||
def on_color(self, msg: Image):
|
||||
self.color_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8')
|
||||
|
||||
def on_depth(self, msg: Image):
|
||||
if msg.encoding in ('16UC1', 'mono16'):
|
||||
self.depth_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding='passthrough')
|
||||
else:
|
||||
self.get_logger().warn(f'不支持的深度编码: {msg.encoding}')
|
||||
|
||||
def on_info(self, msg: CameraInfo):
|
||||
self.K = np.array(msg.k, dtype=np.float64).reshape(3, 3)
|
||||
|
||||
def get_xyz_from_pixel(self, u: int, v: int):
|
||||
if self.depth_img is None or self.K is None:
|
||||
return None
|
||||
|
||||
h, w = self.depth_img.shape[:2]
|
||||
if not (0 <= u < w and 0 <= v < h):
|
||||
return None
|
||||
|
||||
k = self.median_kernel
|
||||
r = k // 2
|
||||
u0, u1 = max(0, u - r), min(w, u + r + 1)
|
||||
v0, v1 = max(0, v - r), min(h, v + r + 1)
|
||||
patch = self.depth_img[v0:v1, u0:u1].astype(np.float32)
|
||||
|
||||
valid = patch[patch > 0]
|
||||
if valid.size == 0:
|
||||
return None
|
||||
|
||||
z = np.median(valid) * self.depth_scale
|
||||
if z < self.min_depth_m or z > self.max_depth_m:
|
||||
return None
|
||||
|
||||
fx = self.K[0, 0]
|
||||
fy = self.K[1, 1]
|
||||
cx = self.K[0, 2]
|
||||
cy = self.K[1, 2]
|
||||
|
||||
x = (u - cx) * z / fx
|
||||
y = (v - cy) * z / fy
|
||||
return float(x), float(y), float(z)
|
||||
|
||||
def save_samples(self):
|
||||
data = {
|
||||
'samples': self.samples,
|
||||
'cmd_dim': len(self.samples[0]['arm_cmd']) if self.samples else 0
|
||||
}
|
||||
with open(self.save_path, 'w', encoding='utf-8') as f:
|
||||
yaml.safe_dump(data, f, allow_unicode=True, sort_keys=False)
|
||||
print(f'[SAVE] 已保存到 {self.save_path}')
|
||||
|
||||
def on_mouse(self, event, x, y, flags, param):
|
||||
if event != cv2.EVENT_LBUTTONDOWN:
|
||||
return
|
||||
|
||||
xyz = self.get_xyz_from_pixel(x, y)
|
||||
if xyz is None:
|
||||
print(f'[WARN] 点击点 ({x}, {y}) 无有效深度')
|
||||
return
|
||||
|
||||
X, Y, Z = xyz
|
||||
print(f'\n点击像素: ({x}, {y})')
|
||||
print(f'相机坐标: X={X:.4f} m, Y={Y:.4f} m, Z={Z:.4f} m')
|
||||
print('请手动把机械臂末端移到这个点正上方,然后输入命令向量,例如 500,620,410,530')
|
||||
cmd_str = input('arm_cmd> ').strip()
|
||||
if not cmd_str:
|
||||
print('[SKIP] 未输入,跳过')
|
||||
return
|
||||
|
||||
try:
|
||||
arm_cmd = [float(s) for s in cmd_str.split(',')]
|
||||
except Exception:
|
||||
print('[ERR] 输入格式错误,应类似 500,620,410,530')
|
||||
return
|
||||
|
||||
item = {
|
||||
'u': int(x),
|
||||
'v': int(y),
|
||||
'x_cam': X,
|
||||
'y_cam': Y,
|
||||
'z_cam': Z,
|
||||
'arm_cmd': arm_cmd
|
||||
}
|
||||
self.samples.append(item)
|
||||
print(f'[OK] 已记录第 {len(self.samples)} 个样本')
|
||||
|
||||
# 自动保存
|
||||
self.save_samples()
|
||||
|
||||
# 采满自动退出
|
||||
if len(self.samples) >= self.target_count:
|
||||
print(f'[DONE] 已采满 {self.target_count} 个样本,自动保存并退出')
|
||||
self.should_exit = True
|
||||
|
||||
def spin_loop(self):
|
||||
while rclpy.ok() and not self.should_exit:
|
||||
rclpy.spin_once(self, timeout_sec=0.03)
|
||||
|
||||
if self.color_img is not None:
|
||||
show = self.color_img.copy()
|
||||
for i, s in enumerate(self.samples):
|
||||
cv2.circle(show, (s['u'], s['v']), 4, (0, 255, 0), -1)
|
||||
cv2.putText(
|
||||
show, str(i + 1), (s['u'] + 6, s['v'] - 6),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1
|
||||
)
|
||||
cv2.imshow(self.window_name, show)
|
||||
|
||||
key = cv2.waitKey(1) & 0xFF
|
||||
if key == ord('q'):
|
||||
print('[EXIT] 用户退出')
|
||||
break
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
||||
def main():
|
||||
rclpy.init()
|
||||
node = PlaneCalibCollector()
|
||||
try:
|
||||
node.spin_loop()
|
||||
finally:
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
344
arm_plane_calib/depth_click_to_learm_cmd_node.py
Normal file
344
arm_plane_calib/depth_click_to_learm_cmd_node.py
Normal file
|
|
@ -0,0 +1,344 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import yaml
|
||||
import cv2
|
||||
import numpy as np
|
||||
import serial
|
||||
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import Image, CameraInfo
|
||||
from cv_bridge import CvBridge
|
||||
|
||||
|
||||
class LeArmSerial:
|
||||
def __init__(self, port="/dev/ttyUSB0", baudrate=9600):
|
||||
self.port = port
|
||||
self.baudrate = baudrate
|
||||
self.ser = None
|
||||
|
||||
def open(self):
|
||||
self.ser = serial.Serial()
|
||||
self.ser.port = self.port
|
||||
self.ser.baudrate = self.baudrate
|
||||
self.ser.bytesize = serial.EIGHTBITS
|
||||
self.ser.parity = serial.PARITY_NONE
|
||||
self.ser.stopbits = serial.STOPBITS_ONE
|
||||
self.ser.timeout = 0.1
|
||||
self.ser.xonxoff = False
|
||||
self.ser.rtscts = False
|
||||
self.ser.dsrdtr = False
|
||||
self.ser.dtr = False
|
||||
self.ser.rts = False
|
||||
self.ser.open()
|
||||
|
||||
print(f"[INFO] 串口已打开: {self.port} @ {self.baudrate}")
|
||||
print("[INFO] 等待控制板稳定...")
|
||||
time.sleep(3.0)
|
||||
|
||||
self.ser.reset_input_buffer()
|
||||
self.ser.reset_output_buffer()
|
||||
|
||||
def close(self):
|
||||
if self.ser and self.ser.is_open:
|
||||
self.ser.close()
|
||||
print("[INFO] 串口已关闭")
|
||||
|
||||
@staticmethod
|
||||
def build_frame(cmd: int, params: bytes = b"") -> bytes:
|
||||
# 协议: 55 55 Length CMD Params...
|
||||
# Length = CMD(1) + Params长度
|
||||
length = 1 + len(params)
|
||||
return bytes([0x55, 0x55, length, cmd]) + params
|
||||
|
||||
def move_servos(self, servo_pairs, move_time_ms=800):
|
||||
"""
|
||||
servo_pairs: [(servo_id, pulse), ...]
|
||||
CMD=3 多舵机控制
|
||||
"""
|
||||
if not servo_pairs:
|
||||
print("[WARN] 空舵机列表")
|
||||
return
|
||||
|
||||
params = bytearray()
|
||||
params.append(len(servo_pairs))
|
||||
params.append(move_time_ms & 0xFF)
|
||||
params.append((move_time_ms >> 8) & 0xFF)
|
||||
|
||||
for sid, pulse in servo_pairs:
|
||||
sid = int(sid)
|
||||
pulse = int(pulse)
|
||||
params.append(sid & 0xFF)
|
||||
params.append(pulse & 0xFF)
|
||||
params.append((pulse >> 8) & 0xFF)
|
||||
|
||||
frame = self.build_frame(0x03, bytes(params))
|
||||
print("TX:", frame.hex(" "))
|
||||
self.ser.write(frame)
|
||||
self.ser.flush()
|
||||
|
||||
|
||||
class DepthClickToLeArm(Node):
|
||||
def __init__(self):
|
||||
super().__init__("depth_click_to_learm_cmd")
|
||||
|
||||
# 相机话题
|
||||
self.declare_parameter("depth_topic", "/camera/depth/image_raw")
|
||||
self.declare_parameter("camera_info_topic", "/camera/depth/camera_info")
|
||||
self.declare_parameter("color_topic", "/camera/color/image_raw")
|
||||
|
||||
# 模型
|
||||
self.declare_parameter("model_path", "model.yaml")
|
||||
|
||||
# 深度参数
|
||||
self.declare_parameter("depth_scale", 0.001) # 16UC1 常见 mm->m
|
||||
self.declare_parameter("min_depth_m", 0.05)
|
||||
self.declare_parameter("max_depth_m", 1.20)
|
||||
self.declare_parameter("median_kernel", 5)
|
||||
|
||||
# 串口
|
||||
self.declare_parameter("serial_port", "/dev/ttyUSB0")
|
||||
self.declare_parameter("baud_rate", 9600)
|
||||
self.declare_parameter("move_time_ms", 800)
|
||||
|
||||
# 视图
|
||||
self.declare_parameter("show_color_view", True)
|
||||
self.declare_parameter("draw_text", True)
|
||||
|
||||
# 命令向量 -> 舵机ID映射
|
||||
# 这里的顺序必须和 model.yaml 输出的命令向量顺序一致
|
||||
# 默认给一组常见顺序,你后面按自己机械臂实际改
|
||||
self.declare_parameter("servo_ids", [6, 5, 4, 3])
|
||||
|
||||
# 每个舵机范围,按你给出的范围设置
|
||||
self.declare_parameter("servo_min", [125, 125, 125, 125])
|
||||
self.declare_parameter("servo_max", [875, 875, 875, 875])
|
||||
|
||||
# 如果想把夹爪加入抓取动作,可在点击后自己再加固定动作
|
||||
self.declare_parameter("auto_send", True)
|
||||
|
||||
self.depth_topic = self.get_parameter("depth_topic").value
|
||||
self.camera_info_topic = self.get_parameter("camera_info_topic").value
|
||||
self.color_topic = self.get_parameter("color_topic").value
|
||||
|
||||
self.model_path = self.get_parameter("model_path").value
|
||||
|
||||
self.depth_scale = float(self.get_parameter("depth_scale").value)
|
||||
self.min_depth_m = float(self.get_parameter("min_depth_m").value)
|
||||
self.max_depth_m = float(self.get_parameter("max_depth_m").value)
|
||||
self.median_kernel = int(self.get_parameter("median_kernel").value)
|
||||
|
||||
self.serial_port = self.get_parameter("serial_port").value
|
||||
self.baud_rate = int(self.get_parameter("baud_rate").value)
|
||||
self.move_time_ms = int(self.get_parameter("move_time_ms").value)
|
||||
|
||||
self.show_color_view = bool(self.get_parameter("show_color_view").value)
|
||||
self.draw_text = bool(self.get_parameter("draw_text").value)
|
||||
|
||||
self.servo_ids = list(self.get_parameter("servo_ids").value)
|
||||
self.servo_min = list(self.get_parameter("servo_min").value)
|
||||
self.servo_max = list(self.get_parameter("servo_max").value)
|
||||
self.auto_send = bool(self.get_parameter("auto_send").value)
|
||||
|
||||
# 读取模型
|
||||
with open(self.model_path, "r", encoding="utf-8") as f:
|
||||
model = yaml.safe_load(f)
|
||||
|
||||
self.W = np.array(model["weights"], dtype=np.float64) # [6, cmd_dim]
|
||||
self.cmd_dim = int(model["cmd_dim"])
|
||||
if self.cmd_dim != len(self.servo_ids):
|
||||
raise RuntimeError(
|
||||
f"model cmd_dim={self.cmd_dim} 与 servo_ids 数量={len(self.servo_ids)} 不一致"
|
||||
)
|
||||
|
||||
self.bridge = CvBridge()
|
||||
self.depth_img = None
|
||||
self.color_img = None
|
||||
self.K = None
|
||||
|
||||
self.last_click = None
|
||||
self.window_name = "depth_click_to_learm_cmd"
|
||||
|
||||
self.arm = LeArmSerial(self.serial_port, self.baud_rate)
|
||||
self.arm.open()
|
||||
|
||||
self.create_subscription(Image, self.depth_topic, self.on_depth, 10)
|
||||
self.create_subscription(CameraInfo, self.camera_info_topic, self.on_info, 10)
|
||||
self.create_subscription(Image, self.color_topic, self.on_color, 10)
|
||||
|
||||
cv2.namedWindow(self.window_name, cv2.WINDOW_NORMAL)
|
||||
cv2.setMouseCallback(self.window_name, self.on_mouse)
|
||||
|
||||
self.get_logger().info("节点已启动,左键点击目标点即可预测并发送 CMD=3。")
|
||||
|
||||
def destroy_node(self):
|
||||
try:
|
||||
self.arm.close()
|
||||
except Exception:
|
||||
pass
|
||||
super().destroy_node()
|
||||
|
||||
def on_depth(self, msg: Image):
|
||||
self.depth_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding="passthrough")
|
||||
|
||||
def on_color(self, msg: Image):
|
||||
try:
|
||||
self.color_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding="bgr8")
|
||||
except Exception:
|
||||
self.color_img = None
|
||||
|
||||
def on_info(self, msg: CameraInfo):
|
||||
self.K = np.array(msg.k, dtype=np.float64).reshape(3, 3)
|
||||
|
||||
@staticmethod
|
||||
def features(x, y):
|
||||
return np.array([1.0, x, y, x * x, x * y, y * y], dtype=np.float64)
|
||||
|
||||
def pixel_to_xyz(self, u, v):
|
||||
if self.depth_img is None or self.K is None:
|
||||
return None
|
||||
|
||||
h, w = self.depth_img.shape[:2]
|
||||
if not (0 <= u < w and 0 <= v < h):
|
||||
return None
|
||||
|
||||
r = self.median_kernel // 2
|
||||
u0, u1 = max(0, u - r), min(w, u + r + 1)
|
||||
v0, v1 = max(0, v - r), min(h, v + r + 1)
|
||||
patch = self.depth_img[v0:v1, u0:u1].astype(np.float32)
|
||||
|
||||
valid = patch[patch > 0]
|
||||
if valid.size == 0:
|
||||
return None
|
||||
|
||||
z = float(np.median(valid) * self.depth_scale)
|
||||
if z < self.min_depth_m or z > self.max_depth_m:
|
||||
return None
|
||||
|
||||
fx = self.K[0, 0]
|
||||
fy = self.K[1, 1]
|
||||
cx = self.K[0, 2]
|
||||
cy = self.K[1, 2]
|
||||
|
||||
x = float((u - cx) * z / fx)
|
||||
y = float((v - cy) * z / fy)
|
||||
return x, y, z
|
||||
|
||||
def predict_cmd(self, x_cam, y_cam):
|
||||
feat = self.features(x_cam, y_cam) # [6]
|
||||
cmd = feat @ self.W # [cmd_dim]
|
||||
return cmd
|
||||
|
||||
def clamp_cmd(self, cmd):
|
||||
out = []
|
||||
for i, v in enumerate(cmd):
|
||||
lo = float(self.servo_min[i])
|
||||
hi = float(self.servo_max[i])
|
||||
out.append(int(round(max(lo, min(hi, v)))))
|
||||
return out
|
||||
|
||||
def send_cmd_vector(self, cmd_vec):
|
||||
servo_pairs = list(zip(self.servo_ids, cmd_vec))
|
||||
self.arm.move_servos(servo_pairs, move_time_ms=self.move_time_ms)
|
||||
|
||||
def on_mouse(self, event, x, y, flags, param):
|
||||
if event != cv2.EVENT_LBUTTONDOWN:
|
||||
return
|
||||
|
||||
xyz = self.pixel_to_xyz(x, y)
|
||||
if xyz is None:
|
||||
print(f"[WARN] 点击点 ({x}, {y}) 无有效深度")
|
||||
return
|
||||
|
||||
x_cam, y_cam, z_cam = xyz
|
||||
pred = self.predict_cmd(x_cam, y_cam)
|
||||
pred_clamped = self.clamp_cmd(pred)
|
||||
|
||||
self.last_click = {
|
||||
"u": int(x),
|
||||
"v": int(y),
|
||||
"x_cam": x_cam,
|
||||
"y_cam": y_cam,
|
||||
"z_cam": z_cam,
|
||||
"pred_raw": pred.tolist(),
|
||||
"pred_cmd": pred_clamped,
|
||||
}
|
||||
|
||||
print("\n========== 点击目标点 ==========")
|
||||
print(f"像素: ({x}, {y})")
|
||||
print(f"相机坐标: X={x_cam:.4f} m, Y={y_cam:.4f} m, Z={z_cam:.4f} m")
|
||||
print("预测原始命令向量:", ", ".join([f"{v:.2f}" for v in pred.tolist()]))
|
||||
print("限幅后命令向量:", pred_clamped)
|
||||
print("舵机映射:", list(zip(self.servo_ids, pred_clamped)))
|
||||
|
||||
if self.auto_send:
|
||||
self.send_cmd_vector(pred_clamped)
|
||||
print("[OK] 已直接发送 CMD=3")
|
||||
|
||||
def make_depth_vis(self):
|
||||
if self.depth_img is None:
|
||||
return None
|
||||
|
||||
depth = self.depth_img.astype(np.float32) * self.depth_scale
|
||||
depth = np.clip(depth, self.min_depth_m, self.max_depth_m)
|
||||
|
||||
norm = (depth - self.min_depth_m) / max(1e-6, (self.max_depth_m - self.min_depth_m))
|
||||
norm = (norm * 255.0).astype(np.uint8)
|
||||
vis = cv2.applyColorMap(255 - norm, cv2.COLORMAP_JET)
|
||||
return vis
|
||||
|
||||
def spin_loop(self):
|
||||
while rclpy.ok():
|
||||
rclpy.spin_once(self, timeout_sec=0.03)
|
||||
|
||||
show = None
|
||||
if self.show_color_view and self.color_img is not None:
|
||||
show = self.color_img.copy()
|
||||
else:
|
||||
vis = self.make_depth_vis()
|
||||
if vis is not None:
|
||||
show = vis
|
||||
|
||||
if show is not None and self.last_click is not None:
|
||||
u = self.last_click["u"]
|
||||
v = self.last_click["v"]
|
||||
cv2.circle(show, (u, v), 6, (0, 255, 0), -1)
|
||||
if self.draw_text:
|
||||
txt1 = f"({u},{v})"
|
||||
txt2 = f"X={self.last_click['x_cam']:.3f} Y={self.last_click['y_cam']:.3f} Z={self.last_click['z_cam']:.3f}"
|
||||
txt3 = "CMD=" + ",".join([str(v) for v in self.last_click["pred_cmd"]])
|
||||
cv2.putText(show, txt1, (u + 8, v - 24), cv2.FONT_HERSHEY_SIMPLEX, 0.55, (0, 255, 0), 1)
|
||||
cv2.putText(show, txt2, (u + 8, v - 8), cv2.FONT_HERSHEY_SIMPLEX, 0.50, (0, 255, 0), 1)
|
||||
cv2.putText(show, txt3, (u + 8, v + 10), cv2.FONT_HERSHEY_SIMPLEX, 0.50, (0, 255, 0), 1)
|
||||
|
||||
cv2.imshow(self.window_name, show)
|
||||
elif show is not None:
|
||||
cv2.imshow(self.window_name, show)
|
||||
|
||||
key = cv2.waitKey(1) & 0xFF
|
||||
if key == ord("q"):
|
||||
break
|
||||
elif key == ord("s") and self.last_click is not None:
|
||||
# 手动再发送一次
|
||||
self.send_cmd_vector(self.last_click["pred_cmd"])
|
||||
print("[OK] 手动再次发送 CMD=3")
|
||||
elif key == ord("c"):
|
||||
self.last_click = None
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
||||
def main():
|
||||
rclpy.init()
|
||||
node = DepthClickToLeArm()
|
||||
try:
|
||||
node.spin_loop()
|
||||
finally:
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
60
arm_plane_calib/fit_plane_calib.py
Normal file
60
arm_plane_calib/fit_plane_calib.py
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env python3
|
||||
import yaml
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
|
||||
def features(x, y):
|
||||
return np.array([1.0, x, y, x * x, x * y, y * y], dtype=np.float64)
|
||||
|
||||
|
||||
def main():
|
||||
sample_path = sys.argv[1] if len(sys.argv) > 1 else 'samples.yaml'
|
||||
model_path = sys.argv[2] if len(sys.argv) > 2 else 'model.yaml'
|
||||
|
||||
with open(sample_path, 'r', encoding='utf-8') as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
samples = data['samples']
|
||||
if len(samples) < 6:
|
||||
print('样本太少,至少需要 6 个,建议 9~16 个')
|
||||
return
|
||||
|
||||
X = []
|
||||
Y = []
|
||||
|
||||
for s in samples:
|
||||
X.append(features(s['x_cam'], s['y_cam']))
|
||||
Y.append(s['arm_cmd'])
|
||||
|
||||
X = np.array(X, dtype=np.float64) # [N, 6]
|
||||
Y = np.array(Y, dtype=np.float64) # [N, cmd_dim]
|
||||
|
||||
# 最小二乘
|
||||
W, _, _, _ = np.linalg.lstsq(X, Y, rcond=None) # [6, cmd_dim]
|
||||
Y_pred = X @ W
|
||||
err = Y_pred - Y
|
||||
mae = np.mean(np.abs(err), axis=0)
|
||||
rmse = np.sqrt(np.mean(err ** 2, axis=0))
|
||||
|
||||
model = {
|
||||
'feature_order': ['1', 'x', 'y', 'x2', 'xy', 'y2'],
|
||||
'weights': W.tolist(),
|
||||
'cmd_dim': int(Y.shape[1]),
|
||||
'sample_count': int(len(samples)),
|
||||
'mae_per_dim': mae.tolist(),
|
||||
'rmse_per_dim': rmse.tolist(),
|
||||
'z_ref_median': float(np.median([s['z_cam'] for s in samples]))
|
||||
}
|
||||
|
||||
with open(model_path, 'w', encoding='utf-8') as f:
|
||||
yaml.safe_dump(model, f, allow_unicode=True, sort_keys=False)
|
||||
|
||||
print(f'模型已保存到: {model_path}')
|
||||
print('每维 MAE:', mae)
|
||||
print('每维 RMSE:', rmse)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
242
arm_plane_calib/learm_test.py
Normal file
242
arm_plane_calib/learm_test.py
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import serial
|
||||
|
||||
|
||||
class LeArmSerial:
|
||||
def __init__(self, port="/dev/ttyUSB0", baudrate=9600):
|
||||
self.port = port
|
||||
self.baudrate = baudrate
|
||||
self.ser = None
|
||||
|
||||
def open(self):
|
||||
self.ser = serial.Serial()
|
||||
self.ser.port = self.port
|
||||
self.ser.baudrate = self.baudrate
|
||||
self.ser.bytesize = serial.EIGHTBITS
|
||||
self.ser.parity = serial.PARITY_NONE
|
||||
self.ser.stopbits = serial.STOPBITS_ONE
|
||||
self.ser.timeout = 0.1
|
||||
self.ser.xonxoff = False
|
||||
self.ser.rtscts = False
|
||||
self.ser.dsrdtr = False
|
||||
|
||||
self.ser.dtr = False
|
||||
self.ser.rts = False
|
||||
self.ser.open()
|
||||
|
||||
print(f"[INFO] 串口已打开: {self.port} @ {self.baudrate}")
|
||||
print("[INFO] 等待控制板稳定...")
|
||||
time.sleep(3.0)
|
||||
|
||||
self.ser.reset_input_buffer()
|
||||
self.ser.reset_output_buffer()
|
||||
|
||||
def close(self):
|
||||
if self.ser and self.ser.is_open:
|
||||
self.ser.close()
|
||||
print("[INFO] 串口已关闭")
|
||||
|
||||
@staticmethod
|
||||
def build_frame(cmd: int, params: bytes = b"") -> bytes:
|
||||
length = 2 + len(params)
|
||||
return bytes([0x55, 0x55, length, cmd]) + params
|
||||
|
||||
def send_frame(self, cmd: int, params: bytes = b""):
|
||||
frame = self.build_frame(cmd, params)
|
||||
print("TX:", frame.hex(" "))
|
||||
self.ser.write(frame)
|
||||
self.ser.flush()
|
||||
|
||||
def read_frames(self, wait_s: float = 1.0):
|
||||
deadline = time.time() + wait_s
|
||||
buf = bytearray()
|
||||
|
||||
while time.time() < deadline:
|
||||
n = self.ser.in_waiting
|
||||
if n > 0:
|
||||
buf.extend(self.ser.read(n))
|
||||
time.sleep(0.01)
|
||||
|
||||
print("RAW RX:", bytes(buf).hex(" "))
|
||||
return self.split_frames(bytes(buf))
|
||||
|
||||
@staticmethod
|
||||
def split_frames(buf: bytes):
|
||||
frames = []
|
||||
i = 0
|
||||
while i <= len(buf) - 3:
|
||||
if buf[i] == 0x55 and buf[i + 1] == 0x55:
|
||||
length = buf[i + 2]
|
||||
frame_len = 2 + length
|
||||
if i + frame_len <= len(buf):
|
||||
frames.append(buf[i:i + frame_len])
|
||||
i += frame_len
|
||||
continue
|
||||
i += 1
|
||||
return frames
|
||||
|
||||
@staticmethod
|
||||
def parse_fw_query(frame: bytes):
|
||||
if len(frame) != 6 or frame[:4] != b"\x55\x55\x04\x01":
|
||||
return None
|
||||
servo_type = frame[4]
|
||||
fw_ver = frame[5]
|
||||
return {
|
||||
"servo_type": servo_type,
|
||||
"servo_type_text": {1: "PWM舵机", 2: "总线舵机"}.get(servo_type, f"未知({servo_type})"),
|
||||
"firmware_version": fw_ver,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def parse_servo_readback(frame: bytes):
|
||||
if len(frame) < 6 or frame[0] != 0x55 or frame[1] != 0x55 or frame[3] != 0x0D:
|
||||
return None
|
||||
|
||||
payload = frame[4:]
|
||||
items = []
|
||||
if len(payload) % 3 != 0:
|
||||
usable = len(payload) - (len(payload) % 3)
|
||||
payload = payload[:usable]
|
||||
|
||||
for i in range(0, len(payload), 3):
|
||||
sid = payload[i]
|
||||
pulse = payload[i + 1] | (payload[i + 2] << 8)
|
||||
items.append({"id": sid, "pulse": pulse})
|
||||
return items
|
||||
|
||||
def query_firmware(self):
|
||||
self.ser.reset_input_buffer()
|
||||
self.send_frame(0x01)
|
||||
frames = self.read_frames(wait_s=1.0)
|
||||
|
||||
ok = False
|
||||
for f in frames:
|
||||
print("FRAME:", f.hex(" "))
|
||||
info = self.parse_fw_query(f)
|
||||
if info:
|
||||
ok = True
|
||||
print("[OK] 固件查询成功")
|
||||
print("舵机类型:", info["servo_type_text"])
|
||||
print("固件版本号:", info["firmware_version"])
|
||||
if not ok:
|
||||
print("[WARN] 未解析到有效固件查询返回")
|
||||
|
||||
def read_servo_angles(self):
|
||||
self.ser.reset_input_buffer()
|
||||
self.send_frame(0x0D)
|
||||
frames = self.read_frames(wait_s=1.0)
|
||||
|
||||
ok = False
|
||||
for f in frames:
|
||||
print("FRAME:", f.hex(" "))
|
||||
items = self.parse_servo_readback(f)
|
||||
if items is not None:
|
||||
ok = True
|
||||
print("[OK] 舵机角度回读成功")
|
||||
for item in items:
|
||||
print(f" 舵机ID={item['id']}, 脉宽={item['pulse']}")
|
||||
if not ok:
|
||||
print("[WARN] 未解析到有效舵机角度回读返回")
|
||||
|
||||
def set_init_pose(self):
|
||||
self.ser.reset_input_buffer()
|
||||
self.send_frame(0x0C)
|
||||
time.sleep(1.5)
|
||||
print("[OK] 已发送初始位姿设置命令")
|
||||
|
||||
def move_servos(self, servo_pairs, move_time_ms=800):
|
||||
"""
|
||||
servo_pairs: [(servo_id, pulse), ...]
|
||||
协议:
|
||||
长度 = 舵机个数*3 + 5
|
||||
params:
|
||||
个数(1B), time_low(1B), time_high(1B),
|
||||
[id, pulse_low, pulse_high] * N
|
||||
"""
|
||||
if not servo_pairs:
|
||||
print("[WARN] 空舵机列表")
|
||||
return
|
||||
|
||||
params = bytearray()
|
||||
params.append(len(servo_pairs))
|
||||
params.append(move_time_ms & 0xFF)
|
||||
params.append((move_time_ms >> 8) & 0xFF)
|
||||
|
||||
for sid, pulse in servo_pairs:
|
||||
pulse = int(pulse)
|
||||
params.append(int(sid) & 0xFF)
|
||||
params.append(pulse & 0xFF)
|
||||
params.append((pulse >> 8) & 0xFF)
|
||||
|
||||
self.ser.reset_input_buffer()
|
||||
self.send_frame(0x03, bytes(params))
|
||||
time.sleep(max(move_time_ms / 1000.0, 0.5))
|
||||
print("[OK] 已发送多舵机控制命令")
|
||||
|
||||
def interactive(self):
|
||||
menu = """
|
||||
================ LeArm 串口测试 =================
|
||||
1. 固件查询
|
||||
2. 舵机角度回读
|
||||
3. 初始位姿设置
|
||||
4. 控制单个舵机
|
||||
5. 控制多个舵机
|
||||
q. 退出
|
||||
舵机范围
|
||||
(1夹爪,200-700;2腕部,125-875;)
|
||||
(3号,125-875;4号,125-875;)
|
||||
(5号,125-875;6旋转,125-875;)
|
||||
=================================================
|
||||
"""
|
||||
while True:
|
||||
print(menu)
|
||||
choice = input("请选择: ").strip().lower()
|
||||
|
||||
if choice == "1":
|
||||
self.query_firmware()
|
||||
|
||||
elif choice == "2":
|
||||
self.read_servo_angles()
|
||||
|
||||
elif choice == "3":
|
||||
self.set_init_pose()
|
||||
|
||||
elif choice == "4":
|
||||
sid = int(input("舵机ID: ").strip())
|
||||
pulse = int(input("目标位置(例如 500): ").strip())
|
||||
t = int(input("运行时间ms(例如 800): ").strip() or "800")
|
||||
self.move_servos([(sid, pulse)], move_time_ms=t)
|
||||
|
||||
elif choice == "5":
|
||||
print("输入格式示例: 1:500,2:600,3:450")
|
||||
raw = input("舵机列表: ").strip()
|
||||
t = int(input("运行时间ms(例如 800): ").strip() or "800")
|
||||
|
||||
pairs = []
|
||||
for item in raw.split(","):
|
||||
sid_s, pulse_s = item.split(":")
|
||||
pairs.append((int(sid_s), int(pulse_s)))
|
||||
|
||||
self.move_servos(pairs, move_time_ms=t)
|
||||
|
||||
elif choice == "q":
|
||||
break
|
||||
|
||||
else:
|
||||
print("[WARN] 无效选项")
|
||||
|
||||
|
||||
def main():
|
||||
arm = LeArmSerial(port="/dev/ttyUSB0", baudrate=9600)
|
||||
try:
|
||||
arm.open()
|
||||
arm.interactive()
|
||||
finally:
|
||||
arm.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
45
arm_plane_calib/model.yaml
Normal file
45
arm_plane_calib/model.yaml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
feature_order:
|
||||
- '1'
|
||||
- x
|
||||
- y
|
||||
- x2
|
||||
- xy
|
||||
- y2
|
||||
weights:
|
||||
- - 511.28515454089643
|
||||
- 821.2615901131778
|
||||
- 265.21874233385535
|
||||
- 398.5549181928104
|
||||
- - -771.8329814607213
|
||||
- 52.76710377195036
|
||||
- 237.64443893556836
|
||||
- -114.8132656337159
|
||||
- - 362.52663422740244
|
||||
- -580.4727764870705
|
||||
- -26.751203474622418
|
||||
- -1877.4142059960259
|
||||
- - 680.0875101829623
|
||||
- 7153.497267194028
|
||||
- 5925.331927860114
|
||||
- 1758.558407685675
|
||||
- - -4993.565252238856
|
||||
- 4809.674284044076
|
||||
- 17834.265848385203
|
||||
- -12695.665144123212
|
||||
- - 5570.783049089005
|
||||
- 3393.015647299803
|
||||
- 30196.06155860567
|
||||
- -33269.65533447665
|
||||
cmd_dim: 4
|
||||
sample_count: 9
|
||||
mae_per_dim:
|
||||
- 17.308270436659697
|
||||
- 9.353204865258602
|
||||
- 23.274954237277775
|
||||
- 26.493102071291403
|
||||
rmse_per_dim:
|
||||
- 20.835859382625955
|
||||
- 12.3444244473184
|
||||
- 28.89964968573881
|
||||
- 35.21007477027654
|
||||
z_ref_median: 0.34400000000000003
|
||||
152
arm_plane_calib/predict_plane_cmd.py
Normal file
152
arm_plane_calib/predict_plane_cmd.py
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
#!/usr/bin/env python3
|
||||
import yaml
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import Image, CameraInfo
|
||||
from cv_bridge import CvBridge
|
||||
|
||||
|
||||
def features(x, y):
|
||||
return np.array([1.0, x, y, x * x, x * y, y * y], dtype=np.float64)
|
||||
|
||||
|
||||
class PlaneCmdPredictor(Node):
|
||||
def __init__(self):
|
||||
super().__init__('plane_cmd_predictor')
|
||||
|
||||
self.declare_parameter('color_topic', '/camera/color/image_raw')
|
||||
self.declare_parameter('depth_topic', '/camera/depth/image_raw')
|
||||
self.declare_parameter('camera_info_topic', '/camera/depth/camera_info')
|
||||
self.declare_parameter('model_path', 'model.yaml')
|
||||
self.declare_parameter('depth_scale', 0.001)
|
||||
|
||||
self.color_topic = self.get_parameter('color_topic').value
|
||||
self.depth_topic = self.get_parameter('depth_topic').value
|
||||
self.camera_info_topic = self.get_parameter('camera_info_topic').value
|
||||
self.model_path = self.get_parameter('model_path').value
|
||||
self.depth_scale = float(self.get_parameter('depth_scale').value)
|
||||
|
||||
with open(self.model_path, 'r', encoding='utf-8') as f:
|
||||
model = yaml.safe_load(f)
|
||||
|
||||
self.W = np.array(model['weights'], dtype=np.float64) # [6, cmd_dim]
|
||||
self.bridge = CvBridge()
|
||||
self.color_img = None
|
||||
self.depth_img = None
|
||||
self.K = None
|
||||
|
||||
# 你的模型输出顺序固定为:6号、5号、4号、3号
|
||||
self.model_servo_order = [6, 5, 4, 3]
|
||||
|
||||
# 你想打印成:3号、4号、5号、6号
|
||||
self.print_servo_order = [3, 4, 5, 6]
|
||||
|
||||
# 当前只处理 3/4/5/6 号舵机,范围都一致
|
||||
self.servo_min = 125
|
||||
self.servo_max = 875
|
||||
|
||||
self.create_subscription(Image, self.color_topic, self.on_color, 10)
|
||||
self.create_subscription(Image, self.depth_topic, self.on_depth, 10)
|
||||
self.create_subscription(CameraInfo, self.camera_info_topic, self.on_info, 10)
|
||||
|
||||
self.window_name = 'predict_plane_cmd'
|
||||
cv2.namedWindow(self.window_name, cv2.WINDOW_NORMAL)
|
||||
cv2.setMouseCallback(self.window_name, self.on_mouse)
|
||||
|
||||
def on_color(self, msg):
|
||||
self.color_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8')
|
||||
|
||||
def on_depth(self, msg):
|
||||
self.depth_img = self.bridge.imgmsg_to_cv2(msg, desired_encoding='passthrough')
|
||||
|
||||
def on_info(self, msg):
|
||||
self.K = np.array(msg.k, dtype=np.float64).reshape(3, 3)
|
||||
|
||||
def pixel_to_xyz(self, u, v):
|
||||
if self.depth_img is None or self.K is None:
|
||||
return None
|
||||
|
||||
h, w = self.depth_img.shape[:2]
|
||||
if not (0 <= u < w and 0 <= v < h):
|
||||
return None
|
||||
|
||||
patch = self.depth_img[max(0, v - 2):min(h, v + 3), max(0, u - 2):min(w, u + 3)].astype(np.float32)
|
||||
valid = patch[patch > 0]
|
||||
if valid.size == 0:
|
||||
return None
|
||||
|
||||
z = np.median(valid) * self.depth_scale
|
||||
fx = self.K[0, 0]
|
||||
fy = self.K[1, 1]
|
||||
cx = self.K[0, 2]
|
||||
cy = self.K[1, 2]
|
||||
|
||||
x = (u - cx) * z / fx
|
||||
y = (v - cy) * z / fy
|
||||
return float(x), float(y), float(z)
|
||||
|
||||
def clamp_servo(self, value):
|
||||
value = int(round(value))
|
||||
if value < self.servo_min:
|
||||
value = self.servo_min
|
||||
if value > self.servo_max:
|
||||
value = self.servo_max
|
||||
return value
|
||||
|
||||
def on_mouse(self, event, x, y, flags, param):
|
||||
if event != cv2.EVENT_LBUTTONDOWN:
|
||||
return
|
||||
|
||||
xyz = self.pixel_to_xyz(x, y)
|
||||
if xyz is None:
|
||||
print('[WARN] 无有效深度')
|
||||
return
|
||||
|
||||
X, Y, Z = xyz
|
||||
|
||||
# 模型输出顺序:6,5,4,3
|
||||
cmd_raw = features(X, Y) @ self.W
|
||||
cmd_raw = cmd_raw.tolist()
|
||||
|
||||
# 先取整并限幅
|
||||
cmd_int = [self.clamp_servo(v) for v in cmd_raw]
|
||||
|
||||
# 转成 {舵机ID: 值}
|
||||
servo_map = {}
|
||||
for sid, val in zip(self.model_servo_order, cmd_int):
|
||||
servo_map[sid] = val
|
||||
|
||||
# 按你希望的顺序打印:3,4,5,6
|
||||
ordered_pairs = [(sid, servo_map[sid]) for sid in self.print_servo_order]
|
||||
|
||||
print(f'\n点击像素: ({x}, {y})')
|
||||
print(f'相机坐标: X={X:.4f}, Y={Y:.4f}, Z={Z:.4f}')
|
||||
print('预测机械臂命令向量(按模型顺序 6,5,4,3):',
|
||||
', '.join([str(servo_map[sid]) for sid in self.model_servo_order]))
|
||||
print('舵机列表:', ','.join([f'{sid}:{val}' for sid, val in ordered_pairs]))
|
||||
|
||||
def spin_loop(self):
|
||||
while rclpy.ok():
|
||||
rclpy.spin_once(self, timeout_sec=0.03)
|
||||
if self.color_img is not None:
|
||||
cv2.imshow(self.window_name, self.color_img)
|
||||
if (cv2.waitKey(1) & 0xFF) == ord('q'):
|
||||
break
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
||||
def main():
|
||||
rclpy.init()
|
||||
node = PlaneCmdPredictor()
|
||||
try:
|
||||
node.spin_loop()
|
||||
finally:
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
310
arm_plane_calib/readme.md
Normal file
310
arm_plane_calib/readme.md
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
# arm_plane_calib 使用说明
|
||||
|
||||
|
||||
## 1. 当前机器的实际设备映射
|
||||
|
||||
根据现场枚举结果,当前机器建议按下面的映射理解和使用:
|
||||
|
||||
### 1.1 串口设备
|
||||
|
||||
- **机械臂控制口**:`/dev/ttyUSB1`
|
||||
- **机械臂默认波特率**:`9600`
|
||||
|
||||
现场串口枚举:
|
||||
|
||||
```bash
|
||||
root@ubuntu:~# ls /dev/ttyUSB*
|
||||
/dev/ttyUSB0 /dev/ttyUSB1
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- `ttyUSB0` 当前用于底盘
|
||||
- `ttyUSB1` 当前用于机械臂
|
||||
|
||||
### 1.2 深度相机
|
||||
|
||||
- **深度相机型号**:Orbbec Gemini 2
|
||||
- **系统节点**:`/dev/video1`
|
||||
|
||||
但本工程里的深度数据 **不是直接按普通 UVC 摄像头去读 `/dev/video1`**,而是通过 `orbbec_camera` 驱动发布 ROS 2 话题:
|
||||
|
||||
- `/camera/color/image_raw`
|
||||
- `/camera/depth/image_raw`
|
||||
- `/camera/depth/camera_info`
|
||||
|
||||
所以在做标定前,需要先把 Gemini 2 的 ROS 话题跑起来。
|
||||
|
||||
---
|
||||
|
||||
## 2. 目录说明
|
||||
|
||||
```bash
|
||||
~/arm_plane_calib
|
||||
├── biaodi.png # 标定示意图
|
||||
├── collect_plane_calib.py # 采样脚本
|
||||
├── depth_click_to_learm_cmd_node.py # 点击深度图 -> 预测舵机值 -> 可选自动发送
|
||||
├── fit_plane_calib.py # 拟合脚本
|
||||
├── learm_test.py # 机械臂串口测试脚本
|
||||
├── model.yaml # 拟合后的模型参数
|
||||
├── predict_plane_cmd.py # 点击图像预测舵机命令
|
||||
├── readme.md # 原始说明
|
||||
└── samples.yaml # 采样数据
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 平面标定的目的
|
||||
|
||||
平面标定的核心目的是:
|
||||
|
||||
> 当你在相机画面中点击一个桌面目标点时,系统能够根据深度相机测得的三维信息,预测出一组机械臂舵机控制值,使机械臂末端运动到该目标点上方。
|
||||
|
||||
当前这套标定使用的是:
|
||||
|
||||
- 输入特征:`x_cam`, `y_cam`
|
||||
- 拟合模型:二次多项式
|
||||
- 特征顺序:`[1, x, y, x², x*y, y²]`
|
||||
|
||||
注意:当前拟合 **不直接使用 `z_cam` 做建模**,但会记录 `z_cam`,并在 `model.yaml` 中给出 `z_ref_median` 作为参考。
|
||||
|
||||
---
|
||||
|
||||
## 4. 标定前准备
|
||||
|
||||
### 4.1 先启动 Gemini 2
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
source install/setup.bash
|
||||
ros2 launch origintank_bringup orbbec_gemini2.launch.py
|
||||
```
|
||||
|
||||
### 4.2 再进入标定目录
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. 脚本说明
|
||||
|
||||
### 5.1 `collect_plane_calib.py` —— 采样脚本
|
||||
|
||||
作用:
|
||||
|
||||
- 订阅:
|
||||
- `/camera/color/image_raw`
|
||||
- `/camera/depth/image_raw`
|
||||
- `/camera/depth/camera_info`
|
||||
- 鼠标点击图像中的标定点
|
||||
- 自动计算该点的相机坐标 `X_cam, Y_cam, Z_cam`
|
||||
- 终端手动输入对应的机械臂命令向量
|
||||
- 自动保存到 `samples.yaml`
|
||||
- 采满设定数量后自动退出
|
||||
|
||||
默认参数要点:
|
||||
|
||||
- `save_path = samples.yaml`
|
||||
- `depth_scale = 0.001`
|
||||
- `min_depth_m = 0.05`
|
||||
- `max_depth_m = 1.50`
|
||||
- `median_kernel = 5`
|
||||
- `target_count = 9`
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 collect_plane_calib.py
|
||||
```
|
||||
|
||||
采样时终端输入示例:
|
||||
|
||||
```bash
|
||||
520,610,430,500
|
||||
```
|
||||
|
||||
这 4 维命令向量的具体含义,需要与你的模型输出顺序保持一致。
|
||||
|
||||
---
|
||||
|
||||
### 5.2 `fit_plane_calib.py` —— 拟合脚本
|
||||
|
||||
作用:
|
||||
|
||||
- 读取 `samples.yaml`
|
||||
- 构造二次多项式特征
|
||||
- 对机械臂命令向量做最小二乘拟合
|
||||
- 输出 `model.yaml`
|
||||
- 同时打印每一维的 `MAE` 和 `RMSE`
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 fit_plane_calib.py samples.yaml model.yaml
|
||||
```
|
||||
|
||||
要求:
|
||||
|
||||
- 至少需要 `6` 个样本点才能拟合
|
||||
- 实际建议 `9~16` 个点
|
||||
- 点位尽量铺满工作区,不要只集中在中间
|
||||
|
||||
---
|
||||
|
||||
### 5.3 `predict_plane_cmd.py` —— 点击图像预测舵机值
|
||||
|
||||
作用:
|
||||
|
||||
- 运行时点击图像任意位置
|
||||
- 自动求取该像素点对应的相机三维坐标
|
||||
- 调用 `model.yaml` 预测机械臂命令向量
|
||||
- 在终端输出预测结果
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 predict_plane_cmd.py
|
||||
```
|
||||
|
||||
当前脚本中的关键约定:
|
||||
|
||||
- 模型输出顺序固定为:**6、5、4、3**
|
||||
- 终端打印时会整理为:**3、4、5、6**
|
||||
- 当前默认舵机限幅范围:`125 ~ 875`
|
||||
|
||||
示例输出:
|
||||
|
||||
```text
|
||||
点击像素: (694, 230)
|
||||
相机坐标: X=0.0267, Y=-0.0681, Z=0.3600
|
||||
预测机械臂命令向量(按模型顺序 6,5,4,3): 501, 874, 385, 393
|
||||
舵机列表: 3:393,4:385,5:874,6:501
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5.4 `depth_click_to_learm_cmd_node.py` —— 点击深度图后可直接发送控制
|
||||
|
||||
作用:
|
||||
|
||||
- 订阅深度图、彩色图和相机内参
|
||||
- 点击图像后自动预测机械臂命令向量
|
||||
- 可按参数决定是否自动通过串口发送给机械臂
|
||||
|
||||
关键默认参数:
|
||||
|
||||
- `serial_port = /dev/ttyUSB0`
|
||||
- `baud_rate = 9600`
|
||||
- `move_time_ms = 800`
|
||||
- `servo_ids = [6, 5, 4, 3]`
|
||||
- `servo_min = [125, 125, 125, 125]`
|
||||
- `servo_max = [875, 875, 875, 875]`
|
||||
- `auto_send = True`
|
||||
|
||||
**注意:这个脚本源码默认串口仍然写的是 `/dev/ttyUSB0`,与你当前机器的机械臂实际口 `/dev/ttyUSB1` 不一致。**
|
||||
|
||||
因此当前机器使用时,建议显式传参:
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 depth_click_to_learm_cmd_node.py --ros-args -p serial_port:=/dev/ttyUSB1 -p baud_rate:=9600
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5.5 `learm_test.py` —— 机械臂串口测试脚本
|
||||
|
||||
作用:
|
||||
|
||||
- 测试串口是否能连上机械臂
|
||||
- 查询固件
|
||||
- 回读舵机位置
|
||||
- 发初始位姿命令
|
||||
- 控制单个或多个舵机
|
||||
|
||||
当前脚本 `main()` 里默认写的是:
|
||||
|
||||
- `port = /dev/ttyUSB0`
|
||||
- `baudrate = 9600`
|
||||
|
||||
但你当前机器的机械臂实际连接为 **`/dev/ttyUSB1`**,因此使用前建议先把源码最后一行改成:
|
||||
|
||||
```python
|
||||
arm = LeArmSerial(port="/dev/ttyUSB1", baudrate=9600)
|
||||
```
|
||||
|
||||
再运行:
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 learm_test.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 九点标定推荐流程
|
||||
|
||||
### 6.1 布点建议
|
||||
|
||||
建议用 3×3 共 9 个点,尽量铺满机械臂实际抓取区域:
|
||||
|
||||
```text
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
```
|
||||
|
||||
### 6.2 启动 Gemini 2
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
source install/setup.bash
|
||||
ros2 launch origintank_bringup orbbec_gemini2.launch.py
|
||||
```
|
||||
|
||||
### 6.3 运行采样脚本
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 collect_plane_calib.py
|
||||
```
|
||||
|
||||
### 6.4 对每个点重复以下动作
|
||||
|
||||
1. 鼠标点击图像中的桌面标定点
|
||||
2. 手动把机械臂末端移动到该点正上方
|
||||
3. 在终端输入这一点的机械臂命令向量
|
||||
4. 脚本自动保存到 `samples.yaml`
|
||||
|
||||
例如输入:
|
||||
|
||||
```bash
|
||||
520,610,430,500
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- 当前标定默认以 **4 维命令向量** 为例
|
||||
- 夹爪开合通常不参与平面标定
|
||||
- 抓取时再单独附加夹爪动作即可
|
||||
|
||||
### 6.5 完成后拟合模型
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 fit_plane_calib.py samples.yaml model.yaml
|
||||
```
|
||||
|
||||
### 6.6 预测测试
|
||||
|
||||
```bash
|
||||
cd ~/arm_plane_calib
|
||||
python3 predict_plane_cmd.py
|
||||
```
|
||||
92
arm_plane_calib/samples.yaml
Normal file
92
arm_plane_calib/samples.yaml
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
samples:
|
||||
- u: 582
|
||||
v: 240
|
||||
x_cam: -0.03145534404311617
|
||||
y_cam: -0.0625876597787623
|
||||
z_cam: 0.358
|
||||
arm_cmd:
|
||||
- 540.0
|
||||
- 885.0
|
||||
- 421.0
|
||||
- 375.0
|
||||
- u: 681
|
||||
v: 233
|
||||
x_cam: 0.01995364206116322
|
||||
y_cam: -0.06658371695309058
|
||||
z_cam: 0.36
|
||||
arm_cmd:
|
||||
- 505.0
|
||||
- 884.0
|
||||
- 369.0
|
||||
- 401.0
|
||||
- u: 771
|
||||
v: 243
|
||||
x_cam: 0.06592038079659751
|
||||
y_cam: -0.060522141786992736
|
||||
z_cam: 0.355
|
||||
arm_cmd:
|
||||
- 467.0
|
||||
- 872.0
|
||||
- 363.0
|
||||
- 422.0
|
||||
- u: 566
|
||||
v: 316
|
||||
x_cam: -0.03830266258671575
|
||||
y_cam: -0.022374943079671503
|
||||
z_cam: 0.34500000000000003
|
||||
arm_cmd:
|
||||
- 514.0
|
||||
- 847.0
|
||||
- 284.0
|
||||
- 419.0
|
||||
- u: 681
|
||||
v: 323
|
||||
x_cam: 0.019066813525111522
|
||||
y_cam: -0.018825745192638882
|
||||
z_cam: 0.34400000000000003
|
||||
arm_cmd:
|
||||
- 468.0
|
||||
- 815.0
|
||||
- 332.0
|
||||
- 363.0
|
||||
- u: 761
|
||||
v: 329
|
||||
x_cam: 0.05855634668063165
|
||||
y_cam: -0.015747077324389527
|
||||
z_cam: 0.342
|
||||
arm_cmd:
|
||||
- 513.0
|
||||
- 879.0
|
||||
- 242.0
|
||||
- 498.0
|
||||
- u: 566
|
||||
v: 412
|
||||
x_cam: -0.03674835164116786
|
||||
y_cam: 0.024512461886783923
|
||||
z_cam: 0.331
|
||||
arm_cmd:
|
||||
- 566.0
|
||||
- 816.0
|
||||
- 274.0
|
||||
- 347.0
|
||||
- u: 681
|
||||
v: 419
|
||||
x_cam: 0.018179984989059823
|
||||
y_cam: 0.027612575073894863
|
||||
z_cam: 0.328
|
||||
arm_cmd:
|
||||
- 518.0
|
||||
- 816.0
|
||||
- 274.0
|
||||
- 347.0
|
||||
- u: 780
|
||||
v: 419
|
||||
x_cam: 0.06517939133605848
|
||||
y_cam: 0.027612575073894863
|
||||
z_cam: 0.328
|
||||
arm_cmd:
|
||||
- 450.0
|
||||
- 843.0
|
||||
- 384.0
|
||||
- 265.0
|
||||
cmd_dim: 4
|
||||
210
dev_ws/README.md
Normal file
210
dev_ws/README.md
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
# README_RDK_X5 使用说明
|
||||
|
||||
|
||||
## 1. 当前机器的实际设备映射
|
||||
|
||||
根据现场枚举结果,当前机器建议按下面的映射理解和使用:
|
||||
|
||||
### 1.1 串口设备
|
||||
|
||||
- **底盘控制口**:`/dev/ttyUSB0`
|
||||
- **机械臂控制口**:`/dev/ttyUSB1`
|
||||
- **机械臂默认波特率**:`9600`
|
||||
|
||||
现场串口枚举:
|
||||
|
||||
```bash
|
||||
root@ubuntu:~# ls /dev/ttyUSB*
|
||||
/dev/ttyUSB0 /dev/ttyUSB1
|
||||
```
|
||||
|
||||
### 1.2 摄像头设备
|
||||
|
||||
- **普通 USB 摄像头**:`/dev/video0`
|
||||
- **深度摄像头设备节点**:`/dev/video1`
|
||||
- **深度相机型号**:Orbbec Gemini 2
|
||||
|
||||
现场 USB 枚举:
|
||||
|
||||
```bash
|
||||
root@ubuntu:~# lsusb
|
||||
Bus 002 Device 003: ID 2bc5:0670 Orbbec 3D Technology International, Inc Orbbec(R) Gemini(TM)
|
||||
Bus 001 Device 008: ID 0c45:6341 Microdia Defender G-Lens 2577 HD720p Camera
|
||||
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics CH340 serial converter
|
||||
Bus 001 Device 003: ID 1a86:7523 QinHeng Electronics CH340 serial converter
|
||||
```
|
||||
|
||||
### 1.3 一个很重要的说明
|
||||
|
||||
虽然系统里能看到 `/dev/video1`,但这套工程中的 **Gemini 2 深度数据并不是按普通 UVC 摄像头方式直接读取 `/dev/video1`**,而是通过 `orbbec_camera` 驱动发布 ROS 2 话题:
|
||||
|
||||
- `/camera/color/image_raw`
|
||||
- `/camera/depth/image_raw`
|
||||
- `/camera/depth/camera_info`
|
||||
|
||||
所以:
|
||||
|
||||
- **普通 USB 摄像头** 走 `usb_video_device:=/dev/video0`
|
||||
- **Gemini 2** 走 `orbbec_camera` 驱动和对应 ROS 话题
|
||||
|
||||
不要把这两套链路混在一起。
|
||||
|
||||
---
|
||||
|
||||
## 2. 工作空间目录
|
||||
|
||||
```bash
|
||||
~/dev_ws
|
||||
├── src
|
||||
│ ├── depth_target_detector
|
||||
│ ├── lerobot_arm_controller
|
||||
│ ├── mission_manager
|
||||
│ ├── orbbec_camera
|
||||
│ ├── orbbec_camera_msgs
|
||||
│ ├── origintank_base
|
||||
│ ├── origintank_bringup
|
||||
│ └── signal_board_detector
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 各功能包作用
|
||||
|
||||
- `origintank_base`:底盘驱动,负责底盘控制与基础传感器数据发布
|
||||
- `origintank_bringup`:整机启动入口
|
||||
- `mission_manager`:任务状态机,统一调度底盘、识别和机械臂动作
|
||||
- `signal_board_detector`:普通 USB 摄像头识别任务目标或标志牌
|
||||
- `depth_target_detector`:基于 Gemini 2 输出深度目标三维点
|
||||
- `lerobot_arm_controller`:机械臂串口控制与抓取流程
|
||||
- `orbbec_camera`:Gemini 2 驱动
|
||||
- `orbbec_camera_msgs`:Orbbec 相机消息定义
|
||||
|
||||
---
|
||||
|
||||
## 4. 整机控制链路
|
||||
|
||||
整机链路可以理解为:
|
||||
|
||||
1. **底盘** 由 `origintank_base` 负责,发布 `/odom`、`/imu`、`/ultrasonic/front/range`
|
||||
2. **普通 USB 摄像头** 由相关 launch 拉起,供 `signal_board_detector` 使用
|
||||
3. **Gemini 2** 由 `orbbec_camera` 启动,输出彩色图、深度图和相机内参
|
||||
4. `depth_target_detector` 将目标转换为三维点并发布到 `/depth_target/point3d`
|
||||
5. `lerobot_arm_controller` 订阅 `/depth_target/point3d`,控制机械臂执行抓取
|
||||
6. `mission_manager` 统一管理开始、停止、状态切换和任务流程
|
||||
|
||||
---
|
||||
|
||||
## 5. 编译前准备
|
||||
|
||||
### 5.1 加载 ROS 环境
|
||||
|
||||
```bash
|
||||
source /opt/ros/humble/setup.bash
|
||||
```
|
||||
|
||||
### 5.2 安装 Orbbec udev 规则
|
||||
|
||||
如果工程里带有安装脚本,可先执行:
|
||||
|
||||
```bash
|
||||
cd ~/raico_rdk_x5_ws_minimal_gemini2
|
||||
chmod +x scripts/setup_orbbec_udev.sh
|
||||
./scripts/setup_orbbec_udev.sh
|
||||
```
|
||||
|
||||
如果你实际使用的是 `~/dev_ws` 这一套工程,也要确保 `orbbec_camera/scripts/99-obsensor-libusb.rules` 已正确安装到系统里。
|
||||
|
||||
### 5.3 编译工作空间
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||
source install/setup.bash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 内存不足时的处理方法
|
||||
|
||||
Orbbec 相关包较大,如果编译时内存不足,可以临时开 8G swap:
|
||||
|
||||
```bash
|
||||
free -h
|
||||
swapon --show
|
||||
|
||||
fallocate -l 8G /swapfile || dd if=/dev/zero of=/swapfile bs=1M count=8192
|
||||
chmod 600 /swapfile
|
||||
mkswap /swapfile
|
||||
swapon /swapfile
|
||||
free -h
|
||||
swapon --show
|
||||
```
|
||||
|
||||
编译完成后可关闭:
|
||||
|
||||
```bash
|
||||
swapoff /swapfile
|
||||
rm -f /swapfile
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. 整机启动方式
|
||||
|
||||
### 7.1 推荐启动命令(按当前机器实际连接)
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
source install/setup.bash
|
||||
|
||||
ros2 launch origintank_bringup rdk_x5_auto_mission.launch.py \
|
||||
cmd_port:=/dev/ttyUSB0 \
|
||||
arm_port:=/dev/ttyUSB1 \
|
||||
usb_video_device:=/dev/video0
|
||||
```
|
||||
|
||||
### 7.2 启动后默认会拉起的模块
|
||||
|
||||
- 底盘驱动
|
||||
- 普通 USB 摄像头识别
|
||||
- Gemini 2 驱动
|
||||
- 深度目标检测
|
||||
- 机械臂控制
|
||||
- 任务状态机
|
||||
|
||||
---
|
||||
|
||||
## 8. 只测试 Gemini 2
|
||||
|
||||
```bash
|
||||
cd ~/dev_ws
|
||||
source /opt/ros/humble/setup.bash
|
||||
source install/setup.bash
|
||||
|
||||
ros2 launch origintank_bringup orbbec_gemini2.launch.py
|
||||
```
|
||||
|
||||
可选检查:
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_devices_node
|
||||
ros2 run orbbec_camera list_depth_work_mode_node
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 手动启动和停止任务
|
||||
|
||||
启动任务:
|
||||
|
||||
```bash
|
||||
ros2 topic pub --once /mission/start std_msgs/msg/Bool "{data: true}"
|
||||
```
|
||||
|
||||
停止任务:
|
||||
|
||||
```bash
|
||||
ros2 topic pub --once /mission/start std_msgs/msg/Bool "{data: false}"
|
||||
```
|
||||
11
dev_ws/scripts/setup_orbbec_udev.sh
Normal file
11
dev_ws/scripts/setup_orbbec_udev.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
RULE_SRC="$(cd "$(dirname "$0")/.." && pwd)/src/orbbec_camera/scripts/99-obsensor-libusb.rules"
|
||||
if [ ! -f "$RULE_SRC" ]; then
|
||||
echo "udev rule not found: $RULE_SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo cp "$RULE_SRC" /etc/udev/rules.d/99-obsensor-libusb.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger
|
||||
echo "Orbbec udev rules installed. Replug Gemini 2 if it is already connected."
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
depth_target_detector:
|
||||
ros__parameters:
|
||||
depth_topic: "/camera/depth/image_raw"
|
||||
camera_info_topic: "/camera/depth/camera_info"
|
||||
min_depth_m: 0.10
|
||||
max_depth_m: 1.20
|
||||
roi_x_ratio: 0.25
|
||||
roi_y_ratio: 0.25
|
||||
roi_w_ratio: 0.50
|
||||
roi_h_ratio: 0.50
|
||||
nearest_band_m: 0.03
|
||||
min_cluster_pixels: 80
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
import cv2
|
||||
import numpy as np
|
||||
import rclpy
|
||||
from cv_bridge import CvBridge
|
||||
from geometry_msgs.msg import PointStamped
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import CameraInfo, Image
|
||||
|
||||
|
||||
class DepthTargetDetector(Node):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('depth_target_detector')
|
||||
self.declare_parameter('depth_topic', '/camera/depth/image_raw')
|
||||
self.declare_parameter('camera_info_topic', '/camera/depth/camera_info')
|
||||
self.declare_parameter('min_depth_m', 0.10)
|
||||
self.declare_parameter('max_depth_m', 1.20)
|
||||
self.declare_parameter('roi_x_ratio', 0.25)
|
||||
self.declare_parameter('roi_y_ratio', 0.25)
|
||||
self.declare_parameter('roi_w_ratio', 0.50)
|
||||
self.declare_parameter('roi_h_ratio', 0.50)
|
||||
self.declare_parameter('nearest_band_m', 0.03)
|
||||
self.declare_parameter('min_cluster_pixels', 80)
|
||||
|
||||
self.depth_topic = str(self.get_parameter('depth_topic').value)
|
||||
self.camera_info_topic = str(self.get_parameter('camera_info_topic').value)
|
||||
self.min_depth_m = float(self.get_parameter('min_depth_m').value)
|
||||
self.max_depth_m = float(self.get_parameter('max_depth_m').value)
|
||||
self.roi_x_ratio = float(self.get_parameter('roi_x_ratio').value)
|
||||
self.roi_y_ratio = float(self.get_parameter('roi_y_ratio').value)
|
||||
self.roi_w_ratio = float(self.get_parameter('roi_w_ratio').value)
|
||||
self.roi_h_ratio = float(self.get_parameter('roi_h_ratio').value)
|
||||
self.nearest_band_m = float(self.get_parameter('nearest_band_m').value)
|
||||
self.min_cluster_pixels = int(self.get_parameter('min_cluster_pixels').value)
|
||||
|
||||
self.bridge = CvBridge()
|
||||
self.point_pub = self.create_publisher(PointStamped, '/depth_target/point', 10)
|
||||
self.point3d_pub = self.create_publisher(PointStamped, '/depth_target/point3d', 10)
|
||||
self.debug_pub = self.create_publisher(Image, '/depth_target/debug_image', 10)
|
||||
self.create_subscription(Image, self.depth_topic, self.on_depth_image, 10)
|
||||
self.create_subscription(CameraInfo, self.camera_info_topic, self.on_camera_info, 10)
|
||||
|
||||
self.fx = None
|
||||
self.fy = None
|
||||
self.cx = None
|
||||
self.cy = None
|
||||
|
||||
def on_camera_info(self, msg: CameraInfo) -> None:
|
||||
if len(msg.k) >= 9:
|
||||
self.fx = float(msg.k[0])
|
||||
self.fy = float(msg.k[4])
|
||||
self.cx = float(msg.k[2])
|
||||
self.cy = float(msg.k[5])
|
||||
|
||||
def normalize_depth(self, depth_image: np.ndarray) -> np.ndarray:
|
||||
if depth_image.dtype == np.uint16:
|
||||
return depth_image.astype(np.float32) / 1000.0
|
||||
return depth_image.astype(np.float32)
|
||||
|
||||
def _extract_target(self, roi: np.ndarray):
|
||||
valid_mask = np.logical_and(np.isfinite(roi), np.logical_and(roi > self.min_depth_m, roi < self.max_depth_m))
|
||||
if np.count_nonzero(valid_mask) < self.min_cluster_pixels:
|
||||
return None
|
||||
|
||||
valid_depths = np.where(valid_mask, roi, np.nan)
|
||||
nearest = float(np.nanmin(valid_depths))
|
||||
band_mask = np.logical_and(valid_mask, roi <= nearest + self.nearest_band_m)
|
||||
band_mask_u8 = (band_mask.astype(np.uint8) * 255)
|
||||
band_mask_u8 = cv2.morphologyEx(band_mask_u8, cv2.MORPH_OPEN, np.ones((3, 3), np.uint8))
|
||||
band_mask_u8 = cv2.morphologyEx(band_mask_u8, cv2.MORPH_CLOSE, np.ones((5, 5), np.uint8))
|
||||
|
||||
num_labels, labels, stats, centroids = cv2.connectedComponentsWithStats(band_mask_u8)
|
||||
best = None
|
||||
best_depth = None
|
||||
for label in range(1, num_labels):
|
||||
area = int(stats[label, cv2.CC_STAT_AREA])
|
||||
if area < self.min_cluster_pixels:
|
||||
continue
|
||||
ys, xs = np.where(labels == label)
|
||||
depths = roi[ys, xs]
|
||||
med_depth = float(np.median(depths))
|
||||
if best is None or med_depth < best_depth:
|
||||
cx, cy = centroids[label]
|
||||
best = (int(round(cx)), int(round(cy)), area, med_depth)
|
||||
best_depth = med_depth
|
||||
return best
|
||||
|
||||
def on_depth_image(self, msg: Image) -> None:
|
||||
depth_image = self.bridge.imgmsg_to_cv2(msg)
|
||||
depth_m = self.normalize_depth(depth_image)
|
||||
if depth_m.ndim != 2:
|
||||
self.get_logger().warning('Depth image is not single channel, skip frame.')
|
||||
return
|
||||
|
||||
h, w = depth_m.shape[:2]
|
||||
x0 = int(w * self.roi_x_ratio)
|
||||
y0 = int(h * self.roi_y_ratio)
|
||||
rw = int(w * self.roi_w_ratio)
|
||||
rh = int(h * self.roi_h_ratio)
|
||||
x1 = min(w, x0 + rw)
|
||||
y1 = min(h, y0 + rh)
|
||||
roi = depth_m[y0:y1, x0:x1]
|
||||
|
||||
target = self._extract_target(roi)
|
||||
if target is None:
|
||||
return
|
||||
|
||||
px_roi, py_roi, area, distance = target
|
||||
global_x = x0 + px_roi
|
||||
global_y = y0 + py_roi
|
||||
offset_x = (global_x - (w / 2.0)) / (w / 2.0)
|
||||
offset_y = (global_y - (h / 2.0)) / (h / 2.0)
|
||||
|
||||
point = PointStamped()
|
||||
point.header = msg.header
|
||||
point.point.x = float(distance)
|
||||
point.point.y = float(offset_x)
|
||||
point.point.z = float(offset_y)
|
||||
self.point_pub.publish(point)
|
||||
|
||||
if all(v is not None for v in [self.fx, self.fy, self.cx, self.cy]):
|
||||
x_cam = (global_x - self.cx) * distance / self.fx
|
||||
y_cam = (global_y - self.cy) * distance / self.fy
|
||||
z_cam = distance
|
||||
point3d = PointStamped()
|
||||
point3d.header = msg.header
|
||||
point3d.point.x = float(x_cam)
|
||||
point3d.point.y = float(y_cam)
|
||||
point3d.point.z = float(z_cam)
|
||||
self.point3d_pub.publish(point3d)
|
||||
|
||||
roi_vis = np.nan_to_num(roi, nan=self.max_depth_m)
|
||||
roi_vis = np.clip(roi_vis, self.min_depth_m, self.max_depth_m)
|
||||
roi_vis = ((roi_vis - self.min_depth_m) / (self.max_depth_m - self.min_depth_m + 1e-6) * 255.0).astype(np.uint8)
|
||||
roi_vis = cv2.applyColorMap(roi_vis, cv2.COLORMAP_JET)
|
||||
cv2.circle(roi_vis, (px_roi, py_roi), 8, (255, 255, 255), 2)
|
||||
cv2.putText(roi_vis, f'd={distance:.3f}m area={area}', (10, 25), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)
|
||||
debug_msg = self.bridge.cv2_to_imgmsg(roi_vis, encoding='bgr8')
|
||||
debug_msg.header = msg.header
|
||||
self.debug_pub.publish(debug_msg)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
rclpy.init()
|
||||
node = DepthTargetDetector()
|
||||
try:
|
||||
rclpy.spin(node)
|
||||
finally:
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
config = os.path.join(
|
||||
get_package_share_directory('depth_target_detector'),
|
||||
'config', 'depth_target_detector.yaml'
|
||||
)
|
||||
return LaunchDescription([
|
||||
Node(
|
||||
package='depth_target_detector',
|
||||
executable='depth_target_detector',
|
||||
name='depth_target_detector',
|
||||
output='screen',
|
||||
parameters=[config],
|
||||
)
|
||||
])
|
||||
23
dev_ws/src/depth_target_detector/package.xml
Normal file
23
dev_ws/src/depth_target_detector/package.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>depth_target_detector</name>
|
||||
<version>0.1.0</version>
|
||||
<description>Simple depth target detector for sponge and floor block pickup.</description>
|
||||
<maintainer email="openai@example.com">OpenAI</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
|
||||
<depend>rclpy</depend>
|
||||
<depend>geometry_msgs</depend>
|
||||
<depend>sensor_msgs</depend>
|
||||
<depend>cv_bridge</depend>
|
||||
|
||||
<exec_depend>python3-opencv</exec_depend>
|
||||
<exec_depend>python3-numpy</exec_depend>
|
||||
<exec_depend>ros2launch</exec_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_python</build_type>
|
||||
</export>
|
||||
</package>
|
||||
4
dev_ws/src/depth_target_detector/setup.cfg
Normal file
4
dev_ws/src/depth_target_detector/setup.cfg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[develop]
|
||||
script_dir=$base/lib/depth_target_detector
|
||||
[install]
|
||||
install_scripts=$base/lib/depth_target_detector
|
||||
26
dev_ws/src/depth_target_detector/setup.py
Normal file
26
dev_ws/src/depth_target_detector/setup.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from setuptools import setup
|
||||
|
||||
package_name = 'depth_target_detector'
|
||||
|
||||
setup(
|
||||
name=package_name,
|
||||
version='0.1.0',
|
||||
packages=[package_name],
|
||||
data_files=[
|
||||
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
|
||||
('share/' + package_name, ['package.xml']),
|
||||
('share/' + package_name + '/launch', ['launch/depth_target_detector.launch.py']),
|
||||
('share/' + package_name + '/config', ['config/depth_target_detector.yaml']),
|
||||
],
|
||||
install_requires=['setuptools'],
|
||||
zip_safe=True,
|
||||
maintainer='OpenAI',
|
||||
maintainer_email='openai@example.com',
|
||||
description='Simple depth target detector for sponge and floor block pickup',
|
||||
license='Apache-2.0',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'depth_target_detector = depth_target_detector.depth_target_detector_node:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
13
dev_ws/src/display_controller/config/display_controller.yaml
Normal file
13
dev_ws/src/display_controller/config/display_controller.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
display_controller:
|
||||
ros__parameters:
|
||||
width: 640
|
||||
height: 480
|
||||
square_size_px: 260
|
||||
publish_fps: 10.0
|
||||
minimum_hold_sec: 3.10
|
||||
show_window: false
|
||||
window_name: "Logistics Challenge Display"
|
||||
command_topic: "/display/command"
|
||||
image_topic: "/display/image"
|
||||
status_topic: "/display/status"
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
import math
|
||||
from typing import Optional
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import rclpy
|
||||
from cv_bridge import CvBridge
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import Image
|
||||
from std_msgs.msg import String
|
||||
|
||||
|
||||
class DisplayController(Node):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('display_controller')
|
||||
self._declare_parameters()
|
||||
self._load_parameters()
|
||||
|
||||
self.bridge = CvBridge()
|
||||
self.image_pub = self.create_publisher(Image, self.image_topic, 10)
|
||||
self.status_pub = self.create_publisher(String, self.status_topic, 10)
|
||||
self.create_subscription(String, self.command_topic, self.on_command, 10)
|
||||
self.timer = self.create_timer(1.0 / max(self.publish_fps, 1.0), self.on_timer)
|
||||
|
||||
self.current_command = 'clear'
|
||||
self.command_start_time = self.get_clock().now()
|
||||
self.done_sent = False
|
||||
self.window_ready = False
|
||||
self.last_frame: Optional[np.ndarray] = None
|
||||
self.publish_status('ready:clear')
|
||||
|
||||
def _declare_parameters(self) -> None:
|
||||
defaults = {
|
||||
'width': 640,
|
||||
'height': 480,
|
||||
'square_size_px': 260,
|
||||
'publish_fps': 10.0,
|
||||
'minimum_hold_sec': 3.10,
|
||||
'show_window': False,
|
||||
'window_name': 'Logistics Challenge Display',
|
||||
'command_topic': '/display/command',
|
||||
'image_topic': '/display/image',
|
||||
'status_topic': '/display/status',
|
||||
}
|
||||
for name, value in defaults.items():
|
||||
self.declare_parameter(name, value)
|
||||
|
||||
def _load_parameters(self) -> None:
|
||||
get = self.get_parameter
|
||||
self.width = max(64, int(get('width').value))
|
||||
self.height = max(64, int(get('height').value))
|
||||
self.square_size_px = max(10, int(get('square_size_px').value))
|
||||
self.publish_fps = float(get('publish_fps').value)
|
||||
self.minimum_hold_sec = max(3.0, float(get('minimum_hold_sec').value))
|
||||
self.show_window = bool(get('show_window').value)
|
||||
self.window_name = str(get('window_name').value)
|
||||
self.command_topic = str(get('command_topic').value)
|
||||
self.image_topic = str(get('image_topic').value)
|
||||
self.status_topic = str(get('status_topic').value)
|
||||
|
||||
def publish_status(self, text: str) -> None:
|
||||
msg = String()
|
||||
msg.data = text
|
||||
self.status_pub.publish(msg)
|
||||
self.get_logger().info(text)
|
||||
|
||||
def on_command(self, msg: String) -> None:
|
||||
command = msg.data.strip().lower()
|
||||
supported = {'clear', 'blue_square', 'all_green', 'yellow_square',
|
||||
'yellow_triangle', 'yellow_star'}
|
||||
if command not in supported:
|
||||
self.publish_status(f'error:unsupported_command:{command}')
|
||||
return
|
||||
self.current_command = command
|
||||
self.command_start_time = self.get_clock().now()
|
||||
self.done_sent = False
|
||||
self.publish_status(f'showing:{command}')
|
||||
|
||||
def blank_frame(self, color=(255, 255, 255)) -> np.ndarray:
|
||||
return np.full((self.height, self.width, 3), color, dtype=np.uint8)
|
||||
|
||||
def render_frame(self) -> np.ndarray:
|
||||
if self.current_command == 'all_green':
|
||||
return self.blank_frame((0, 255, 0))
|
||||
if self.current_command == 'clear':
|
||||
return self.blank_frame((255, 255, 255))
|
||||
|
||||
frame = self.blank_frame((255, 255, 255))
|
||||
centre = (self.width // 2, self.height // 2)
|
||||
size = min(self.square_size_px, self.width - 20, self.height - 20)
|
||||
half = size // 2
|
||||
if self.current_command == 'blue_square':
|
||||
cv2.rectangle(frame, (centre[0] - half, centre[1] - half),
|
||||
(centre[0] + half, centre[1] + half), (255, 0, 0), -1)
|
||||
elif self.current_command == 'yellow_square':
|
||||
cv2.rectangle(frame, (centre[0] - half, centre[1] - half),
|
||||
(centre[0] + half, centre[1] + half), (0, 255, 255), -1)
|
||||
elif self.current_command == 'yellow_triangle':
|
||||
points = np.asarray([
|
||||
[centre[0], centre[1] - half],
|
||||
[centre[0] - half, centre[1] + half],
|
||||
[centre[0] + half, centre[1] + half],
|
||||
], dtype=np.int32)
|
||||
cv2.fillPoly(frame, [points], (0, 255, 255))
|
||||
elif self.current_command == 'yellow_star':
|
||||
points = []
|
||||
for index in range(10):
|
||||
angle = -math.pi / 2.0 + index * math.pi / 5.0
|
||||
radius = half if index % 2 == 0 else half * 0.42
|
||||
points.append([
|
||||
int(round(centre[0] + radius * math.cos(angle))),
|
||||
int(round(centre[1] + radius * math.sin(angle))),
|
||||
])
|
||||
cv2.fillPoly(frame, [np.asarray(points, dtype=np.int32)], (0, 255, 255))
|
||||
return frame
|
||||
|
||||
def on_timer(self) -> None:
|
||||
frame = self.render_frame()
|
||||
self.last_frame = frame
|
||||
image_msg = self.bridge.cv2_to_imgmsg(frame, encoding='bgr8')
|
||||
image_msg.header.stamp = self.get_clock().now().to_msg()
|
||||
image_msg.header.frame_id = 'competition_display'
|
||||
self.image_pub.publish(image_msg)
|
||||
|
||||
if self.show_window:
|
||||
try:
|
||||
if not self.window_ready:
|
||||
cv2.namedWindow(self.window_name, cv2.WINDOW_NORMAL)
|
||||
cv2.setWindowProperty(
|
||||
self.window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN
|
||||
)
|
||||
self.window_ready = True
|
||||
cv2.imshow(self.window_name, frame)
|
||||
cv2.waitKey(1)
|
||||
except cv2.error as exc:
|
||||
self.show_window = False
|
||||
self.publish_status(f'error:display_window:{exc}')
|
||||
|
||||
if self.current_command == 'clear' or self.done_sent:
|
||||
return
|
||||
elapsed = (self.get_clock().now() - self.command_start_time).nanoseconds / 1e9
|
||||
if elapsed >= self.minimum_hold_sec:
|
||||
self.done_sent = True
|
||||
self.publish_status(f'done:{self.current_command}')
|
||||
|
||||
def destroy_node(self):
|
||||
if self.window_ready:
|
||||
try:
|
||||
cv2.destroyWindow(self.window_name)
|
||||
except cv2.error:
|
||||
pass
|
||||
return super().destroy_node()
|
||||
|
||||
|
||||
def main() -> None:
|
||||
rclpy.init()
|
||||
node = DisplayController()
|
||||
try:
|
||||
rclpy.spin(node)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
import os
|
||||
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.parameter_descriptions import ParameterValue
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
config = os.path.join(
|
||||
get_package_share_directory('display_controller'),
|
||||
'config',
|
||||
'display_controller.yaml',
|
||||
)
|
||||
return LaunchDescription([
|
||||
DeclareLaunchArgument('show_window', default_value='false'),
|
||||
Node(
|
||||
package='display_controller',
|
||||
executable='display_controller',
|
||||
name='display_controller',
|
||||
output='screen',
|
||||
parameters=[
|
||||
config,
|
||||
{
|
||||
'show_window': ParameterValue(
|
||||
LaunchConfiguration('show_window'),
|
||||
value_type=bool,
|
||||
)
|
||||
},
|
||||
],
|
||||
)
|
||||
])
|
||||
|
||||
22
dev_ws/src/display_controller/package.xml
Normal file
22
dev_ws/src/display_controller/package.xml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>display_controller</name>
|
||||
<version>0.1.0</version>
|
||||
<description>Competition pattern display controller.</description>
|
||||
<maintainer email="sk@example.com">SK</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
<depend>rclpy</depend>
|
||||
<depend>sensor_msgs</depend>
|
||||
<depend>std_msgs</depend>
|
||||
<depend>cv_bridge</depend>
|
||||
<exec_depend>python3-opencv</exec_depend>
|
||||
<exec_depend>python3-numpy</exec_depend>
|
||||
<exec_depend>ros2launch</exec_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_python</build_type>
|
||||
</export>
|
||||
</package>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
5
dev_ws/src/display_controller/setup.cfg
Normal file
5
dev_ws/src/display_controller/setup.cfg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[develop]
|
||||
script_dir=$base/lib/display_controller
|
||||
[install]
|
||||
install_scripts=$base/lib/display_controller
|
||||
|
||||
29
dev_ws/src/display_controller/setup.py
Normal file
29
dev_ws/src/display_controller/setup.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from setuptools import setup
|
||||
|
||||
|
||||
package_name = 'display_controller'
|
||||
|
||||
|
||||
setup(
|
||||
name=package_name,
|
||||
version='0.1.0',
|
||||
packages=[package_name],
|
||||
data_files=[
|
||||
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
|
||||
('share/' + package_name, ['package.xml']),
|
||||
('share/' + package_name + '/launch', ['launch/display_controller.launch.py']),
|
||||
('share/' + package_name + '/config', ['config/display_controller.yaml']),
|
||||
],
|
||||
install_requires=['setuptools'],
|
||||
zip_safe=True,
|
||||
maintainer='SK',
|
||||
maintainer_email='sk@example.com',
|
||||
description='Competition display image and hold-time controller.',
|
||||
license='Apache-2.0',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'display_controller = display_controller.display_controller_node:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
lerobot_arm_controller:
|
||||
ros__parameters:
|
||||
simulation: false
|
||||
port: "/dev/ttyUSB2"
|
||||
baud_rate: 115200
|
||||
serial_timeout_sec: 0.10
|
||||
latest_point_timeout_sec: 1.0
|
||||
move_time_ms: 500
|
||||
settle_sec: 0.20
|
||||
safe_z_cm: 18.0
|
||||
home_x_cm: 15.0
|
||||
home_y_cm: 0.0
|
||||
home_z_cm: 10.0
|
||||
grasp_pre_z_offset_cm: 4.0
|
||||
grasp_final_z_offset_cm: 1.0
|
||||
gripper_open_angle_deg: 90.0
|
||||
gripper_close_angle_deg: 18.0
|
||||
wrist_roll_angle_deg: 0.0
|
||||
camera_to_arm_x_m: 0.02
|
||||
camera_to_arm_y_m: 0.00
|
||||
camera_to_arm_z_m: 0.08
|
||||
grasp_forward_extra_m: 0.00
|
||||
grasp_lateral_extra_m: 0.00
|
||||
grasp_height_extra_m: 0.00
|
||||
platform_left_x_cm: 14.0
|
||||
platform_left_y_cm: 8.0
|
||||
platform_left_z_cm: 4.5
|
||||
platform_right_x_cm: 14.0
|
||||
platform_right_y_cm: -8.0
|
||||
platform_right_z_cm: 4.5
|
||||
blue_zone_x_cm: 18.0
|
||||
blue_zone_y_cm: 8.0
|
||||
blue_zone_z_cm: 4.0
|
||||
green_zone_x_cm: 18.0
|
||||
green_zone_y_cm: -8.0
|
||||
green_zone_z_cm: 4.0
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import os
|
||||
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
cfg = os.path.join(
|
||||
get_package_share_directory('lerobot_arm_controller'), 'config', 'lerobot_arm_controller.yaml'
|
||||
)
|
||||
return LaunchDescription([
|
||||
DeclareLaunchArgument('port', default_value='/dev/ttyUSB2'),
|
||||
DeclareLaunchArgument('baud_rate', default_value='115200'),
|
||||
Node(
|
||||
package='lerobot_arm_controller',
|
||||
executable='lerobot_arm_controller',
|
||||
name='lerobot_arm_controller',
|
||||
output='screen',
|
||||
parameters=[cfg, {
|
||||
'port': LaunchConfiguration('port'),
|
||||
'baud_rate': LaunchConfiguration('baud_rate'),
|
||||
}],
|
||||
)
|
||||
])
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
import math
|
||||
import queue
|
||||
import struct
|
||||
import threading
|
||||
import time
|
||||
from typing import Optional, Tuple
|
||||
|
||||
import rclpy
|
||||
from geometry_msgs.msg import PointStamped
|
||||
from rclpy.node import Node
|
||||
from std_msgs.msg import String
|
||||
|
||||
try:
|
||||
import serial # type: ignore
|
||||
except Exception: # pragma: no cover
|
||||
serial = None
|
||||
|
||||
|
||||
APP_PACKET_HEADER = 0x55
|
||||
CMD_MULT_SERVO_MOVE = 3
|
||||
CMD_COORDINATE_SET = 4
|
||||
|
||||
MIN_X_CM = 10.0
|
||||
MAX_X_CM = 20.0
|
||||
MIN_Y_CM = -10.0
|
||||
MAX_Y_CM = 10.0
|
||||
MIN_Z_CM = 0.0
|
||||
MAX_Z_CM = 25.0
|
||||
|
||||
SERIAL_ANGLE_FACTOR = 4.166666666666667
|
||||
SERIAL_CLAW_FACTOR = 5.555555555555556
|
||||
|
||||
|
||||
class LeRobotArmController(Node):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('lerobot_arm_controller')
|
||||
self._declare_parameters()
|
||||
self._load_parameters()
|
||||
|
||||
self.arm_status_pub = self.create_publisher(String, '/arm/status', 10)
|
||||
self.arm_debug_target_pub = self.create_publisher(PointStamped, '/arm/debug_target', 10)
|
||||
self.create_subscription(String, '/arm_command', self.on_arm_command, 10)
|
||||
self.create_subscription(PointStamped, '/depth_target/point3d', self.on_depth_point, 10)
|
||||
|
||||
self.latest_point3d: Optional[PointStamped] = None
|
||||
self.current_xyz_cm = [self.home_x_cm, self.home_y_cm, self.home_z_cm]
|
||||
self._cmd_queue: 'queue.Queue[str]' = queue.Queue()
|
||||
self._worker = threading.Thread(target=self._worker_loop, daemon=True)
|
||||
self._worker.start()
|
||||
|
||||
self.ser = None
|
||||
if not self.simulation:
|
||||
self._open_serial()
|
||||
|
||||
self.publish_status('idle')
|
||||
|
||||
def _declare_parameters(self) -> None:
|
||||
defaults = {
|
||||
'simulation': False,
|
||||
'port': '/dev/ttyUSB2',
|
||||
'baud_rate': 115200,
|
||||
'serial_timeout_sec': 0.10,
|
||||
'latest_point_timeout_sec': 1.0,
|
||||
'move_time_ms': 500,
|
||||
'settle_sec': 0.20,
|
||||
'safe_z_cm': 18.0,
|
||||
'home_x_cm': 15.0,
|
||||
'home_y_cm': 0.0,
|
||||
'home_z_cm': 10.0,
|
||||
'grasp_pre_z_offset_cm': 4.0,
|
||||
'grasp_final_z_offset_cm': 1.0,
|
||||
'gripper_open_angle_deg': 90.0,
|
||||
'gripper_close_angle_deg': 18.0,
|
||||
'wrist_roll_angle_deg': 0.0,
|
||||
'camera_to_arm_x_m': 0.02,
|
||||
'camera_to_arm_y_m': 0.0,
|
||||
'camera_to_arm_z_m': 0.08,
|
||||
'grasp_forward_extra_m': 0.0,
|
||||
'grasp_lateral_extra_m': 0.0,
|
||||
'grasp_height_extra_m': 0.0,
|
||||
'platform_left_x_cm': 14.0,
|
||||
'platform_left_y_cm': 8.0,
|
||||
'platform_left_z_cm': 4.5,
|
||||
'platform_right_x_cm': 14.0,
|
||||
'platform_right_y_cm': -8.0,
|
||||
'platform_right_z_cm': 4.5,
|
||||
'blue_zone_x_cm': 18.0,
|
||||
'blue_zone_y_cm': 8.0,
|
||||
'blue_zone_z_cm': 4.0,
|
||||
'green_zone_x_cm': 18.0,
|
||||
'green_zone_y_cm': -8.0,
|
||||
'green_zone_z_cm': 4.0,
|
||||
}
|
||||
for key, value in defaults.items():
|
||||
self.declare_parameter(key, value)
|
||||
|
||||
def _load_parameters(self) -> None:
|
||||
g = self.get_parameter
|
||||
self.simulation = bool(g('simulation').value)
|
||||
self.port = str(g('port').value)
|
||||
self.baud_rate = int(g('baud_rate').value)
|
||||
self.serial_timeout_sec = float(g('serial_timeout_sec').value)
|
||||
self.latest_point_timeout_sec = float(g('latest_point_timeout_sec').value)
|
||||
self.move_time_ms = int(g('move_time_ms').value)
|
||||
self.settle_sec = float(g('settle_sec').value)
|
||||
self.safe_z_cm = float(g('safe_z_cm').value)
|
||||
self.home_x_cm = float(g('home_x_cm').value)
|
||||
self.home_y_cm = float(g('home_y_cm').value)
|
||||
self.home_z_cm = float(g('home_z_cm').value)
|
||||
self.grasp_pre_z_offset_cm = float(g('grasp_pre_z_offset_cm').value)
|
||||
self.grasp_final_z_offset_cm = float(g('grasp_final_z_offset_cm').value)
|
||||
self.gripper_open_angle_deg = float(g('gripper_open_angle_deg').value)
|
||||
self.gripper_close_angle_deg = float(g('gripper_close_angle_deg').value)
|
||||
self.wrist_roll_angle_deg = float(g('wrist_roll_angle_deg').value)
|
||||
self.camera_to_arm_x_m = float(g('camera_to_arm_x_m').value)
|
||||
self.camera_to_arm_y_m = float(g('camera_to_arm_y_m').value)
|
||||
self.camera_to_arm_z_m = float(g('camera_to_arm_z_m').value)
|
||||
self.grasp_forward_extra_m = float(g('grasp_forward_extra_m').value)
|
||||
self.grasp_lateral_extra_m = float(g('grasp_lateral_extra_m').value)
|
||||
self.grasp_height_extra_m = float(g('grasp_height_extra_m').value)
|
||||
self.platform_left = (
|
||||
float(g('platform_left_x_cm').value),
|
||||
float(g('platform_left_y_cm').value),
|
||||
float(g('platform_left_z_cm').value),
|
||||
)
|
||||
self.platform_right = (
|
||||
float(g('platform_right_x_cm').value),
|
||||
float(g('platform_right_y_cm').value),
|
||||
float(g('platform_right_z_cm').value),
|
||||
)
|
||||
self.blue_zone = (
|
||||
float(g('blue_zone_x_cm').value),
|
||||
float(g('blue_zone_y_cm').value),
|
||||
float(g('blue_zone_z_cm').value),
|
||||
)
|
||||
self.green_zone = (
|
||||
float(g('green_zone_x_cm').value),
|
||||
float(g('green_zone_y_cm').value),
|
||||
float(g('green_zone_z_cm').value),
|
||||
)
|
||||
|
||||
def _open_serial(self) -> None:
|
||||
if serial is None:
|
||||
raise RuntimeError('pyserial is not available, cannot control arm hardware.')
|
||||
self.ser = serial.Serial(self.port, self.baud_rate, timeout=self.serial_timeout_sec)
|
||||
self.get_logger().info(f'LeRobot arm serial opened: {self.port} @ {self.baud_rate}')
|
||||
|
||||
def on_depth_point(self, msg: PointStamped) -> None:
|
||||
self.latest_point3d = msg
|
||||
|
||||
def on_arm_command(self, msg: String) -> None:
|
||||
cmd = msg.data.strip()
|
||||
if cmd:
|
||||
self._cmd_queue.put(cmd)
|
||||
|
||||
def publish_status(self, text: str) -> None:
|
||||
msg = String()
|
||||
msg.data = text
|
||||
self.arm_status_pub.publish(msg)
|
||||
|
||||
def _worker_loop(self) -> None:
|
||||
while rclpy.ok():
|
||||
cmd = self._cmd_queue.get()
|
||||
try:
|
||||
self.publish_status('busy')
|
||||
self._execute_command(cmd)
|
||||
self.publish_status('done')
|
||||
except Exception as exc: # pragma: no cover
|
||||
self.get_logger().error(f'Arm command failed: {cmd}: {exc}')
|
||||
self.publish_status('error')
|
||||
|
||||
def _execute_command(self, cmd: str) -> None:
|
||||
if cmd in {'home', 'move_home'}:
|
||||
self.move_home()
|
||||
return
|
||||
if cmd == 'open_claw':
|
||||
self.set_claw(self.gripper_open_angle_deg)
|
||||
return
|
||||
if cmd == 'close_claw':
|
||||
self.set_claw(self.gripper_close_angle_deg)
|
||||
return
|
||||
if cmd.startswith('pick_and_place_platform:'):
|
||||
side = cmd.split(':', 1)[1].strip().lower()
|
||||
self.pick_from_latest_depth()
|
||||
self.place_platform(side)
|
||||
self.move_home()
|
||||
return
|
||||
if cmd.startswith('pick_block:'):
|
||||
self.pick_from_latest_depth()
|
||||
return
|
||||
if cmd.startswith('place_block:'):
|
||||
zone = cmd.split(':', 1)[1].strip().lower()
|
||||
self.place_block(zone)
|
||||
self.move_home()
|
||||
return
|
||||
if cmd in {'pick_from_depth', 'pick'}:
|
||||
self.pick_from_latest_depth()
|
||||
return
|
||||
raise ValueError(f'Unsupported arm command: {cmd}')
|
||||
|
||||
def _packet(self, cmd: int, payload: bytes) -> bytes:
|
||||
return bytes([APP_PACKET_HEADER, APP_PACKET_HEADER, 2 + len(payload), cmd]) + payload
|
||||
|
||||
def _write_packet(self, packet: bytes) -> None:
|
||||
if self.simulation:
|
||||
self.get_logger().info(f'[SIM] TX {packet.hex(" ")}')
|
||||
return
|
||||
assert self.ser is not None
|
||||
self.ser.write(packet)
|
||||
self.ser.flush()
|
||||
|
||||
def send_coordinate_delta(self, dx_cm: float, dy_cm: float, dz_cm: float, move_time_ms: Optional[int] = None) -> None:
|
||||
move_time_ms = int(move_time_ms or self.move_time_ms)
|
||||
sx = int(max(-120, min(120, round(dx_cm * 10.0))))
|
||||
sy = int(max(-120, min(120, round(dy_cm * 10.0))))
|
||||
sz = int(max(-120, min(120, round(dz_cm * 10.0))))
|
||||
payload = struct.pack('bbb', sx, sy, sz)
|
||||
self._write_packet(self._packet(CMD_COORDINATE_SET, payload))
|
||||
self.current_xyz_cm[0] += sx / 10.0
|
||||
self.current_xyz_cm[1] += sy / 10.0
|
||||
self.current_xyz_cm[2] += sz / 10.0
|
||||
time.sleep(max(move_time_ms / 1000.0, self.settle_sec))
|
||||
|
||||
def move_absolute_xyz(self, target_x_cm: float, target_y_cm: float, target_z_cm: float, move_time_ms: Optional[int] = None) -> None:
|
||||
move_time_ms = int(move_time_ms or self.move_time_ms)
|
||||
tx = max(MIN_X_CM, min(MAX_X_CM, target_x_cm))
|
||||
ty = max(MIN_Y_CM, min(MAX_Y_CM, target_y_cm))
|
||||
tz = max(MIN_Z_CM, min(MAX_Z_CM, target_z_cm))
|
||||
dx = tx - self.current_xyz_cm[0]
|
||||
dy = ty - self.current_xyz_cm[1]
|
||||
dz = tz - self.current_xyz_cm[2]
|
||||
max_axis = max(abs(dx), abs(dy), abs(dz), 0.0)
|
||||
steps = max(1, int(math.ceil(max_axis / 6.0)))
|
||||
for i in range(1, steps + 1):
|
||||
next_x = self.current_xyz_cm[0] + (tx - self.current_xyz_cm[0]) / (steps - i + 1)
|
||||
next_y = self.current_xyz_cm[1] + (ty - self.current_xyz_cm[1]) / (steps - i + 1)
|
||||
next_z = self.current_xyz_cm[2] + (tz - self.current_xyz_cm[2]) / (steps - i + 1)
|
||||
self.send_coordinate_delta(next_x - self.current_xyz_cm[0], next_y - self.current_xyz_cm[1], next_z - self.current_xyz_cm[2], move_time_ms)
|
||||
|
||||
def _send_multi_servo(self, pairs, move_time_ms: Optional[int] = None) -> None:
|
||||
move_time_ms = int(move_time_ms or self.move_time_ms)
|
||||
payload = bytearray()
|
||||
payload.append(len(pairs))
|
||||
payload.append(move_time_ms & 0xFF)
|
||||
payload.append((move_time_ms >> 8) & 0xFF)
|
||||
for servo_id, duty in pairs:
|
||||
payload.append(int(servo_id) & 0xFF)
|
||||
payload.append(int(duty) & 0xFF)
|
||||
payload.append((int(duty) >> 8) & 0xFF)
|
||||
self._write_packet(self._packet(CMD_MULT_SERVO_MOVE, bytes(payload)))
|
||||
time.sleep(max(move_time_ms / 1000.0, self.settle_sec))
|
||||
|
||||
def set_claw(self, open_angle_deg: float, move_time_ms: Optional[int] = None) -> None:
|
||||
angle = max(0.0, min(90.0, open_angle_deg))
|
||||
duty = int(round(700.0 - SERIAL_CLAW_FACTOR * angle))
|
||||
duty = max(200, min(700, duty))
|
||||
self._send_multi_servo([(1, duty)], move_time_ms)
|
||||
|
||||
def set_roll(self, rotation_angle_deg: float, move_time_ms: Optional[int] = None) -> None:
|
||||
angle = max(-90.0, min(90.0, rotation_angle_deg))
|
||||
duty = int(round(500.0 - SERIAL_ANGLE_FACTOR * angle))
|
||||
duty = max(120, min(880, duty))
|
||||
self._send_multi_servo([(2, duty)], move_time_ms)
|
||||
|
||||
def move_home(self) -> None:
|
||||
self.move_absolute_xyz(self.current_xyz_cm[0], self.current_xyz_cm[1], max(self.current_xyz_cm[2], self.safe_z_cm))
|
||||
self.move_absolute_xyz(self.home_x_cm, self.home_y_cm, max(self.home_z_cm, self.safe_z_cm))
|
||||
self.move_absolute_xyz(self.home_x_cm, self.home_y_cm, self.home_z_cm)
|
||||
self.set_roll(self.wrist_roll_angle_deg)
|
||||
self.set_claw(self.gripper_open_angle_deg)
|
||||
|
||||
def _latest_point_fresh(self) -> bool:
|
||||
if self.latest_point3d is None:
|
||||
return False
|
||||
stamp = self.latest_point3d.header.stamp
|
||||
point_time = float(stamp.sec) + float(stamp.nanosec) / 1e9
|
||||
now_time = self.get_clock().now().nanoseconds / 1e9
|
||||
return (now_time - point_time) <= self.latest_point_timeout_sec
|
||||
|
||||
def camera_point_to_arm_xyz_cm(self, point: PointStamped) -> Tuple[float, float, float]:
|
||||
x_cam = float(point.point.x)
|
||||
y_cam = float(point.point.y)
|
||||
z_cam = float(point.point.z)
|
||||
arm_x_m = z_cam + self.camera_to_arm_x_m + self.grasp_forward_extra_m
|
||||
arm_y_m = -x_cam + self.camera_to_arm_y_m + self.grasp_lateral_extra_m
|
||||
arm_z_m = -y_cam + self.camera_to_arm_z_m + self.grasp_height_extra_m
|
||||
debug = PointStamped()
|
||||
debug.header = point.header
|
||||
debug.point.x = arm_x_m
|
||||
debug.point.y = arm_y_m
|
||||
debug.point.z = arm_z_m
|
||||
self.arm_debug_target_pub.publish(debug)
|
||||
return arm_x_m * 100.0, arm_y_m * 100.0, arm_z_m * 100.0
|
||||
|
||||
def pick_from_latest_depth(self) -> None:
|
||||
if not self._latest_point_fresh():
|
||||
raise RuntimeError('No fresh /depth_target/point3d available for grasping.')
|
||||
assert self.latest_point3d is not None
|
||||
target_x_cm, target_y_cm, target_z_cm = self.camera_point_to_arm_xyz_cm(self.latest_point3d)
|
||||
pre_z = target_z_cm + self.grasp_pre_z_offset_cm
|
||||
final_z = target_z_cm + self.grasp_final_z_offset_cm
|
||||
|
||||
self.set_roll(self.wrist_roll_angle_deg)
|
||||
self.set_claw(self.gripper_open_angle_deg)
|
||||
self.move_absolute_xyz(self.current_xyz_cm[0], self.current_xyz_cm[1], max(self.current_xyz_cm[2], self.safe_z_cm))
|
||||
self.move_absolute_xyz(target_x_cm, target_y_cm, max(pre_z, self.safe_z_cm))
|
||||
self.move_absolute_xyz(target_x_cm, target_y_cm, pre_z)
|
||||
self.move_absolute_xyz(target_x_cm, target_y_cm, final_z, move_time_ms=max(250, self.move_time_ms // 2))
|
||||
self.set_claw(self.gripper_close_angle_deg, move_time_ms=max(250, self.move_time_ms // 2))
|
||||
self.move_absolute_xyz(target_x_cm, target_y_cm, max(pre_z, self.safe_z_cm))
|
||||
|
||||
def place_platform(self, side: str) -> None:
|
||||
target = self.platform_left if side == 'left' else self.platform_right
|
||||
self._place_to_xyz(target)
|
||||
|
||||
def place_block(self, zone: str) -> None:
|
||||
if zone == 'blue':
|
||||
self._place_to_xyz(self.blue_zone)
|
||||
elif zone == 'green':
|
||||
self._place_to_xyz(self.green_zone)
|
||||
else:
|
||||
raise ValueError(f'Unknown place zone: {zone}')
|
||||
|
||||
def _place_to_xyz(self, target_xyz_cm: Tuple[float, float, float]) -> None:
|
||||
tx, ty, tz = target_xyz_cm
|
||||
pre_z = max(tz + 4.0, self.safe_z_cm)
|
||||
self.move_absolute_xyz(self.current_xyz_cm[0], self.current_xyz_cm[1], max(self.current_xyz_cm[2], self.safe_z_cm))
|
||||
self.move_absolute_xyz(tx, ty, pre_z)
|
||||
self.move_absolute_xyz(tx, ty, tz)
|
||||
self.set_claw(self.gripper_open_angle_deg)
|
||||
self.move_absolute_xyz(tx, ty, pre_z)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
rclpy.init()
|
||||
node = LeRobotArmController()
|
||||
try:
|
||||
rclpy.spin(node)
|
||||
finally:
|
||||
if getattr(node, 'ser', None) is not None:
|
||||
try:
|
||||
node.ser.close()
|
||||
except Exception:
|
||||
pass
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
23
dev_ws/src/lerobot_arm_controller/package.xml
Normal file
23
dev_ws/src/lerobot_arm_controller/package.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<package format="3">
|
||||
<name>lerobot_arm_controller</name>
|
||||
<version>0.1.0</version>
|
||||
<description>LeRobot mechanical arm controller with depth-guided grasping for ROS 2 Humble</description>
|
||||
<maintainer email="openai@example.com">OpenAI</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
|
||||
<depend>rclpy</depend>
|
||||
<depend>std_msgs</depend>
|
||||
<depend>geometry_msgs</depend>
|
||||
<depend>builtin_interfaces</depend>
|
||||
|
||||
<exec_depend>python3-serial</exec_depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_python</build_type>
|
||||
</export>
|
||||
</package>
|
||||
4
dev_ws/src/lerobot_arm_controller/setup.cfg
Normal file
4
dev_ws/src/lerobot_arm_controller/setup.cfg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[develop]
|
||||
script_dir=$base/lib/lerobot_arm_controller
|
||||
[install]
|
||||
install_scripts=$base/lib/lerobot_arm_controller
|
||||
26
dev_ws/src/lerobot_arm_controller/setup.py
Normal file
26
dev_ws/src/lerobot_arm_controller/setup.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from setuptools import setup
|
||||
|
||||
package_name = 'lerobot_arm_controller'
|
||||
|
||||
setup(
|
||||
name=package_name,
|
||||
version='0.1.0',
|
||||
packages=[package_name],
|
||||
data_files=[
|
||||
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
|
||||
('share/' + package_name, ['package.xml']),
|
||||
('share/' + package_name + '/launch', ['launch/lerobot_arm_controller.launch.py']),
|
||||
('share/' + package_name + '/config', ['config/lerobot_arm_controller.yaml']),
|
||||
],
|
||||
install_requires=['setuptools'],
|
||||
zip_safe=True,
|
||||
maintainer='OpenAI',
|
||||
maintainer_email='openai@example.com',
|
||||
description='ROS 2 serial arm controller for LeRobot arm with depth-guided grasping',
|
||||
license='Apache-2.0',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'lerobot_arm_controller = lerobot_arm_controller.lerobot_arm_controller_node:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
17
dev_ws/src/mission_manager/config/mission_manager.yaml
Normal file
17
dev_ws/src/mission_manager/config/mission_manager.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
mission_manager:
|
||||
ros__parameters:
|
||||
autostart: false
|
||||
auto_arm_complete_timeout_sec: 8.0
|
||||
platform_side: "left"
|
||||
blue_zone_label: "blue"
|
||||
green_zone_label: "green"
|
||||
approach_speed_mps: 0.18
|
||||
slope_speed_mps: 0.32
|
||||
lateral_speed_mps: 0.12
|
||||
turn_speed_radps: 0.65
|
||||
yaw_tolerance_deg: 5.0
|
||||
ultrasonic_stop_distance_m: 0.35
|
||||
signboard_stop_distance_m: 0.70
|
||||
board_hold_sec: 3.0
|
||||
alignment_tolerance: 0.12
|
||||
max_wait_signal_board_sec: 30.0
|
||||
21
dev_ws/src/mission_manager/launch/mission_manager.launch.py
Normal file
21
dev_ws/src/mission_manager/launch/mission_manager.launch.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
config = os.path.join(
|
||||
get_package_share_directory('mission_manager'),
|
||||
'config',
|
||||
'mission_manager.yaml'
|
||||
)
|
||||
return LaunchDescription([
|
||||
Node(
|
||||
package='mission_manager',
|
||||
executable='mission_manager',
|
||||
name='mission_manager',
|
||||
output='screen',
|
||||
parameters=[config],
|
||||
)
|
||||
])
|
||||
0
dev_ws/src/mission_manager/mission_manager/__init__.py
Normal file
0
dev_ws/src/mission_manager/mission_manager/__init__.py
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
import math
|
||||
from enum import Enum, auto
|
||||
from typing import Optional
|
||||
|
||||
import rclpy
|
||||
from geometry_msgs.msg import PointStamped, Twist
|
||||
from nav_msgs.msg import Odometry
|
||||
from rclpy.duration import Duration
|
||||
from rclpy.node import Node
|
||||
from sensor_msgs.msg import Imu, Range
|
||||
from std_msgs.msg import Bool, String
|
||||
|
||||
|
||||
class MissionState(Enum):
|
||||
IDLE = auto()
|
||||
APPROACH_SLOPE_ENTRY = auto()
|
||||
PICK_AND_PLACE_SPONGE = auto()
|
||||
TURN_LEFT_90 = auto()
|
||||
RUSH_SLOPE = auto()
|
||||
CHECK_SIGNAL_BOARD = auto()
|
||||
MOVE_TO_BLOCK_1 = auto()
|
||||
PICK_BLOCK_1 = auto()
|
||||
PLACE_BLOCK_1 = auto()
|
||||
MOVE_TO_BLOCK_2 = auto()
|
||||
PICK_BLOCK_2 = auto()
|
||||
PLACE_BLOCK_2 = auto()
|
||||
FINISHED = auto()
|
||||
|
||||
|
||||
class MissionManager(Node):
|
||||
def __init__(self) -> None:
|
||||
super().__init__('mission_manager')
|
||||
|
||||
self.declare_parameter('autostart', False)
|
||||
self.declare_parameter('auto_arm_complete_timeout_sec', 2.0)
|
||||
self.declare_parameter('platform_side', 'left')
|
||||
self.declare_parameter('blue_zone_label', 'blue')
|
||||
self.declare_parameter('green_zone_label', 'green')
|
||||
self.declare_parameter('approach_speed_mps', 0.18)
|
||||
self.declare_parameter('slope_speed_mps', 0.32)
|
||||
self.declare_parameter('lateral_speed_mps', 0.12)
|
||||
self.declare_parameter('turn_speed_radps', 0.65)
|
||||
self.declare_parameter('yaw_tolerance_deg', 5.0)
|
||||
self.declare_parameter('ultrasonic_stop_distance_m', 0.35)
|
||||
self.declare_parameter('signboard_stop_distance_m', 0.70)
|
||||
self.declare_parameter('board_hold_sec', 3.0)
|
||||
self.declare_parameter('alignment_tolerance', 0.12)
|
||||
self.declare_parameter('max_wait_signal_board_sec', 30.0)
|
||||
|
||||
self.autostart = self.get_parameter('autostart').value
|
||||
self.auto_arm_complete_timeout_sec = float(self.get_parameter('auto_arm_complete_timeout_sec').value)
|
||||
self.platform_side = str(self.get_parameter('platform_side').value)
|
||||
self.blue_zone_label = str(self.get_parameter('blue_zone_label').value)
|
||||
self.green_zone_label = str(self.get_parameter('green_zone_label').value)
|
||||
self.approach_speed_mps = float(self.get_parameter('approach_speed_mps').value)
|
||||
self.slope_speed_mps = float(self.get_parameter('slope_speed_mps').value)
|
||||
self.lateral_speed_mps = float(self.get_parameter('lateral_speed_mps').value)
|
||||
self.turn_speed_radps = float(self.get_parameter('turn_speed_radps').value)
|
||||
self.yaw_tolerance_rad = math.radians(float(self.get_parameter('yaw_tolerance_deg').value))
|
||||
self.ultrasonic_stop_distance_m = float(self.get_parameter('ultrasonic_stop_distance_m').value)
|
||||
self.signboard_stop_distance_m = float(self.get_parameter('signboard_stop_distance_m').value)
|
||||
self.board_hold_sec = float(self.get_parameter('board_hold_sec').value)
|
||||
self.alignment_tolerance = float(self.get_parameter('alignment_tolerance').value)
|
||||
self.max_wait_signal_board_sec = float(self.get_parameter('max_wait_signal_board_sec').value)
|
||||
|
||||
self.cmd_pub = self.create_publisher(Twist, '/cmd_vel', 10)
|
||||
self.arm_cmd_pub = self.create_publisher(String, '/arm_command', 10)
|
||||
self.state_pub = self.create_publisher(String, '/mission_manager/state', 10)
|
||||
|
||||
self.create_subscription(Range, '/ultrasonic/front/range', self.on_range, 10)
|
||||
self.create_subscription(Imu, '/imu', self.on_imu, 10)
|
||||
self.create_subscription(Odometry, '/odom', self.on_odom, 10)
|
||||
self.create_subscription(String, '/signal_board/result', self.on_signal_board, 10)
|
||||
self.create_subscription(PointStamped, '/depth_target/point', self.on_depth_target, 10)
|
||||
self.create_subscription(String, '/arm/status', self.on_arm_status, 10)
|
||||
self.create_subscription(Bool, '/mission/start', self.on_start, 10)
|
||||
|
||||
self.timer = self.create_timer(0.05, self.on_timer)
|
||||
|
||||
self.state = MissionState.APPROACH_SLOPE_ENTRY if self.autostart else MissionState.IDLE
|
||||
self.current_range_m: Optional[float] = None
|
||||
self.current_yaw: Optional[float] = None
|
||||
self.current_pose = None
|
||||
self.signal_board_result = 'unknown'
|
||||
self.depth_target: Optional[PointStamped] = None
|
||||
self.arm_busy = False
|
||||
self.pending_arm_done_deadline = None
|
||||
self.turn_start_yaw: Optional[float] = None
|
||||
self.state_enter_time = self.get_clock().now()
|
||||
self.block_pick_count = 0
|
||||
self.sponge_done = False
|
||||
self.signal_idle_seen = False
|
||||
|
||||
self.publish_state('READY' if self.autostart else 'IDLE_WAIT_START')
|
||||
|
||||
def on_range(self, msg: Range) -> None:
|
||||
self.current_range_m = float(msg.range)
|
||||
|
||||
def on_imu(self, msg: Imu) -> None:
|
||||
q = msg.orientation
|
||||
siny_cosp = 2.0 * (q.w * q.z + q.x * q.y)
|
||||
cosy_cosp = 1.0 - 2.0 * (q.y * q.y + q.z * q.z)
|
||||
self.current_yaw = math.atan2(siny_cosp, cosy_cosp)
|
||||
|
||||
def on_odom(self, msg: Odometry) -> None:
|
||||
self.current_pose = msg.pose.pose
|
||||
|
||||
def on_signal_board(self, msg: String) -> None:
|
||||
self.signal_board_result = msg.data.strip()
|
||||
|
||||
def on_depth_target(self, msg: PointStamped) -> None:
|
||||
self.depth_target = msg
|
||||
|
||||
def on_arm_status(self, msg: String) -> None:
|
||||
data = msg.data.strip().lower()
|
||||
if data in {'busy', 'running'}:
|
||||
self.arm_busy = True
|
||||
elif data in {'done', 'idle', 'ok', 'success'}:
|
||||
self.arm_busy = False
|
||||
self.pending_arm_done_deadline = None
|
||||
elif data in {'failed', 'error'}:
|
||||
self.arm_busy = False
|
||||
self.pending_arm_done_deadline = None
|
||||
self.get_logger().warning('Arm reported failure, mission pauses at current state.')
|
||||
|
||||
def on_start(self, msg: Bool) -> None:
|
||||
if msg.data and self.state == MissionState.IDLE:
|
||||
self.transition_to(MissionState.APPROACH_SLOPE_ENTRY, 'external start signal')
|
||||
elif (not msg.data) and self.state != MissionState.IDLE:
|
||||
self.stop_robot()
|
||||
self.transition_to(MissionState.IDLE, 'external stop signal')
|
||||
|
||||
def publish_state(self, detail: str) -> None:
|
||||
msg = String()
|
||||
msg.data = f'{self.state.name}:{detail}'
|
||||
self.state_pub.publish(msg)
|
||||
|
||||
def transition_to(self, new_state: MissionState, reason: str) -> None:
|
||||
self.stop_robot()
|
||||
self.state = new_state
|
||||
self.state_enter_time = self.get_clock().now()
|
||||
if new_state != MissionState.TURN_LEFT_90:
|
||||
self.turn_start_yaw = None
|
||||
self.publish_state(reason)
|
||||
self.get_logger().info(f'Transition -> {new_state.name}: {reason}')
|
||||
|
||||
def state_elapsed(self) -> float:
|
||||
return (self.get_clock().now() - self.state_enter_time).nanoseconds / 1e9
|
||||
|
||||
def stop_robot(self) -> None:
|
||||
self.cmd_pub.publish(Twist())
|
||||
|
||||
def send_cmd(self, linear_x: float = 0.0, linear_y: float = 0.0, angular_z: float = 0.0) -> None:
|
||||
cmd = Twist()
|
||||
cmd.linear.x = float(linear_x)
|
||||
cmd.linear.y = float(linear_y)
|
||||
cmd.angular.z = float(angular_z)
|
||||
self.cmd_pub.publish(cmd)
|
||||
|
||||
def send_arm_command(self, command: str) -> None:
|
||||
msg = String()
|
||||
msg.data = command
|
||||
self.arm_cmd_pub.publish(msg)
|
||||
self.arm_busy = True
|
||||
self.pending_arm_done_deadline = self.get_clock().now() + Duration(seconds=self.auto_arm_complete_timeout_sec)
|
||||
self.get_logger().info(f'Arm command -> {command}')
|
||||
|
||||
def arm_action_finished(self) -> bool:
|
||||
if not self.arm_busy:
|
||||
return True
|
||||
if self.pending_arm_done_deadline is not None and self.get_clock().now() >= self.pending_arm_done_deadline:
|
||||
self.arm_busy = False
|
||||
self.pending_arm_done_deadline = None
|
||||
self.get_logger().warning('Arm timeout auto-completed for integration testing.')
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def angle_wrap(angle: float) -> float:
|
||||
while angle > math.pi:
|
||||
angle -= 2.0 * math.pi
|
||||
while angle < -math.pi:
|
||||
angle += 2.0 * math.pi
|
||||
return angle
|
||||
|
||||
def depth_target_aligned(self) -> bool:
|
||||
if self.depth_target is None:
|
||||
return False
|
||||
return abs(self.depth_target.point.y) <= self.alignment_tolerance
|
||||
|
||||
def on_timer(self) -> None:
|
||||
if self.state == MissionState.IDLE:
|
||||
self.stop_robot()
|
||||
return
|
||||
|
||||
if self.state == MissionState.APPROACH_SLOPE_ENTRY:
|
||||
if (not self.sponge_done) and self.depth_target is not None and self.depth_target.point.x <= 0.55:
|
||||
self.stop_robot()
|
||||
self.send_arm_command(f'pick_and_place_platform:{self.platform_side}')
|
||||
self.sponge_done = True
|
||||
self.transition_to(MissionState.PICK_AND_PLACE_SPONGE, 'depth target in pickup window')
|
||||
return
|
||||
|
||||
if self.current_range_m is not None and self.current_range_m <= self.ultrasonic_stop_distance_m:
|
||||
self.transition_to(MissionState.TURN_LEFT_90, 'ultrasonic reached slope-entry stop line')
|
||||
return
|
||||
|
||||
self.send_cmd(linear_x=self.approach_speed_mps)
|
||||
return
|
||||
|
||||
if self.state == MissionState.PICK_AND_PLACE_SPONGE:
|
||||
if self.arm_action_finished():
|
||||
self.transition_to(MissionState.APPROACH_SLOPE_ENTRY, 'sponge placed on side platform')
|
||||
return
|
||||
|
||||
if self.state == MissionState.TURN_LEFT_90:
|
||||
if self.current_yaw is None:
|
||||
self.stop_robot()
|
||||
return
|
||||
if self.turn_start_yaw is None:
|
||||
self.turn_start_yaw = self.current_yaw
|
||||
delta = self.angle_wrap(self.current_yaw - self.turn_start_yaw)
|
||||
target = math.pi / 2.0
|
||||
if abs(target - abs(delta)) <= self.yaw_tolerance_rad:
|
||||
self.transition_to(MissionState.RUSH_SLOPE, 'left turn completed')
|
||||
return
|
||||
self.send_cmd(angular_z=self.turn_speed_radps)
|
||||
return
|
||||
|
||||
if self.state == MissionState.RUSH_SLOPE:
|
||||
if self.current_range_m is not None and self.current_range_m <= self.signboard_stop_distance_m:
|
||||
self.transition_to(MissionState.CHECK_SIGNAL_BOARD, 'arrived at signboard check point')
|
||||
return
|
||||
self.send_cmd(linear_x=self.slope_speed_mps)
|
||||
return
|
||||
|
||||
if self.state == MissionState.CHECK_SIGNAL_BOARD:
|
||||
self.stop_robot()
|
||||
if self.signal_board_result.startswith('idle'):
|
||||
if not self.signal_idle_seen:
|
||||
self.signal_idle_seen = True
|
||||
self.state_enter_time = self.get_clock().now()
|
||||
self.publish_state(f'signal board idle confirmed: {self.signal_board_result}')
|
||||
elif self.state_elapsed() >= self.board_hold_sec:
|
||||
self.transition_to(MissionState.MOVE_TO_BLOCK_1, 'signal board display hold completed')
|
||||
return
|
||||
|
||||
if self.signal_board_result == 'busy' and self.state_elapsed() >= self.max_wait_signal_board_sec:
|
||||
self.get_logger().warning('Signal board stayed busy too long, mission still waits for manual intervention.')
|
||||
self.state_enter_time = self.get_clock().now()
|
||||
return
|
||||
|
||||
if self.state == MissionState.MOVE_TO_BLOCK_1:
|
||||
if self.depth_target is not None and self.depth_target_aligned() and self.depth_target.point.x <= 0.45:
|
||||
self.send_arm_command('pick_block:1')
|
||||
self.transition_to(MissionState.PICK_BLOCK_1, 'first floor block aligned')
|
||||
return
|
||||
self.send_cmd(linear_y=self.lateral_speed_mps)
|
||||
return
|
||||
|
||||
if self.state == MissionState.PICK_BLOCK_1:
|
||||
if self.arm_action_finished():
|
||||
self.send_arm_command(f'place_block:{self.blue_zone_label}')
|
||||
self.transition_to(MissionState.PLACE_BLOCK_1, 'first pick completed')
|
||||
return
|
||||
|
||||
if self.state == MissionState.PLACE_BLOCK_1:
|
||||
if self.arm_action_finished():
|
||||
self.block_pick_count = 1
|
||||
self.transition_to(MissionState.MOVE_TO_BLOCK_2, 'first block placed to blue zone')
|
||||
return
|
||||
|
||||
if self.state == MissionState.MOVE_TO_BLOCK_2:
|
||||
if self.depth_target is not None and self.depth_target_aligned() and self.depth_target.point.x <= 0.45:
|
||||
self.send_arm_command('pick_block:2')
|
||||
self.transition_to(MissionState.PICK_BLOCK_2, 'second floor block aligned')
|
||||
return
|
||||
self.send_cmd(linear_y=self.lateral_speed_mps)
|
||||
return
|
||||
|
||||
if self.state == MissionState.PICK_BLOCK_2:
|
||||
if self.arm_action_finished():
|
||||
self.send_arm_command(f'place_block:{self.green_zone_label}')
|
||||
self.transition_to(MissionState.PLACE_BLOCK_2, 'second pick completed')
|
||||
return
|
||||
|
||||
if self.state == MissionState.PLACE_BLOCK_2:
|
||||
if self.arm_action_finished():
|
||||
self.block_pick_count = 2
|
||||
self.transition_to(MissionState.FINISHED, 'all competition actions completed')
|
||||
return
|
||||
|
||||
if self.state == MissionState.FINISHED:
|
||||
self.stop_robot()
|
||||
return
|
||||
|
||||
|
||||
def main() -> None:
|
||||
rclpy.init()
|
||||
node = MissionManager()
|
||||
try:
|
||||
rclpy.spin(node)
|
||||
finally:
|
||||
node.stop_robot()
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
22
dev_ws/src/mission_manager/package.xml
Normal file
22
dev_ws/src/mission_manager/package.xml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>mission_manager</name>
|
||||
<version>0.1.0</version>
|
||||
<description>Mission state machine for the RDK X5 logistics competition robot.</description>
|
||||
<maintainer email="openai@example.com">OpenAI</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
|
||||
<depend>rclpy</depend>
|
||||
<depend>geometry_msgs</depend>
|
||||
<depend>nav_msgs</depend>
|
||||
<depend>sensor_msgs</depend>
|
||||
<depend>std_msgs</depend>
|
||||
|
||||
<exec_depend>ros2launch</exec_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_python</build_type>
|
||||
</export>
|
||||
</package>
|
||||
0
dev_ws/src/mission_manager/resource/mission_manager
Normal file
0
dev_ws/src/mission_manager/resource/mission_manager
Normal file
4
dev_ws/src/mission_manager/setup.cfg
Normal file
4
dev_ws/src/mission_manager/setup.cfg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[develop]
|
||||
script_dir=$base/lib/mission_manager
|
||||
[install]
|
||||
install_scripts=$base/lib/mission_manager
|
||||
26
dev_ws/src/mission_manager/setup.py
Normal file
26
dev_ws/src/mission_manager/setup.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from setuptools import setup
|
||||
|
||||
package_name = 'mission_manager'
|
||||
|
||||
setup(
|
||||
name=package_name,
|
||||
version='0.1.0',
|
||||
packages=[package_name],
|
||||
data_files=[
|
||||
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
|
||||
('share/' + package_name, ['package.xml']),
|
||||
('share/' + package_name + '/launch', ['launch/mission_manager.launch.py']),
|
||||
('share/' + package_name + '/config', ['config/mission_manager.yaml']),
|
||||
],
|
||||
install_requires=['setuptools'],
|
||||
zip_safe=True,
|
||||
maintainer='OpenAI',
|
||||
maintainer_email='openai@example.com',
|
||||
description='Mission state machine for RDK X5 logistics robot',
|
||||
license='Apache-2.0',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'mission_manager = mission_manager.mission_manager_node:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
204
dev_ws/src/orbbec_camera/CMakeLists.txt
Normal file
204
dev_ws/src/orbbec_camera/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
project(orbbec_camera)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -O1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC -g3")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -O1")
|
||||
option(USE_RK_HW_DECODER "Use Rockchip hardware decoder" OFF)
|
||||
option(USE_NV_HW_DECODER "Use Nvidia hardware decoder" OFF)
|
||||
option(INSTALL_UDEV_RULES "Install udev rule for Orbbec cameras" ON)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Werror -Wno-pedantic -Wno-array-bounds)
|
||||
endif()
|
||||
|
||||
set(dependencies
|
||||
ament_cmake
|
||||
ament_index_cpp
|
||||
Eigen3
|
||||
builtin_interfaces
|
||||
cv_bridge
|
||||
backward_ros
|
||||
camera_info_manager
|
||||
image_transport
|
||||
image_publisher
|
||||
OpenCV
|
||||
orbbec_camera_msgs
|
||||
rclcpp
|
||||
rclcpp_components
|
||||
sensor_msgs
|
||||
std_msgs
|
||||
std_srvs
|
||||
tf2
|
||||
tf2_msgs
|
||||
tf2_ros
|
||||
tf2_sensor_msgs
|
||||
Threads
|
||||
diagnostic_updater
|
||||
diagnostic_msgs
|
||||
statistics_msgs
|
||||
yaml-cpp
|
||||
camera_calibration_parsers
|
||||
)
|
||||
|
||||
foreach(dep IN LISTS dependencies)
|
||||
find_package(${dep} REQUIRED)
|
||||
endforeach()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
if(USE_RK_HW_DECODER)
|
||||
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
|
||||
if(NOT RK_MPP_FOUND)
|
||||
message(FATAL_ERROR "rockchip_mpp is not found")
|
||||
endif()
|
||||
pkg_search_module(RGA librga)
|
||||
if(NOT RGA_FOUND)
|
||||
add_definitions(-DUSE_LIBYUV)
|
||||
message("librga is not found, use libyuv instead")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND uname -m OUTPUT_VARIABLE MACHINES)
|
||||
execute_process(COMMAND getconf LONG_BIT OUTPUT_VARIABLE MACHINES_BIT)
|
||||
if((${MACHINES} MATCHES "x86_64") AND (${MACHINES_BIT} MATCHES "64"))
|
||||
set(HOST_PLATFORM "x64")
|
||||
elseif(${MACHINES} MATCHES "arm" OR (${MACHINES} MATCHES "aarch64" AND ${MACHINES_BIT} MATCHES "32"))
|
||||
message(FATAL_ERROR "ORBBEC SDK does not support arm32")
|
||||
elseif((${MACHINES} MATCHES "aarch64") AND (${MACHINES_BIT} MATCHES "64"))
|
||||
set(HOST_PLATFORM "arm64")
|
||||
endif()
|
||||
|
||||
set(ORBBEC_LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDK/lib/${HOST_PLATFORM})
|
||||
set(ORBBEC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDK/include/)
|
||||
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}:${ORBBEC_LIBS_DIR}")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${ORBBEC_LIBS_DIR}")
|
||||
|
||||
if(USE_NV_HW_DECODER)
|
||||
set(JETSON_MULTI_MEDIA_API_DIR /usr/src/jetson_multimedia_api)
|
||||
set(JETSON_MULTI_MEDIA_API_CLASS_DIR ${JETSON_MULTI_MEDIA_API_DIR}/samples/common/classes)
|
||||
set(JETSON_MULTI_MEDIA_API_INCLUDE_DIR ${JETSON_MULTI_MEDIA_API_DIR}/include/)
|
||||
set(LIBJPEG8B_INCLUDE_DIR ${JETSON_MULTI_MEDIA_API_INCLUDE_DIR}/libjpeg-8b)
|
||||
set(TEGRA_ARMABI /usr/lib/aarch64-linux-gnu/)
|
||||
add_definitions(-DUSE_NV_HW_DECODER)
|
||||
add_compile_options(-Wno-missing-field-initializers -Wno-unused-parameter)
|
||||
set(NV_LIBRARIES -lnvjpeg -lnvbufsurface -lnvbufsurftransform -lyuv -lv4l2)
|
||||
list(APPEND NV_LIBRARIES -L${TEGRA_ARMABI} -L${TEGRA_ARMABI}/tegra)
|
||||
endif()
|
||||
|
||||
set(COMMON_INCLUDE_DIRS
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
${ORBBEC_INCLUDE_DIR}
|
||||
${OpenCV_INCLUDED_DIRS}
|
||||
)
|
||||
|
||||
set(COMMON_LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
Eigen3::Eigen
|
||||
-lOrbbecSDK
|
||||
-L${ORBBEC_LIBS_DIR}
|
||||
Threads::Threads
|
||||
-lrt
|
||||
-ldw
|
||||
yaml-cpp
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
src/d2c_viewer.cpp
|
||||
src/dynamic_params.cpp
|
||||
src/image_publisher.cpp
|
||||
src/ob_camera_node_driver.cpp
|
||||
src/ob_camera_node.cpp
|
||||
src/ob_lidar_node.cpp
|
||||
src/ros_param_backend.cpp
|
||||
src/ros_service.cpp
|
||||
src/synced_imu_publisher.cpp
|
||||
src/utils.cpp
|
||||
src/jpeg_decoder.cpp
|
||||
)
|
||||
|
||||
if(USE_RK_HW_DECODER)
|
||||
add_definitions(-DUSE_RK_HW_DECODER)
|
||||
list(APPEND SOURCE_FILES src/rk_mpp_decoder.cpp)
|
||||
list(APPEND COMMON_INCLUDE_DIRS ${RK_MPP_INCLUDE_DIRS} ${RGA_INCLUDE_DIRS})
|
||||
list(APPEND COMMON_LIBRARIES ${RGA_LIBRARIES} ${RK_MPP_LIBRARIES})
|
||||
if(NOT RGA_FOUND)
|
||||
list(APPEND COMMON_LIBRARIES -lyuv)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_NV_HW_DECODER)
|
||||
list(APPEND SOURCE_FILES src/jetson_nv_decoder.cpp)
|
||||
list(APPEND COMMON_INCLUDE_DIRS ${JETSON_MULTI_MEDIA_API_INCLUDE_DIR} ${LIBJPEG8B_INCLUDE_DIR})
|
||||
list(APPEND SOURCE_FILES
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvBuffer.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvElement.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvElementProfiler.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvJpegDecoder.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvJpegEncoder.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvLogging.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvUtils.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvV4l2Element.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvV4l2ElementPlane.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvVideoDecoder.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvVideoEncoder.cpp
|
||||
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvBufSurface.cpp
|
||||
)
|
||||
list(APPEND COMMON_LIBRARIES ${NV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
macro(add_orbbec_executable TARGET SOURCE)
|
||||
add_executable(${TARGET} ${SOURCE})
|
||||
target_include_directories(${TARGET} PUBLIC ${COMMON_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET} ${COMMON_LIBRARIES} ${PROJECT_NAME})
|
||||
ament_target_dependencies(${TARGET} ${dependencies})
|
||||
endmacro()
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
|
||||
ament_target_dependencies(${PROJECT_NAME} ${dependencies})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${COMMON_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES})
|
||||
|
||||
rclcpp_components_register_node(
|
||||
${PROJECT_NAME} PLUGIN "orbbec_camera::OBCameraNodeDriver" EXECUTABLE orbbec_camera_node
|
||||
)
|
||||
|
||||
# add_orbbec_executable(list_devices_node tools/list_devices_node.cpp)
|
||||
# add_orbbec_executable(list_depth_work_mode_node tools/list_depth_work_mode.cpp)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
# install(TARGETS list_devices_node list_depth_work_mode_node DESTINATION lib/${PROJECT_NAME}/)
|
||||
install(DIRECTORY include/ DESTINATION include)
|
||||
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/)
|
||||
install(DIRECTORY config DESTINATION share/${PROJECT_NAME}/)
|
||||
install(DIRECTORY ${ORBBEC_INCLUDE_DIR} DESTINATION include)
|
||||
install(DIRECTORY ${ORBBEC_LIBS_DIR}/ DESTINATION lib/ FILES_MATCHING PATTERN "*.so*")
|
||||
file(GLOB_RECURSE EXTENSION_FILES "${ORBBEC_LIBS_DIR}/extensions/*")
|
||||
if(EXTENSION_FILES)
|
||||
install(FILES ${EXTENSION_FILES} DESTINATION lib/extensions/)
|
||||
endif()
|
||||
if(INSTALL_UDEV_RULES)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/99-obsensor-libusb.rules
|
||||
DESTINATION share/${PROJECT_NAME}/udev)
|
||||
endif()
|
||||
if(DEFINED ENV{BUILDING_PACKAGE})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/99-obsensor-libusb.rules DESTINATION /etc/udev/rules.d)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
ament_export_include_directories(include)
|
||||
ament_export_libraries(${PROJECT_NAME})
|
||||
ament_export_dependencies(${dependencies})
|
||||
ament_package()
|
||||
23
dev_ws/src/orbbec_camera/SDK/include/libobsensor/ObSensor.h
Normal file
23
dev_ws/src/orbbec_camera/SDK/include/libobsensor/ObSensor.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* \file ObSensor.h
|
||||
* \brief This file serves as the C entrance for the SDK library.
|
||||
* It includes all necessary header files for SDK usage.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <libobsensor/h/Context.h>
|
||||
#include <libobsensor/h/Device.h>
|
||||
#include <libobsensor/h/Error.h>
|
||||
#include <libobsensor/h/Filter.h>
|
||||
#include <libobsensor/h/Frame.h>
|
||||
#include <libobsensor/h/ObTypes.h>
|
||||
#include <libobsensor/h/Pipeline.h>
|
||||
#include <libobsensor/h/Property.h>
|
||||
#include <libobsensor/h/Sensor.h>
|
||||
#include <libobsensor/h/StreamProfile.h>
|
||||
#include <libobsensor/h/Version.h>
|
||||
#include <libobsensor/h/TypeHelper.h>
|
||||
#include <libobsensor/h/RecordPlayback.h>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* \file ObSensor.hpp
|
||||
* \brief This is the main entry point for the SDK C++ library.
|
||||
* It includes all necessary header files for using the library.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <libobsensor/hpp/Context.hpp>
|
||||
#include <libobsensor/hpp/Device.hpp>
|
||||
#include <libobsensor/hpp/Error.hpp>
|
||||
#include <libobsensor/hpp/Filter.hpp>
|
||||
#include <libobsensor/hpp/Frame.hpp>
|
||||
#include <libobsensor/hpp/Pipeline.hpp>
|
||||
#include <libobsensor/hpp/RecordPlayback.hpp>
|
||||
#include <libobsensor/hpp/Sensor.hpp>
|
||||
#include <libobsensor/hpp/StreamProfile.hpp>
|
||||
#include <libobsensor/hpp/Version.hpp>
|
||||
#include <libobsensor/hpp/TypeHelper.hpp>
|
||||
337
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Advanced.h
Normal file
337
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Advanced.h
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Get the current depth work mode.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode The current depth work mode.
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode ob_device_get_current_depth_work_mode(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get current depth mode name
|
||||
* @brief According the current preset name to return current depth mode name
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return the current depth mode name.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_depth_work_mode_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the depth work mode by ob_depth_work_mode.
|
||||
* Prefer to use ob_device_switch_depth_work_mode_by_name to switch depth mode when the complete name of the depth work mode is known.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] work_mode The depth work mode from ob_depth_work_mode_list which is returned by ob_device_get_depth_work_mode_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_device_switch_depth_work_mode(ob_device *device, const ob_depth_work_mode *work_mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the depth work mode by work mode name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] mode_name The depth work mode name which is equal to ob_depth_work_mode.name.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_device_switch_depth_work_mode_by_name(ob_device *device, const char *mode_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Request the list of supported depth work modes.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode_list The list of ob_depth_work_mode.
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode_list *ob_device_get_depth_work_mode_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the depth work mode count that ob_depth_work_mode_list hold
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The total number contained in ob_depth_work_mode_list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_depth_work_mode_list_get_count(const ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the index target of ob_depth_work_mode from work_mode_list
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[in] index Index of the target ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_work_mode_list *work_mode_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Free the resources of ob_depth_work_mode_list
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current preset name.
|
||||
* @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current preset name, it should be one of the preset names returned by @ref ob_device_get_available_preset_list.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_preset_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset list.
|
||||
* @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device
|
||||
* settings to update the user program temporarily.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] preset_name Pointer to an error object that will be set if an error occurs. The name should be one of the preset names returned by @ref
|
||||
* ob_device_get_available_preset_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Load preset from json string.
|
||||
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
|
||||
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] json_file_path The json file path.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Load custom preset from data.
|
||||
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
|
||||
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the @p presetName.
|
||||
*
|
||||
* @attention The user should ensure that the custom preset data is adapted to the device and the settings in the data are valid.
|
||||
* @attention It is recommended to re-read the device settings to update the user program temporarily after successfully loading the custom preset.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] presetName The name of the custome preset.
|
||||
* @param[in] data The custom preset data.
|
||||
* @param[in] size The size of the custom preset data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset_from_json_data(ob_device *device, const char *presetName, const uint8_t *data, uint32_t size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Export current settings as a preset json file.
|
||||
* @brief After exporting the custom preset, the available preset list will be appended with the custom preset and named as the file name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] json_file_path The json file path.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Export current device settings as a preset json data.
|
||||
* @brief After exporting the preset, a new preset named as the @p presetName will be added to the available preset list.
|
||||
*
|
||||
* @attention The memory of the data is allocated by the SDK, and will automatically be released by the SDK.
|
||||
* @attention The memory of the data will be reused by the SDK on the next call, so the user should copy the data to a new buffer if it needs to be
|
||||
* preserved.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] presetName The name of the custome preset.
|
||||
* @param[out] data Return the preset json data.
|
||||
* @param[out] dataSize Return the size of the preset json data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_export_current_settings_as_preset_json_data(ob_device *device, const char *presetName, const uint8_t **data, uint32_t *dataSize,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available preset list.
|
||||
*/
|
||||
OB_EXPORT ob_device_preset_list *ob_device_get_available_preset_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of preset in the preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of preset in the preset list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_preset_list_get_count(const ob_device_preset_list *preset_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the preset in the preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[in] index The index of the preset in the preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The name of the preset in the preset list.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_preset_list_get_name(const ob_device_preset_list *preset_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the preset list has the preset.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[in] preset_name The name of the preset.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return Whether the preset list has the preset. If true, the preset list has the preset. If false, the preset list does not have the preset.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_preset_list_has_preset(const ob_device_preset_list *preset_list, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the device supports the frame interleave feature.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Returns true if the device supports the frame interleave feature.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_frame_interleave_supported(const ob_device *device, ob_error **error);
|
||||
/**
|
||||
*
|
||||
* @brief load the frame interleave mode according to frame interleavee name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] frame_interleave_name The name should be one of the frame interleave names returned by @ref ob_device_get_available_frame_interleave_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_frame_interleave(ob_device *device, const char *frame_interleave_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available frame interleave list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available frame interleave list.
|
||||
*/
|
||||
OB_EXPORT ob_device_frame_interleave_list *ob_device_get_available_frame_interleave_list(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_frame_interleave_list(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of frame interleave in the frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of frame interleave in the frame interleave list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_frame_interleave_list_get_count(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of frame interleave in the frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[in] index The index of frame interleave in the frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The name of frame interleave in the frame interleave list..
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_frame_interleave_list_get_name(ob_device_frame_interleave_list *frame_interleave_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the interleave ae list has the interleave ae.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available interleave ae list.
|
||||
* @param[in] frame_interleave_name The name of the interleave ae.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return Whether the interleave ae list has the interleave ae. If true, the interleave ae list has the interleave ae. If false, the interleave ae list does
|
||||
* not have the interleave ae.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_frame_interleave_list_has_frame_interleave(ob_device_frame_interleave_list *frame_interleave_list, const char *frame_interleave_name,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset resolution config list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available frame resolution config list.
|
||||
*/
|
||||
OB_EXPORT ob_preset_resolution_config_list *ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of preset resolution in the preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of preset resolution in the preset resolution list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_preset_resolution_config_get_count(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the preset resolution in the preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[in] index The index of preset resolution in the preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The preset resolution in the preset resolution list.
|
||||
*/
|
||||
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_list,
|
||||
uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_preset_resolution_config_list(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_depth_work_mode_list_count ob_depth_work_mode_list_get_count
|
||||
#define ob_device_preset_list_count ob_device_preset_list_get_count
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
268
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Context.h
Normal file
268
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Context.h
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Context.h
|
||||
* @brief Context is a management class that describes the runtime of the SDK and is responsible for resource allocation and release of the SDK.
|
||||
* Context has the ability to manage multiple devices. It is responsible for enumerating devices, monitoring device callbacks, and enabling multi-device
|
||||
* synchronization.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a context object with the default configuration file
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
|
||||
*
|
||||
* @return Pointer to the created context object
|
||||
*/
|
||||
OB_EXPORT ob_context *ob_create_context(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a context object with a specified configuration file
|
||||
*
|
||||
* @param[in] config_file_path Path to the configuration file. If NULL, the default configuration file will be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
|
||||
*
|
||||
* @return Pointer to the created context object
|
||||
*/
|
||||
OB_EXPORT ob_context *ob_create_context_with_config(const char *config_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a context object
|
||||
*
|
||||
* @param[in] context Pointer to the context object to be deleted
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context deletion
|
||||
*/
|
||||
OB_EXPORT void ob_delete_context(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a list of enumerated devices
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device enumeration
|
||||
*
|
||||
* @return Pointer to the device list object
|
||||
*/
|
||||
OB_EXPORT ob_device_list *ob_query_device_list(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable network device enumeration
|
||||
* @brief After enabling, the network device will be automatically discovered and can be retrieved through @ref ob_query_device_list. The default state can be
|
||||
* set in the configuration file.
|
||||
*
|
||||
* @attention Network device enumeration is performed through the GVCP protocol. If the device is not in the same subnet as the host, it will be discovered but
|
||||
* cannot be connected.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] enable true to enable, false to disable
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_enable_net_device_enumeration(ob_context *context, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief "Force" a static IP address configuration in a device identified by its MAC Address.
|
||||
*
|
||||
* @param[in] macAddress MAC address of the network device.
|
||||
* You can obtain it from @ref ob_device_info_get_uid, or specify it manually
|
||||
* in the format xx:xx:xx:xx:xx:xx, where each xx is a two-digit hexadecimal value.
|
||||
* @param[in] config The new IP configuration.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*
|
||||
* @return bool true if the configuration command was processed successfully, false otherwise.
|
||||
*
|
||||
* @note This applies to all GigE Vision devices
|
||||
*/
|
||||
OB_EXPORT bool ob_force_ip_config(const char *macAddress, ob_net_ip_config config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a network device object
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] address IP address of the device
|
||||
* @param[in] port Port number of the device
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device creation
|
||||
*
|
||||
* @return Pointer to the created device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_net_device(ob_context *context, const char *address, uint16_t port, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a network device object
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] address IP address of the device
|
||||
* @param[in] port Port number of the device
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device creation
|
||||
*
|
||||
* @return Pointer to the created device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_net_device_ex(ob_context *context, const char *address, uint16_t port, ob_device_access_mode accessMode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a device plug-in callback function
|
||||
*
|
||||
* @deprecated This function is deprecated. Please use ob_register_device_changed_callback() instead.
|
||||
*
|
||||
* @attention The added and removed device lists returned through the callback interface need to be released manually
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Register a device plug-in callback function.
|
||||
*
|
||||
* This function registers a callback that will be triggered whenever a device is plugged in or unplugged.
|
||||
*
|
||||
* @attention The added and removed device lists returned through the callback interface need to be released manually.
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] context Pointer to the context object.
|
||||
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged.
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting.
|
||||
*
|
||||
* @return A ob_callback_id that uniquely identifies the registered callback.
|
||||
* This ID can be used later to unregister the callback with ob_unregister_device_changed_callback().
|
||||
* Returns INVALID_DEVICE_CHANGED_CALLBACK_ID if the registration fails.
|
||||
*/
|
||||
OB_EXPORT ob_callback_id ob_register_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Unregister a previously registered device plug-in callback function.
|
||||
*
|
||||
* This function removes a callback that was registered by ob_register_device_changed_callback().
|
||||
*
|
||||
* @param[in] context Pointer to the context object.
|
||||
* @param[in] callback_id The callback ID returned by ob_register_device_changed_callback().
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting.
|
||||
*/
|
||||
OB_EXPORT void ob_unregister_device_changed_callback(ob_context *context, ob_callback_id callback_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] repeat_interval_msec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during execution
|
||||
*/
|
||||
OB_EXPORT void ob_enable_device_clock_sync(ob_context *context, uint64_t repeat_interval_msec, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Free idle memory from the internal frame memory pool
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during memory freeing
|
||||
*/
|
||||
OB_EXPORT void ob_free_idle_memory(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
|
||||
* @brief It is effective when the new device is created.
|
||||
*
|
||||
* @attention This interface is only available for Linux.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] backend_type The backend type to be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during backend type setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_uvc_backend_type(ob_context *context, ob_uvc_backend_type backend_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the global log level
|
||||
*
|
||||
* @attention This interface setting will affect the output level of all logs (terminal, file, callback)
|
||||
*
|
||||
* @param[in] severity Log level to set
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log level setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_severity(ob_log_severity severity, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log output to a file
|
||||
*
|
||||
* @param[in] severity Log level to output to file
|
||||
* @param[in] directory Path to the log file output directory.
|
||||
* If empty, the existing configuration is used;
|
||||
* if the existing configuration is also empty,
|
||||
* the value from the config file or the default configuration will be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*
|
||||
* @note Other settings, such as log file name, remain unchanged.
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_file(ob_log_severity severity, const char *directory, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log file name for file output
|
||||
*
|
||||
* @param[in] file_name Log file name. Must not be empty.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @note Other settings, such as log level and output directory, remain unchanged.
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_file_name(const char *file_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log callback function
|
||||
*
|
||||
* @param[in] severity Log level to set for the callback function
|
||||
* @param[in] callback Pointer to the callback function
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log callback function setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_callback(ob_log_severity severity, ob_log_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log output to the console
|
||||
*
|
||||
* @param[in] severity Log level to output to the console
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_console(ob_log_severity severity, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Logs a message with severity, file, function, and line info.
|
||||
*
|
||||
* @param[in] severity Log level, see @ref ob_log_severity for details
|
||||
* @param[in] module The module or component the log belongs to
|
||||
* @param[in] message Message string to log
|
||||
* @param[in] file Source file name, e.g., __FILE__
|
||||
* @param[in] func Function name, e.g., __func__
|
||||
* @param[in] line Line number, e.g., __LINE__
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*/
|
||||
OB_EXPORT void ob_log_external_message(ob_log_severity severity, const char *module, const char *message, const char *file, const char *func, int line,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
* @param[in] directory Path to the extensions directory. If the path is empty, extensions path will be set to the current working directory.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during extensions directory setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_extensions_directory(const char *directory, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_enable_multi_device_sync ob_enable_device_clock_sync
|
||||
#define ob_set_logger_callback ob_set_logger_to_callback
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
873
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Device.h
Normal file
873
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Device.h
Normal file
|
|
@ -0,0 +1,873 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Device.h
|
||||
* @brief Device-related functions, including operations such as obtaining and creating a device, setting and obtaining device property, and obtaining sensors
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
#include "Property.h"
|
||||
#include "MultipleDevices.h"
|
||||
#include "Advanced.h"
|
||||
|
||||
/**
|
||||
* @brief Delete a device.
|
||||
*
|
||||
* @param[in] device The device to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_device(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief List all sensors.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_sensor_list* The list of all sensors.
|
||||
*/
|
||||
OB_EXPORT ob_sensor_list *ob_device_get_sensor_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a device's sensor.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] type The type of sensor to get.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_sensor* The acquired sensor.
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_device_get_sensor(ob_device *device, ob_sensor_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set an integer type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property to be set.
|
||||
* @param[in] value The property value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_int_property(ob_device *device, ob_property_id property_id, int32_t value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get an integer type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property ID.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int32_t The property value.
|
||||
*/
|
||||
OB_EXPORT int32_t ob_device_get_int_property(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the integer type of device property range.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property id.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The property range.
|
||||
*/
|
||||
OB_EXPORT ob_int_property_range ob_device_get_int_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a float type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property to be set.
|
||||
* @param[in] value The property value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_float_property(ob_device *device, ob_property_id property_id, float value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a float type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property ID.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The property value.
|
||||
*/
|
||||
OB_EXPORT float ob_device_get_float_property(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the float type of device property range.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property id.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The property range.
|
||||
*/
|
||||
OB_EXPORT ob_float_property_range ob_device_get_float_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a boolean type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property to be set.
|
||||
* @param[in] value The property value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_bool_property(ob_device *device, ob_property_id property_id, bool value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a boolean type of device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property ID.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool The property value.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_get_bool_property(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the boolean type of device property range.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property id.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The property range.
|
||||
*/
|
||||
OB_EXPORT ob_bool_property_range ob_device_get_bool_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set structured data.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property to be set.
|
||||
* @param[in] data The property data to be set.
|
||||
* @param[in] data_size The size of the property to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_structured_data(ob_device *device, ob_property_id property_id, const uint8_t *data, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get structured data of a device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property.
|
||||
* @param[out] data The obtained property data.
|
||||
* @param[out] data_size The size of the obtained property data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_get_structured_data(ob_device *device, ob_property_id property_id, uint8_t *data, uint32_t *data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get raw data of a device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The ID of the property.
|
||||
* @param[out] cb The get data callback.
|
||||
* @param[out] user_data User-defined data that will be returned in the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_get_raw_data(ob_device *device, ob_property_id property_id, ob_get_data_callback cb, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set customer data.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] data The property data to be set.
|
||||
* @param[in] data_size The size of the property to be set,the maximum length cannot exceed 65532 bytes.
|
||||
* @param[out] error Log error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_device_write_customer_data(ob_device *device, const void *data, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get customer data of a device property.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] data The obtained property data.
|
||||
* @param[out] data_size The size of the obtained property data.
|
||||
* @param[out] error Log error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_device_read_customer_data(ob_device *device, void *data, uint32_t *data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of properties supported by the device.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of properties supported by the device.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_get_supported_property_count(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the type of property supported by the device.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] index The property index.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The type of property supported by the device.
|
||||
*/
|
||||
OB_EXPORT ob_property_item ob_device_get_supported_property_item(const ob_device *device, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if a device property permission is supported.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] property_id The property id.
|
||||
* @param[in] permission The type of permission that needs to be interpreted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return Whether the property permission is supported.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_property_supported(const ob_device *device, ob_property_id property_id, ob_permission_type permission, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the device supports global timestamp.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Whether the device supports global timestamp.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_global_timestamp_supported(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable global timestamp.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] enable Whether to enable global timestamp.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_enable_global_timestamp(ob_device *device, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update the device firmware.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] path The firmware path.
|
||||
* @param[in] callback The firmware upgrade progress callback.
|
||||
* @param[in] async Whether to execute asynchronously.
|
||||
* @param[in] user_data User-defined data that will be returned in the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_update_firmware(ob_device *device, const char *path, ob_device_fw_update_callback callback, bool async, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update the device firmware from data.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] data The firmware file data.
|
||||
* @param[in] data_size The firmware file size.
|
||||
* @param[in] callback The firmware upgrade progress callback.
|
||||
* @param[in] async Whether to execute asynchronously.
|
||||
* @param[in] user_data User-defined data that will be returned in the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_update_firmware_from_data(ob_device *device, const uint8_t *data, uint32_t data_size, ob_device_fw_update_callback callback,
|
||||
bool async, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update the device optional depth presets.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] file_path_list A list(2D array) of preset file paths, each up to OB_PATH_MAX characters.
|
||||
* @param[in] path_count The number of the preset file paths.
|
||||
* @param[in] callback The preset upgrade progress callback.
|
||||
* @param[in] user_data User-defined data that will be returned in the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_update_optional_depth_presets(ob_device *device, const char file_path_list[][OB_PATH_MAX], uint8_t path_count,
|
||||
ob_device_fw_update_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Device reboot
|
||||
* @attention The device will be disconnected and reconnected. After the device is disconnected, the interface access to the device handle may be abnormal.
|
||||
* Please use the ob_delete_device interface to delete the handle directly. After the device is reconnected, it can be obtained again.
|
||||
*
|
||||
* @param[in] device Device object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_reboot(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current device status.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_state The device state information.
|
||||
*/
|
||||
OB_EXPORT ob_device_state ob_device_get_device_state(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the device state changed callback.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] callback The callback function to be called when the device status changes.
|
||||
* @param[in] user_data User-defined data that will be returned in the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_state_changed_callback(ob_device *device, ob_device_state_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable the device heartbeat.
|
||||
* @brief After enable the device heartbeat, the sdk will start a thread to send heartbeat signal to the device error every 3 seconds.
|
||||
|
||||
* @attention If the device does not receive the heartbeat signal for a long time, it will be disconnected and rebooted.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] enable Whether to enable the device heartbeat.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_enable_heartbeat(ob_device *device, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Send data to the device and receive data from the device.
|
||||
* @brief This is a factory and debug function, which can be used to send and receive data from the device. The data format is secret and belongs to the device
|
||||
* vendor.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] send_data The data to be sent to the device.
|
||||
* @param[in] send_data_size The size of the data to be sent to the device.
|
||||
* @param[out] receive_data The data received from the device.
|
||||
* @param[in,out] receive_data_size Pass in the expected size of the receive data, and return the actual size of the received data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_send_and_receive_data(ob_device *device, const uint8_t *send_data, uint32_t send_data_size, uint8_t *receive_data,
|
||||
uint32_t *receive_data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device information.
|
||||
*
|
||||
* @param[in] device The device to obtain information from.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_info* The device information.
|
||||
*/
|
||||
OB_EXPORT ob_device_info *ob_device_get_device_info(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete device information.
|
||||
*
|
||||
* @param[in] info The device information to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_device_info(ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device name
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return the device name
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_name(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device pid
|
||||
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int return the device pid
|
||||
*/
|
||||
OB_EXPORT int ob_device_info_get_pid(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device vid
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int return device vid
|
||||
*/
|
||||
OB_EXPORT int ob_device_info_get_vid(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device uid
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return device uid
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_uid(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device serial number
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return device serial number
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_serial_number(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the firmware version number
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int return the firmware version number
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_firmware_version(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device connection type
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet", "GMSL2"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_connection_type(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device IP address
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0.0.0.0"
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The IP address, such as "192.168.1.10"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_ip_address(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the network device subnet mask
|
||||
*
|
||||
* @param[in] info Device information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* The subnet mask, such as "255.255.255.0"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_subnet_mask(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the network device gateway address
|
||||
*
|
||||
* @param[in] info Device information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The gateway address, such as "192.168.1.1"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_gateway(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the hardware version number
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The hardware version number
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_hardware_version(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the device extension information exists.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] info_key The key of the device extension information.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Whether the device extension information exists.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_extension_info_exist(const ob_device *device, const char *info_key, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device extension information.
|
||||
* @brief Extension information is a set of key-value pair of string, user cat get the information by the key.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] info_key The key of the device extension information.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The device extension information
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_extension_info(const ob_device *device, const char *info_key, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the minimum SDK version number supported by the device
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The minimum SDK version number supported by the device
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_supported_min_sdk_version(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the chip name
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The ASIC name
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_asicName(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device type
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_type The device type
|
||||
*/
|
||||
OB_EXPORT ob_device_type ob_device_info_get_device_type(const ob_device_info *info, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a device list.
|
||||
*
|
||||
* @param[in] list The device list object to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_device_list(ob_device_list *list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of devices
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the number of devices
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_list_get_count(const ob_device_list *list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device name
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return device name
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_name(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the pid of the specified device
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int return the device pid
|
||||
*/
|
||||
OB_EXPORT int ob_device_list_get_device_pid(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the vid of the specified device
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int return device vid
|
||||
*/
|
||||
OB_EXPORT int ob_device_list_get_device_vid(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the uid of the specified device
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return the device uid
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_uid(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the serial number of the specified device.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] index Device index.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The device UID.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_serial_number(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device connection type
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* returns the device connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2",
|
||||
* "Ethernet", "GMSL2"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_connection_type(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device ip address
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0.0.0.0".
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* returns the device ip address, such as "192.168.1.10"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_ip_address(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device subnet mask
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0.0.0.0".
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* returns the device subnet mask, such as "255.255.255.0"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_subnet_mask(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device gateway
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0.0.0.0".
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* returns the device gateway, such as "192.168.1.1"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_gateway(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the MAC address of the host network interface corresponding to the network device.
|
||||
*
|
||||
* @attention Only valid for network devices. Returns "0:0:0:0:0:0" for non-network devices.
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The MAC address of the host network interface associated with the device.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_local_mac(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the IP address of the host network interface corresponding to the network device.
|
||||
*
|
||||
* @attention Only valid for network devices. Returns "0.0.0.0" for non-network devices.
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The IP address of the host network interface associated with the device.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_local_ip(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the subnet length of the host network interface corresponding to the network device.
|
||||
*
|
||||
* @attention Only valid for network devices. Returns 0 for non-network devices.
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const uint8_t The subnet length (0~32) of the host network interface associated with the device.
|
||||
*/
|
||||
OB_EXPORT uint8_t ob_device_list_get_device_local_subnet_length(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the gateway of the host network interface corresponding to the network device.
|
||||
*
|
||||
* @attention Only valid for network devices. Returns "0.0.0.0" for non-network devices.
|
||||
*
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The gateway of the host network interface associated with the device.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_local_gateway(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a device.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] index The index of the device to create.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*
|
||||
* @note Default access mode is OB_DEVICE_DEFAULT_ACCESS
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a device.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] index The index of the device to create.
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device_ex(const ob_device_list *list, uint32_t index, ob_device_access_mode accessMode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a device.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] serial_number The serial number of the device to create.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*
|
||||
* @note Default access mode is OB_DEVICE_DEFAULT_ACCESS
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device_by_serial_number(const ob_device_list *list, const char *serial_number, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a device.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] serial_number The serial number of the device to create.
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device_by_serial_number_ex(const ob_device_list *list, const char *serial_number, ob_device_access_mode accessMode,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create device by uid
|
||||
* @brief On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number and
|
||||
* only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port. Similarly,
|
||||
* users can also directly pass in bus-port as uid to create device.
|
||||
* @brief For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] uid The UID of the device to create.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*
|
||||
* @note Default access mode is OB_DEVICE_DEFAULT_ACCESS
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device_by_uid(const ob_device_list *list, const char *uid, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create device by uid
|
||||
* @brief On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number and
|
||||
* only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port. Similarly,
|
||||
* users can also directly pass in bus-port as uid to create device.
|
||||
* @brief For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
* @param[in] list Device list object.
|
||||
* @param[in] uid The UID of the device to create.
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The created device.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_device_list_get_device_by_uid_ex(const ob_device_list *list, const char *uid, ob_device_access_mode accessMode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the original parameter list of camera calibration saved on the device.
|
||||
*
|
||||
* @attention The parameters in the list do not correspond to the current open-stream configuration.You need to select the parameters according to the actual
|
||||
* situation, and may need to do scaling, mirroring and other processing. Non-professional users are recommended to use the ob_pipeline_get_camera_param()
|
||||
* interface.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Log error messages.
|
||||
*
|
||||
* @return ob_camera_param_list The camera parameter list.
|
||||
*/
|
||||
OB_EXPORT ob_camera_param_list *ob_device_get_calibration_camera_param_list(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of camera parameter lists
|
||||
*
|
||||
* @param[in] param_list Camera parameter list
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return uint32_t The number of lists
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_camera_param_list_get_count(ob_camera_param_list *param_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get camera parameters from the camera parameter list
|
||||
*
|
||||
* @param[in] param_list Camera parameter list
|
||||
* @param[in] index Parameter index
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_camera_param The camera parameters. Since it returns the structure object directly, there is no need to provide a delete interface.
|
||||
*/
|
||||
OB_EXPORT ob_camera_param ob_camera_param_list_get_param(ob_camera_param_list *param_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the camera parameter list
|
||||
*
|
||||
* @param[in] param_list Camera parameter list
|
||||
* @param[out] error Log error messages
|
||||
*/
|
||||
OB_EXPORT void ob_delete_camera_param_list(ob_camera_param_list *param_list, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_device_list_device_count ob_device_list_get_count
|
||||
#define ob_device_list_get_extension_info ob_device_info_get_extension_info
|
||||
#define ob_device_upgrade ob_device_update_firmware
|
||||
#define ob_device_upgrade_from_data ob_device_update_firmware_from_data
|
||||
#define ob_device_get_supported_property ob_device_get_supported_property_item
|
||||
#define ob_device_state_changed ob_device_set_state_changed_callback
|
||||
#define ob_device_info_name ob_device_info_get_name
|
||||
#define ob_device_info_pid ob_device_info_get_pid
|
||||
#define ob_device_info_vid ob_device_info_get_vid
|
||||
#define ob_device_info_uid ob_device_info_get_uid
|
||||
#define ob_device_info_serial_number ob_device_info_get_serial_number
|
||||
#define ob_device_info_firmware_version ob_device_info_get_firmware_version
|
||||
#define ob_device_info_connection_type ob_device_info_get_connection_type
|
||||
#define ob_device_info_ip_address ob_device_info_get_ip_address
|
||||
#define ob_device_info_hardware_version ob_device_info_get_hardware_version
|
||||
#define ob_device_info_supported_min_sdk_version ob_device_info_get_supported_min_sdk_version
|
||||
#define ob_device_info_asicName ob_device_info_get_asicName
|
||||
#define ob_device_info_device_type ob_device_info_get_device_type
|
||||
#define ob_device_list_get_device_count ob_device_list_get_count
|
||||
#define ob_camera_param_list_count ob_camera_param_list_get_count
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
85
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Error.h
Normal file
85
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Error.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Error.h
|
||||
* @brief Functions for handling errors, mainly used for obtaining error messages.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a new error object.
|
||||
*
|
||||
* @param[in] status The error status.
|
||||
* @param[in] message The error message.
|
||||
* @param[in] function The name of the API function that caused the error.
|
||||
* @param[in] args The error parameters.
|
||||
* @param[in] exception_type The type of exception that caused the error.
|
||||
*
|
||||
* @return ob_error* The new error object.
|
||||
*/
|
||||
OB_EXPORT ob_error *ob_create_error(ob_status status, const char *message, const char *function, const char *args, ob_exception_type exception_type);
|
||||
|
||||
/**
|
||||
* @brief Get the error status.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error status.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_error_get_status(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the error message.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error message.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_message(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the API function that caused the error.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The name of the API function.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_function(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the error parameters.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error parameters.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_args(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the type of exception that caused the error.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The type of exception.
|
||||
*/
|
||||
OB_EXPORT ob_exception_type ob_error_get_exception_type(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Delete the error object.
|
||||
*
|
||||
* @param[in] error The error object to delete, you should set the pointer to NULL after calling this function.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_error(ob_error *error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_error_status ob_error_get_status
|
||||
#define ob_error_message ob_error_get_message
|
||||
#define ob_error_function ob_error_get_function
|
||||
#define ob_error_args ob_error_get_args
|
||||
#define ob_error_exception_type ob_error_get_exception_type
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
43
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Export.h
Normal file
43
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Export.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
#ifndef OB_EXPORT_H
|
||||
#define OB_EXPORT_H
|
||||
|
||||
#ifdef OB_STATIC_DEFINE
|
||||
# define OB_EXPORT
|
||||
# define OB_NO_EXPORT
|
||||
#else
|
||||
# ifndef OB_EXPORT
|
||||
# ifdef OrbbecSDK_EXPORTS
|
||||
/* We are building this library */
|
||||
# define OB_EXPORT __attribute__((visibility("default")))
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define OB_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef OB_NO_EXPORT
|
||||
# define OB_NO_EXPORT __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED
|
||||
# define OB_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED_EXPORT
|
||||
# define OB_DEPRECATED_EXPORT OB_EXPORT OB_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED_NO_EXPORT
|
||||
# define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED
|
||||
#endif
|
||||
|
||||
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef OB_NO_DEPRECATED
|
||||
# define OB_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* OB_EXPORT_H */
|
||||
273
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Filter.h
Normal file
273
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Filter.h
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Filter.h
|
||||
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a Filter object.
|
||||
*
|
||||
* @attention If the filter of the specified name is a private filter, and the creator of the filter have not been activated, the function will return NULL.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_create_filter(const char *name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of ob_filter
|
||||
*
|
||||
* @param[in] filter ob_filter object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return char The filter of name
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_name(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the vendor specific code of a filter by filter name.
|
||||
* @brief A private filter can define its own vendor specific code for specific purposes.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* Return the vendor specific code of the filter.
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_vendor_specific_code(const char *name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a private Filter object with activation key.
|
||||
* @brief Some private filters require an activation key to be activated, its depends on the vendor of the filter.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[in] activation_key The activation key of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter* Return the private filter object.
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_create_private_filter(const char *name, const char *activation_key, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the filter.
|
||||
*
|
||||
* @param[in] filter The filter object to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter(ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get config schema of the filter
|
||||
* @brief The returned string is a csv format string representing the configuration schema of the filter. The format of the string is:
|
||||
* `<parameter_name>`, `<parameter_type: "int", "float", "bool">`, `<minimum_value>`, `<maximum_value>`, `<value_step>`, `<default_value>`,
|
||||
* `<parameter_description>`
|
||||
*
|
||||
* @param[in] filter The filter object to get the configuration schema for
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*
|
||||
* @return A csv format string representing the configuration schema of the filter
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_config_schema(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter config schema list of the filter
|
||||
* @brief The returned string is a list of ob_config_schema_item representing the configuration schema of the filter.
|
||||
*
|
||||
* @attention The returned list should be deleted by calling @ref ob_delete_filter_config_schema_list when it is no longer needed.
|
||||
*
|
||||
* @param[in] filter The filter object to get the configuration schema for
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*
|
||||
* @return ob_filter_config_schema_list* Return the filter config schema list of the filter
|
||||
*/
|
||||
OB_EXPORT ob_filter_config_schema_list *ob_filter_get_config_schema_list(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of filter config schema items.
|
||||
*
|
||||
* @param[in] config_schema_list The list of filter config schema items to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter_config_schema_list(ob_filter_config_schema_list *config_schema_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update config of the filter
|
||||
*
|
||||
* @attention The passed in argc and argv must match the configuration schema returned by the @ref ob_filter_get_config_schema function.
|
||||
*
|
||||
* @param[in] filter The filter object to update the configuration for
|
||||
* @param[in] argc The number of arguments in the argv array
|
||||
* @param[in] argv An array of strings representing the configuration values
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*/
|
||||
OB_EXPORT void ob_filter_update_config(ob_filter *filter, uint8_t argc, const char **argv, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter config value by name and cast to double.
|
||||
*
|
||||
* @attention The returned value is cast to double, the actual type of the value depends on the filter config schema returned by @ref
|
||||
* ob_filter_get_config_schema.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] config_name config name
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return double The value of the config.
|
||||
*/
|
||||
OB_EXPORT double ob_filter_get_config_value(const ob_filter *filter, const char *config_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the filter config value by name.
|
||||
*
|
||||
* @attention The pass into value type is double, witch will be cast to the actual type inside the filter. The actual type can be queried by the filter config
|
||||
* schema returned by @ref ob_filter_get_config_schema.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] config_name config name
|
||||
* @param[in] value The value to set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_set_config_value(ob_filter *filter, const char *config_name, double value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Reset the filter, clears the cache, and resets the state. If the asynchronous interface is used, the processing thread will also be stopped and the
|
||||
* pending cache frames will be cleared.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_reset(ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable the frame post processing
|
||||
* @brief The filter default is enable.
|
||||
*
|
||||
* @attention If the filter has been disabled by calling this function, processing will directly output a clone of the input frame.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] enable enable status, true: enable; false: disable.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_enable(ob_filter *filter, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the enable status of the frame post processing
|
||||
*
|
||||
* @attention If the filter is disabled, the processing will directly output a clone of the input frame.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The post processing filter status. True: enable; False: disable.
|
||||
*/
|
||||
OB_EXPORT bool ob_filter_is_enabled(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Process the frame (synchronous interface).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] frame Pointer to the frame object to be processed.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The frame object processed by the filter.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_filter_process(ob_filter *filter, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the processing result callback function for the filter (asynchronous callback interface).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] callback Callback function.
|
||||
* @param[in] user_data Arbitrary user data pointer can be passed in and returned from the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_set_callback(ob_filter *filter, ob_filter_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Push the frame into the pending cache for the filter (asynchronous callback interface).
|
||||
* @brief The frame will be processed by the filter when the processing thread is available and return a new processed frame to the callback function.
|
||||
*
|
||||
* @attention The frame object will be add reference count, so the user still need call @ref ob_delete_frame to release the frame after calling this function.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] frame Pointer to the frame object to be processed.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_push_frame(ob_filter *filter, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of filter in the list
|
||||
*
|
||||
* @param[in] filter_list filter list
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_filter_list_get_count(const ob_filter_list *filter_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter by index
|
||||
*
|
||||
* @param[in] filter_list Filter list
|
||||
* @param[in] index Filter index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter The index of ob_filter
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_filter_list_get_filter(const ob_filter_list *filter_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of ob_filter objects.
|
||||
*
|
||||
* @param[in] filter_list The list of ob_filter objects to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter_list(ob_filter_list *filter_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of config schema items in the config schema list
|
||||
*
|
||||
* @param[in] config_schema_list Filter config schema list
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of config schema items in the filter list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_filter_config_schema_list_get_count(const ob_filter_config_schema_list *config_schema_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the config schema item by index
|
||||
*
|
||||
* @param[in] config_schema_list Filter config schema list
|
||||
* @param[in] index Config schema item index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_filter_config_schema_item* The config schema item by index
|
||||
*/
|
||||
OB_EXPORT ob_filter_config_schema_item ob_filter_config_schema_list_get_item(const ob_filter_config_schema_list *config_schema_list, uint32_t index,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the align to stream profile for the align filter.
|
||||
* @brief It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] align_to_stream_profile The align target stream profile.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_align_filter_set_align_to_stream_profile(ob_filter *filter, const ob_stream_profile *align_to_stream_profile, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_get_filter ob_filter_list_get_filter
|
||||
#define ob_get_filter_name ob_filter_get_name
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
686
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Frame.h
Normal file
686
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Frame.h
Normal file
|
|
@ -0,0 +1,686 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Frame.h
|
||||
* @brief Frame related function is mainly used to obtain frame data and frame information
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Crate a frame object based on the specified parameters.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type The frame object type.
|
||||
* @param[in] format The frame object format.
|
||||
* @param[in] data_size The size of the frame object data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame(ob_frame_type frame_type, ob_format format, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create (clone) a frame object based on the specified other frame object.
|
||||
* @brief The new frame object will have the same properties as the other frame object, but the data buffer is newly allocated.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] other_frame The frame object to create the new frame object according to.
|
||||
* @param[in] should_copy_data If true, the data of the source frame object will be copied to the new frame object. If false, the new frame object will
|
||||
* have a data buffer with random data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the new frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_other_frame(const ob_frame *other_frame, bool should_copy_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a frame object according to the specified stream profile.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no logger needed.
|
||||
*
|
||||
* @param[in] stream_profile The stream profile to create the new frame object according to.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the new frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_stream_profile(const ob_stream_profile *stream_profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create an video frame object based on the specified parameters.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] width Frame object width.
|
||||
* @param[in] height Frame object height.
|
||||
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return an empty frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_video_frame(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a frame object based on an externally created buffer.
|
||||
*
|
||||
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] buffer Frame object buffer.
|
||||
* @param[in] buffer_size Frame object buffer size.
|
||||
* @param[in] buffer_destroy_cb Destroy callback, will be called when the frame object is destroyed.
|
||||
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint8_t *buffer, uint32_t buffer_size,
|
||||
ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a video frame object based on an externally created buffer.
|
||||
*
|
||||
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] width Frame object width.
|
||||
* @param[in] height Frame object height.
|
||||
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
|
||||
* @param[in] buffer Frame object buffer.
|
||||
* @param[in] buffer_size Frame object buffer size.
|
||||
* @param[in] buffer_destroy_cb Destroy callback, user-defined function to destroy the buffer.
|
||||
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_video_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes,
|
||||
uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb,
|
||||
void *buffer_destroy_context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create an empty frameset object.
|
||||
* @brief A frameset object is a special type of frame object that can be used to store multiple frames.
|
||||
*
|
||||
* @attention The frameset object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it
|
||||
* is no longer needed.
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_frame* Return the frameset object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frameset(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Increase the reference count of a frame object.
|
||||
* @brief The reference count is used to manage the lifetime of the frame object.
|
||||
*
|
||||
* @attention When calling this function, the reference count of the frame object is
|
||||
* increased and requires to be decreased by calling @ref ob_delete_frame().
|
||||
*
|
||||
* @param[in] frame Frame object to increase the reference count.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_add_ref(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a frame object
|
||||
* @brief This function will decrease the reference count of the frame object and release the memory if the reference count becomes 0.
|
||||
*
|
||||
* @param[in] frame The frame object to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the information of the source frame object to the destination frame object.
|
||||
* @brief Including the index, timestamp, system timestamp, global timestamp and metadata will be copied.
|
||||
*
|
||||
* @param[in] src_frame Source frame object to copy the information from.
|
||||
* @param[in] dst_frame Destination frame object to copy the information to.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_copy_info(const ob_frame *src_frame, ob_frame *dst_frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame index
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log wrong message
|
||||
*
|
||||
* @return uint64_t return the frame index
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_index(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame format
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_format return the frame format
|
||||
*/
|
||||
OB_EXPORT ob_format ob_frame_get_format(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame type
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame_type return the frame type
|
||||
*/
|
||||
OB_EXPORT ob_frame_type ob_frame_get_type(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame timestamp (also known as device timestamp, hardware timestamp) of the frame in microseconds.
|
||||
* @brief The hardware timestamp is the time point when the frame was captured by the device (Typically in the mid-exposure, unless otherwise stated), on device
|
||||
* clock domain.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t return the frame hardware timestamp in microseconds
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the frame timestamp (also known as the device timestamp, hardware timestamp) of a frame object.
|
||||
*
|
||||
* @param[in] frame Frame object to set the timestamp.
|
||||
* @param[in] timestamp_us frame timestamp to set in microseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_timestamp_us(ob_frame *frame, uint64_t timestamp_us, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the system timestamp of the frame in microseconds.
|
||||
* @brief The system timestamp is the time point when the frame was received by the host, on host clock domain.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t return the frame system timestamp in microseconds
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_system_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the system timestamp of the frame in microseconds.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] system_timestamp_us frame system timestamp to set in microseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system_timestamp_us, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the global timestamp of the frame in microseconds.
|
||||
* @brief The global timestamp is the time point when the frame was captured by the device, and has been converted to the host clock domain. The
|
||||
* conversion process base on the frame timestamp and can eliminate the timer drift of the device
|
||||
*
|
||||
* @attention The global timestamp is disabled by default. If global timestamp is not enabled, the function will return 0. To enable it, call @ref
|
||||
* ob_device_enable_global_timestamp() function.
|
||||
* @attention Only some models of device support getting the global timestamp. Check the device support status by @ref
|
||||
* ob_device_is_global_timestamp_supported() function.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t The global timestamp of the frame in microseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_global_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the data buffer of a frame.
|
||||
*
|
||||
* @attention The returned data buffer is mutable, but it is not recommended to modify it directly. Modifying the data directly may cause issues if the frame is
|
||||
* being used in other threads or future use. If you need to modify the data, it is recommended to create a new frame object.
|
||||
*
|
||||
* @param[in] frame The frame object from which to retrieve the data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint8_t* Pointer to the frame data buffer.
|
||||
*/
|
||||
OB_EXPORT uint8_t *ob_frame_get_data(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update the data of a frame.
|
||||
* @brief The data will be memcpy to the frame data buffer.
|
||||
* @brief The frame data size will be also updated as the input data size.
|
||||
*
|
||||
* @attention It is not recommended to update the frame data if the frame was not created by the user. If you must update it, ensure that the frame is not being
|
||||
* used in other threads.
|
||||
* @attention The size of the new data should be equal to or less than the current data size of the frame. Exceeding the original size may cause memory
|
||||
* exceptions.
|
||||
*
|
||||
* @param[in] frame The frame object to update.
|
||||
* @param[in] data The new data to update the frame with.
|
||||
* @param[in] data_size The size of the new data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_update_data(ob_frame *frame, const uint8_t *data, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame data size
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame data size
|
||||
* If it is point cloud data, it return the number of bytes occupied by all point sets. If you need to find the number of points, you need to divide dataSize
|
||||
* by the structure size of the corresponding point type.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frame_get_data_size(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the metadata of the frame
|
||||
*
|
||||
* @attention The returned metadata is mutable, but it is not recommended to modify it directly. Modifying the metadata directly may cause issues if the frame
|
||||
* is being used in other threads or future use. If you need to modify the metadata, it is recommended to create a new frame object.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const uint8_t * return the metadata pointer of the frame
|
||||
*/
|
||||
OB_EXPORT uint8_t *ob_frame_get_metadata(const ob_frame *frame, ob_error **error);
|
||||
#define ob_video_frame_metadata ob_frame_get_metadata // for compatibility
|
||||
|
||||
/**
|
||||
* @brief Get the metadata size of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the metadata size of the frame
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frame_get_metadata_size(const ob_frame *frame, ob_error **error);
|
||||
#define ob_video_frame_metadata_size ob_frame_get_metadata_size // for compatibility
|
||||
|
||||
/**
|
||||
* @brief Update the metadata of the frame
|
||||
* @brief The metadata will be memcpy to the frame metadata buffer.
|
||||
* @brief The frame metadata size will be also updated as the input metadata size.
|
||||
*
|
||||
* @attention It is not recommended to update the frame metadata if the frame was not created by the user. If you must update it, ensure that the frame is not
|
||||
* being used in other threads or future use.
|
||||
* @attention The metadata size should be equal to or less than 256 bytes, otherwise it will cause memory exception.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] metadata The new metadata to update.
|
||||
* @param[in] metadata_size The size of the new metadata.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_update_metadata(ob_frame *frame, const uint8_t *metadata, uint32_t metadata_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief check if the frame contains the specified metadata
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT bool ob_frame_has_metadata(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the metadata value of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int64_t return the metadata value of the frame
|
||||
*/
|
||||
OB_EXPORT int64_t ob_frame_get_metadata_value(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_stream_profile() to release the return stream profile.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_stream_profile* Return the stream profile of the frame, if the frame is not captured by a sensor stream, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_frame_get_stream_profile(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set (override) the stream profile of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] stream_profile The stream profile to set for the frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_stream_profile(ob_frame *frame, const ob_stream_profile *stream_profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sensor of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_sensor() to release the return sensor.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_sensor* return the sensor of the frame, if the frame is not captured by a sensor or the sensor stream has been destroyed, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_frame_get_sensor(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_device() to release the return device.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* return the device of the frame, if the frame is not captured by a sensor stream or the device has been destroyed, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_frame_get_device(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame width
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame width
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_frame_get_width(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame height
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame height
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_frame_get_height(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame pixel format
|
||||
* @brief Usually used to determine the pixel type of depth frame (depth, disparity, raw phase, etc.)
|
||||
*
|
||||
* @attention Always return OB_PIXEL_UNKNOWN for non-depth frame currently if user has not set the pixel type by @ref ob_video_frame_set_pixel_type()
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pixel_type return the pixel format of the frame.
|
||||
*/
|
||||
OB_EXPORT ob_pixel_type ob_video_frame_get_pixel_type(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set video frame pixel format
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] pixel_type the pixel format of the frame
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_frame_set_pixel_type(ob_frame *frame, ob_pixel_type pixel_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @param[in] frame video frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint8_t return the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
*/
|
||||
OB_EXPORT uint8_t ob_video_frame_get_pixel_available_bit_size(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @param[in] frame video frame object
|
||||
* @param[in] bit_size the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_frame_set_pixel_available_bit_size(ob_frame *frame, uint8_t bit_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
|
||||
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The value scale of the depth frame
|
||||
*/
|
||||
OB_EXPORT float ob_depth_frame_get_value_scale(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
|
||||
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] value_scale The value scale of the depth frame
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_depth_frame_set_value_scale(ob_frame *frame, float value_scale, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the point coordinate value scale of the points frame. The point position value of the points frame is multiplied by the scale to give a position
|
||||
* value in millimeters. For example, if scale=0.1, the x-coordinate value of a point is x = 10000, which means that the actual x-coordinate value = x*scale =
|
||||
* 10000*0.1 = 1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The coordinate value scale of the points frame
|
||||
*/
|
||||
OB_EXPORT float ob_points_frame_get_coordinate_value_scale(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get accelerometer frame data.
|
||||
*
|
||||
* @param[in] frame Accelerometer frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_accel_value Return the accelerometer data.
|
||||
*/
|
||||
OB_EXPORT ob_accel_value ob_accel_frame_get_value(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature when acquiring the accelerometer frame.
|
||||
*
|
||||
* @param[in] frame Accelerometer frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float Return the temperature value.
|
||||
*/
|
||||
OB_EXPORT float ob_accel_frame_get_temperature(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get gyroscope frame data.
|
||||
*
|
||||
* @param[in] frame Gyroscope frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_gyro_value Return the gyroscope data.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_value ob_gyro_frame_get_value(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature when acquiring the gyroscope frame.
|
||||
*
|
||||
* @param[in] frame Gyroscope frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float Return the temperature value.
|
||||
*/
|
||||
OB_EXPORT float ob_gyro_frame_get_temperature(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of frames contained in the frameset
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset frameset object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the number of frames
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frameset_get_count(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the depth frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the depth frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_depth_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the color frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the color frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_color_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the infrared frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the infrared frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_ir_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the point cloud frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_points_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a frame of a specific type from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] frame_type Frame type.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame of the specified type, or nullptr if it does not exist.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_frame(const ob_frame *frameset, ob_frame_type frame_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a frame at a specific index from the FrameSet
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] index The index of the frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame at the specified index, or nullptr if it does not exist.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_frame_by_index(const ob_frame *frameset, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Push a frame to the frameset
|
||||
*
|
||||
* @attention If a frame with same type already exists in the frameset, it will be replaced by the new frame.
|
||||
* @attention The frame push to the frameset will be add reference count, so you still need to call @ref ob_delete_frame() to decrease the reference count when
|
||||
* it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] frame Frame object to push.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame width
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the point cloud frame width
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame height
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the point cloud frame height
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_frame_index ob_frame_get_index
|
||||
#define ob_frame_format ob_frame_get_format
|
||||
#define ob_frame_time_stamp_us ob_frame_get_timestamp_us
|
||||
#define ob_frame_set_device_time_stamp_us ob_frame_set_timestamp_us
|
||||
#define ob_frame_system_time_stamp_us ob_frame_get_system_timestamp_us
|
||||
#define ob_frame_global_time_stamp_us ob_frame_get_global_timestamp_us
|
||||
#define ob_frame_data ob_frame_get_data
|
||||
#define ob_frame_data_size ob_frame_get_data_size
|
||||
#define ob_frame_metadata ob_frame_get_metadata
|
||||
#define ob_frame_metadata_size ob_frame_get_metadata_size
|
||||
#define ob_video_frame_width ob_video_frame_get_width
|
||||
#define ob_video_frame_height ob_video_frame_get_height
|
||||
#define ob_video_frame_pixel_available_bit_size ob_video_frame_get_pixel_available_bit_size
|
||||
#define ob_points_frame_get_position_value_scale ob_points_frame_get_coordinate_value_scale
|
||||
#define ob_frameset_frame_count ob_frameset_get_count
|
||||
#define ob_frameset_depth_frame ob_frameset_get_depth_frame
|
||||
#define ob_frameset_color_frame ob_frameset_get_color_frame
|
||||
#define ob_frameset_ir_frame ob_frameset_get_ir_frame
|
||||
#define ob_frameset_points_frame ob_frameset_get_points_frame
|
||||
#define ob_accel_frame_value ob_accel_frame_get_value
|
||||
#define ob_accel_frame_temperature ob_accel_frame_get_temperature
|
||||
#define ob_gyro_frame_value ob_gyro_frame_get_value
|
||||
#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
|
||||
#define ob_frameset_get_frame_count ob_frameset_get_count
|
||||
|
||||
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err) / 1000)
|
||||
#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
|
||||
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
|
||||
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file MultipleDevices.h
|
||||
* @brief This file contains the multiple devices related API witch is used to control the synchronization between multiple devices and the synchronization
|
||||
* between different sensor within single device.
|
||||
* @brief The synchronization between multiple devices is complex, and different models have different synchronization modes and limitations. please refer to
|
||||
* the product manual for details.
|
||||
* @brief As the Depth and Infrared are the same sensor physically, the behavior of the Infrared is same as the Depth in the synchronization mode.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
#include "Device.h"
|
||||
|
||||
/**
|
||||
* @brief Get the supported multi device sync mode bitmap of the device.
|
||||
* @brief For example, if the return value is 0b00001100, it means the device supports @ref OB_MULTI_DEVICE_SYNC_MODE_PRIMARY and @ref
|
||||
* OB_MULTI_DEVICE_SYNC_MODE_SECONDARY. User can check the supported mode by the code:
|
||||
* ```c
|
||||
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN){
|
||||
* //support OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN
|
||||
* }
|
||||
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_STANDALONE){
|
||||
* //support OB_MULTI_DEVICE_SYNC_MODE_STANDALONE
|
||||
* }
|
||||
* // and so on
|
||||
* ```
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint16_t return the supported multi device sync mode bitmap of the device.
|
||||
*/
|
||||
OB_EXPORT uint16_t ob_device_get_supported_multi_device_sync_mode_bitmap(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief set the multi device sync configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[in] config The multi device sync configuration.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_multi_device_sync_config(ob_device *device, const ob_multi_device_sync_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief get the current multi device sync configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_multi_device_sync_config return the multi device sync configuration of the device.
|
||||
*/
|
||||
OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief send the capture command to the device to trigger the capture.
|
||||
* @brief The device will start one time capture after receiving the capture command when it is in the @ref OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING
|
||||
*
|
||||
* @attention The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream. The
|
||||
* number of frames per trigger can be set by @ref ob_multi_device_sync_config::framesPerTrigger.
|
||||
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
|
||||
* function should not be too high, please refer to the product manual for the specific supported frequency.
|
||||
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_trigger_capture(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief set the timestamp reset configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[in] config The timestamp reset configuration.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_timestamp_reset_config(ob_device *device, const ob_device_timestamp_reset_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief get the timestamp reset configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_timestamp_reset_config return the timestamp reset configuration of the device.
|
||||
*/
|
||||
OB_EXPORT ob_device_timestamp_reset_config ob_device_get_timestamp_reset_config(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief send the timestamp reset command to the device.
|
||||
* @brief The device will reset the timer for calculating the timestamp for output frames to 0 after receiving the timestamp reset command when the timestamp
|
||||
* reset function is enabled. The timestamp reset function can be enabled by call @ref ob_device_set_timestamp_reset_config.
|
||||
*
|
||||
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will jump once after the timestamp reset.
|
||||
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
|
||||
* can call this function periodically to reset the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_timestamp_reset(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Alias for @ref ob_device_timestamp_reset since it is more accurate.
|
||||
*/
|
||||
#define ob_device_timer_reset ob_device_timestamp_reset
|
||||
|
||||
/**
|
||||
* @brief synchronize the timer of the device with the host.
|
||||
* @brief After calling this function, the timer of the device will be synchronized with the host. User can call this function to multiple devices to
|
||||
* synchronize all timers of the devices.
|
||||
*
|
||||
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will may jump once after the timer sync.
|
||||
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
|
||||
* can call this function periodically to synchronize the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_timer_sync_with_host(ob_device *device, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
2058
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h
Normal file
2058
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h
Normal file
File diff suppressed because it is too large
Load diff
372
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h
Normal file
372
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Pipeline.h
|
||||
* @brief The SDK's advanced API can quickly implement functions such as switching streaming, frame synchronization, software filtering, etc., suitable for
|
||||
* applications, and the algorithm focuses on rgbd data stream scenarios. If you are on real-time or need to handle synchronization separately, align the scene.
|
||||
* Please use the interface of Device's Lower API.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a pipeline object
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pipeline* return the pipeline object
|
||||
*/
|
||||
OB_EXPORT ob_pipeline *ob_create_pipeline(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Using device objects to create pipeline objects
|
||||
*
|
||||
* @param[in] dev Device object used to create pipeline
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pipeline* return the pipeline object
|
||||
*/
|
||||
OB_EXPORT ob_pipeline *ob_create_pipeline_with_device(const ob_device *dev, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete pipeline objects
|
||||
*
|
||||
* @param[in] pipeline The pipeline object to be deleted
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_pipeline(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with default parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start_with_config(ob_pipeline *pipeline, const ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline and set the frame collection data callback
|
||||
*
|
||||
* @attention After start the pipeline with this interface, the frames will be output to the callback function and cannot be obtained frames by call
|
||||
* @ref ob_pipeline_wait_for_frameset
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[in] callback Trigger a callback when all frame data in the frameset arrives
|
||||
* @param[in] user_data Pass in any user data and get it from the callback
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start_with_callback(ob_pipeline *pipeline, const ob_config *config, ob_frameset_callback callback, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Stop pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_stop(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the configuration object associated with the pipeline
|
||||
* @brief Returns default configuration if the user has not configured
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_config* The configuration object
|
||||
*/
|
||||
OB_EXPORT ob_config *ob_pipeline_get_config(const ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the corresponding configuration
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_switch_config(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Wait for a set of frames to be returned synchronously
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] timeout_ms The timeout for waiting (in milliseconds)
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* The frameset that was waited for. A frameset is a special frame that can be used to obtain independent frames from the set.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_pipeline_wait_for_frameset(ob_pipeline *pipeline, uint32_t timeout_ms, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device object associated with the pipeline
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_pipeline_get_device(const ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile list associated with the pipeline
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] sensorType The sensor type. The supported sensor types can be obtained through the ob_device_get_sensor_list() interface.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The stream profile list
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_pipeline_get_stream_profile_list(const ob_pipeline *pipeline, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable frame synchronization
|
||||
* @brief Synchronize the frames of different streams by using the timestamp information of the frames.
|
||||
* @brief Dynamically (when pipeline is started) enable/disable frame synchronization is allowed.
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_enable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable frame synchronization
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_disable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Return a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] color_profile The input profile of the color sensor
|
||||
* @param[in] align_mode The input align mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The list of D2C-enabled depth sensor resolutions
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_get_d2c_depth_profile_list(const ob_pipeline *pipeline, const ob_stream_profile *color_profile, ob_align_mode align_mode,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create the pipeline configuration
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_config* The configuration object
|
||||
*/
|
||||
OB_EXPORT ob_config *ob_create_config(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the pipeline configuration
|
||||
*
|
||||
* @param[in] config The configuration to be deleted
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_config(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a stream with default profile
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_stream(ob_config *config, ob_stream_type stream_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable all streams in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a stream according to the stream profile
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] profile The stream profile to be enabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_stream_with_stream_profile(ob_config *config, const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable video stream with specified parameters
|
||||
*
|
||||
* @attention The stream_type should be a video stream type, such as OB_STREAM_IR, OB_STREAM_COLOR, OB_STREAM_DEPTH, etc.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[in] width The width of the video stream
|
||||
* @param[in] height The height of the video stream
|
||||
* @param[in] fps The frame rate of the video stream
|
||||
* @param[in] format The format of the video stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_video_stream(ob_config *config, ob_stream_type stream_type, uint32_t width, uint32_t height, uint32_t fps, ob_format format,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream using a decimation configuration.
|
||||
*
|
||||
* @attention The stream_type should be a video stream type, such as OB_STREAM_IR, OB_STREAM_DEPTH, etc.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[in] decimation_config The decimation configuration for the stream
|
||||
* @param[in] fps The frame rate of the video stream
|
||||
* @param[in] format The format of the video stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_video_stream_by_decimation_config(ob_config *config, ob_stream_type stream_type,
|
||||
ob_hardware_decimation_config decimation_config, uint32_t fps, ob_format format,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable accelerometer stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] full_scale_range The full scale range of the accelerometer
|
||||
* @param[in] sample_rate The sample rate of the accelerometer
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_accel_stream(ob_config *config, ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable gyroscope stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] full_scale_range The full scale range of the gyroscope
|
||||
* @param[in] sample_rate The sample rate of the gyroscope
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_gyro_stream(ob_config *config, ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable LiDAR stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] scan_rate The scan rate of LiDAR
|
||||
* @param[in] format The format of the LiDAR stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_lidar_stream(ob_config *config, ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the enabled stream profile list in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The enabled stream profile list, should be released by @ref ob_delete_stream_profile_list after use
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_config_get_enabled_stream_profile_list(const ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable a specific stream in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] type The type of stream to be disabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_disable_stream(ob_config *config, ob_stream_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable all streams in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_disable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the alignment mode for the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] mode The alignment mode to be set
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_align_mode(ob_config *config, ob_align_mode mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set whether depth scaling is required after enable depth to color alignment
|
||||
* @brief After enabling depth to color alignment, the depth image may need to be scaled to match the color image size.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] enable Whether scaling is required
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_depth_scale_after_align_require(ob_config *config, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the frame aggregation output mode for the pipeline configuration
|
||||
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
|
||||
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_frame_aggregate_output_mode(ob_config *config, ob_frame_aggregate_output_mode mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get current camera parameters
|
||||
* @attention If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_camera_param The camera internal parameters
|
||||
*/
|
||||
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current camera parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] colorWidth color width
|
||||
* @param[in] colorHeight color height
|
||||
* @param[in] depthWidth depth width
|
||||
* @param[in] depthHeight depth height
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_camera_param returns camera internal parameters
|
||||
*/
|
||||
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param_with_profile(ob_pipeline *pipeline, uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth,
|
||||
uint32_t depthHeight, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device calibration parameters with the specified configuration
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_calibration_param The calibration parameters
|
||||
*/
|
||||
OB_EXPORT ob_calibration_param ob_pipeline_get_calibration_param(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_config_set_depth_scale_require ob_config_set_depth_scale_after_align_require
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
1073
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Property.h
Normal file
1073
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Property.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,141 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
/**
|
||||
* @brief Create a recording device for the specified device with a specified file path and compression enabled.
|
||||
*
|
||||
* @param[in] device The device to record.
|
||||
* @param[in] file_path The file path to record to.
|
||||
* @param[in] compression_enabled Whether to enable compression for the recording.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return A pointer to the newly created recording device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_record_device *ob_create_record_device(ob_device *device, const char *file_path, bool compression_enabled, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_record_device(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_pause(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_resume(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a playback device for the specified file path.
|
||||
*
|
||||
* @param[in] file_path The file path to playback from.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return A pointer to the newly created playback device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_playback_device(const char *file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_pause(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_resume(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] timestamp The position to set the playback to, in milliseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_seek(ob_device *player, const uint64_t timestamp, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] rate The playback rate to set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_rate(ob_device *player, const float rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the status for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current playback status of the played data.
|
||||
*/
|
||||
OB_EXPORT ob_playback_status ob_playback_device_get_current_playback_status(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to receive playback status updates.
|
||||
*
|
||||
* @param[in] player The playback device to set the callback for.
|
||||
* @param[in] callback The callback function to receive playback status updates.
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_status_changed_callback(ob_device *player, ob_playback_status_changed_callback callback, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback position of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the position for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current playback position of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_position(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the duration for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The duration of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_duration(ob_device *player, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
138
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Sensor.h
Normal file
138
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Sensor.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Sensor.h
|
||||
* @brief Defines types related to sensors, used for obtaining stream configurations, opening and closing streams, and setting and getting sensor properties.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Get the type of the sensor.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor type.
|
||||
*/
|
||||
OB_EXPORT ob_sensor_type ob_sensor_get_type(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a list of all supported stream profiles.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return A list of stream profiles.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_sensor_get_stream_profile_list(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Open the current sensor and set the callback data frame.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[in] profile The stream configuration information.
|
||||
* @param[in] callback The callback function triggered when frame data arrives.
|
||||
* @param[in] user_data Any user data to pass in and get from the callback.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_start(ob_sensor *sensor, const ob_stream_profile *profile, ob_frame_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Stop the sensor stream.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_stop(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch resolutions.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[in] profile The stream configuration information.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_switch_profile(ob_sensor *sensor, ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a sensor object.
|
||||
*
|
||||
* @param[in] sensor The sensor object to delete.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_sensor(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a list of recommended filters for the specified sensor.
|
||||
*
|
||||
* @param[in] sensor The ob_sensor object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter_list
|
||||
*/
|
||||
OB_EXPORT ob_filter_list *ob_sensor_create_recommended_filter_list(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of sensors in the sensor list.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The number of sensors in the list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_sensor_list_get_count(const ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sensor type.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] index The index of the sensor on the list.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor type.
|
||||
*/
|
||||
OB_EXPORT ob_sensor_type ob_sensor_list_get_sensor_type(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by sensor type.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] sensorType The sensor type to be obtained.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor pointer. If the specified type of sensor does not exist, it will return null.
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor_by_type(const ob_sensor_list *sensor_list, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by index number.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] index The index of the sensor on the list.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor object.
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of sensor objects.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects to delete.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_sensor_list(ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
#define ob_sensor_list_get_sensor_count ob_sensor_list_get_count
|
||||
#define ob_sensor_get_recommended_filter_list ob_sensor_create_recommended_filter_list
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,505 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file StreamProfile.h
|
||||
* @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a stream profile object
|
||||
*
|
||||
* @param[in] type Stream type
|
||||
* @param[in] format Stream format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile(ob_stream_type type, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a video stream profile object
|
||||
*
|
||||
* @param[in] type Stream type
|
||||
* @param[in] format Stream format
|
||||
* @param[in] width Stream width
|
||||
* @param[in] height Stream height
|
||||
* @param[in] fps Stream frame rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the video stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_video_stream_profile(ob_stream_type type, ob_format format, uint32_t width, uint32_t height, uint32_t fps,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a accel stream profile object
|
||||
*
|
||||
* @param[in] full_scale_range Accel full scale range
|
||||
* @param[in] sample_rate Accel sample rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the accel stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_accel_stream_profile(ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a gyro stream profile object
|
||||
*
|
||||
* @param[in] full_scale_range Gyro full scale range
|
||||
* @param[in] sample_rate Gyro sample rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the gyro stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_gyro_stream_profile(ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a LiDAR stream profile object
|
||||
*
|
||||
* @param[in] scan_rate The scan rate of LiDAR
|
||||
* @param[in] format The format of the LiDAR stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_stream_profile* return the LiDAR stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_lidar_stream_profile(ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the stream profile object from an other stream profile object
|
||||
*
|
||||
* @param[in] srcProfile Source stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the new stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile_from_other_stream_profile(const ob_stream_profile *srcProfile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the stream profile object with a new format object
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] new_format New format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the new stream profile object with the new format
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile_with_new_format(const ob_stream_profile *profile, ob_format new_format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the stream configuration.
|
||||
*
|
||||
* @param[in] profile Stream profile object .
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_stream_profile(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get stream profile format
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_format return the format of the stream
|
||||
*/
|
||||
OB_EXPORT ob_format ob_stream_profile_get_format(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set stream profile format
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] format The format of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_format(ob_stream_profile *profile, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get stream profile type
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_type stream type
|
||||
*/
|
||||
OB_EXPORT ob_stream_type ob_stream_profile_get_type(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set stream profile type
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] type The type of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_type(const ob_stream_profile *profile, ob_stream_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the extrinsic for source stream to target stream
|
||||
*
|
||||
* @param[in] source Source stream profile
|
||||
* @param[in] target Target stream profile
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_extrinsic The extrinsic
|
||||
*/
|
||||
OB_EXPORT ob_extrinsic ob_stream_profile_get_extrinsic_to(const ob_stream_profile *source, ob_stream_profile *target, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic for source stream to target stream
|
||||
*
|
||||
* @param[in] source Stream profile object
|
||||
* @param[in] target Target stream type
|
||||
* @param[in] extrinsic The extrinsic
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_extrinsic_to(ob_stream_profile *source, const ob_stream_profile *target, ob_extrinsic extrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic for source stream to target stream type
|
||||
*
|
||||
* @param[in] source Source stream profile
|
||||
* @param[in] type Target stream type
|
||||
* @param[in] extrinsic The extrinsic
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_extrinsic_to_type(ob_stream_profile *source, const ob_stream_type type, ob_extrinsic extrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame rate of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame rate of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_fps(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the width of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the width of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_width(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the width of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[in] width The width of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_width(ob_stream_profile *profile, uint32_t width, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the height of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the height of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_height(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the height of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[in] height The height of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_height(ob_stream_profile *profile, uint32_t height, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_camera_intrinsic Return the intrinsic of the stream
|
||||
*/
|
||||
OB_EXPORT ob_camera_intrinsic ob_video_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] intrinsic The intrinsic of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_camera_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the distortion of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_camera_distortion Return the distortion of the stream
|
||||
*/
|
||||
OB_EXPORT ob_camera_distortion ob_video_stream_profile_get_distortion(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the decimation configuration of the video stream profile.
|
||||
*
|
||||
* @param[in] profile Stream profile object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_hardware_decimation_config Return the decimation configuration of the stream.
|
||||
*/
|
||||
OB_EXPORT ob_hardware_decimation_config ob_video_stream_profile_get_decimation_config(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the distortion of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] distortion The distortion of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_distortion(ob_stream_profile *profile, ob_camera_distortion distortion, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the process param of the disparity stream
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_disparity_param Return the disparity process param of the stream
|
||||
*/
|
||||
OB_EXPORT ob_disparity_param ob_disparity_based_stream_profile_get_disparity_param(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the disparity process param of the disparity stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the disparity stream, an error will be returned.
|
||||
* @param[in] param The disparity process param of the disparity stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_disparity_based_stream_profile_set_disparity_param(ob_stream_profile *profile, ob_disparity_param param, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the full-scale range of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The full-scale range of the accelerometer stream.
|
||||
*/
|
||||
OB_EXPORT ob_accel_full_scale_range ob_accel_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sampling frequency of the accelerometer frame.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The sampling frequency of the accelerometer frame.
|
||||
*/
|
||||
OB_EXPORT ob_accel_sample_rate ob_accel_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_accel_intrinsic Return the intrinsic of the accelerometer stream.
|
||||
*/
|
||||
OB_EXPORT ob_accel_intrinsic ob_accel_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[in] intrinsic The intrinsic of the accelerometer stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_accel_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_accel_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the full-scale range of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The full-scale range of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_full_scale_range ob_gyro_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sampling frequency of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The sampling frequency of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_sample_rate ob_gyro_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_gyro_intrinsic Return the intrinsic of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[in] intrinsic The intrinsic of the gyroscope stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_gyro_stream_set_intrinsic(ob_stream_profile *profile, ob_gyro_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the scan rate of the LiDAR stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the LiDAR stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The scan rate of the LiDAR stream.
|
||||
*/
|
||||
OB_EXPORT ob_lidar_scan_rate ob_lidar_stream_profile_get_scan_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of StreamProfile lists.
|
||||
*
|
||||
* @param[in] profile_list StreamProfile list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of StreamProfile lists.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_stream_profile_list_get_count(const ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the corresponding StreamProfile by subscripting.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list StreamProfile lists.
|
||||
* @param[in] index Index.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_profile(const ob_stream_profile_list *profile_list, int index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] width Width. If you don't need to add matching conditions, you can pass OB_WIDTH_ANY.
|
||||
* @param[in] height Height. If you don't need to add matching conditions, you can pass OB_HEIGHT_ANY.
|
||||
* @param[in] format Format. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
|
||||
* @param[in] fps Frame rate. If you don't need to add matching conditions, you can pass OB_FPS_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile(const ob_stream_profile_list *profile_list, int width, int height,
|
||||
ob_format format, int fps, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile based on the provided decimation configuration. If multiple profiles match, the first profile in the list
|
||||
* is returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be released with @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list The list of stream profiles.
|
||||
* @param[in] decimation_config Decimation configuration. The actual resolution is determined by original resolution and the scale factor.
|
||||
* @param[in] format Stream format. If no matching condition is required, pass OB_FORMAT_ANY.
|
||||
* @param[in] fps Frame rate. If no matching condition is required, pass OB_FPS_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matched stream profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile_by_decimation_config(const ob_stream_profile_list *profile_list,
|
||||
ob_hardware_decimation_config decimation_config,
|
||||
ob_format format, int fps, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_accel_stream_profile(const ob_stream_profile_list *profile_list,
|
||||
ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_gyro_stream_profile(const ob_stream_profile_list *profile_list,
|
||||
ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] scan_rate The scan rate of LiDAR. If you don't need to add matching conditions, you can pass OB_LIDAR_SCAN_ANY.
|
||||
* @param[in] format The format of the LiDAR stream. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_lidar_stream_profile(const ob_stream_profile_list *profile_list, ob_lidar_scan_rate scan_rate,
|
||||
ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the stream profile list.
|
||||
*
|
||||
* @param[in] profile_list Stream configuration list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_stream_profile_list(const ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_stream_profile_format ob_stream_profile_get_format
|
||||
#define ob_stream_profile_type ob_stream_profile_get_type
|
||||
#define ob_video_stream_profile_fps ob_video_stream_profile_get_fps
|
||||
#define ob_video_stream_profile_width ob_video_stream_profile_get_width
|
||||
#define ob_video_stream_profile_height ob_video_stream_profile_get_height
|
||||
#define ob_accel_stream_profile_full_scale_range ob_accel_stream_profile_get_full_scale_range
|
||||
#define ob_accel_stream_profile_sample_rate ob_accel_stream_profile_get_sample_rate
|
||||
#define ob_gyro_stream_profile_full_scale_range ob_gyro_stream_profile_get_full_scale_range
|
||||
#define ob_gyro_stream_profile_sample_rate ob_gyro_stream_profile_get_sample_rate
|
||||
#define ob_stream_profile_list_count ob_stream_profile_list_get_count
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
111
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h
Normal file
111
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Convert OBFormat to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFormat type.
|
||||
*
|
||||
* @return OBFormat of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_format_type_to_string(OBFormat type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBFrameType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_frame_type_to_string(OBFrameType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBStreamType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_stream_type_to_string(OBStreamType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBSensorType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_sensor_type_to_string(OBSensorType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return OBIMUSampleRate of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_imu_rate_type_to_string(OBIMUSampleRate type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBGyroFullScaleRange to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBGyroFullScaleRange type.
|
||||
*
|
||||
* @return OBGyroFullScaleRange of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_gyro_range_type_to_string(OBGyroFullScaleRange type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBAccelFullScaleRange to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBAccelFullScaleRange type.
|
||||
*
|
||||
* @return OBAccelFullScaleRange of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_accel_range_type_to_string(OBAccelFullScaleRange type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBLiDARScanRate to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBLiDARScanRate type.
|
||||
* @return OBLiDARScanRate of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char *ob_lidar_scan_rate_type_to_string(OBLiDARScanRate type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameMetadataType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameMetadataType type.
|
||||
*
|
||||
* @return OBFrameMetadataType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_meta_data_type_to_string(OBFrameMetadataType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to OBSensorType.
|
||||
*
|
||||
* @param[in] type The sensor type to convert.
|
||||
*
|
||||
* @return OBStreamType The corresponding stream type.
|
||||
*/
|
||||
OB_EXPORT OBStreamType ob_sensor_type_to_stream_type(OBSensorType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFormat to " char* " type and then return.
|
||||
*
|
||||
* @param[in] format The OBFormat to convert.
|
||||
*
|
||||
* @return The string.
|
||||
*/
|
||||
OB_EXPORT const char *ob_format_to_string(OBFormat format);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
136
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Utils.h
Normal file
136
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Utils.h
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_3d_to_2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel coordinate of the target camera
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_distortion Source distortion parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT ob_frame *transformation_depth_frame_to_color_camera(ob_device *device, ob_frame *depth_frame, uint32_t target_color_camera_width,
|
||||
uint32_t target_color_camera_height, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT bool transformation_init_xy_tables(const ob_calibration_param calibration_param, const ob_sensor_type sensor_type, float *data, uint32_t *data_size,
|
||||
ob_xy_tables *xy_tables, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data,
|
||||
void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_3d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f,
|
||||
ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_2d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_2d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point2f *target_point2f,
|
||||
ob_error **error);
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] file_name Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] save_binary Binary or textual,true: binary, false: textual
|
||||
* @param[in] use_mesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] mesh_threshold Distance threshold for creating faces in point cloud,default value :50
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
OB_EXPORT bool ob_save_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, bool use_mesh, float mesh_threshold, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief save LiDAR point cloud to ply file.
|
||||
*
|
||||
* @param[in] file_name Point cloud save path
|
||||
* @param[in] frame LiDAR point cloud frame
|
||||
* @param[in] save_binary Binary or textual,true: binary, false: textual
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool save LiDAR point cloud result
|
||||
*/
|
||||
OB_EXPORT bool ob_save_lidar_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, ob_error **error);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
56
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Version.h
Normal file
56
dev_ws/src/orbbec_camera/SDK/include/libobsensor/h/Version.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Version.h
|
||||
* @brief Functions for retrieving the SDK version number information.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the SDK version number.
|
||||
*
|
||||
* @return int The SDK version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK major version number.
|
||||
*
|
||||
* @return int The SDK major version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_major_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK minor version number.
|
||||
*
|
||||
* @return int The SDK minor version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_minor_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK patch version number.
|
||||
*
|
||||
* @return int The SDK patch version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_patch_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK stage version.
|
||||
*
|
||||
* @attention The returned char* does not need to be freed.
|
||||
*
|
||||
* @return const char* The SDK stage version.
|
||||
*/
|
||||
OB_EXPORT const char *ob_get_stage_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
359
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Context.hpp
Normal file
359
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Context.hpp
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Context.hpp
|
||||
* @brief The SDK context class, which serves as the entry point to the underlying SDK. It is used to query device lists, handle device callbacks, and set the
|
||||
* log level.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/Context.h"
|
||||
#include "Types.hpp"
|
||||
#include "Error.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <mutex>
|
||||
|
||||
namespace ob {
|
||||
|
||||
// forward declarations
|
||||
class Device;
|
||||
class DeviceInfo;
|
||||
class DeviceList;
|
||||
|
||||
class Context {
|
||||
public:
|
||||
/**
|
||||
* @brief Type definition for the device changed callback function.
|
||||
*
|
||||
* @param[in] removedList The list of removed devices.
|
||||
* @param[in] addedList The list of added devices.
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<DeviceList> removedList, std::shared_ptr<DeviceList> addedList)> DeviceChangedCallback;
|
||||
|
||||
/**
|
||||
* @brief Type definition for the log output callback function.
|
||||
*
|
||||
* @param[in] severity The current callback log level.
|
||||
* @param[in] logMsg The log message.
|
||||
*/
|
||||
typedef std::function<void(OBLogSeverity severity, const char *logMsg)> LogCallback;
|
||||
|
||||
struct DeviceChangedCallbackContext {
|
||||
Context *ctx;
|
||||
uint64_t callbackId;
|
||||
DeviceChangedCallback callback;
|
||||
};
|
||||
|
||||
private:
|
||||
ob_context *impl_ = nullptr;
|
||||
std::mutex callbackMtx_;
|
||||
|
||||
std::mutex legacyCallbackMtx_;
|
||||
OBCallbackId legacyCallbackId_ = INVALID_CALLBACK_ID;
|
||||
|
||||
std::unordered_map<OBCallbackId, std::unique_ptr<DeviceChangedCallbackContext>> devChangedCallbacks_;
|
||||
// static LogCallback logCallback_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Context constructor.
|
||||
* @brief The Context class is a management class that describes the runtime of the SDK. It is responsible for applying and releasing resources for the SDK.
|
||||
* The context has the ability to manage multiple devices, enumerate devices, monitor device callbacks, and enable functions such as multi-device
|
||||
* synchronization.
|
||||
*
|
||||
* @param[in] configPath The path to the configuration file. If the path is empty, the default configuration will be used.
|
||||
*/
|
||||
explicit Context(const char *configPath = "") {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_context_with_config(configPath, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Context destructor.
|
||||
*/
|
||||
~Context() noexcept {
|
||||
// delete contex of C API, which will auto unregister all callbacks
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_context(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Queries the enumerated device list.
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList> A pointer to the device list class.
|
||||
*/
|
||||
std::shared_ptr<DeviceList> queryDeviceList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_query_device_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<DeviceList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enable or disable net device enumeration.
|
||||
* @brief after enable, the net device will be discovered automatically and can be retrieved by @ref queryDeviceList. The default state can be set in the
|
||||
* configuration file.
|
||||
*
|
||||
* @attention Net device enumeration by gvcp protocol, if the device is not in the same subnet as the host, it will be discovered but cannot be connected.
|
||||
*
|
||||
* @param[in] enable true to enable, false to disable
|
||||
*/
|
||||
void enableNetDeviceEnumeration(bool enable) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_enable_net_device_enumeration(impl_, enable, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief "Force" a static IP address configuration in a device identified by its MAC Address.
|
||||
*
|
||||
* @param[in] macAddress MAC address of the network device.
|
||||
* You can obtain it from @ref ob_device_info_get_uid, or specify it manually
|
||||
* in the format xx:xx:xx:xx:xx:xx, where each xx is a two-digit hexadecimal value.
|
||||
* @param[in] config The new IP configuration.
|
||||
* @return bool true if the configuration command was processed successfully, false otherwise.
|
||||
*
|
||||
* @note This applies to all GigE Vision devices
|
||||
*/
|
||||
bool forceIp(const char *macAddress, const OBNetIpConfig &config) {
|
||||
ob_error *error = nullptr;
|
||||
auto res = ob_force_ip_config(macAddress, config, &error);
|
||||
Error::handle(&error);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a network device with the specified IP address and port.
|
||||
*
|
||||
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> The created device object.
|
||||
*/
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_create_net_device_ex(impl_, address, port, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the device plug-in callback function.
|
||||
*
|
||||
* @deprecated This function is deprecated. Please use registerDeviceChangedCallback() instead.
|
||||
*
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] callback The function triggered when the device is plugged and unplugged.
|
||||
*/
|
||||
void setDeviceChangedCallback(DeviceChangedCallback callback) {
|
||||
std::lock_guard<std::mutex> lock(legacyCallbackMtx_);
|
||||
// remove the last callback first
|
||||
if(legacyCallbackId_ != INVALID_CALLBACK_ID) {
|
||||
unregisterDeviceChangedCallback(legacyCallbackId_);
|
||||
}
|
||||
// register the new callback
|
||||
legacyCallbackId_ = registerDeviceChangedCallback(callback);
|
||||
}
|
||||
|
||||
OBCallbackId registerDeviceChangedCallback(DeviceChangedCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
auto cbCtxHolder = std::unique_ptr<DeviceChangedCallbackContext>(new DeviceChangedCallbackContext({ this, 0, nullptr }));
|
||||
auto id = ob_register_device_changed_callback(impl_, &Context::deviceChangedCallback, (void *)cbCtxHolder.get(), &error);
|
||||
Error::handle(&error);
|
||||
|
||||
cbCtxHolder->callbackId = id;
|
||||
cbCtxHolder->callback = callback;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(callbackMtx_);
|
||||
devChangedCallbacks_[id] = std::move(cbCtxHolder);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void unregisterDeviceChangedCallback(OBCallbackId id) {
|
||||
ob_error *error = nullptr;
|
||||
ob_unregister_device_changed_callback(impl_, id, &error);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(callbackMtx_);
|
||||
if(devChangedCallbacks_.count(id)) {
|
||||
devChangedCallbacks_.erase(id);
|
||||
}
|
||||
}
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
|
||||
*
|
||||
* @param[in] repeatIntervalMsec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
|
||||
*/
|
||||
void enableDeviceClockSync(uint64_t repeatIntervalMsec) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_enable_device_clock_sync(impl_, repeatIntervalMsec, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frees idle memory from the internal frame memory pool.
|
||||
* @brief The SDK includes an internal frame memory pool that caches memory allocated for frames received from devices.
|
||||
*/
|
||||
void freeIdleMemory() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_free_idle_memory(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
|
||||
* @brief It is effective when the new device is created.
|
||||
*
|
||||
* @attention This interface is only available for Linux.
|
||||
*
|
||||
* @param[in] type The backend type to be used.
|
||||
*/
|
||||
void setUvcBackendType(OBUvcBackendType type) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_uvc_backend_type(impl_, type, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the level of the global log, which affects both the log level output to the console, output to the file and output the user defined
|
||||
* callback.
|
||||
*
|
||||
* @param[in] severity The log output level.
|
||||
*/
|
||||
static void setLoggerSeverity(OBLogSeverity severity) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_severity(severity, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set log output to a file.
|
||||
*
|
||||
* @param[in] severity The log level output to the file.
|
||||
* @param[in] directory The log file output path. If the path is empty, the existing settings will continue to be used (if the existing configuration is
|
||||
* also empty, the log will not be output to the file).
|
||||
*/
|
||||
static void setLoggerToFile(OBLogSeverity severity, const char *directory) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_to_file(severity, directory, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the log file name for file output
|
||||
*
|
||||
* @param[in] fileName Log file name. Must not be empty.
|
||||
*
|
||||
* @note Other settings, such as log level and output directory, remain unchanged.
|
||||
*/
|
||||
static void setLoggerFileName(const std::string &fileName) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_file_name(fileName.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set log output to the console.
|
||||
*
|
||||
* @param[in] severity The log level output to the console.
|
||||
*/
|
||||
static void setLoggerToConsole(OBLogSeverity severity) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_to_console(severity, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the logger to callback.
|
||||
*
|
||||
* @param[in] severity The callback log level.
|
||||
* @param[in] callback The callback function.
|
||||
*/
|
||||
static void setLoggerToCallback(OBLogSeverity severity, LogCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
Context::getLogCallback() = callback;
|
||||
ob_set_logger_to_callback(severity, &Context::logCallback, &Context::getLogCallback(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logs a message with severity, file, function, and line info.
|
||||
*
|
||||
* @param severity Log level, see @ref OBLogSeverity for details
|
||||
* @param module The module or component the log belongs to
|
||||
* @param message Message string to log
|
||||
* @param file Source file name, e.g., __FILE__
|
||||
* @param func Function name, e.g., __func__
|
||||
* @param line Line number, e.g., __LINE__
|
||||
*/
|
||||
static void logExternalMessage(OBLogSeverity severity, const std::string &module, const std::string &message, const std::string &file,
|
||||
const std::string &func, int line) {
|
||||
ob_error *error = nullptr;
|
||||
ob_log_external_message(severity, module.c_str(), message.c_str(), file.c_str(), func.c_str(), line, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
* @param[in] directory Path to the extensions directory. If the path is empty, the existing settings will continue to be used (if the existing
|
||||
*/
|
||||
static void setExtensionsDirectory(const char *directory) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_extensions_directory(directory, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
private:
|
||||
static void deviceChangedCallback(ob_device_list *removedList, ob_device_list *addedList, void *userData) {
|
||||
auto cbCtx = static_cast<DeviceChangedCallbackContext *>(userData);
|
||||
if(cbCtx && cbCtx->ctx && cbCtx->callbackId != INVALID_CALLBACK_ID) {
|
||||
DeviceChangedCallback callbackCopy;
|
||||
{
|
||||
// preventing the captured variables from being released.
|
||||
std::unique_lock<std::mutex> lock(cbCtx->ctx->callbackMtx_);
|
||||
if(cbCtx->ctx->devChangedCallbacks_.count(cbCtx->callbackId)) {
|
||||
callbackCopy = cbCtx->callback;
|
||||
}
|
||||
}
|
||||
auto removed = std::make_shared<DeviceList>(removedList);
|
||||
auto added = std::make_shared<DeviceList>(addedList);
|
||||
callbackCopy(removed, added);
|
||||
}
|
||||
}
|
||||
|
||||
static void logCallback(OBLogSeverity severity, const char *logMsg, void *userData) {
|
||||
auto cb = static_cast<LogCallback *>(userData);
|
||||
if(cb) {
|
||||
(*cb)(severity, logMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// Lazy initialization of the logcallback_. The purpose is to initialize logcallback_ in .hpp
|
||||
static LogCallback &getLogCallback() {
|
||||
static LogCallback logCallback_ = nullptr;
|
||||
return logCallback_;
|
||||
}
|
||||
|
||||
// for backward compatibility
|
||||
#define enableMultiDeviceSync enableDeviceClockSync
|
||||
};
|
||||
} // namespace ob
|
||||
1712
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Device.hpp
Normal file
1712
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Device.hpp
Normal file
File diff suppressed because it is too large
Load diff
116
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Error.hpp
Normal file
116
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Error.hpp
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Error.hpp
|
||||
* @brief This file defines the Error class, which describes abnormal errors within the SDK.
|
||||
* Detailed information about the exception can be obtained through this class.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/h/Error.h"
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Error : public std::exception {
|
||||
private:
|
||||
ob_error *impl_;
|
||||
|
||||
/**
|
||||
* @brief Construct a new Error object
|
||||
*
|
||||
* @attention This constructor should not be called directly, use the handle() function instead.
|
||||
*
|
||||
* @param[in] error The ob_error object
|
||||
*/
|
||||
explicit Error(ob_error *error) : impl_(error) {};
|
||||
|
||||
Error& operator=(const Error&) = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief A static function to handle the ob_error and throw an exception if needed.
|
||||
*
|
||||
* @param[in,out] error The ob_error pointer to be handled.
|
||||
* @param[in] throw_exception A boolean value to indicate whether to throw an exception or not, the default value is true.
|
||||
*/
|
||||
static void handle(ob_error **error, bool throw_exception = true) {
|
||||
if(!error || !*error) { // no error
|
||||
return;
|
||||
}
|
||||
|
||||
if(throw_exception) {
|
||||
throw Error(*error);
|
||||
}
|
||||
else {
|
||||
ob_delete_error(*error);
|
||||
*error = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroy the Error object
|
||||
*/
|
||||
~Error() override {
|
||||
if(impl_) {
|
||||
ob_delete_error(impl_);
|
||||
impl_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error message of the exception.
|
||||
*
|
||||
* @return const char* The error message.
|
||||
*/
|
||||
const char *what() const noexcept override {
|
||||
return impl_->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the exception type of the exception.
|
||||
* @brief Read the comments of the OBExceptionType enum in the libobsensor/h/ObTypes.h file for more information.
|
||||
*
|
||||
* @return OBExceptionType The exception type.
|
||||
*/
|
||||
OBExceptionType getExceptionType() const noexcept {
|
||||
return impl_->exception_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the name of the function where the exception occurred.
|
||||
*
|
||||
* @return const char* The function name.
|
||||
*/
|
||||
const char *getFunction() const noexcept {
|
||||
return impl_->function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the arguments of the function where the exception occurred.
|
||||
*
|
||||
* @return const char* The arguments.
|
||||
*/
|
||||
const char *getArgs() const noexcept {
|
||||
return impl_->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error message of the exception.
|
||||
* @brief It is recommended to use the what() function instead.
|
||||
*
|
||||
* @return const char* The error message.
|
||||
*/
|
||||
const char *getMessage() const noexcept {
|
||||
return impl_->message;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
const char *getName() const noexcept {
|
||||
return impl_->function;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
1557
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Filter.hpp
Normal file
1557
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Filter.hpp
Normal file
File diff suppressed because it is too large
Load diff
1318
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp
Normal file
1318
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,486 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Pipeline.hpp
|
||||
* @brief The SDK's advanced API type can quickly implement switching streaming and frame synchronization
|
||||
* operations.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Frame.hpp"
|
||||
#include "Device.hpp"
|
||||
#include "StreamProfile.hpp"
|
||||
|
||||
#include "libobsensor/h/Pipeline.h"
|
||||
#include "libobsensor/hpp/Types.hpp"
|
||||
#include "libobsensor/hpp/TypeHelper.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
namespace ob {
|
||||
|
||||
/**
|
||||
* @brief Config class for configuring pipeline parameters
|
||||
*
|
||||
* The Config class provides an interface for configuring pipeline parameters.
|
||||
*/
|
||||
class Config {
|
||||
private:
|
||||
ob_config_t *impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Config object
|
||||
*/
|
||||
Config() {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_config(&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
explicit Config(ob_config_t *impl) : impl_(impl) {}
|
||||
|
||||
/**
|
||||
* @brief Destroy the Config object
|
||||
*/
|
||||
~Config() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_config(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
ob_config_t *getImpl() const {
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enable a stream with a specific stream type
|
||||
*
|
||||
* @param[in] streamType The stream type to be enabled
|
||||
*/
|
||||
void enableStream(OBStreamType streamType) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_stream(impl_, streamType, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a stream with a specific sensor type
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled
|
||||
*/
|
||||
void enableStream(OBSensorType sensorType) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
enableStream(streamType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a stream to be used in the pipeline
|
||||
*
|
||||
* @param[in] streamProfile The stream configuration to be enabled
|
||||
*/
|
||||
void enableStream(std::shared_ptr<const StreamProfile> streamProfile) const {
|
||||
ob_error *error = nullptr;
|
||||
auto c_stream_profile = streamProfile->getImpl();
|
||||
ob_config_enable_stream_with_stream_profile(impl_, c_stream_profile, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a video stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default resolution settings.
|
||||
* Users who wish to set custom resolutions should refer to the product manual, as available resolutions vary by camera model.
|
||||
*
|
||||
* @param[in] streamType The video stream type.
|
||||
* @param[in] width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
|
||||
* @param[in] height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBStreamType streamType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_video_stream(impl_, streamType, width, height, fps, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled.
|
||||
* @param[in] width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
|
||||
* @param[in] height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBSensorType sensorType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
enableVideoStream(streamType, width, height, fps, format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline with decimation configuration.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled.
|
||||
* @param[in] decimationConfig The decimation configuration for this stream.
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBSensorType sensorType, OBHardwareDecimationConfig decimationConfig, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_video_stream_by_decimation_config(impl_, streamType, decimationConfig, fps, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable an accelerometer stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable an accelerometer stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] fullScaleRange The full-scale range of the accelerometer (default is OB_ACCEL_FULL_SCALE_RANGE_ANY, which selects the default range).
|
||||
* @param[in] sampleRate The sample rate of the accelerometer (default is OB_ACCEL_SAMPLE_RATE_ANY, which selects the default rate).
|
||||
*/
|
||||
void enableAccelStream(OBAccelFullScaleRange fullScaleRange = OB_ACCEL_FULL_SCALE_RANGE_ANY,
|
||||
OBAccelSampleRate sampleRate = OB_ACCEL_SAMPLE_RATE_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_accel_stream(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a gyroscope stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a gyroscope stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] fullScaleRange The full-scale range of the gyroscope (default is OB_GYRO_FULL_SCALE_RANGE_ANY, which selects the default range).
|
||||
* @param[in] sampleRate The sample rate of the gyroscope (default is OB_GYRO_SAMPLE_RATE_ANY, which selects the default rate).
|
||||
*/
|
||||
void enableGyroStream(OBGyroFullScaleRange fullScaleRange = OB_GYRO_FULL_SCALE_RANGE_ANY, OBGyroSampleRate sampleRate = OB_GYRO_SAMPLE_RATE_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_gyro_stream(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a LiDAR stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a LiDAR stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of the LiDAR (default is OB_LIDAR_SCAN_ANY, which selects the default scan rate).
|
||||
* @param[in] format The stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableLiDARStream(OBLiDARScanRate scanRate = OB_LIDAR_SCAN_ANY, OBFormat format = OB_FORMAT_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_lidar_stream(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use enableStream(std::shared_ptr<StreamProfile> streamProfile) instead
|
||||
* @brief Enable all streams to be used in the pipeline
|
||||
*/
|
||||
void enableAllStream() {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_all_stream(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable a stream to be used in the pipeline
|
||||
*
|
||||
* @param[in] streamType The stream configuration to be disabled
|
||||
*/
|
||||
void disableStream(OBStreamType streamType) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_disable_stream(impl_, streamType, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable a sensor stream to be used in the pipeline.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor configuration to be disabled
|
||||
*/
|
||||
void disableStream(OBSensorType sensorType) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
disableStream(streamType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable all streams to be used in the pipeline
|
||||
*/
|
||||
void disableAllStream() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_disable_all_stream(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Enabled Stream Profile List
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList>
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getEnabledStreamProfileList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_config_get_enabled_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the alignment mode
|
||||
*
|
||||
* @param[in] mode The alignment mode
|
||||
*/
|
||||
void setAlignMode(OBAlignMode mode) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_align_mode(impl_, mode, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set whether the depth needs to be scaled after setting D2C
|
||||
*
|
||||
* @param[in] enable Whether scaling is required
|
||||
*/
|
||||
void setDepthScaleRequire(bool enable) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_depth_scale_after_align_require(impl_, enable, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the frame aggregation output mode for the pipeline configuration
|
||||
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
|
||||
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
|
||||
*
|
||||
* @param[in] mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
|
||||
*/
|
||||
void setFrameAggregateOutputMode(OBFrameAggregateOutputMode mode) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_frame_aggregate_output_mode(impl_, mode, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
};
|
||||
|
||||
class Pipeline {
|
||||
public:
|
||||
/**
|
||||
* @brief FrameSetCallback is a callback function type for frameset data arrival.
|
||||
*
|
||||
* @param[in] frame The returned frameset data
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
|
||||
|
||||
private:
|
||||
ob_pipeline_t *impl_;
|
||||
FrameSetCallback callback_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Pipeline is a high-level interface for applications, algorithms related RGBD data streams. Pipeline can provide alignment inside and synchronized
|
||||
* FrameSet. Pipeline() no parameter version, which opens the first device in the list of devices connected to the OS by default. If the application has
|
||||
* obtained the device through the DeviceList, opening the Pipeline() at this time will throw an exception that the device has been created.
|
||||
*/
|
||||
Pipeline() {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_pipeline(&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Pipeline(std::shared_ptr< Device > device ) Function for multi-device operations. Multiple devices need to be obtained through DeviceList, and the device
|
||||
* and pipeline are bound through this interface.
|
||||
*/
|
||||
explicit Pipeline(std::shared_ptr<Device> device) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_pipeline_with_device(device->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroy the pipeline object
|
||||
*/
|
||||
~Pipeline() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_pipeline(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param[in] config The parameter configuration of the pipeline
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config = nullptr) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_t *config_impl = config == nullptr ? nullptr : config->getImpl();
|
||||
ob_pipeline_start_with_config(impl_, config_impl, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline and set the frameset data callback
|
||||
*
|
||||
* @param[in] config The configuration of the pipeline
|
||||
* @param[in] callback The callback to be triggered when all frame data in the frameset arrives
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config, FrameSetCallback callback) {
|
||||
callback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_start_with_callback(impl_, config ? config->getImpl() : nullptr, &Pipeline::frameSetCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
static void frameSetCallback(ob_frame_t *frameSet, void *userData) {
|
||||
auto pipeline = static_cast<Pipeline *>(userData);
|
||||
pipeline->callback_(std::make_shared<FrameSet>(frameSet));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the pipeline
|
||||
*/
|
||||
void stop() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_stop(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the pipeline configuration parameters
|
||||
* @brief Returns the default configuration if the user has not configured it
|
||||
*
|
||||
* @return std::shared_ptr<Config> The configured parameters
|
||||
*/
|
||||
std::shared_ptr<Config> getConfig() const {
|
||||
ob_error *error = nullptr;
|
||||
auto config = ob_pipeline_get_config(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Config>(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for frameset
|
||||
*
|
||||
* @param[in] timeoutMs The waiting timeout in milliseconds
|
||||
*
|
||||
* @return std::shared_ptr<FrameSet> The waiting frameset data
|
||||
*/
|
||||
std::shared_ptr<FrameSet> waitForFrameset(uint32_t timeoutMs = 1000) const {
|
||||
ob_error *error = nullptr;
|
||||
auto frameSet = ob_pipeline_wait_for_frameset(impl_, timeoutMs, &error);
|
||||
if(frameSet == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
Error::handle(&error);
|
||||
return std::make_shared<FrameSet>(frameSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the device object
|
||||
*
|
||||
* @return std::shared_ptr<Device> The device object
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice() const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_pipeline_get_device(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile of the specified sensor
|
||||
*
|
||||
* @param[in] sensorType The type of sensor
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList(OBSensorType sensorType) const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_pipeline_get_stream_profile_list(impl_, sensorType, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile list of supported depth-to-color alignments
|
||||
*
|
||||
* @param[in] colorProfile The color stream profile, which is the target stream profile for the depth-to-color alignment.
|
||||
* @param[in] alignMode The alignment mode.
|
||||
*
|
||||
* @attention Currently, only ALIGN_D2C_HW_MODE supported. For other align modes, please using the AlignFilter interface.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list of supported depth-to-color alignments.
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getD2CDepthProfileList(std::shared_ptr<StreamProfile> colorProfile, OBAlignMode alignMode) {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_get_d2c_depth_profile_list(impl_, colorProfile->getImpl(), alignMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turn on frame synchronization
|
||||
*/
|
||||
void enableFrameSync() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_enable_frame_sync(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turn off frame synchronization
|
||||
*/
|
||||
void disableFrameSync() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_disable_frame_sync(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
|
||||
OBCameraParam getCameraParam() {
|
||||
ob_error *error = nullptr;
|
||||
OBCameraParam cameraParam = ob_pipeline_get_camera_param(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return cameraParam;
|
||||
}
|
||||
|
||||
OBCameraParam getCameraParamWithProfile(uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth, uint32_t depthHeight) {
|
||||
ob_error *error = nullptr;
|
||||
OBCameraParam cameraParam = ob_pipeline_get_camera_param_with_profile(impl_, colorWidth, colorHeight, depthWidth, depthHeight, &error);
|
||||
Error::handle(&error);
|
||||
return cameraParam;
|
||||
}
|
||||
|
||||
OBCalibrationParam getCalibrationParam(std::shared_ptr<Config> config) {
|
||||
ob_error *error = nullptr;
|
||||
OBCalibrationParam calibrationParam = ob_pipeline_get_calibration_param(impl_, config->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
return calibrationParam;
|
||||
}
|
||||
|
||||
std::shared_ptr<FrameSet> waitForFrames(uint32_t timeoutMs = 1000) const {
|
||||
return waitForFrameset(timeoutMs);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "libobsensor/h/RecordPlayback.h"
|
||||
#include "libobsensor/hpp/Device.hpp"
|
||||
|
||||
namespace ob {
|
||||
|
||||
typedef std::function<void(OBPlaybackStatus status)> PlaybackStatusChangeCallback;
|
||||
|
||||
class RecordDevice {
|
||||
private:
|
||||
ob_record_device_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
explicit RecordDevice(std::shared_ptr<Device> device, const std::string &file, bool compressionEnabled = true) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_record_device(device->getImpl(), file.c_str(), compressionEnabled, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
virtual ~RecordDevice() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_record_device(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
RecordDevice(RecordDevice &&other) noexcept {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RecordDevice &operator=(RecordDevice &&other) noexcept {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
RecordDevice(const RecordDevice &) = delete;
|
||||
RecordDevice &operator=(const RecordDevice &) = delete;
|
||||
|
||||
public:
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
};
|
||||
|
||||
class PlaybackDevice : public Device {
|
||||
public:
|
||||
explicit PlaybackDevice(const std::string &file) : Device(nullptr) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_playback_device(file.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
virtual ~PlaybackDevice() noexcept override = default;
|
||||
|
||||
PlaybackDevice(PlaybackDevice &&other) noexcept : Device(std::move(other)) {}
|
||||
|
||||
PlaybackDevice &operator=(PlaybackDevice &&other) noexcept {
|
||||
Device::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
PlaybackDevice(const PlaybackDevice &) = delete;
|
||||
PlaybackDevice &operator=(const PlaybackDevice &) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Pause the streaming data from the playback device.
|
||||
*/
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume the streaming data from the playback device.
|
||||
*/
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Seek to a specific timestamp when playing back a recording.
|
||||
* @param[in] timestamp The timestamp to seek to, in milliseconds.
|
||||
*/
|
||||
void seek(const int64_t timestamp) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_seek(impl_, timestamp, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the playback rate of the playback device.
|
||||
* @param[in] rate The playback rate to set.
|
||||
*/
|
||||
void setPlaybackRate(const float rate) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_rate(impl_, rate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to be called when the playback status changes.
|
||||
* @param[in] callback The callback function to set.
|
||||
*/
|
||||
void setPlaybackStatusChangeCallback(PlaybackStatusChangeCallback callback) {
|
||||
callback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_status_changed_callback(impl_, &PlaybackDevice::playbackStatusCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the playback device.
|
||||
* @return The current playback status.
|
||||
*/
|
||||
OBPlaybackStatus getPlaybackStatus() const {
|
||||
ob_error *error = nullptr;
|
||||
OBPlaybackStatus status = ob_playback_device_get_current_playback_status(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current position of the playback device.
|
||||
* @return The current position of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getPosition() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t position = ob_playback_device_get_position(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the playback device.
|
||||
* @return The duration of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getDuration() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t duration = ob_playback_device_get_duration(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
private:
|
||||
static void playbackStatusCallback(OBPlaybackStatus status, void *userData) {
|
||||
auto *playbackDevice = static_cast<PlaybackDevice *>(userData);
|
||||
if(playbackDevice && playbackDevice->callback_) {
|
||||
playbackDevice->callback_(status);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PlaybackStatusChangeCallback callback_;
|
||||
};
|
||||
} // namespace ob
|
||||
239
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Sensor.hpp
Normal file
239
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Sensor.hpp
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Sensor.hpp
|
||||
* @brief Defines types related to sensors, which are used to obtain stream configurations, open and close streams, and set and get sensor properties.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/hpp/Filter.hpp"
|
||||
#include "libobsensor/h/Sensor.h"
|
||||
#include "libobsensor/h/Filter.h"
|
||||
#include "Error.hpp"
|
||||
#include "StreamProfile.hpp"
|
||||
#include "Device.hpp"
|
||||
#include "Frame.hpp"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ob {
|
||||
|
||||
class Sensor {
|
||||
public:
|
||||
/**
|
||||
* @brief Callback function for frame data.
|
||||
*
|
||||
* @param[in] frame The frame data.
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<Frame> frame)> FrameCallback;
|
||||
|
||||
protected:
|
||||
ob_sensor_t *impl_;
|
||||
FrameCallback callback_;
|
||||
|
||||
public:
|
||||
explicit Sensor(ob_sensor_t *impl) : impl_(impl) {}
|
||||
|
||||
Sensor(Sensor &&sensor) noexcept : impl_(sensor.impl_) {
|
||||
sensor.impl_ = nullptr;
|
||||
}
|
||||
|
||||
Sensor &operator=(Sensor &&sensor) noexcept {
|
||||
if(this != &sensor) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor(impl_, &error);
|
||||
Error::handle(&error);
|
||||
impl_ = sensor.impl_;
|
||||
sensor.impl_ = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Sensor(const Sensor &sensor) = delete;
|
||||
Sensor &operator=(const Sensor &sensor) = delete;
|
||||
|
||||
virtual ~Sensor() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the sensor type.
|
||||
*
|
||||
* @return OBSensorType The sensor type.
|
||||
*/
|
||||
OBSensorType getType() const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_sensor_get_type(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the list of stream profiles.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list.
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_sensor_get_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a list of recommended filters for the sensor.
|
||||
*
|
||||
* @return OBFilterList list of frame processing block
|
||||
*/
|
||||
std::vector<std::shared_ptr<Filter>> createRecommendedFilters() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_sensor_create_recommended_filter_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
auto filter_count = ob_filter_list_get_count(list, &error);
|
||||
|
||||
std::vector<std::shared_ptr<Filter>> filters;
|
||||
for(uint32_t i = 0; i < filter_count; i++) {
|
||||
auto filterImpl = ob_filter_list_get_filter(list, i, &error);
|
||||
Error::handle(&error);
|
||||
filters.push_back(std::make_shared<Filter>(filterImpl));
|
||||
}
|
||||
ob_delete_filter_list(list, &error);
|
||||
Error::handle(&error, false);
|
||||
return filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Open a frame data stream and set up a callback.
|
||||
*
|
||||
* @param[in] streamProfile The stream configuration.
|
||||
* @param[in] callback The callback to set when frame data arrives.
|
||||
*/
|
||||
void start(std::shared_ptr<StreamProfile> streamProfile, FrameCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
callback_ = std::move(callback);
|
||||
ob_sensor_start(impl_, const_cast<ob_stream_profile_t *>(streamProfile->getImpl()), &Sensor::frameCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the stream.
|
||||
*/
|
||||
void stop() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_sensor_stop(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dynamically switch resolutions.
|
||||
*
|
||||
* @param[in] streamProfile The resolution to switch to.
|
||||
*/
|
||||
void switchProfile(std::shared_ptr<StreamProfile> streamProfile) {
|
||||
ob_error *error = nullptr;
|
||||
ob_sensor_switch_profile(impl_, const_cast<ob_stream_profile_t *>(streamProfile->getImpl()), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
private:
|
||||
static void frameCallback(ob_frame *frame, void *userData) {
|
||||
auto sensor = static_cast<Sensor *>(userData);
|
||||
sensor->callback_(std::make_shared<Frame>(frame));
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBSensorType type() const {
|
||||
return getType();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Filter>> getRecommendedFilters() const {
|
||||
return createRecommendedFilters();
|
||||
}
|
||||
};
|
||||
|
||||
class SensorList {
|
||||
private:
|
||||
ob_sensor_list_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
explicit SensorList(ob_sensor_list_t *impl) : impl_(impl) {}
|
||||
|
||||
~SensorList() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor_list(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the number of sensors.
|
||||
*
|
||||
* @return uint32_t The number of sensors.
|
||||
*/
|
||||
uint32_t getCount() const {
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_sensor_list_get_count(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the type of the specified sensor.
|
||||
*
|
||||
* @param[in] index The sensor index.
|
||||
*
|
||||
* @return OBSensorType The sensor type.
|
||||
*/
|
||||
OBSensorType getSensorType(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_sensor_list_get_sensor_type(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by index number.
|
||||
*
|
||||
* @param[in] index The sensor index. The range is [0, count-1]. If the index exceeds the range, an exception will be thrown.
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> The sensor object.
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto sensor = ob_sensor_list_get_sensor(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Sensor>(sensor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by sensor type.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to obtain.
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> A sensor object. If the specified sensor type does not exist, it will return empty.
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType sensorType) const {
|
||||
ob_error *error = nullptr;
|
||||
auto sensor = ob_sensor_list_get_sensor_by_type(impl_, sensorType, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Sensor>(sensor);
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t count() const {
|
||||
return getCount();
|
||||
}
|
||||
|
||||
OBSensorType type(uint32_t index) const {
|
||||
return getSensorType(index);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
|
||||
|
|
@ -0,0 +1,603 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file StreamProfile.hpp
|
||||
* @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/h/StreamProfile.h"
|
||||
#include "libobsensor/h/Error.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
|
||||
class StreamProfile : public std::enable_shared_from_this<StreamProfile> {
|
||||
protected:
|
||||
const ob_stream_profile_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
StreamProfile(StreamProfile &streamProfile) = delete;
|
||||
StreamProfile &operator=(StreamProfile &streamProfile) = delete;
|
||||
|
||||
StreamProfile(StreamProfile &&streamProfile) noexcept : impl_(streamProfile.impl_) {
|
||||
streamProfile.impl_ = nullptr;
|
||||
}
|
||||
|
||||
StreamProfile &operator=(StreamProfile &&streamProfile) noexcept {
|
||||
if(this != &streamProfile) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile(impl_, &error);
|
||||
Error::handle(&error);
|
||||
impl_ = streamProfile.impl_;
|
||||
streamProfile.impl_ = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~StreamProfile() noexcept {
|
||||
if(impl_) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
}
|
||||
|
||||
const ob_stream_profile *getImpl() const {
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the format of the stream.
|
||||
*
|
||||
* @return OBFormat return the format of the stream.
|
||||
*/
|
||||
OBFormat getFormat() const {
|
||||
ob_error *error = nullptr;
|
||||
auto format = ob_stream_profile_get_format(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return format;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the type of stream.
|
||||
*
|
||||
* @return OBStreamType return the type of the stream.
|
||||
*/
|
||||
OBStreamType getType() const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_stream_profile_get_type(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the extrinsic parameters from current stream profile to the given target stream profile.
|
||||
*
|
||||
* @return OBExtrinsic Return the extrinsic parameters.
|
||||
*/
|
||||
OBExtrinsic getExtrinsicTo(std::shared_ptr<StreamProfile> target) const {
|
||||
ob_error *error = nullptr;
|
||||
auto extrinsic = ob_stream_profile_get_extrinsic_to(impl_, const_cast<ob_stream_profile_t *>(target->getImpl()), &error);
|
||||
Error::handle(&error);
|
||||
return extrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic parameters from current stream profile to the given target stream profile.
|
||||
*
|
||||
* @tparam target Target stream profile.
|
||||
* @tparam extrinsic The extrinsic.
|
||||
*/
|
||||
void bindExtrinsicTo(std::shared_ptr<StreamProfile> target, const OBExtrinsic &extrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_stream_profile_set_extrinsic_to(const_cast<ob_stream_profile_t *>(impl_), const_cast<const ob_stream_profile_t *>(target->getImpl()), extrinsic,
|
||||
&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic parameters from current stream profile to the given target stream type.
|
||||
*
|
||||
* @tparam targetStreamType Target stream type.
|
||||
* @tparam extrinsic The extrinsic.
|
||||
*/
|
||||
void bindExtrinsicTo(const OBStreamType &targetStreamType, const OBExtrinsic &extrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_stream_profile_set_extrinsic_to_type(const_cast<ob_stream_profile_t *>(impl_), targetStreamType, extrinsic, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if frame object is compatible with the given type.
|
||||
*
|
||||
* @tparam T Given type.
|
||||
*
|
||||
* @return bool return result.
|
||||
*/
|
||||
template <typename T> bool is() const;
|
||||
|
||||
/**
|
||||
* @brief Converts object type to target type.
|
||||
*
|
||||
* @tparam T Target type.
|
||||
*
|
||||
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>()) {
|
||||
throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
|
||||
}
|
||||
|
||||
return std::dynamic_pointer_cast<T>(shared_from_this());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts object type to target type (const version).
|
||||
*
|
||||
* @tparam T Target type.
|
||||
*
|
||||
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
|
||||
*/
|
||||
template <typename T> std::shared_ptr<const T> as() const {
|
||||
if(!is<T>()) {
|
||||
throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
|
||||
}
|
||||
|
||||
return std::static_pointer_cast<const T>(shared_from_this());
|
||||
}
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBFormat format() const {
|
||||
return getFormat();
|
||||
}
|
||||
|
||||
OBStreamType type() const {
|
||||
return getType();
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit StreamProfile(const ob_stream_profile_t *impl) : impl_(impl) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a video stream profile.
|
||||
*/
|
||||
class VideoStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit VideoStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~VideoStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the frame rate of the stream.
|
||||
*
|
||||
* @return uint32_t Return the frame rate of the stream.
|
||||
*/
|
||||
uint32_t getFps() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fps = ob_video_stream_profile_get_fps(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the width of the stream.
|
||||
*
|
||||
* @return uint32_t Return the width of the stream.
|
||||
*/
|
||||
uint32_t getWidth() const {
|
||||
ob_error *error = nullptr;
|
||||
auto width = ob_video_stream_profile_get_width(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the height of the stream.
|
||||
*
|
||||
* @return uint32_t Return the height of the stream.
|
||||
*/
|
||||
uint32_t getHeight() const {
|
||||
ob_error *error = nullptr;
|
||||
auto height = ob_video_stream_profile_get_height(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBCameraIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBCameraIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_video_stream_profile_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic parameters of the stream.
|
||||
*
|
||||
* @param[in] intrinsic The intrinsic parameters.
|
||||
*/
|
||||
void setIntrinsic(const OBCameraIntrinsic &intrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_video_stream_profile_set_intrinsic(const_cast<ob_stream_profile_t *>(impl_), intrinsic, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the distortion parameters of the stream.
|
||||
* @brief Brown distortion model
|
||||
*
|
||||
* @return OBCameraDistortion Return the distortion parameters.
|
||||
*/
|
||||
OBCameraDistortion getDistortion() const {
|
||||
ob_error *error = nullptr;
|
||||
auto distortion = ob_video_stream_profile_get_distortion(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return distortion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the distortion parameters of the stream.
|
||||
*
|
||||
* @param[in] distortion The distortion parameters.
|
||||
*/
|
||||
void setDistortion(const OBCameraDistortion &distortion) {
|
||||
ob_error *error = nullptr;
|
||||
ob_video_stream_profile_set_distortion(const_cast<ob_stream_profile_t *>(impl_), distortion, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the decimation configuration of the stream.
|
||||
* Includes original resolution and scale factor.
|
||||
*
|
||||
* @return OBHardwareDecimationConfig Return the decimation configuration.
|
||||
*/
|
||||
OBHardwareDecimationConfig getDecimationConfig() const {
|
||||
ob_error *error = nullptr;
|
||||
auto decimationConfig = ob_video_stream_profile_get_decimation_config(const_cast<ob_stream_profile_t *>(impl_), &error);
|
||||
Error::handle(&error);
|
||||
return decimationConfig;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t fps() const {
|
||||
return getFps();
|
||||
}
|
||||
|
||||
uint32_t width() const {
|
||||
return getWidth();
|
||||
}
|
||||
|
||||
uint32_t height() const {
|
||||
return getHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing an accelerometer stream profile.
|
||||
*/
|
||||
class AccelStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit AccelStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~AccelStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the full scale range.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the scale range value.
|
||||
*/
|
||||
OBAccelFullScaleRange getFullScaleRange() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fullScaleRange = ob_accel_stream_profile_get_full_scale_range(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fullScaleRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the sampling frequency.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the sampling frequency.
|
||||
*/
|
||||
OBAccelSampleRate getSampleRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto sampleRate = ob_accel_stream_profile_get_sample_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBAccelIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBAccelIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_accel_stream_profile_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBAccelFullScaleRange fullScaleRange() const {
|
||||
return getFullScaleRange();
|
||||
}
|
||||
|
||||
OBAccelSampleRate sampleRate() const {
|
||||
return getSampleRate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a gyroscope stream profile.
|
||||
*/
|
||||
class GyroStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit GyroStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~GyroStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the full scale range.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the scale range value.
|
||||
*/
|
||||
OBGyroFullScaleRange getFullScaleRange() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fullScaleRange = ob_gyro_stream_profile_get_full_scale_range(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fullScaleRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the sampling frequency.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the sampling frequency.
|
||||
*/
|
||||
OBGyroSampleRate getSampleRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto sampleRate = ob_gyro_stream_profile_get_sample_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBGyroIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBGyroIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_gyro_stream_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBGyroFullScaleRange fullScaleRange() const {
|
||||
return getFullScaleRange();
|
||||
}
|
||||
|
||||
OBGyroSampleRate sampleRate() const {
|
||||
return getSampleRate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a LiDAR stream profile.
|
||||
*/
|
||||
|
||||
class LiDARStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit LiDARStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~LiDARStreamProfile() noexcept override = default;
|
||||
|
||||
OBLiDARScanRate getScanRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto rate = ob_lidar_stream_profile_get_scan_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return rate;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> bool StreamProfile::is() const {
|
||||
switch(this->getType()) {
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_IR_LEFT:
|
||||
case OB_STREAM_IR_RIGHT:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_COLOR_LEFT:
|
||||
case OB_STREAM_COLOR_RIGHT:
|
||||
case OB_STREAM_DEPTH:
|
||||
case OB_STREAM_RAW_PHASE:
|
||||
case OB_STREAM_CONFIDENCE:
|
||||
return typeid(T) == typeid(VideoStreamProfile);
|
||||
case OB_STREAM_ACCEL:
|
||||
return typeid(T) == typeid(AccelStreamProfile);
|
||||
case OB_STREAM_GYRO:
|
||||
return typeid(T) == typeid(GyroStreamProfile);
|
||||
case OB_STREAM_LIDAR:
|
||||
return typeid(T) == typeid(LiDARStreamProfile);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class StreamProfileFactory {
|
||||
public:
|
||||
static std::shared_ptr<StreamProfile> create(const ob_stream_profile_t *impl) {
|
||||
ob_error *error = nullptr;
|
||||
const auto type = ob_stream_profile_get_type(impl, &error);
|
||||
Error::handle(&error);
|
||||
switch(type) {
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_IR_LEFT:
|
||||
case OB_STREAM_IR_RIGHT:
|
||||
case OB_STREAM_DEPTH:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_COLOR_LEFT:
|
||||
case OB_STREAM_COLOR_RIGHT:
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_CONFIDENCE:
|
||||
return std::make_shared<VideoStreamProfile>(impl);
|
||||
case OB_STREAM_ACCEL:
|
||||
return std::make_shared<AccelStreamProfile>(impl);
|
||||
case OB_STREAM_GYRO:
|
||||
return std::make_shared<GyroStreamProfile>(impl);
|
||||
case OB_STREAM_LIDAR:
|
||||
return std::make_shared<LiDARStreamProfile>(impl);
|
||||
default: {
|
||||
ob_error *err = ob_create_error(OB_STATUS_ERROR, "Unsupported stream type.", "StreamProfileFactory::create", "", OB_EXCEPTION_TYPE_INVALID_VALUE);
|
||||
Error::handle(&err);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class StreamProfileList {
|
||||
protected:
|
||||
const ob_stream_profile_list_t *impl_;
|
||||
|
||||
public:
|
||||
explicit StreamProfileList(ob_stream_profile_list_t *impl) : impl_(impl) {}
|
||||
~StreamProfileList() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the number of StreamProfile objects.
|
||||
*
|
||||
* @return uint32_t Return the number of StreamProfile objects.
|
||||
*/
|
||||
uint32_t getCount() const {
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_stream_profile_list_get_count(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the StreamProfile object at the specified index.
|
||||
*
|
||||
* @param[in] index The index of the StreamProfile object to be retrieved. Must be in the range [0, count-1]. Throws an exception if the index is out of
|
||||
* range.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfile> Return the StreamProfile object.
|
||||
*/
|
||||
std::shared_ptr<StreamProfile> getProfile(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_profile(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return StreamProfileFactory::create(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding video stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] width The width of the stream. Pass OB_WIDTH_ANY if no matching condition is required.
|
||||
* @param[in] height The height of the stream. Pass OB_HEIGHT_ANY if no matching condition is required.
|
||||
* @param[in] format The type of the stream. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
* @param[in] fps The frame rate of the stream. Pass OB_FPS_ANY if no matching condition is required.
|
||||
*
|
||||
* @return std::shared_ptr<VideoStreamProfile> Return the matching resolution.
|
||||
*/
|
||||
std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = OB_WIDTH_ANY, int height = OB_HEIGHT_ANY, OBFormat format = OB_FORMAT_ANY,
|
||||
int fps = OB_FPS_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_video_stream_profile(impl_, width, height, format, fps, &error);
|
||||
Error::handle(&error);
|
||||
auto vsp = StreamProfileFactory::create(profile);
|
||||
return vsp->as<VideoStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding video stream profile according to the decimation configuration. If multiple profiles match, the first one in the list is
|
||||
* returned. Throws an exception when no matching profile is found.
|
||||
*
|
||||
* @param[in] decimationConfig Decimation configuration. The actual resolution is computed fromthe original resolution and scale factor.
|
||||
* @param[in] format Stream format. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
* @param[in] fps Frame rate. Pass OB_FPS_ANY if no matching condition is required.
|
||||
*
|
||||
* @return std::shared_ptr<VideoStreamProfile> Return the matched video stream profile.
|
||||
*/
|
||||
std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(OBHardwareDecimationConfig decimationConfig, OBFormat format = OB_FORMAT_ANY,
|
||||
int fps = OB_FPS_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_video_stream_profile_by_decimation_config(impl_, decimationConfig, format, fps, &error);
|
||||
Error::handle(&error);
|
||||
auto vsp = StreamProfileFactory::create(profile);
|
||||
return vsp->as<VideoStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding accelerometer stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list
|
||||
* is returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] fullScaleRange The full scale range. Pass 0 if no matching condition is required.
|
||||
* @param[in] sampleRate The sampling frequency. Pass 0 if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<AccelStreamProfile> getAccelStreamProfile(OBAccelFullScaleRange fullScaleRange, OBAccelSampleRate sampleRate) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_accel_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
auto asp = StreamProfileFactory::create(profile);
|
||||
return asp->as<AccelStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding gyroscope stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] fullScaleRange The full scale range. Pass 0 if no matching condition is required.
|
||||
* @param[in] sampleRate The sampling frequency. Pass 0 if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<GyroStreamProfile> getGyroStreamProfile(OBGyroFullScaleRange fullScaleRange, OBGyroSampleRate sampleRate) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_gyro_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
auto gsp = StreamProfileFactory::create(profile);
|
||||
return gsp->as<GyroStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding LiDAR stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of LiDAR. Pass OB_LIDAR_SCAN_ANY if no matching condition is required.
|
||||
* @param[in] format The type of the stream. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<LiDARStreamProfile> getLiDARStreamProfile(OBLiDARScanRate scanRate, OBFormat format) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_lidar_stream_profile(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
auto lsp = StreamProfileFactory::create(profile);
|
||||
return lsp->as<LiDARStreamProfile>();
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t count() const {
|
||||
return getCount();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "libobsensor/h/ObTypes.h"
|
||||
#include "libobsensor/h/TypeHelper.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace ob {
|
||||
class TypeHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief Convert OBFormat to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFormat type.
|
||||
*
|
||||
* @return OBFormat of "string" type.
|
||||
*/
|
||||
static std::string convertOBFormatTypeToString(const OBFormat &type) {
|
||||
return ob_format_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBFrameType of "string" type.
|
||||
*/
|
||||
static std::string convertOBFrameTypeToString(const OBFrameType &type) {
|
||||
return ob_frame_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBStreamType of "string" type.
|
||||
*/
|
||||
static std::string convertOBStreamTypeToString(const OBStreamType &type) {
|
||||
return ob_stream_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBSensorType of "string" type.
|
||||
*/
|
||||
static std::string convertOBSensorTypeToString(const OBSensorType &type) {
|
||||
return ob_sensor_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return OBIMUSampleRate of "string" type.
|
||||
*/
|
||||
static std::string convertOBIMUSampleRateTypeToString(const OBIMUSampleRate &type) {
|
||||
return ob_imu_rate_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBGyroFullScaleRange to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBGyroFullScaleRange type.
|
||||
*
|
||||
* @return OBGyroFullScaleRange of "string" type.
|
||||
*/
|
||||
static std::string convertOBGyroFullScaleRangeTypeToString(const OBGyroFullScaleRange &type) {
|
||||
return ob_gyro_range_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBAccelFullScaleRange to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBAccelFullScaleRange type.
|
||||
*
|
||||
* @return OBAccelFullScaleRange of "string" type.
|
||||
*/
|
||||
static std::string convertOBAccelFullScaleRangeTypeToString(const OBAccelFullScaleRange &type) {
|
||||
return ob_accel_range_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBLiDARScanRate to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBLiDARScanRate type.
|
||||
* @return OBLiDARScanRate of "string" type.
|
||||
*/
|
||||
static std::string convertOBLiDARScanRateTypeToString(const OBLiDARScanRate &type) {
|
||||
return ob_lidar_scan_rate_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameMetadataType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameMetadataType type.
|
||||
*
|
||||
* @return OBFrameMetadataType of "string" type.
|
||||
*/
|
||||
static std::string convertOBFrameMetadataTypeToString(const OBFrameMetadataType &type) {
|
||||
return ob_meta_data_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to OBStreamType type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBStreamType type.
|
||||
*/
|
||||
static OBStreamType convertSensorTypeToStreamType(OBSensorType type) {
|
||||
return ob_sensor_type_to_stream_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given sensor type is a video sensor.
|
||||
* @brief Video sensors are sensors that produce video frames.
|
||||
* @brief The following sensor types are considered video sensors:
|
||||
* OB_SENSOR_COLOR,
|
||||
* OB_SENSOR_COLOR_LEFT,
|
||||
* OB_SENSOR_COLOR_RIGHT,
|
||||
* OB_SENSOR_DEPTH,
|
||||
* OB_SENSOR_IR,
|
||||
* OB_SENSOR_IR_LEFT,
|
||||
* OB_SENSOR_IR_RIGHT,
|
||||
* OB_SENSOR_CONFIDENCE,
|
||||
*
|
||||
* @param[in] type The sensor type
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
static bool isVideoSensorType(OBSensorType type) {
|
||||
return ob_is_video_sensor_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given stream type is a video stream.
|
||||
* @brief Video streams are streams that contain video frames.
|
||||
* @brief The following stream types are considered video streams:
|
||||
* OB_STREAM_VIDEO,
|
||||
* OB_STREAM_DEPTH,
|
||||
* OB_STREAM_COLOR,
|
||||
* OB_STREAM_COLOR_LEFT,
|
||||
* OB_STREAM_COLOR_RIGHT,
|
||||
* OB_STREAM_IR,
|
||||
* OB_STREAM_IR_LEFT,
|
||||
* OB_STREAM_IR_RIGHT,
|
||||
* OB_STREAM_CONFIDENCE,
|
||||
*
|
||||
* @param[in] type The stream type to check.
|
||||
*
|
||||
* @return true if the given stream type is a video stream, false otherwise.
|
||||
*/
|
||||
static bool isVideoStreamType(OBStreamType type) {
|
||||
return ob_is_video_stream_type(type);
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
#include <libobsensor/h/ObTypes.h>
|
||||
206
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Utils.hpp
Normal file
206
dev_ws/src/orbbec_camera/SDK/include/libobsensor/hpp/Utils.hpp
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Utils.hpp
|
||||
* @brief The SDK utils class
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "libobsensor/h/Utils.h"
|
||||
#include "Device.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "Frame.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
|
||||
class CoordinateTransformHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_3d(source_point3f, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation2dto3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_3d(source_point2f, source_depth_pixel_value, source_intrinsic, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_2d(source_point3f, target_intrinsic, target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel coordinate of the target camera
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_distortion Source distortion parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation2dto2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_2d(source_point2f, source_depth_pixel_value, source_intrinsic, source_distortion, target_intrinsic,
|
||||
target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
static bool calibration3dTo3d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_3d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration2dTo3d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result =
|
||||
ob_calibration_2d_to_3d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration3dTo2d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_2d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration2dTo2d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result =
|
||||
ob_calibration_2d_to_2d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::shared_ptr<ob::Frame> transformationDepthFrameToColorCamera(std::shared_ptr<ob::Device> device, std::shared_ptr<ob::Frame> depthFrame,
|
||||
uint32_t targetColorCameraWidth, uint32_t targetColorCameraHeight) {
|
||||
ob_error *error = NULL;
|
||||
|
||||
// unsafe operation, need to cast const to non-const
|
||||
auto unConstImpl = const_cast<ob_frame *>(depthFrame->getImpl());
|
||||
|
||||
auto result = transformation_depth_frame_to_color_camera(device->getImpl(), unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<ob::Frame>(result);
|
||||
}
|
||||
|
||||
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
|
||||
OBXYTables *xyTables) {
|
||||
ob_error *error = NULL;
|
||||
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void transformationDepthToPointCloud(OBXYTables *xyTables, const void *depthImageData, void *pointCloudData) {
|
||||
ob_error *error = NULL;
|
||||
transformation_depth_to_pointcloud(xyTables, depthImageData, pointCloudData, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData) {
|
||||
ob_error *error = NULL;
|
||||
transformation_depth_to_rgbd_pointcloud(xyTables, depthImageData, colorImageData, pointCloudData, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
};
|
||||
|
||||
class PointCloudHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @param[in] useMesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] meshThreshold Distance threshold for creating faces in point cloud,default value :50
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
static bool savePointcloudToPly(const char *fileName, std::shared_ptr<ob::Frame> frame, bool saveBinary, bool useMesh, float meshThreshold) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_pointcloud_to_ply(fileName, unConstImpl, saveBinary, useMesh, meshThreshold, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Save LiDAR point cloud to PLY file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame LiDAR point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @return bool save LiDAR point cloud result
|
||||
*/
|
||||
static bool saveLiDARPointcloudToPly(const char *fileName, std::shared_ptr<ob::LiDARPointsFrame> frame, bool saveBinary) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_lidar_pointcloud_to_ply(fileName, unConstImpl, saveBinary, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Version.hpp
|
||||
* @brief Provides functions to retrieve version information of the SDK.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/Version.h"
|
||||
|
||||
namespace ob {
|
||||
class Version {
|
||||
public:
|
||||
/**
|
||||
* @brief Get the full version number of the SDK.
|
||||
* @brief The full version number equals to: major * 10000 + minor * 100 + patch
|
||||
*
|
||||
* @return int The full version number of the SDK.
|
||||
*/
|
||||
static int getVersion() {
|
||||
return ob_get_version();
|
||||
}
|
||||
/**
|
||||
* @brief Get the major version number of the SDK.
|
||||
*
|
||||
* @return int The major version number of the SDK.
|
||||
*/
|
||||
static int getMajor() {
|
||||
return ob_get_major_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the minor version number of the SDK.
|
||||
*
|
||||
* @return int The minor version number of the SDK.
|
||||
*/
|
||||
static int getMinor() {
|
||||
return ob_get_minor_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the patch version number of the SDK.
|
||||
*
|
||||
* @return int The patch version number of the SDK.
|
||||
*/
|
||||
static int getPatch() {
|
||||
return ob_get_patch_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stage version of the SDK.
|
||||
* @brief The stage version string is a vendor defined string for some special releases.
|
||||
*
|
||||
* @return char* The stage version string of the SDK.
|
||||
*/
|
||||
static const char *getStageVersion() {
|
||||
return ob_get_stage_version();
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file for configuration "Release".
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "ob::OrbbecSDK" for configuration "Release"
|
||||
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.7.6"
|
||||
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
||||
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.7.6" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
104
dev_ws/src/orbbec_camera/SDK/lib/arm64/OrbbecSDKConfig.cmake
Normal file
104
dev_ws/src/orbbec_camera/SDK/lib/arm64/OrbbecSDKConfig.cmake
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.8.3...3.28)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS ob::OrbbecSDK)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target ob::OrbbecSDK
|
||||
add_library(ob::OrbbecSDK SHARED IMPORTED)
|
||||
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OrbbecSDKConfig-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "2.7.6")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("2.7.6" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "2.7.6")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so
Normal file
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so
Normal file
Binary file not shown.
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so.2
Normal file
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so.2
Normal file
Binary file not shown.
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so.2.7.6
Normal file
BIN
dev_ws/src/orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so.2.7.6
Normal file
Binary file not shown.
|
|
@ -0,0 +1,19 @@
|
|||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file for configuration "Release".
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "ob::OrbbecSDK" for configuration "Release"
|
||||
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.7.6"
|
||||
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
||||
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.7.6" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
104
dev_ws/src/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake
Normal file
104
dev_ws/src/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.8.3...3.28)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS ob::OrbbecSDK)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target ob::OrbbecSDK
|
||||
add_library(ob::OrbbecSDK SHARED IMPORTED)
|
||||
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OrbbecSDKConfig-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
65
dev_ws/src/orbbec_camera/SDK/lib/x64/OrbbecSDKVersion.cmake
Normal file
65
dev_ws/src/orbbec_camera/SDK/lib/x64/OrbbecSDKVersion.cmake
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "2.7.6")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("2.7.6" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "2.7.6")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue