mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-10 02:10:20 +08:00
init commit
This commit is contained in:
+167
@@ -0,0 +1,167 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: true
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
- Language: TextProto
|
||||
Delimiters:
|
||||
- pb
|
||||
- PB
|
||||
- proto
|
||||
- PROTO
|
||||
EnclosingFunctions:
|
||||
- EqualsProto
|
||||
- EquivToProto
|
||||
- PARSE_PARTIAL_TEXT_PROTO
|
||||
- PARSE_TEST_PROTO
|
||||
- PARSE_TEXT_PROTO
|
||||
- ParseTextOrDie
|
||||
- ParseTextProtoOrDie
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: Auto
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
...
|
||||
@@ -0,0 +1,4 @@
|
||||
*.so.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.so filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
+769
@@ -0,0 +1,769 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,c++,python,jetbrains+all,ros,ros2
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,visualstudiocode,c++,python,jetbrains+all,ros,ros2
|
||||
|
||||
### C++ ###
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
### JetBrains+all ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### JetBrains+all Patch ###
|
||||
# Ignore everything but code style settings and run configurations
|
||||
# that are supposed to be shared within teams.
|
||||
|
||||
.idea/*
|
||||
|
||||
!.idea/codeStyles
|
||||
!.idea/runConfigurations
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
### ROS ###
|
||||
devel/
|
||||
logs/
|
||||
bin/
|
||||
msg_gen/
|
||||
srv_gen/
|
||||
msg/*Action.msg
|
||||
msg/*ActionFeedback.msg
|
||||
msg/*ActionGoal.msg
|
||||
msg/*ActionResult.msg
|
||||
msg/*Feedback.msg
|
||||
msg/*Goal.msg
|
||||
msg/*Result.msg
|
||||
msg/_*.py
|
||||
build_isolated/
|
||||
devel_isolated/
|
||||
|
||||
# Generated by dynamic reconfigure
|
||||
*.cfgc
|
||||
/cfg/cpp/
|
||||
/cfg/*.py
|
||||
|
||||
# Ignore generated docs
|
||||
*.dox
|
||||
*.wikidoc
|
||||
|
||||
# eclipse stuff
|
||||
.project
|
||||
.cproject
|
||||
|
||||
# qcreator stuff
|
||||
CMakeLists.txt.user
|
||||
|
||||
srv/_*.py
|
||||
*.pcd
|
||||
*.pyc
|
||||
qtcreator-*
|
||||
*.user
|
||||
|
||||
/planning/cfg
|
||||
/planning/docs
|
||||
/planning/src
|
||||
|
||||
*~
|
||||
|
||||
# Emacs
|
||||
.#*
|
||||
|
||||
# Catkin custom files
|
||||
CATKIN_IGNORE
|
||||
|
||||
### ROS2 ###
|
||||
install/
|
||||
log/
|
||||
|
||||
# Ignore generated docs
|
||||
|
||||
# eclipse stuff
|
||||
|
||||
# qcreator stuff
|
||||
|
||||
|
||||
|
||||
# Emacs
|
||||
|
||||
# Colcon custom files
|
||||
COLCON_IGNORE
|
||||
AMENT_IGNORE
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# Support for Project snippet scope
|
||||
.vscode/*.code-snippets
|
||||
|
||||
# Ignore code-workspaces
|
||||
*.code-workspace
|
||||
|
||||
### VisualStudio ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.iobj
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
### VisualStudio Patch ###
|
||||
# Additional files built by Visual Studio
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,c++,python,jetbrains+all,ros,ros2
|
||||
@@ -0,0 +1 @@
|
||||
*.so.* filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,136 @@
|
||||
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")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-variable -Wno-unused-parameter -Werror)
|
||||
endif ()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(ament_index_cpp REQUIRED)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(builtin_interfaces REQUIRED)
|
||||
find_package(cv_bridge REQUIRED)
|
||||
find_package(glog REQUIRED)
|
||||
find_package(image_transport REQUIRED)
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(orbbec_camera_msgs REQUIRED)
|
||||
find_package(rclcpp REQUIRED)
|
||||
find_package(rclcpp_components REQUIRED)
|
||||
find_package(sensor_msgs REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
find_package(std_srvs REQUIRED)
|
||||
find_package(tf2 REQUIRED)
|
||||
find_package(tf2_eigen REQUIRED)
|
||||
find_package(tf2_msgs REQUIRED)
|
||||
find_package(tf2_ros REQUIRED)
|
||||
find_package(tf2_sensor_msgs REQUIRED)
|
||||
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
find_package(ORBBEC_SDK REQUIRED)
|
||||
|
||||
if (NOT ORBBEC_SDK_FOUND)
|
||||
message("Could not find Orbbec SDK!")
|
||||
endif ()
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED
|
||||
src/device_ctrl_service.cpp
|
||||
src/ob_camera_node_factory.cpp
|
||||
src/ob_camera_node.cpp
|
||||
src/utils.cpp
|
||||
)
|
||||
|
||||
set(dependencies
|
||||
ament_index_cpp
|
||||
builtin_interfaces
|
||||
cv_bridge
|
||||
Eigen3
|
||||
image_transport
|
||||
orbbec_camera_msgs
|
||||
ORBBEC_SDK
|
||||
rclcpp
|
||||
rclcpp_components
|
||||
sensor_msgs
|
||||
std_msgs
|
||||
std_srvs
|
||||
tf2
|
||||
tf2_msgs
|
||||
tf2_ros
|
||||
tf2_sensor_msgs
|
||||
)
|
||||
|
||||
ament_target_dependencies(${PROJECT_NAME}
|
||||
${dependencies}
|
||||
)
|
||||
rclcpp_components_register_node(${PROJECT_NAME}
|
||||
PLUGIN "orbbec_camera::OBCameraNodeFactory"
|
||||
EXECUTABLE orbbec_camera_node
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
${ORBBEC_SDK_INCLUDE_DIR}
|
||||
${OpenCV_INCLUDED_DIRS}
|
||||
)
|
||||
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
${ORBBEC_SDK_LIBRARIES}
|
||||
${OpenCV_LIBS}
|
||||
Eigen3::Eigen
|
||||
glog::glog
|
||||
magic_enum::magic_enum
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION include
|
||||
)
|
||||
|
||||
install(DIRECTORY
|
||||
launch
|
||||
DESTINATION share/${PROJECT_NAME}/
|
||||
)
|
||||
|
||||
install(DIRECTORY
|
||||
config
|
||||
DESTINATION share/${PROJECT_NAME}/
|
||||
)
|
||||
|
||||
|
||||
install(DIRECTORY
|
||||
params
|
||||
DESTINATION share/${PROJECT_NAME}/
|
||||
)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
# the following line skips the linter which checks for copyrights
|
||||
# uncomment the line when a copyright and license is not present in all source files
|
||||
#set(ament_cmake_copyright_FOUND TRUE)
|
||||
# the following line skips cpplint (only works in a git repo)
|
||||
# uncomment the line when this package is not in a git repo
|
||||
#set(ament_cmake_cpplint_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif ()
|
||||
|
||||
ament_export_include_directories(include)
|
||||
ament_export_libraries(${PROJECT_NAME})
|
||||
ament_export_dependencies(${dependencies})
|
||||
|
||||
ament_package()
|
||||
@@ -0,0 +1,50 @@
|
||||
message("***************************************************")
|
||||
message("* *")
|
||||
message("* Find Orbbec SDK *")
|
||||
message("* *")
|
||||
message("***************************************************")
|
||||
|
||||
set(ORBBEC_SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/orbbec")
|
||||
|
||||
find_path(ORBBEC_SDK_INCLUDE_DIR "libobsensor/ObSensor.hpp" "${ORBBEC_SDK_DIR}/include")
|
||||
message("include:\n${ORBBEC_SDK_INCLUDE_DIR}")
|
||||
|
||||
execute_process(COMMAND uname -m OUTPUT_VARIABLE MACHINES)
|
||||
execute_process(COMMAND getconf LONG_BIT OUTPUT_VARIABLE MACHINES_BIT)
|
||||
MESSAGE(STATUS "ORRBEC Machine : ${MACHINES}")
|
||||
MESSAGE(STATUS "ORRBEC Machine Bits : ${MACHINES_BIT}")
|
||||
if ((${MACHINES} MATCHES "x86_64") AND (${MACHINES_BIT} MATCHES "64"))
|
||||
set(HOST_PLATFORM "x64")
|
||||
elseif ((${MACHINES} MATCHES "x86_64") AND (${MACHINES_BIT} MATCHES "32"))
|
||||
set(HOST_PLATFORM "x86")
|
||||
elseif (${MACHINES} MATCHES "x86")
|
||||
elseif (${MACHINES} MATCHES "x86")
|
||||
set(HOST_PLATFORM "x86")
|
||||
elseif (${MACHINES} MATCHES "i686")
|
||||
set(HOST_PLATFORM "x86")
|
||||
elseif (${MACHINES} MATCHES "i386")
|
||||
set(HOST_PLATFORM "x86")
|
||||
elseif (${MACHINES} MATCHES "arm")
|
||||
set(HOST_PLATFORM "arm")
|
||||
elseif ((${MACHINES} MATCHES "aarch64") AND (${MACHINES_BIT} MATCHES "64"))
|
||||
set(HOST_PLATFORM "arm64")
|
||||
elseif ((${MACHINES} MATCHES "aarch64") AND (${MACHINES_BIT} MATCHES "32"))
|
||||
set(HOST_PLATFORM "arm")
|
||||
endif ()
|
||||
|
||||
message(STATUS "ORRBEC : ${HOST_PLATFORM}")
|
||||
|
||||
set(ORBBEC_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/orbbec/lib/${HOST_PLATFORM}")
|
||||
|
||||
message("Orbbec lib path: ${ORBBEC_LIB_PATH}")
|
||||
|
||||
find_library(ORBBEC_SDK_LIBRARY NAMES OrbbecSDK PATHS ${ORBBEC_LIB_PATH} REQUIRED)
|
||||
find_library(POSTFILTER_LIBRARY NAMES postfilter PATHS ${ORBBEC_LIB_PATH} REQUIRED)
|
||||
|
||||
message("OrbbecSDK path: ${ORBBEC_SDK_LIBRARY}")
|
||||
message("postfilter path: ${POSTFILTER_LIBRARY}")
|
||||
|
||||
set(ORBBEC_SDK_LIBRARIES ${ORBBEC_SDK_LIBRARY} ${POSTFILTER_LIBRARY})
|
||||
message("libraries:\n${ORBBEC_SDK_LIBRARIES}")
|
||||
|
||||
set(ORBBEC_SDK_FOUND TRUE)
|
||||
@@ -0,0 +1,100 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2013-2021 Orbbec 3D Technology, Inc */
|
||||
/* */
|
||||
/* PROPRIETARY RIGHTS of Orbbec 3D Technology are involved in the */
|
||||
/* subject matter of this material. All manufacturing, reproduction, use, */
|
||||
/* and sales rights pertaining to this subject matter are governed by the */
|
||||
/* license agreement. The recipient of this software implicitly accepts */
|
||||
/* the terms of the license. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define OB_ROS_MAJOR_VERSION 1
|
||||
#define OB_ROS_MINOR_VERSION 0
|
||||
#define OB_ROS_PATCH_VERSION 0
|
||||
|
||||
#ifndef STRINGIFY
|
||||
#define STRINGIFY(arg) #arg
|
||||
#endif
|
||||
#ifndef VAR_ARG_STRING
|
||||
#define VAR_ARG_STRING(arg) STRINGIFY(arg)
|
||||
#endif
|
||||
|
||||
#define STRINGIFY(arg) #arg
|
||||
#define VAR_ARG_STRING(arg) STRINGIFY(arg)
|
||||
/* Return version in "X.Y.Z" format */
|
||||
#define OB_ROS_VERSION_STR \
|
||||
(VAR_ARG_STRING(OB_ROS_MAJOR_VERSION.OB_ROS_MINOR_VERSION.OB_ROS_PATCH_VERSION))
|
||||
|
||||
#define ROS_DEBUG(...) RCLCPP_DEBUG(_logger, __VA_ARGS__)
|
||||
#define ROS_INFO(...) RCLCPP_INFO(_logger, __VA_ARGS__)
|
||||
#define ROS_WARN(...) RCLCPP_WARN(_logger, __VA_ARGS__)
|
||||
#define ROS_ERROR(...) RCLCPP_ERROR(_logger, __VA_ARGS__)
|
||||
|
||||
#
|
||||
|
||||
namespace orbbec_camera {
|
||||
|
||||
const bool ALIGN_DEPTH = false;
|
||||
const bool POINTCLOUD = false;
|
||||
const bool ALLOW_NO_TEXTURE_POINTS = false;
|
||||
const bool SYNC_FRAMES = false;
|
||||
const bool ORDERED_POINTCLOUD = false;
|
||||
|
||||
const bool PUBLISH_TF = true;
|
||||
const double TF_PUBLISH_RATE = 0; // Static transform
|
||||
const double DIAGNOSTICS_PERIOD = 0; // Static transform
|
||||
|
||||
const int IMAGE_WIDTH = 640;
|
||||
const int IMAGE_HEIGHT = 480;
|
||||
const double IMAGE_FPS = 30;
|
||||
|
||||
const std::string IMAGE_QOS = "SYSTEM_DEFAULT";
|
||||
const std::string DEFAULT_QOS = "DEFAULT";
|
||||
const std::string HID_QOS = "HID_DEFAULT";
|
||||
const std::string EXTRINSICS_QOS = "EXTRINSICS_DEFAULT";
|
||||
|
||||
const double IMU_FPS = 0;
|
||||
|
||||
const bool ENABLE_DEPTH = true;
|
||||
const bool ENABLE_INFRA1 = true;
|
||||
const bool ENABLE_INFRA2 = true;
|
||||
const bool ENABLE_COLOR = true;
|
||||
const bool ENABLE_FISHEYE = true;
|
||||
const bool ENABLE_IMU = true;
|
||||
const bool HOLD_BACK_IMU_FOR_FRAMES = false;
|
||||
const bool PUBLISH_ODOM_TF = true;
|
||||
|
||||
const std::string DEFAULT_BASE_FRAME_ID = "camera_link";
|
||||
const std::string DEFAULT_ODOM_FRAME_ID = "odom_frame";
|
||||
const std::string DEFAULT_DEPTH_FRAME_ID = "camera_depth_frame";
|
||||
const std::string DEFAULT_INFRA1_FRAME_ID = "camera_infra1_frame";
|
||||
const std::string DEFAULT_INFRA2_FRAME_ID = "camera_infra2_frame";
|
||||
const std::string DEFAULT_COLOR_FRAME_ID = "camera_color_frame";
|
||||
const std::string DEFAULT_FISHEYE_FRAME_ID = "camera_fisheye_frame";
|
||||
const std::string DEFAULT_IMU_FRAME_ID = "camera_imu_frame";
|
||||
|
||||
const std::string DEFAULT_DEPTH_OPTICAL_FRAME_ID = "camera_depth_optical_frame";
|
||||
const std::string DEFAULT_INFRA1_OPTICAL_FRAME_ID = "camera_infra1_optical_frame";
|
||||
const std::string DEFAULT_INFRA2_OPTICAL_FRAME_ID = "camera_infra2_optical_frame";
|
||||
const std::string DEFAULT_COLOR_OPTICAL_FRAME_ID = "camera_color_optical_frame";
|
||||
const std::string DEFAULT_FISHEYE_OPTICAL_FRAME_ID = "camera_fisheye_optical_frame";
|
||||
const std::string DEFAULT_ACCEL_OPTICAL_FRAME_ID = "camera_accel_optical_frame";
|
||||
const std::string DEFAULT_GYRO_OPTICAL_FRAME_ID = "camera_gyro_optical_frame";
|
||||
const std::string DEFAULT_IMU_OPTICAL_FRAME_ID = "camera_imu_optical_frame";
|
||||
|
||||
const std::string DEFAULT_ALIGNED_DEPTH_TO_COLOR_FRAME_ID = "camera_aligned_depth_to_color_frame";
|
||||
const std::string DEFAULT_ALIGNED_DEPTH_TO_INFRA1_FRAME_ID = "camera_aligned_depth_to_infra1_frame";
|
||||
const std::string DEFAULT_ALIGNED_DEPTH_TO_INFRA2_FRAME_ID = "camera_aligned_depth_to_infra2_frame";
|
||||
const std::string DEFAULT_ALIGNED_DEPTH_TO_FISHEYE_FRAME_ID =
|
||||
"camera_aligned_depth_to_fisheye_frame";
|
||||
|
||||
const std::string DEFAULT_UNITE_IMU_METHOD = "";
|
||||
const std::string DEFAULT_FILTERS = "";
|
||||
const std::string DEFAULT_TOPIC_ODOM_IN = "";
|
||||
|
||||
const float ROS_DEPTH_SCALE = 0.001;
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,259 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2013-2021 Orbbec 3D Technology, Inc */
|
||||
/* */
|
||||
/* PROPRIETARY RIGHTS of Orbbec 3D Technology are involved in the */
|
||||
/* subject matter of this material. All manufacturing, reproduction, use, */
|
||||
/* and sales rights pertaining to this subject matter are governed by the */
|
||||
/* license agreement. The recipient of this software implicitly accepts */
|
||||
/* the terms of the license. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <cv_bridge/cv_bridge.h>
|
||||
#include <sensor_msgs/msg/point_cloud2.hpp>
|
||||
#include <sensor_msgs/point_cloud2_iterator.hpp>
|
||||
#include <tf2_ros/static_transform_broadcaster.h>
|
||||
#include <tf2_ros/transform_broadcaster.h>
|
||||
#include <tf2/LinearMath/Quaternion.h>
|
||||
#include <std_srvs/srv/set_bool.hpp>
|
||||
#include <sensor_msgs/msg/camera_info.hpp>
|
||||
#include <image_publisher.h>
|
||||
|
||||
#include "libobsensor/ObSensor.hpp"
|
||||
|
||||
#include "orbbec_camera_msgs/msg/device_info.hpp"
|
||||
#include "orbbec_camera_msgs/srv/get_device_list.hpp"
|
||||
#include "orbbec_camera_msgs/msg/extrinsics.hpp"
|
||||
#include "orbbec_camera_msgs/msg/metadata.hpp"
|
||||
#include "orbbec_camera_msgs/srv/get_int32.hpp"
|
||||
#include "orbbec_camera_msgs/srv/set_int32.hpp"
|
||||
|
||||
#include "orbbec_camera/constants.h"
|
||||
|
||||
#define STREAM_NAME(sip) \
|
||||
(static_cast<std::ostringstream&&>(std::ostringstream() \
|
||||
<< _stream_name[sip.first] \
|
||||
<< ((sip.second > 0) ? std::to_string(sip.second) : ""))) \
|
||||
.str()
|
||||
#define FRAME_ID(sip) \
|
||||
(static_cast<std::ostringstream&&>(std::ostringstream() \
|
||||
<< getNamespaceStr() << "_" << STREAM_NAME(sip) << "_frame")) \
|
||||
.str()
|
||||
#define OPTICAL_FRAME_ID(sip) \
|
||||
(static_cast<std::ostringstream&&>( \
|
||||
std::ostringstream() << getNamespaceStr() << "_" << STREAM_NAME(sip) << "_optical_frame")) \
|
||||
.str()
|
||||
#define ALIGNED_DEPTH_TO_FRAME_ID(sip) \
|
||||
(static_cast<std::ostringstream&&>(std::ostringstream() \
|
||||
<< getNamespaceStr() << "_aligned_depth_to_" \
|
||||
<< STREAM_NAME(sip) << "_frame")) \
|
||||
.str()
|
||||
#define BASE_FRAME_ID() \
|
||||
(static_cast<std::ostringstream&&>(std::ostringstream() << getNamespaceStr() << "_link")).str()
|
||||
#define ODOM_FRAME_ID() \
|
||||
(static_cast<std::ostringstream&&>(std::ostringstream() << getNamespaceStr() << "_odom_frame")) \
|
||||
.str()
|
||||
|
||||
namespace orbbec_camera {
|
||||
using GetDeviceList = orbbec_camera_msgs::srv::GetDeviceList;
|
||||
using Extrinsics = orbbec_camera_msgs::msg::Extrinsics;
|
||||
using SetInt32 = orbbec_camera_msgs::srv::SetInt32;
|
||||
using GetInt32 = orbbec_camera_msgs::srv::GetInt32;
|
||||
|
||||
typedef std::pair<ob_stream_type, int> stream_index_pair;
|
||||
|
||||
const stream_index_pair COLOR{OB_STREAM_COLOR, 0};
|
||||
const stream_index_pair DEPTH{OB_STREAM_DEPTH, 0};
|
||||
const stream_index_pair IR0{OB_STREAM_IR, 0};
|
||||
const stream_index_pair IR1{OB_STREAM_IR, 1};
|
||||
const stream_index_pair IR2{OB_STREAM_IR, 2};
|
||||
|
||||
const stream_index_pair GYRO{OB_STREAM_GYRO, 0};
|
||||
const stream_index_pair ACCEL{OB_STREAM_ACCEL, 0};
|
||||
|
||||
const std::vector<stream_index_pair> IMAGE_STREAMS = {DEPTH, IR0, COLOR};
|
||||
|
||||
const std::vector<stream_index_pair> HID_STREAMS = {GYRO, ACCEL};
|
||||
class OBCameraNode {
|
||||
public:
|
||||
OBCameraNode(rclcpp::Node* node, std::shared_ptr<ob::Device> device);
|
||||
~OBCameraNode();
|
||||
|
||||
private:
|
||||
void setupDevices();
|
||||
|
||||
void setupProfiles();
|
||||
|
||||
void getParameters();
|
||||
|
||||
void setupTopics();
|
||||
|
||||
void setupCameraCtrlServices();
|
||||
|
||||
void startPipeline();
|
||||
|
||||
void setupPublishers();
|
||||
|
||||
void updateStreamCalibData();
|
||||
|
||||
void publishStaticTF(const rclcpp::Time& t, const std::vector<float>& trans,
|
||||
const tf2::Quaternion& q, const std::string& from, const std::string& to);
|
||||
|
||||
void calcAndPublishStaticTransform();
|
||||
|
||||
void publishDynamicTransforms();
|
||||
|
||||
void publishStaticTransforms();
|
||||
|
||||
std::optional<OBCameraParam> findCameraParam();
|
||||
|
||||
void getExposureCallback(const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index);
|
||||
|
||||
void setExposureCallback(const std::shared_ptr<SetInt32::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index);
|
||||
|
||||
void getGainCallback(const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index);
|
||||
|
||||
void setGainCallback(const std::shared_ptr<SetInt32::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index);
|
||||
|
||||
void getWhiteBalanceCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32::Response>& response);
|
||||
|
||||
void setWhiteBalanceCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<SetInt32 ::Request>& request,
|
||||
std::shared_ptr<SetInt32 ::Response>& response);
|
||||
|
||||
void setAutoExposureCallback(const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response,
|
||||
const stream_index_pair& stream_index);
|
||||
|
||||
void setLaserEnableCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response);
|
||||
|
||||
void setFloorEnableCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response);
|
||||
|
||||
void setLdpEnableCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response);
|
||||
|
||||
void setFanModeCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<SetInt32::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response);
|
||||
|
||||
void publishPointCloud(std::shared_ptr<ob::FrameSet> frame_set, const rclcpp::Time& t);
|
||||
|
||||
void publishDepthPointCloud(std::shared_ptr<ob::FrameSet> frame_set, const rclcpp::Time& t);
|
||||
|
||||
void publishColorPointCloud(std::shared_ptr<ob::FrameSet> frame_set, const rclcpp::Time& t);
|
||||
|
||||
void frameSetCallback(std::shared_ptr<ob::FrameSet> frame_set);
|
||||
|
||||
void publishFrame(std::shared_ptr<ob::Frame> frame, const rclcpp::Time& t,
|
||||
const stream_index_pair& stream);
|
||||
|
||||
void publishColorFrame(std::shared_ptr<ob::ColorFrame> frame, const rclcpp::Time& t);
|
||||
|
||||
void publishDepthFrame(std::shared_ptr<ob::DepthFrame> frame, const rclcpp::Time& t);
|
||||
|
||||
void publishIRFrame(std::shared_ptr<ob::IRFrame> frame, const rclcpp::Time& t);
|
||||
|
||||
private:
|
||||
rclcpp::Node* node_;
|
||||
std::shared_ptr<ob::Device> device_;
|
||||
rclcpp::Logger logger_;
|
||||
std::atomic_bool is_running_{false};
|
||||
std::unique_ptr<ob::Pipeline> pipeline_;
|
||||
std::shared_ptr<ob::Config> config_;
|
||||
std::map<stream_index_pair, std::shared_ptr<ob::Sensor>> sensors_;
|
||||
std::map<stream_index_pair, ob_camera_intrinsic> stream_intrinsics_;
|
||||
std::map<stream_index_pair, sensor_msgs::msg::CameraInfo> camera_infos_;
|
||||
std::map<stream_index_pair, OBCameraParam> ob_camera_param_;
|
||||
std::map<stream_index_pair, int> width_;
|
||||
std::map<stream_index_pair, int> height_;
|
||||
std::map<stream_index_pair, double> fps_;
|
||||
std::map<stream_index_pair, std::string> frame_id_;
|
||||
std::map<stream_index_pair, std::string> optical_frame_id_;
|
||||
std::map<stream_index_pair, std::string> depth_aligned_frame_id_;
|
||||
std::string base_frame_id_;
|
||||
bool align_depth_;
|
||||
std::map<stream_index_pair, std::string> qos_;
|
||||
std::map<stream_index_pair, std::string> info_qos_;
|
||||
std::map<stream_index_pair, ob_format> format_;
|
||||
std::map<ob_stream_type, int> image_format_;
|
||||
std::map<stream_index_pair, std::vector<std::shared_ptr<ob::VideoStreamProfile>>>
|
||||
enabled_profiles_;
|
||||
std::map<stream_index_pair, uint32_t> seq_;
|
||||
std::map<stream_index_pair, cv::Mat> images_;
|
||||
std::map<stream_index_pair, std::string> encoding_;
|
||||
std::map<stream_index_pair, int> unit_step_size_;
|
||||
std::vector<int> compression_params_;
|
||||
ob::FormatConvertFilter format_convert_filter;
|
||||
|
||||
std::map<ob_frame_type, bool> is_first_frame_;
|
||||
|
||||
std::map<stream_index_pair, bool> enable_;
|
||||
std::map<ob_stream_type, std::string> stream_name_;
|
||||
std::map<stream_index_pair, image_transport::Publisher> image_publishers_;
|
||||
std::map<stream_index_pair, rclcpp::Publisher<sensor_msgs::msg::CameraInfo>::SharedPtr>
|
||||
camera_info_publishers_;
|
||||
|
||||
std::map<stream_index_pair, rclcpp::Service<GetInt32>::SharedPtr> get_exposure_srv_;
|
||||
std::map<stream_index_pair, rclcpp::Service<SetInt32>::SharedPtr> set_exposure_srv_;
|
||||
std::map<stream_index_pair, rclcpp::Service<GetInt32>::SharedPtr> get_gain_srv_;
|
||||
std::map<stream_index_pair, rclcpp::Service<SetInt32>::SharedPtr> set_gain_srv_;
|
||||
rclcpp::Service<GetInt32>::SharedPtr get_white_balance_srv_; // only rgb
|
||||
rclcpp::Service<SetInt32>::SharedPtr set_white_balance_srv_;
|
||||
std::map<stream_index_pair, rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr>
|
||||
set_auto_exposure_srv_; // only rgb color
|
||||
|
||||
bool publish_tf_;
|
||||
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> static_tf_broadcaster_;
|
||||
std::shared_ptr<tf2_ros::TransformBroadcaster> dynamic_tf_broadcaster_;
|
||||
std::vector<geometry_msgs::msg::TransformStamped> tf_msgs;
|
||||
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr point_cloud_publisher_;
|
||||
ob::PointCloudFilter point_cloud_filter_;
|
||||
sensor_msgs::msg::PointCloud2 point_cloud_msg_;
|
||||
|
||||
rclcpp::Publisher<Extrinsics>::SharedPtr extrinsics_publisher_;
|
||||
std::vector<OBCameraParam> camera_params_;
|
||||
OBD2CTransform extrinsics_;
|
||||
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr toggle_sensors_srv_;
|
||||
orbbec_camera_msgs::msg::DeviceInfo device_info_;
|
||||
rclcpp::Service<GetDeviceList>::SharedPtr get_device_list_srv;
|
||||
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr set_laser_enable_srv_;
|
||||
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr set_ldp_enable_srv_;
|
||||
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr set_floor_enable_srv_;
|
||||
rclcpp::Service<SetInt32>::SharedPtr set_fan_mode_srv_;
|
||||
std::vector<geometry_msgs::msg::TransformStamped> static_tf_msgs_;
|
||||
std::mutex tf_lock_;
|
||||
std::shared_ptr<std::thread> tf_thread_;
|
||||
std::condition_variable tf_cv_;
|
||||
double tf_publish_rate_;
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include "ob_camera_node.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "libobsensor/ObSensor.hpp"
|
||||
|
||||
namespace orbbec_camera {
|
||||
class OBCameraNodeFactory : public rclcpp::Node {
|
||||
public:
|
||||
explicit OBCameraNodeFactory(const rclcpp::NodeOptions& node_options = rclcpp::NodeOptions());
|
||||
OBCameraNodeFactory(const std::string& node_name, const std::string& ns,
|
||||
const rclcpp::NodeOptions& node_options = rclcpp::NodeOptions());
|
||||
~OBCameraNodeFactory() override ;
|
||||
|
||||
private:
|
||||
void init();
|
||||
void startDevice();
|
||||
void getDevice(const std::shared_ptr<ob::DeviceList>& list);
|
||||
|
||||
void deviceConnectCallback(const std::shared_ptr<ob::DeviceList>& device_list);
|
||||
|
||||
void deviceDisconnectCallback(const std::shared_ptr<ob::DeviceList>& device_list);
|
||||
|
||||
private:
|
||||
std::unique_ptr<ob::Context> ctx_;
|
||||
rclcpp::Logger logger_;
|
||||
std::unique_ptr<OBCameraNode> ob_camera_node_;
|
||||
std::shared_ptr<ob::Device> device_;
|
||||
std::atomic_bool is_alive_{false};
|
||||
std::thread query_thread_;
|
||||
std::string serial_number_;
|
||||
std::string usb_port_id_;
|
||||
double reconnect_timeout_;
|
||||
double wait_for_device_timeout_;
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
|
||||
#include <rclcpp_components/register_node_macro.hpp>
|
||||
|
||||
RCLCPP_COMPONENTS_REGISTER_NODE(orbbec_camera::OBCameraNodeFactory)
|
||||
@@ -0,0 +1,42 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2013-2021 Orbbec 3D Technology, Inc */
|
||||
/* */
|
||||
/* PROPRIETARY RIGHTS of Orbbec 3D Technology are involved in the */
|
||||
/* subject matter of this material. All manufacturing, reproduction, use, */
|
||||
/* and sales rights pertaining to this subject matter are governed by the */
|
||||
/* license agreement. The recipient of this software implicitly accepts */
|
||||
/* the terms of the license. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <ostream>
|
||||
#include <glog/logging.h>
|
||||
#include <magic_enum.hpp>
|
||||
#include "libobsensor/ObSensor.hpp"
|
||||
#include <Eigen/Dense>
|
||||
#include <tf2/LinearMath/Quaternion.h>
|
||||
|
||||
#include "sensor_msgs/distortion_models.hpp"
|
||||
#include "sensor_msgs/msg/camera_info.hpp"
|
||||
#include <orbbec_camera_msgs/msg/extrinsics.hpp>
|
||||
|
||||
namespace orbbec_camera {
|
||||
sensor_msgs::msg::CameraInfo convertToCameraInfo(OBCameraIntrinsic intrinsic,
|
||||
OBCameraDistortion distortion);
|
||||
|
||||
void saveRGBPointsToPly(std::shared_ptr<ob::Frame> frame, std::string fileName);
|
||||
|
||||
void savePointsToPly(std::shared_ptr<ob::Frame> frame, std::string fileName);
|
||||
|
||||
tf2::Quaternion rotationMatrixToQuaternion(const float rotation[9]);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const OBCameraParam& rhs);
|
||||
|
||||
std::string strToLowercase(const std::string &str);
|
||||
|
||||
orbbec_camera_msgs::msg::Extrinsics obExtrinsicsToMsg(const OBD2CTransform& extrinsics,
|
||||
const std::string& frame_id);
|
||||
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,22 @@
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python import get_package_share_directory
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
params_config_path = (
|
||||
get_package_share_directory("orbbec_camera")
|
||||
+ "/params/orbbec_camera_params.yaml"
|
||||
)
|
||||
return LaunchDescription(
|
||||
[
|
||||
Node(
|
||||
package="orbbec_camera",
|
||||
namespace="camera",
|
||||
name="camera",
|
||||
executable="orbbec_camera_node",
|
||||
output="screen",
|
||||
parameters=[params_config_path],
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python import get_package_share_directory
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
params_config_path = (
|
||||
get_package_share_directory("orbbec_camera")
|
||||
+ "/params/orbbec_camera_params.yaml"
|
||||
)
|
||||
return LaunchDescription(
|
||||
[
|
||||
Node(
|
||||
package="orbbec_camera",
|
||||
namespace="camera",
|
||||
name="camera",
|
||||
executable="orbbec_camera_node",
|
||||
output="screen",
|
||||
parameters=[params_config_path],
|
||||
prefix=["xterm -e gdb -ex run --args"]
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
/* License: Apache 2.0. See LICENSE file in root directory.
|
||||
Copyright(c) 2020 Orbbec Corporation. All Rights Reserved. */
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* \file ObSensor.h
|
||||
* \brief libobsensor C entrance
|
||||
* \else
|
||||
* \file ObSensor.h
|
||||
* \brief libobsensor的C的入口
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#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/RecordPlayback.h>
|
||||
#include <libobsensor/h/Sensor.h>
|
||||
#include <libobsensor/h/StreamProfile.h>
|
||||
#include <libobsensor/h/Version.h>
|
||||
@@ -0,0 +1,27 @@
|
||||
/* License: Apache 2.0. See LICENSE file in root directory.
|
||||
Copyright(c) 2020 Orbbec Corporation. All Rights Reserved. */
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* \file ObSensor.hpp
|
||||
* \brief
|
||||
* libobsensor pure C ++ entry document
|
||||
* \else
|
||||
* \file ObSensor.hpp
|
||||
* \brief
|
||||
* libobsensor的纯C++的入口文件
|
||||
* \endif
|
||||
*/
|
||||
#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/Types.hpp>
|
||||
#include <libobsensor/hpp/Version.hpp>
|
||||
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Context.h
|
||||
* @brief Context is a management class that describes the runtime of the SDK and is responsible for resource application 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.
|
||||
* \else
|
||||
* @file Context.h
|
||||
* @brief context是描述SDK的runtime一个管理类,负责SDK的资源申请与释放
|
||||
* context具备多设备的管理能力,负责枚举设备,监听设备回调,启用多设备同步等功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief create context api
|
||||
*
|
||||
* @param[out] error record the error information
|
||||
* @return ob_context* return the context that created
|
||||
* \else
|
||||
* @brief 创建context的接口函数
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_context* 返回上下文环境
|
||||
* \endif
|
||||
*/
|
||||
ob_context *ob_create_context(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief create context with config
|
||||
*
|
||||
* @param[in] config_path Configure the path of the file, and return null if the default path is used.
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_context* returns the context
|
||||
* \else
|
||||
* @brief 创建context的接口函数
|
||||
*
|
||||
* @param[in] config_path 配置文件的路径,如果使用默认路径则传NULL
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_context* 返回上下文环境
|
||||
* \endif
|
||||
*/
|
||||
ob_context *ob_create_context_with_config(const char *config_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete context
|
||||
*
|
||||
* @param[in] context The context to delete
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除上下文环境
|
||||
*
|
||||
* @param[in] context 要删除的上下文环境
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_context(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the list of enumerated devices
|
||||
*
|
||||
* @param[in] context Context
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_device_list* return device list object
|
||||
* \else
|
||||
* @brief 枚举设备列表
|
||||
*
|
||||
* @param[in] context 上下文环境
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_device_list* 返回设备列表对象
|
||||
* \endif
|
||||
*/
|
||||
ob_device_list *ob_query_device_list(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set device plug-in callback function
|
||||
* @attention The added and removed device list returned through the callback interface need to be released manually
|
||||
*
|
||||
* @param[in] context Context
|
||||
* @param[in] callback Callback triggered when the device is plugged and unplugged
|
||||
* @param[in] user_data You can pass in any user data and get it from the callback
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置设备插拔回调函数
|
||||
* @attention 通过回调接口返回的added和removed设备列表,需要手动释放设备列表
|
||||
*
|
||||
* @param[in] context 上下文环境
|
||||
* @param[in] callback 设备插拔时触发的回调
|
||||
* @param[in] user_data 可以传入任意用户数据,并从回调中获取
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_set_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Activate the multi-device synchronization function to synchronize the clock of the created device(the device needs to support this function)
|
||||
*
|
||||
* @param[in] context Context
|
||||
* @param[in] repeatInterval synchronization time interval (unit: ms; if repeatInterval=0, itmeans that it will only be synchronized once and will not be executedregularly)
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 启动多设备同步功能,同步已创建设备的时钟(需要使用的设备支持该功能)
|
||||
*
|
||||
* @param[in] context 上下文环境
|
||||
* @param[in] repeatInterval 定时同步时间间隔(单位ms;如果repeatInterval=0,表示只同步一次,不再定时执行)
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_enable_multi_device_sync(ob_context *context, uint64_t repeatInterval, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the global log level and this will affect both the log level output to the console and the log output to the file
|
||||
*
|
||||
* @param[in] severity Output log level
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置全局日志的等级,会同时作用于输出到console和输出到文件的日志等级
|
||||
*
|
||||
* @param[in] severity 输出日志等级
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_set_logger_severity(ob_log_severity severity, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set output log to file
|
||||
*
|
||||
* @param[in] severity log level output to 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)
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置输出日志到文件
|
||||
*
|
||||
* @param[in] severity 输出到文件的日志等级
|
||||
* @param[in] directory 日志文件输出路径,如果路径为空,则继续使用已有设置(已有配置也为空则不输出日志到文件)
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_set_logger_to_file(ob_log_severity severity, const char *directory, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the output log to the console
|
||||
*
|
||||
* @param[in] log Log level
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置输出日志到控制台
|
||||
*
|
||||
* @param[in] severity 日志的等级
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_set_logger_to_console(ob_log_severity severity, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Error.h
|
||||
* @brief Error handling related functions, mainly used to obtain error messages
|
||||
* \else
|
||||
* @file Error.h
|
||||
* @brief 错误处理相关函数,主要用于获取错误信息
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get error status
|
||||
*
|
||||
* @param[in] error Error object
|
||||
* @return ob_status returns error status
|
||||
* \else
|
||||
* @brief 获取错误状态
|
||||
*
|
||||
* @param[in] error 错误对象
|
||||
* @return ob_status 返回错误状态
|
||||
* \endif
|
||||
*/
|
||||
ob_status ob_error_status(ob_error *error);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get error information
|
||||
*
|
||||
* @param[in] error Error object
|
||||
* @return const char* returns an error message
|
||||
* \else
|
||||
* @brief 获取错误信息
|
||||
*
|
||||
* @param[in] error 错误对象
|
||||
* @return const char* 返回错误信息
|
||||
* \endif
|
||||
*/
|
||||
const char *ob_error_message(ob_error *error);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get error API function name
|
||||
*
|
||||
* @param[in] error Error object
|
||||
* @return const char* returns error function
|
||||
* \else
|
||||
* @brief 获取出现错误的API函数名称
|
||||
*
|
||||
* @param[in] error 错误对象
|
||||
* @return const char* 返回错误函数
|
||||
* \endif
|
||||
*/
|
||||
const char *ob_error_function(ob_error *error);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get error parameters
|
||||
*
|
||||
* @param[in] error Error object
|
||||
* @return const char* returns the error parameter
|
||||
* \else
|
||||
* @brief 获取错误参数
|
||||
*
|
||||
* @param[in] error 错误对象
|
||||
* @return const char* 返回错误参数
|
||||
* \endif
|
||||
*/
|
||||
const char *ob_error_args(ob_error *error);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get error exception type
|
||||
*
|
||||
* @param[in] error Error object
|
||||
* @return ob_exception_type returns the error exception type
|
||||
* \else
|
||||
* @brief 获取错误异常类型
|
||||
*
|
||||
* @param[in] error 错误对象
|
||||
* @return ob_exception_type 返回错误异常类型
|
||||
* \endif
|
||||
*/
|
||||
ob_exception_type ob_error_exception_type(ob_error *error);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete the error object
|
||||
*
|
||||
* @param[in] error The error object to delete
|
||||
* \else
|
||||
* @brief 删除错误对象
|
||||
*
|
||||
* @param[in] error 要删除的错误对象
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_error(ob_error *error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Filter.h
|
||||
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
|
||||
|
||||
* \else
|
||||
* @file Filter.h
|
||||
* @brief SDK的处理单元,可以进行点云的生成,格式转换等功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create PointCloud Filter
|
||||
*
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return filter pointcloud_filter object
|
||||
* \else
|
||||
* @brief 创建PointCloud Filter
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
*
|
||||
* @return filter pointcloud_filter对象
|
||||
* \endif
|
||||
*/
|
||||
ob_filter *ob_create_pointcloud_filter(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief PointCloud Filter device camera parameters
|
||||
*
|
||||
* @param[in] filter pointcloud_filter object
|
||||
* @param[in] param Camera parameters
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief PointCloud Filter设备相机参数
|
||||
*
|
||||
* @param[in] filter pointcloud_filter对象
|
||||
* @param[in] param 相机参数
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pointcloud_filter_set_camera_param(ob_filter *filter, ob_camera_param param, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set point cloud type parameters
|
||||
*
|
||||
* @param[in] filter pointcloud_filter object
|
||||
* @param[in] type Point cloud type: depth point cloud or RGBD point cloud
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置点云类型参数
|
||||
*
|
||||
* @param[in] filter pointcloud_filter对象
|
||||
* @param[in] type 点云类型 深度点云或RGBD点云
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pointcloud_filter_set_point_format(ob_filter *filter, ob_format type, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the alignment state of the frames that will be input to produce the point cloud
|
||||
* @param[in] filter pointcloud_filter object
|
||||
* @param[in] state Alignment status, True: aligned; False: unaligned
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置将要输入用于生产点云的帧的对齐状态
|
||||
* @param[in] filter pointcloud_filter对象
|
||||
* @param[in] state 对齐状态,True:已对齐; False:未对齐
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pointcloud_filter_set_frame_align_state(ob_filter *filter, bool state, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create FormatConvet Filter
|
||||
*
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return filter format_convert object
|
||||
* \else
|
||||
* @brief 创建FormatConvet Filter
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
*
|
||||
* @return filter format_convert 对象
|
||||
* \endif
|
||||
*/
|
||||
ob_filter *ob_create_format_convert_filter(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the type of format conversion
|
||||
*
|
||||
* @param[in] filter formatconvet_filter object
|
||||
* @param[in] type Format conversion type
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置格式转化的类型
|
||||
*
|
||||
* @param[in] filter formatconvet_filter对象
|
||||
* @param[in] type 格式转化类型
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_format_convert_filter_set_format(ob_filter *filter, ob_convert_format type, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Filter reset, cache clear, state reset. If the asynchronous interface is used, the processing thread will also be stopped and the pending cache frames will be cleared.
|
||||
*
|
||||
* @param[in] filter filter object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief Filter重置, 缓存清空,状态复位。如果是使用异步方式接口,还会停止处理线程,清空待处理的缓存帧
|
||||
*
|
||||
* @param[in] filter filter对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_filter_reset(ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Filter processing (synchronous interface)
|
||||
*
|
||||
* @param[in] filter filter object
|
||||
* @param[in] frame pointer to the frame object to be processed
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_frame The frame object processed by the filter
|
||||
* \else
|
||||
* @brief Filter 处理(同步接口)
|
||||
*
|
||||
* @param[in] filter filter对象
|
||||
* @param[in] frame 需要被处理的frame对象指针
|
||||
* @param[out] error 记录错误信息
|
||||
*
|
||||
* @return ob_frame filter处理后的frame对象
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_filter_process(ob_filter *filter, ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Filter Set the processing result callback function (asynchronous callback interface)
|
||||
*
|
||||
* @param[in] filter filter object
|
||||
* @param[in] callback
|
||||
* @param[in] user_data Arbitrary user data pointer can be passed in and returned from the callback
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief Filter 设置处理结果回调函数(异步回调接口)
|
||||
*
|
||||
* @param[in] filter filter对象
|
||||
* @param[in] callback 回调函数
|
||||
* @param[in] user_data 可以传入任意用户数据指针,并从回调返回该数据指针
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_filter_set_callback(ob_filter *filter, ob_filter_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief filter Push the frame into the pending cache (asynchronous callback interface)
|
||||
*
|
||||
* @param[in] filter filter object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief filter 压入frame到待处理缓存(异步回调接口)
|
||||
*
|
||||
* @param[in] filter filter对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_filter_push_frame(ob_filter *filter, ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete Filter
|
||||
*
|
||||
* @param[in] filter filter object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除Filter
|
||||
*
|
||||
* @param[in] filter filter 对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_filter(ob_filter *filter, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,435 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Frame.h
|
||||
* @brief Frame related function is mainly used to obtain frame data and frame information
|
||||
* \else
|
||||
* @file Frame.h
|
||||
* @brief 帧相关函数,主要用于获取帧数据及帧的信息
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame index
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log wrong message
|
||||
* @return uint64_t returns the frame index
|
||||
* \else
|
||||
* @brief 获取帧索引
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint64_t 返回帧索引
|
||||
* \endif
|
||||
*/
|
||||
uint64_t ob_frame_index(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame format
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_format returns the frame format
|
||||
* \else
|
||||
* @brief 获取帧格式
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_format 返回帧格式
|
||||
* \endif
|
||||
*/
|
||||
ob_format ob_frame_format(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame type
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame_type returns the frame type
|
||||
* \else
|
||||
* @brief 获取帧类型
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame_type 返回帧类型
|
||||
* \endif
|
||||
*/
|
||||
ob_frame_type ob_frame_get_type(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame time stamp (hardware)
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint64_t returns the frame hardware timestamp
|
||||
* \else
|
||||
* @brief 获取帧硬件时间戳
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint64_t 返回帧硬件时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t ob_frame_time_stamp(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame time stamp (hardware) us
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint64_t returns the frame hardware timestamp, unit us
|
||||
* \else
|
||||
* @brief 获取帧硬件时间戳us
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint64_t 返回帧硬件时间戳,单位us
|
||||
* \endif
|
||||
*/
|
||||
uint64_t ob_frame_time_stamp_us(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame time stamp (system)
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint64_t returns the frame system timestamp
|
||||
* \else
|
||||
* @brief 获取帧系统时间戳
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint64_t 返回帧系统时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t ob_frame_system_time_stamp(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame data
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return void* * returns frame data pointer
|
||||
* \else
|
||||
* @brief 获取帧数据
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return void* 返回帧数据指针
|
||||
* \endif
|
||||
*/
|
||||
void *ob_frame_data(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame data size
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the frame data size
|
||||
* If it is point cloud data, it returns 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.
|
||||
* \else
|
||||
* @brief 获取帧数据大小
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回帧数据大小
|
||||
* 如果是点云数据返回的是所有点集合占的字节数,若需要求出点的个数需要将dataSize除以对应的点类型的结构体大小
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_frame_data_size(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get video frame width
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the frame width
|
||||
* \else
|
||||
* @brief 获取视频帧宽
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回帧宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_frame_width(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get video frame height
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the frame height
|
||||
* \else
|
||||
* @brief 获取视频帧高
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回帧高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_frame_height(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
*\if English
|
||||
* @brief Get the metadata of the frame
|
||||
*
|
||||
* @param[in] frame Video frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return void* returns the metadata pointer of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据
|
||||
*
|
||||
* @param[in] frame 视频帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return void* 返回帧的元数据指针
|
||||
* \endif
|
||||
*/
|
||||
void *ob_video_frame_metadata(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the metadata size of the frame
|
||||
*
|
||||
* @param[in] frame Video frame object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the metadata size of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据大小
|
||||
*
|
||||
* @param[in] frame 视频帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回帧的元数据大小
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_frame_metadata_size(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @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 log error messages
|
||||
* @return uint8_t return the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
* \else
|
||||
* @brief 获取像素有效位数(如Y16格式帧,每个像素占16bit,但实际只有低10位是有效位,高6位填充0)
|
||||
* @attention 仅对Y8/Y10/Y11/Y12/Y14/Y16格式有效
|
||||
*
|
||||
* @param[in] frame 视频帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint8_t 返回像素有效位数,如果是不支持的格式,返回0
|
||||
* \endif
|
||||
*/
|
||||
uint8_t ob_video_frame_pixel_available_bit_size(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the value scale of the depth frame, the unit is mm/step,
|
||||
* such as 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 Log error messages
|
||||
* @return float value scale
|
||||
* \else
|
||||
* @brief 获取深度帧的值刻度,单位为 mm/step,
|
||||
* 如valueScale=0.1, 某坐标像素值为pixelValue=10000,
|
||||
* 则表示深度值value = pixelValue*valueScale = 10000*0.1=1000mm。
|
||||
*
|
||||
* @param[in] frame 帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return float 值刻度
|
||||
* \endif
|
||||
*/
|
||||
float ob_depth_frame_get_value_scale(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete frame
|
||||
*
|
||||
* @param[in] frame The frame object to delete
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除帧
|
||||
*
|
||||
* @param[in] frame 要删除的帧对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_frame(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the number of frames contained in the frameset
|
||||
*
|
||||
* @param[in] frameset frameset object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the number of frames
|
||||
* \else
|
||||
* @brief 获取帧集合包含的帧数量
|
||||
*
|
||||
* @param[in] frameset 帧集合对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回帧数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_frameset_frame_count(ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the depth frame from the frameset
|
||||
*
|
||||
* @param[in] frameset Frameset object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame* returns the depth frame
|
||||
* \else
|
||||
* @brief 从帧集合中获取深度帧
|
||||
*
|
||||
* @param[in] frameset 帧集合对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame* 返回深度帧
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_frameset_depth_frame(ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the color frame from the frameset
|
||||
*
|
||||
* @param[in] frameset Frameset object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame* returns the color frame
|
||||
* \else
|
||||
* @brief 从帧集合中获取彩色帧
|
||||
*
|
||||
* @param[in] frameset 帧集合对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame* 返回彩色帧
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_frameset_color_frame(ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the infrared frame from the frameset
|
||||
*
|
||||
* @param[in] frameset Frameset object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame* returns the infrared frame
|
||||
* \else
|
||||
* @brief 从帧集合中获取红外帧
|
||||
*
|
||||
* @param[in] frameset 帧集合对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame* 返回红外帧
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_frameset_ir_frame(ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get point cloud data from the frameset
|
||||
*
|
||||
* @param[in] frameset Frameset object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame* returns the point cloud frame
|
||||
* \else
|
||||
* @brief 从帧集合中获取点云数据
|
||||
*
|
||||
* @param[in] frameset 帧集合对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame* 返回点云帧
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_frameset_points_frame(ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get accelerometer frame data
|
||||
*
|
||||
* @param[in] frame Accelerometer frame
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_accel_value accelerometer data
|
||||
* \else
|
||||
* @brief 获取加速度帧数据
|
||||
*
|
||||
* @param[in] frame 加速度帧
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_accel_value 加速度数据
|
||||
* \endif
|
||||
*/
|
||||
ob_accel_value ob_accel_frame_value(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the temperature when acquiring the accelerometer frame
|
||||
*
|
||||
* @param[in] frame Accelerometer frame
|
||||
* @param[out] error Log error messages
|
||||
* @return float return value
|
||||
* \else
|
||||
* @brief 获取加速度帧采样时温度
|
||||
*
|
||||
* @param[in] frame 加速度帧
|
||||
* @param[out] error 记录错误信息
|
||||
* @return float 返回数值
|
||||
* \endif
|
||||
*/
|
||||
float ob_accel_frame_temperature(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get gyroscope frame data
|
||||
*
|
||||
* @param[in] frame Gyro Frame
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_gyro_value gyroscope data
|
||||
* \else
|
||||
* @brief 获取陀螺仪帧数据
|
||||
*
|
||||
* @param[in] frame 陀螺仪帧
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_gyro_value 陀螺仪数据
|
||||
* \endif
|
||||
*/
|
||||
ob_gyro_value ob_gyro_frame_value(ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
*\if English
|
||||
* @brief Get the temperature when acquiring the gyroscope frame
|
||||
*
|
||||
* @param[in] frame Accelerometer frame
|
||||
* @param[out] error Log error messages
|
||||
* @return float return value
|
||||
* \else
|
||||
* @brief 获取加速度帧采样时温度
|
||||
*
|
||||
* @param[in] frame 加速度帧
|
||||
* @param[out] error 记录错误信息
|
||||
* @return float 返回数值
|
||||
* \endif
|
||||
*/
|
||||
float ob_gyro_frame_temperature(ob_frame *frame, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,876 @@
|
||||
// License: Apache 2.0. See LICENSE file in root directory.
|
||||
// Copyright(c) 2020 Orbbec Corporation. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @file ObTypes.h
|
||||
* @brief Provide structs commonly used in the SDK, enumerating constant definitions.
|
||||
* \else
|
||||
* @file ObTypes.h
|
||||
* @brief 提供SDK常用的结构体、枚举常量定义。
|
||||
* \endif
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if(defined(WIN32) || defined(_WIN32) || defined(WINCE))
|
||||
#ifdef OB_EXPORTS
|
||||
#define OB_EXTENSION_API __declspec(dllexport)
|
||||
#else
|
||||
#define OB_EXTENSION_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define OB_EXTENSION_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
|
||||
#define DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct ContextImpl ob_context;
|
||||
typedef struct DeviceImpl ob_device;
|
||||
typedef struct DeviceInfoImpl ob_device_info;
|
||||
typedef struct DeviceListImpl ob_device_list;
|
||||
typedef struct CameraParamListImpl ob_camera_param_list;
|
||||
typedef struct SensorImpl ob_sensor;
|
||||
typedef struct SensorListImpl ob_sensor_list;
|
||||
typedef struct StreamProfileImpl ob_stream_profile;
|
||||
typedef struct StreamProfileListImpl ob_stream_profile_list;
|
||||
typedef struct FrameImpl ob_frame;
|
||||
typedef struct FilterImpl ob_filter;
|
||||
typedef struct PipelineImpl ob_pipeline;
|
||||
typedef struct ConfigImpl ob_config;
|
||||
typedef struct RecorderImpl ob_recorder;
|
||||
typedef struct PlaybackImpl ob_playback;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief the permission type of api or property
|
||||
* \else
|
||||
* @brief 接口/属性的访问权限类型
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_PERMISSION_DENY = 0, /**< \if English no permission \else 无访问权限 \endif */
|
||||
OB_PERMISSION_READ = 1, /**< \if English can read \else 可读 \endif */
|
||||
OB_PERMISSION_WRITE = 2, /**< \if English can write \else 可写 \endif */
|
||||
OB_PERMISSION_READ_WRITE = 3, /**< \if English can read and write \else 可读写 \endif */
|
||||
} OBPermissionType,
|
||||
ob_permission_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief error code
|
||||
* \else
|
||||
* @brief 错误码
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_STATUS_OK = 0, /**< \if English status ok \else 状态正常 \endif */
|
||||
OB_STATUS_ERROR = 1, /**< \if English status error \else 状态异常 \endif */
|
||||
} OBStatus,
|
||||
ob_status;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief log level, the higher the level, the stronger the log filter
|
||||
* \else
|
||||
* @brief log等级, 等级越高Log过滤力度越大
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_LOG_SEVERITY_DEBUG, /**< \if English debug \else 调试 \endif */
|
||||
OB_LOG_SEVERITY_INFO, /**< \if English information \else 信息 \endif */
|
||||
OB_LOG_SEVERITY_WARN, /**< \if English warning \else 警告 \endif */
|
||||
OB_LOG_SEVERITY_ERROR, /**< \if English error \else 错误 \endif */
|
||||
OB_LOG_SEVERITY_FATAL, /**< \if English fatal error \else 致命错误 \endif */
|
||||
OB_LOG_SEVERITY_NONE /**< \if English none (close LOG) \else 无(关闭LOG) \endif */
|
||||
} OBLogSeverity,
|
||||
ob_log_severity, DEVICE_LOG_SEVERITY_LEVEL, OBDeviceLogSeverityLevel, ob_device_log_severity_level;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief The exception types in the SDK, through the exception type, you can easily determine the specific type of error.
|
||||
* For detailed error API interface functions and error logs, please refer to the information of ob_error
|
||||
* \else
|
||||
* @brief SDK内部的异常类型,通过异常类型,可以简单判断具体哪个类型的错误
|
||||
* 详细的错误API接口函数、错误日志请参考ob_error的信息
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_EXCEPTION_TYPE_UNKNOWN, /**< \if English Unknown error, an error not clearly defined by the SDK \else 未知错误,SDK未明确定义的错误 \endif */
|
||||
OB_EXCEPTION_TYPE_CAMERA_DISCONNECTED, /**< \if English SDK device disconnection exception \else SDK的设备断开的异常 \endif */
|
||||
OB_EXCEPTION_TYPE_PLATFORM, /**< \if English An error in the SDK adaptation platform layer means an error in the implementation of a specific system platform \else 在SDK适配平台层错误,代表是具体一个系统平台实现上错误 \endif */
|
||||
OB_EXCEPTION_TYPE_INVALID_VALUE, /**< \if English Invalid parameter type exception, need to check input parameter \else 无效的参数类型异常,需要检查输入参数 \endif */
|
||||
OB_EXCEPTION_TYPE_WRONG_API_CALL_SEQUENCE, /**< \if English Exception caused by API version mismatch\else API版本不匹配带来的异常 \endif */
|
||||
OB_EXCEPTION_TYPE_NOT_IMPLEMENTED, /**< \if English SDK and firmware have not yet implemented functions \else SDK及固件还未实现功能 \endif */
|
||||
OB_EXCEPTION_TYPE_IO, /**< \if English SDK access IO exception error \else SDK访问IO异常错误 \endif */
|
||||
OB_EXCEPTION_TYPE_MEMORY, /**< \if English SDK access and use memory errors, which means that the frame fails to allocate memory \else SDK的访问和使用内存错误,代表桢分配内存失败\endif */
|
||||
OB_EXCEPTION_TYPE_UNSUPPORTED_OPERATION, /**< \if English Unsupported operation type error by SDK or RGBD device \else SDK或RGBD设备不支持的操作类型错误 \endif */
|
||||
} OBExceptionType,
|
||||
ob_exception_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief The error class exposed by the SDK, users can get detailed error information according to the erro
|
||||
* \else
|
||||
* @brief SDK的对外暴露的错误类,用户可以根据该错误类,获取详细的错误信息
|
||||
* \endif
|
||||
*/
|
||||
typedef struct ob_error {
|
||||
ob_status status; ///< \if English Describe the status code of the error, as compatible with previous customer status code requirements \else 描述错误的状态码,作为兼容之前客户状态码需求 \endif
|
||||
char message[256]; ///< \if English Describe the detailed error log \else 描述详细的错误日志 \endif
|
||||
char function[256]; ///< \if English Describe the name of the function where the error occurred \else 描述出现错误的函数名称 \endif
|
||||
char args[256]; ///< \if English Describes the parameters passed to the function when an error occurs. Used to check whether the parameter is wrong \else 描述出错时,函数传入的参数。用来检查是不是参数错 \endif
|
||||
ob_exception_type exception_type; ///< \if English The description is the specific error type of the SDK \else 描述是SDK的具体错误类型 \endif
|
||||
} ob_error;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration value describing the sensor type
|
||||
* \else
|
||||
* @brief 描述传感器类型的枚举值
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_SENSOR_UNKNOWN = 0, /**< \if English Unknown type sensor \else 未知类型传感器 \endif */
|
||||
OB_SENSOR_IR = 1, /**< \if English IR \else 红外 \endif */
|
||||
OB_SENSOR_COLOR = 2, /**< \if English Color \else 彩色 \endif */
|
||||
OB_SENSOR_DEPTH = 3, /**< \if English Depth \else 深度 \endif */
|
||||
OB_SENSOR_ACCEL = 4, /**< \if English Accel \else 加速度计 \endif */
|
||||
OB_SENSOR_GYRO = 5, /**< \if English Gyro \else 陀螺仪 \endif */
|
||||
} OBSensorType,
|
||||
ob_sensor_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration value describing the type of data stream
|
||||
* \else
|
||||
* @brief 描述数据流类型的枚举值
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_STREAM_VIDEO = 0, /**< \if English Video stream (infrared, color, depth streams are all video streams) \else 视频流(红外、彩色、深度流都属于视频流) \endif */
|
||||
OB_STREAM_IR = 1, /**< \if English IR stream \else 红外流 \endif */
|
||||
OB_STREAM_COLOR = 2, /**< \if English color stream \else 彩色流 \endif */
|
||||
OB_STREAM_DEPTH = 3, /**< \if English depth stream \else 深度流 \endif */
|
||||
OB_STREAM_ACCEL = 4, /**< \if English Accelerometer data stream \else 加速度计数据流 \endif */
|
||||
OB_STREAM_GYRO = 5, /**< \if English Gyroscope data stream \else 陀螺仪数据流 \endif */
|
||||
} OBStreamType,
|
||||
ob_stream_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Describe the Frame type enumeration value
|
||||
* \else
|
||||
* @brief 描述Frame类型枚举值
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_FRAME_VIDEO = 0, /**< \if English Describes the Frame type enumeration value \else 视频帧(红外、彩色、深度帧都属于视频帧) \endif */
|
||||
OB_FRAME_IR = 1, /**< \if English IR frame \else 红外帧 \endif */
|
||||
OB_FRAME_COLOR = 2, /**< \if English color stream \else 彩色帧 \endif */
|
||||
OB_FRAME_DEPTH = 3, /**< \if English depth stream \else 深度帧 \endif */
|
||||
OB_FRAME_ACCEL = 4, /**< \if English Accelerometer data frame \else 加速度计数据帧 \endif */
|
||||
OB_FRAME_SET = 5, /**< \if English Frame collection (internally contains a variety of data frames) \else 帧集合(内部包含多种数据帧) \endif */
|
||||
OB_FRAME_POINTS = 6, /**< \if English point cloud frame \else 点云帧 \endif */
|
||||
OB_FRAME_GYRO = 7, /**< \if English Gyroscope data frame \else 陀螺仪数据帧 \endif */
|
||||
} OBFrameType,
|
||||
ob_frame_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration value describing the pixel format
|
||||
* \else
|
||||
* @brief 描述像素格式的枚举值
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_FORMAT_YUYV = 0, /**< \if English YUYV format \else YUYV格式 \endif */
|
||||
OB_FORMAT_YUY2 = 1, /**< \if English YUY2 format (the actual format is the same as YUYV) \else YUY2格式(实际格式与YUYV相同) \endif */
|
||||
OB_FORMAT_UYVY = 2, /**< \if English UYVY format \else UYVY格式 \endif */
|
||||
OB_FORMAT_NV12 = 3, /**< \if English NV12 format \else NV12格式 \endif */
|
||||
OB_FORMAT_NV21 = 4, /**< \if English NV21 format \else NV21格式 \endif */
|
||||
OB_FORMAT_MJPG = 5, /**< \if English MJPG encoding format \else MJPG编码格式 \endif */
|
||||
OB_FORMAT_H264 = 6, /**< \if English H.264 encoding format \else H.264编码格式 \endif */
|
||||
OB_FORMAT_H265 = 7, /**< \if English H.265 encoding format \else H.265编码格式 \endif */
|
||||
OB_FORMAT_Y16 = 8, /**< \if English Y16 format, single channel 16bit depth \else Y16格式,单通道16bit深度 \endif */
|
||||
OB_FORMAT_Y8 = 9, /**< \if English Y8 format, single channel 8bit depth \else Y8格式,单通道8bit深度 \endif */
|
||||
OB_FORMAT_Y10 = 10, /**< \if English Y10 format, single channel 10bit depth (SDK will unpack into Y16 by default) \else Y10格式,单通道10bit深度(SDK默认会解包成Y16) \endif */
|
||||
OB_FORMAT_Y11 = 11, /**< \if English Y11 format, single channel 11bit depth (SDK will unpack into Y16 by default)\else Y11格式,单通道11bit深度(SDK默认会解包成Y16) \endif */
|
||||
OB_FORMAT_Y12 = 12, /**< \if English Y12 format, single channel 12bit depth (SDK will unpack into Y16 by default) \else Y12格式,单通道12bit深度(SDK默认会解包成Y16) \endif */
|
||||
OB_FORMAT_GRAY = 13, /**< \if English GRAY (the actual format is the same as YUYV) \else GRAY灰度(实际格式与YUYV相同) \endif */
|
||||
OB_FORMAT_HEVC = 14, /**< \if English HEVC encoding format (the actual format is the same as H265) \else HEVC编码格式(实际格式与H265相同) \endif */
|
||||
OB_FORMAT_I420 = 15, /**< \if English I420 format \else I420格式 \endif */
|
||||
OB_FORMAT_ACCEL = 16, /**< \if English Acceleration data format \else 加速度数据格式 \endif */
|
||||
OB_FORMAT_GYRO = 17, /**< \if English Gyroscope Data Format \else 陀螺仪数据格式 \endif */
|
||||
OB_FORMAT_POINT = 19, /**< \if English xyz 3D coordinate point format \else 纯x-y-z三维坐标点格式 \endif */
|
||||
OB_FORMAT_RGB_POINT = 20, /**< \if English xyz 3D coordinate point format with RGB information \else 带RGB信息的x-y-z三维坐标点格式 \endif */
|
||||
OB_FORMAT_RLE = 21, /**< \if English RLE pressure test format (SDK will be unpacked into Y16 by default) \else RLE压测格式(SDK默认会解包成Y16) \endif */
|
||||
OB_FORMAT_RGB888 = 22, /**< \if English RGB888 format \else RGB888格式 \endif */
|
||||
OB_FORMAT_BGR = 23, /**< \if English BGR format (actual BRG888) \else BGR格式(实际BRG888) \endif */
|
||||
OB_FORMAT_Y14 = 24, /**< \if English Y14 format, single channel 14bit depth (SDK will unpack into Y16 by default) \else Y14格式,单通道14bit深度(SDK默认会解包成Y16) \endif */
|
||||
OB_FORMAT_UNKNOWN = 0xff, /**< \if English unknown format \else 未知格式 \endif */
|
||||
} OBFormat,
|
||||
ob_format;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Firmware upgrade status
|
||||
* \else
|
||||
* @brief 固件升级状态
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
STAT_FILE_TRANSFER = 4, /**< \if English file transfer \else 文件传输中 \endif */
|
||||
STAT_DONE = 3, /**< \if English update completed \else 升级完成 \endif */
|
||||
STAT_IN_PROGRESS = 2, /**< \if English upgrade in process \else 升级中 \endif */
|
||||
STAT_START = 1, /**< \if English start the upgrade \else 开始升级 \endif */
|
||||
STAT_VERIFY_IMAGE = 0, /**< \if English Image file verification \else 镜像文件校验中 \endif */
|
||||
ERR_VERIFY = -1, /**< \if English Verification failed \else 校验失败 \endif */
|
||||
ERR_PROGRAM = -2, /**< \if English Program execution failed \else 程序执行失败 \endif */
|
||||
ERR_ERASE = -3, /**< \if English Flash parameter failed \else Flash参数失败 \endif */
|
||||
ERR_FLASH_TYPE = -4, /**< \if English Flash type error \else Flash类型错误 \endif */
|
||||
ERR_IMAGE_SIZE = -5, /**< \if English Image file size error \else 镜像文件大小错误 \endif */
|
||||
ERR_OTHER = -6, /**< \if English other errors \else 其他错误 \endif */
|
||||
ERR_DDR = -7, /**< \if English DDR access error \else DDR访问错误 \endif */
|
||||
ERR_TIMEOUT = -8 /**< \if English timeout error \else 超时错误 \endif */
|
||||
} OBUpgradeState,
|
||||
ob_upgrade_state;
|
||||
/**
|
||||
* \if English
|
||||
* @brief file transfer status
|
||||
* \else
|
||||
* @brief 文件传输状态
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
FILE_TRAN_STAT_TRANSFER = 2, /**< \if English file transfer \else 文件传输中 \endif */
|
||||
FILE_TRAN_STAT_DONE = 1, /**< \if English file transfer succeeded\else 文件传输成功 \endif */
|
||||
FILE_TRAN_STAT_PREPAR = 0, /**< \if English preparing \else 准备中 \endif */
|
||||
FILE_TRAN_ERR_DDR = -1, /**< \if English DDR access failed \else DDR访问失败 \endif */
|
||||
FILE_TRAN_ERR_NOT_ENOUGH_SPACE = -2, /**< \if English Insufficient target space error \else 目标空间不足错误 \endif */
|
||||
FILE_TRAN_ERR_PATH_NOT_WRITABLE = -3, /**< \if English Destination path is not writable \else 目标路径不可写 \endif */
|
||||
FILE_TRAN_ERR_MD5_ERROR = -4, /**< \if English MD5 checksum error \else MD5校验错误 \endif */
|
||||
FILE_TRAN_ERR_WRITE_FLASH_ERROR = -5, /**< \if English write flash error \else 写Flash错误 \endif */
|
||||
FILE_TRAN_ERR_TIMEOUT = -6 /**< \if English timeout error \else 超时错误 \endif */
|
||||
} OBFileTranState,
|
||||
ob_file_tran_state;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief data transfer status
|
||||
* \else
|
||||
* @brief 数据传输状态
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
DATA_TRAN_STAT_STOPPED = 3, /**< \if English data transfer stoped \else 数据传输终止 \endif */
|
||||
DATA_TRAN_STAT_DONE = 2, /**< \if English data transfer completed \else 数据传输完成 \endif */
|
||||
DATA_TRAN_STAT_VERIFYING = 1, /**< \if English data verifying \else 数据校验中 \endif */
|
||||
DATA_TRAN_STAT_TRANSFERRING = 0, /**< \if English data transferring \else 数据传输中 \endif */
|
||||
DATA_TRAN_ERR_BUSY = -1, /**< \if English Transmission is busy \else 传输忙 \endif */
|
||||
DATA_TRAN_ERR_UNSUPPORTED = -2, /**< \if English not support \else 不支持 \endif */
|
||||
DATA_TRAN_ERR_TRAN_FAILED = -3, /**< \if English transfer failed \else 传输失败 \endif */
|
||||
DATA_TRAN_ERR_VERIFY_FAILED = -4, /**< \if English Test failed \else 检验失败 \endif */
|
||||
DATA_TRAN_ERR_OTHER = -5 /**< \if English other errors \else 其他错误\endif */
|
||||
} OBDataTranState,
|
||||
ob_data_tran_state;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Data block structure for data block transmission
|
||||
* \else
|
||||
* @brief 数据块结构体,用于数据分块传输
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
void * data; ///< \if English current block data pointer \else 当前块数据指针 \endif
|
||||
uint32_t size; ///< \if English Current block data length \else 当前块数据长度 \endif
|
||||
uint32_t offset; ///< \if English The offset of the current data block relative to the complete data \else 当前数据块相对完整数据的偏移 \endif
|
||||
uint32_t fullDataSize; ///< \if English full data size \else 完整数据大小 \endif
|
||||
} OBDataChunk, ob_data_chunk;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Int range structure
|
||||
* \else
|
||||
* @brief 整形范围的结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
int32_t cur; ///< \if English current value \else 当前值 \endif
|
||||
int32_t max; ///< \if English maximum value \else 最大值 \endif
|
||||
int32_t min; ///< \if English minimum value \else 最小值 \endif
|
||||
int32_t step; ///< \if English step value \else 步进值 \endif
|
||||
int32_t def; ///< \if English Default \else 默认值 \endif
|
||||
} OBIntPropertyRange, ob_int_property_range;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Float range structure
|
||||
* \else
|
||||
* @brief 浮点型范围的结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float cur; ///< \if English current value \else 当前值 \endif
|
||||
float max; ///< \if English maximum value \else 最大值 \endif
|
||||
float min; ///< \if English minimum value \else 最小值 \endif
|
||||
float step; ///< \if English step value \else 步进值 \endif
|
||||
float def; ///< \if English default \else 默认值 \endif
|
||||
} OBFloatPropertyRange, ob_float_property_range;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Boolean-scoped structure
|
||||
* \else
|
||||
* @brief 布尔型范围的结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
bool cur; ///< \if English current value \else 当前值 \endif
|
||||
bool max; ///< \if English maximum value \else 最大值 \endif
|
||||
bool min; ///< \if English minimum value \else 最小值 \endif
|
||||
bool step; ///< \if English step value \else 步进值 \endif
|
||||
bool def; ///< \if English default \else 默认值 \endif
|
||||
} OBBoolPropertyRange, ob_bool_property_range;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Camera internal parameters
|
||||
* \else
|
||||
* @brief 相机内参
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float fx; ///< \if English focal length in x direction \else x方向焦距 \endif
|
||||
float fy; ///< \if English focal length in y direction \else y方向焦距 \endif
|
||||
float cx; ///< \if English Optical center abscissa \else 光心横坐标 \endif
|
||||
float cy; ///< \if English Optical center ordinate \else 光心纵坐标 \endif
|
||||
int16_t width; ///< \if English image width \else 图像宽度 \endif
|
||||
int16_t height; ///< \if English image height \else 图像高度 \endif
|
||||
} OBCameraIntrinsic, ob_camera_intrinsic;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Distortion Parameters
|
||||
* \else
|
||||
* @brief 畸变参数
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float k1; ///< \if English Radial distortion factor 1 \else 径向畸变系数1 \endif
|
||||
float k2; ///< \if English Radial distortion factor 2 \else 径向畸变系数2 \endif
|
||||
float k3; ///< \if English Radial distortion factor 3 \else 径向畸变系数3 \endif
|
||||
float k4; ///< \if English Radial distortion factor 4 \else 径向畸变系数4 \endif
|
||||
float k5; ///< \if English Radial distortion factor 5 \else 径向畸变系数5 \endif
|
||||
float k6; ///< \if English Radial distortion factor 6 \else 径向畸变系数6 \endif
|
||||
float p1; ///< \if English Tangential distortion factor 1 \else 切向畸变系数1 \endif
|
||||
float p2; ///< \if English Tangential distortion factor 2 \else 切向畸变系数2 \endif
|
||||
} OBCameraDistortion, ob_camera_distortion;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Rotation/Transformation
|
||||
* \else
|
||||
* @brief 旋转/变换矩阵
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float rot[9]; ///< \if English Rotation matrix \else 旋转矩阵,行优先\endif
|
||||
float trans[3]; ///< \if English transformation matrix \else 变化矩阵 \endif
|
||||
} OBD2CTransform, ob_d2c_transform;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Camera parameters
|
||||
* \else
|
||||
* @brief 相机参数
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
OBCameraIntrinsic depthIntrinsic; ///< \if English Depth camera internal parameters \else 深度相机内参 \endif
|
||||
OBCameraIntrinsic rgbIntrinsic; ///< \if English Color camera internal parameters \else 彩色相机内参 \endif
|
||||
OBCameraDistortion depthDistortion; ///< \if English Depth camera distortion parameters \else 深度相机畸变参数 \endif
|
||||
OBCameraDistortion rgbDistortion; ///< \if English Color camera distortion parameters 1 \else 彩色相机畸变参数 \endif
|
||||
OBD2CTransform transform; ///< \if English rotation/transformation matrix \else 旋转/变换矩阵 \endif
|
||||
bool isMirrored; ///< \if English Whether the image frame corresponding to this group of parameters is mirrored \else 本组参数对应的图像帧是否被镜像 \endif
|
||||
} OBCameraParam, ob_camera_param;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief alignment mode
|
||||
* \else
|
||||
* @brief 对齐模式
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
ALIGN_DISABLE, /**< \if English turn off alignment \else 关闭对齐 \endif */
|
||||
ALIGN_D2C_HW_MODE, /**< \if English Hardware D2C alignment mode \else 硬件D2C对齐模式 \endif */
|
||||
ALIGN_D2C_SW_MODE, /**< \if English Software D2C alignment mode \else 软件D2C对齐模式 \endif */
|
||||
} OBAlignMode,
|
||||
ob_align_mode;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief rectangle
|
||||
* \else
|
||||
* @brief 矩形
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t x; ///< \if English origin coordinate x \else 原点坐标x \endif
|
||||
uint32_t y; ///< \if English origin coordinate y \else 原点坐标y \endif
|
||||
uint32_t width; ///< \if English rectangle width \else 矩形宽度 \endif
|
||||
uint32_t height; ///< \if English rectangle height \else 矩形高度 \endif
|
||||
} OBRect, ob_rect;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief format conversion type enumeration
|
||||
* \else
|
||||
* @brief 格式转换类型枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
FORMAT_YUYV_TO_RGB888 = 0, /**< \if English YUYV to RGB888 \else YUYV转换为RGB888 \endif */
|
||||
FORMAT_I420_TO_RGB888, /**< \if English I420 to RGB888 \else I420转换为RGB888 \endif */
|
||||
FORMAT_NV21_TO_RGB888, /**< \if English NV21 to RGB888 \else NV21转换为RGB888 \endif */
|
||||
FORMAT_NV12_TO_RGB888, /**< \if English NV12 to RGB888 \else NV12转换为RGB888 \endif */
|
||||
FORMAT_MJPEG_TO_I420, /**< \if English MJPG to I420 \else MJPG转换为I420\endif */
|
||||
FORMAT_RGB888_TO_BGR, /**< \if English RGB888 to BGR \else RGB888转换为BGR \endif */
|
||||
FORMAT_MJPEG_TO_NV21, /**< \if English MJPG to NV21 \else MJPG转换为NV21 \endif */
|
||||
FORMAT_MJPEG_TO_RGB888, /**< \if English MJPG to RGB888 \else MJPG转换为RGB888 \endif */
|
||||
} OBConvertFormat,
|
||||
ob_convert_format;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration of IMU sample rate values (gyroscope or accelerometer)
|
||||
* \else
|
||||
* @brief IMU采样率值的枚举(陀螺仪或加速度计)
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_SAMPLE_RATE_1_5625_HZ = 1, /**< 1.5625Hz */
|
||||
OB_SAMPLE_RATE_3_125_HZ, /**< 3.125Hz */
|
||||
OB_SAMPLE_RATE_6_25_HZ, /**< 6.25Hz */
|
||||
OB_SAMPLE_RATE_12_5_HZ, /**< 12.5Hz */
|
||||
OB_SAMPLE_RATE_25_HZ, /**< 25Hz */
|
||||
OB_SAMPLE_RATE_50_HZ, /**< 50Hz */
|
||||
OB_SAMPLE_RATE_100_HZ, /**< 100Hz */
|
||||
OB_SAMPLE_RATE_200_HZ, /**< 200Hz */
|
||||
OB_SAMPLE_RATE_500_HZ, /**< 500Hz */
|
||||
OB_SAMPLE_RATE_1_KHZ, /**< 1KHz */
|
||||
OB_SAMPLE_RATE_2_KHZ, /**< 2KHz */
|
||||
OB_SAMPLE_RATE_4_KHZ, /**< 4KHz */
|
||||
OB_SAMPLE_RATE_8_KHZ, /**< 8KHz */
|
||||
OB_SAMPLE_RATE_16_KHZ, /**< 16KHz */
|
||||
OB_SAMPLE_RATE_32_KHZ, /**< 32Hz */
|
||||
} OBGyroSampleRate,
|
||||
ob_gyro_sample_rate, OBAccelSampleRate, ob_accel_sample_rate, OB_SAMPLE_RATE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration of gyroscope ranges
|
||||
* \else
|
||||
* @brief 陀螺仪量程的枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_GYRO_FS_16dps = 1, /**< \if English 16 degrees per second \else 16度每秒 \endif */
|
||||
OB_GYRO_FS_31dps, /**< \if English 31 degrees per second \else 31度每秒 \endif */
|
||||
OB_GYRO_FS_62dps, /**< \if English 62 degrees per second \else 62度每秒 \endif */
|
||||
OB_GYRO_FS_125dps, /**< \if English 125 degrees per second \else 125度每秒 \endif */
|
||||
OB_GYRO_FS_245dps, /**< \if English 245 degrees per second \else 245度每秒 \endif */
|
||||
OB_GYRO_FS_250dps, /**< \if English 250 degrees per second \else 250度每秒 \endif */
|
||||
OB_GYRO_FS_500dps, /**< \if English 500 degrees per second \else 500度每秒 \endif */
|
||||
OB_GYRO_FS_1000dps, /**< \if English 1000 degrees per second \else 1000度每秒 \endif */
|
||||
OB_GYRO_FS_2000dps, /**< \if English 2000 degrees per second \else 2000度每秒 \endif */
|
||||
} OBGyroFullScaleRange,
|
||||
ob_gyro_full_scale_range, OB_GYRO_FULL_SCALE_RANGE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Accelerometer range enumeration
|
||||
* \else
|
||||
* @brief 加速度计量程枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_ACCEL_FS_2g = 1, /**< \if English 1x the acceleration of gravity \else 1倍重力加速度 \endif */
|
||||
OB_ACCEL_FS_4g, /**< \if English 4x the acceleration of gravity \else 4倍重力加速度 \endif */
|
||||
OB_ACCEL_FS_8g, /**< \if English 8x the acceleration of gravity \else 8倍重力加速度 \endif */
|
||||
OB_ACCEL_FS_16g, /**< \if English 16x the acceleration of gravity \else 16倍重力加速度\endif */
|
||||
} OBAccelFullScaleRange,
|
||||
ob_accel_full_scale_range, OB_ACCEL_FULL_SCALE_RANGE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Data structures for accelerometers and gyroscopes
|
||||
*\else
|
||||
* @brief 加速度计及陀螺仪的数据结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float x; ///< \if English x-direction component \else x方向分量 \endif
|
||||
float y; ///< \if English y-direction component \else y方向分量 \endif
|
||||
float z; ///< \if English z-direction component \else z方向分量 \endif
|
||||
} OBAccelValue, OBGyroValue, ob_accel_value, ob_gyro_value;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Device state enumeration
|
||||
* \else
|
||||
* @brief 设备状态枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_DEVICE_STATE_NULL = 0x0000, /**< \if English No status or LOG information update \else 无状态或LOG信息更新 \endif */
|
||||
OPEN_STREAM_OPERATION_ERROR = 0x0001, /**< \if English Open current exception \else 开流异常 \endif */
|
||||
OB_DEVICE_STATE_INFO = 0x7fff /**< \if English LOG information update \else LOG信息更新 \endif */
|
||||
} OBDeviceState,
|
||||
ob_device_state;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the temperature parameters of the device (unit: Celsius)
|
||||
* \else
|
||||
* @brief 获取设备的温度参数(单位:摄氏度)
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float cpuTemp; ///< \if English CPU temperature \else cpu温度 \endif
|
||||
float irTemp; ///< \if English IR temperature \else IR温度 \endif
|
||||
float ldmTemp; ///< \if English laser temperature \else 激光温度 \endif
|
||||
float mainBoardTemp; ///< \if English motherboard temperature \else 主板温度 \endif
|
||||
float tecTemp; ///< \if English TEC temperature \else TEC温度 \endif
|
||||
float imuTemp; ///< \if English IMU temperature \else IMU温度 \endif
|
||||
float rgbTemp; ///< \if English RGB temperature \else RGB温度 \endif
|
||||
} OBDeviceTemperature, ob_device_temperature, DEVICE_TEMPERATURE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Depth crop mode enumeration
|
||||
* \else
|
||||
* @brief 深度裁切模式枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
DEPTH_CROPPING_MODE_AUTO = 0, /**< \if English automatic mode \else 自动模式 \endif */
|
||||
DEPTH_CROPPING_MODE_CLOSE = 1, /**< \if English close crop \else 关闭裁切 \endif */
|
||||
DEPTH_CROPPING_MODE_OPEN = 2, /**< \if English open crop \else 打开裁切 \endif */
|
||||
} OBDepthCroppingMode,
|
||||
ob_depth_cropping_mode, OB_DEPTH_CROPPING_MODE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device type enumeration
|
||||
* \else
|
||||
* @brief 设备类型枚举
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_STRUCTURED_LIGHT_MONOCULAR_CAMERA = 0, /**< \if English Monocular structured light camera \else 单目结构光相机 \endif */
|
||||
OB_STRUCTURED_LIGHT_BINOCULAR_CAMERA, /**< \if English Binocular structured light camera \else 双目结构光相机 \endif */
|
||||
OB_TOF_CAMERA, /**< \if English TOF camera \else TOF相机 \endif */
|
||||
} OBDeviceType,
|
||||
ob_device_type, OB_DEVICE_TYPE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief record playback of the type of interest
|
||||
* \else
|
||||
* @brief 录制回放感兴趣数据类型
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_MEDIA_COLOR_STREAM = 1, /**< \if English color stream \else 彩色流\endif */
|
||||
OB_MEDIA_DEPTH_STREAM = 2, /**< \if English depth stream \else 深度流 \endif */
|
||||
OB_MEDIA_IR_STREAM = 4, /**< \if English IR stream \else 红外流 \endif */
|
||||
OB_MEDIA_GYRO_STREAM = 8, /**< \if English gyro stream \else 陀螺仪数据流 \endif */
|
||||
OB_MEDIA_ACCEL_STREAM = 16, /**< \if English accel stream \else 加速度计数据流 \endif */
|
||||
OB_MEDIA_CAMERA_PARAM = 32, /**< \if English camera parameter \else 相机参数 \endif */
|
||||
OB_MEDIA_DEVICE_INFO = 64, /**< \if English device information \else 设备信息 \endif */
|
||||
OB_MEDIA_STREAM_INFO = 128, /**< \if English stream information \else 流信息 \endif */
|
||||
|
||||
OB_MEDIA_ALL = OB_MEDIA_COLOR_STREAM | OB_MEDIA_DEPTH_STREAM | OB_MEDIA_IR_STREAM | OB_MEDIA_GYRO_STREAM | OB_MEDIA_ACCEL_STREAM | OB_MEDIA_CAMERA_PARAM
|
||||
| OB_MEDIA_DEVICE_INFO | OB_MEDIA_STREAM_INFO, /**< \if English All media data types \else 所有媒体数据类型 \endif */
|
||||
} OBMediaType,
|
||||
ob_media_type, OB_MEDIA_TYPE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Record playback status
|
||||
* \else
|
||||
* @brief 录制回放状态
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_MEDIA_BEGIN = 0, /**< \if English begin \else 开始 \endif */
|
||||
OB_MEDIA_PAUSE, /**< \if English pause \else 暂停 \endif */
|
||||
OB_MEDIA_RESUME, /**< \if English resume \else 继续 \endif */
|
||||
OB_MEDIA_END, /**< \if English end \else 终止 \endif */
|
||||
} OBMediaState,
|
||||
ob_media_state, OB_MEDIA_STATE_EM;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief depth accuracy class
|
||||
* @attention The depth accuracy level does not completely determine the depth unit and real accuracy, and the influence of the data packaging format needs to be considered.
|
||||
* The specific unit can be obtained through getValueScale() of DepthFrame
|
||||
* \else
|
||||
* @brief 深度精度等级
|
||||
* @attention 深度精度等级并不完全决定深度的单位和真实精度,需要考虑数据打包格式的影响,
|
||||
* 具体单位可通过DepthFrame的getValueScale()获取
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_PRECISION_1MM, /**< 1mm */
|
||||
OB_PRECISION_0MM8, /**< 0.8mm */
|
||||
OB_PRECISION_0MM4, /**< 0.4mm */
|
||||
OB_PRECISION_0MM1, /**< 0.1mm */
|
||||
OB_PRECISION_COUNT,
|
||||
} OBDepthPrecisionLevel,
|
||||
ob_depth_precision_level, OB_DEPTH_PRECISION_LEVEL;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief tof filter scene range
|
||||
* \else
|
||||
* @brief tof滤波场景范围
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_TOF_FILTER_RANGE_CLOSE = 0, /**< \if English close range \else 近距离范围 \endif */
|
||||
OB_TOF_FILTER_RANGE_MIDDLE = 1, /**< \if English middle range \else 中距离范围 \endif */
|
||||
OB_TOF_FILTER_RANGE_LONG = 2, /**< \if English long range \else 远距离范围 \endif */
|
||||
OB_TOF_FILTER_RANGE_DEBUG = 100, /**< \if English debug range \else Debug模式 \endif */
|
||||
} OBTofFilterRange,
|
||||
ob_tof_filter_range, TOF_FILTER_RANGE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief 3D point structure in SDK
|
||||
* \else
|
||||
* @brief SDK中3D点结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float x; ///< \if English x coordinate \else X坐标 \endif
|
||||
float y; ///< \if English y coordinate \else Y坐标 \endif
|
||||
float z; ///< \if English z coordinate \else Z坐标 \endif
|
||||
} OBPoint, ob_point;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief 3D point structure with color information
|
||||
* \else
|
||||
* @brief 带有颜色信息的3D点结构体
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
float x; ///< \if English x coordinate \else X坐标 \endif
|
||||
float y; ///< \if English y coordinate \else Y坐标 \endif
|
||||
float z; ///< \if English z coordinate \else Z坐标 \endif
|
||||
float r; ///< \if English red channel component \else 红色通道分量 \endif
|
||||
float g; ///< \if English green channel component \else 绿色通道分量 \endif
|
||||
float b; ///< \if English blue channel component\else 蓝色通道分量 \endif
|
||||
} OBColorPoint, ob_color_point;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Multi-device sync mode
|
||||
* \else
|
||||
* @brief 多设备同步模式
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_SYNC_STOP = 0x00, /**< \if English turn off sync \else 关闭同步 \endif */
|
||||
OB_SYNC_SINGLE_MODE = 0x01, /**< \if English single device mode \else single device模式 \endif */
|
||||
OB_SYNC_ONLINE_HOST_MODE = 0x02, /**< \if English The single device mode is also the host mode, which is dominated by ir \else single device模式,也是host模式,是ir作主的 \endif */
|
||||
OB_SYNC_ONLINE_SLAVE_MODE = 0x03, /**< \if English slave mode (ext_in --> rgb、tof、ext_out) \else slave模式 (ext_in --> rgb、tof、ext_out) \endif */
|
||||
OB_SYNC_ONLY_MCU_MODE = 0x04, /**< \if English MCU as host mode \else mcu作host的模式 \endif */
|
||||
OB_SYNC_ONLY_IR_MODE = 0x05, /**< \if English IR as host mode\else ir作host的模式 \endif */
|
||||
} OBSyncMode,
|
||||
ob_sync_mode, OB_SYNC_MODE;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief TOF Exposure Threshold
|
||||
* \else
|
||||
* @brief TOF曝光阈值
|
||||
*\endif
|
||||
*/
|
||||
typedef struct {
|
||||
int32_t upper; ///< \if English Upper threshold, unit: ms \else 阈值上限, 单位:ms \endif
|
||||
int32_t lower; ///< \if English Lower threshold, unit: ms \else 阈值下限, 单位:ms \endif
|
||||
} OBTofExposureThresholdControl, ob_tof_exposure_threshold_control, TOF_EXPOSURE_THRESHOLD_CONTROL;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Multi-device synchronization configuration
|
||||
* \else
|
||||
* @brief 多设备同步配置
|
||||
* \endif
|
||||
*/
|
||||
typedef struct {
|
||||
OBSyncMode syncMode; ///< \if English Sync mode \else 同步模式 \endif
|
||||
uint16_t tofPhaseDelay; ///< \if English Tof trigger signal delay us. \else Tof触发信号延时 us \endif
|
||||
uint16_t rgbPhaseDelay; ///< \if English rgb trigger signal delay us \else rgb触发信号延时 us \endif
|
||||
uint16_t outPhaseDelay; ///< \if English Output signal delay us \else 输出信号延时 us \endif
|
||||
uint16_t outOCPolarity; ///< \if English 0: Positive pulse, 1: Negative pulse \else 0:正向脉冲, 1: 负向脉冲 \endif
|
||||
uint16_t mcuHostFps; ///< \if English Trigger frame rate in mcu master mode \else mcu主模式时的触发帧率 \endif
|
||||
uint16_t curDevId; ///< \if English Current device number \else 当前设备编号 \endif
|
||||
} OBMultiDeviceSyncConfig, ob_multi_device_sync_config, OB_MULTI_DEVICE_SYNC_CONFIG;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief file transfer callback
|
||||
* @param state Transmission status
|
||||
* @param message Transfer status information
|
||||
* @param state Transfer progress percentage
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 文件传输回调
|
||||
* @param state 传输状态
|
||||
* @param message 传输状态信息
|
||||
* @param state 传输进度百分比
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_file_send_callback)(ob_file_tran_state state, const char *message, uint8_t percent, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Firmware upgrade callback
|
||||
* @param state upgrade status
|
||||
* @param message upgrade status information
|
||||
* @param state upgrade progress percentage
|
||||
* @param user_data user-defined data
|
||||
* @brief 固件升级回调
|
||||
* @param state 升级状态
|
||||
* @param message 升级状态信息
|
||||
* @param state 升级进度百分比
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_device_upgrade_callback)(ob_upgrade_state state, const char *message, uint8_t percent, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device status callback
|
||||
* @param state device status
|
||||
* @param message Device Status Information
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 设备状态回调
|
||||
* @param state 设备状态
|
||||
* @param message 设备状态信息
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_device_state_callback)(ob_device_state state, const char *message, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Callback for writing data
|
||||
* @param state write data status
|
||||
* @param percent Write data percentage
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 写数据的回调
|
||||
* @param state 写数据状态
|
||||
* @param percent 写数据百分比
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_set_data_callback)(ob_data_tran_state state, uint8_t percent, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief read data callback
|
||||
* @param state read data status
|
||||
* @param dataChunk read the returned data block
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 读数据回调
|
||||
* @param state 读数据状态
|
||||
* @param dataChunk 读取返回的数据块
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_get_data_callback)(ob_data_tran_state state, ob_data_chunk *dataChunk, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Media status callbacks (recording and playback)
|
||||
* @param state condition
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 媒体状态回调(录制和回放)
|
||||
* @param state 状态
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_media_state_callback)(ob_media_state state, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Device change (up and down) callback
|
||||
* @param removed List of deleted (dropped) devices
|
||||
* @param added List of added (online) devices
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 设备变化(上下线)回调
|
||||
* @param removed 已删除(掉线)的设备列表
|
||||
* @param added 已添加(上线)的设备列表
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_device_changed_callback)(ob_device_list *removed, ob_device_list *added, void *user_data);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief dataframe callback
|
||||
* @param frame Data Frame
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 数据帧回调
|
||||
* @param frame 数据帧
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_frame_callback)(ob_frame *frame, void *user_data);
|
||||
#define ob_filter_callback ob_frame_callback
|
||||
#define ob_playback_callback ob_frame_callback
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief dataframe collection callback
|
||||
* @param frameset collection of dataframes
|
||||
* @param user_data user-defined data
|
||||
* \else
|
||||
* @brief 数据帧集合回调
|
||||
* @param frameset 数据帧集合
|
||||
* @param user_data 用户自定义数据
|
||||
* \endif
|
||||
*/
|
||||
typedef void (*ob_frameset_callback)(ob_frame *frameset, void *user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,494 @@
|
||||
/**
|
||||
* \if English
|
||||
* @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.
|
||||
* \else
|
||||
* @file Pipeline.h
|
||||
* @brief SDK的高级API,可以快速实现开关流,帧同步,软件滤波等功能,适用于应用,算法重点关于rgbd数据流场景。如果对实时性或需要单独
|
||||
* 处理的同步,对齐的场景。请使用Device的Lower API的接口。
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a pipeline object
|
||||
*
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_pipeline* returns the pipeline object
|
||||
* \else
|
||||
* @brief 创建pipeline对象
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_pipeline* 返回pipeline对象
|
||||
* \endif
|
||||
*/
|
||||
ob_pipeline *ob_create_pipeline(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Using device objects to create pipeline objects
|
||||
*
|
||||
* @param[in] dev Device object used to create pipeline
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_pipeline* returns the pipeline object
|
||||
* \else
|
||||
* @brief 使用设备对象来创建pipeline对象
|
||||
*
|
||||
* @param[in] dev 用于创建pipeline的设备对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_pipeline* 返回pipeline对象
|
||||
* \endif
|
||||
*/
|
||||
ob_pipeline *ob_create_pipeline_with_device(ob_device *dev, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Use the playback file to create a pipeline object
|
||||
*
|
||||
* @param[in] file_name The playback file path used to create the pipeline
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_pipeline* returns the pipeline object
|
||||
* \else
|
||||
* @brief 使用回放文件来创建pipeline对象
|
||||
*
|
||||
* @param[in] file_name 用于创建pipeline的回放文件路径
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_pipeline* 返回pipeline对象
|
||||
* \endif
|
||||
*/
|
||||
ob_pipeline *ob_create_pipeline_with_playback_file(const char *file_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete pipeline objects
|
||||
*
|
||||
* @param[in] pipeline The pipeline object to be deleted
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除pipeline对象
|
||||
*
|
||||
* @param[in] pipeline 要删除的pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_pipeline(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline with default parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 以默认参数启动pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_start(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 启动pipeline并配置参数
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] config 要配置的参数
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_start_with_config(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline and set the frame collection data callback
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[in] callback Trigger a callback when all frame data in the frame set arrives
|
||||
* @param[in] user_data Pass in any user data and get it from the callback
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 启动pipeline并设置帧集合数据回调
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] config 要配置的参数
|
||||
* @param[in] callback 帧集合中的所有帧数据都到达时触发回调
|
||||
* @param[in] user_data 可以传入任意用户数据,并从回调中获取
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_start_with_callback(ob_pipeline *pipeline, ob_config *config, ob_frameset_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 停止pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_stop(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get current pipeline parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_config* returns pipeline parameters
|
||||
* \else
|
||||
* @brief 获取pipeline当前参数
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_config* 返回pipeline参数
|
||||
* \endif
|
||||
*/
|
||||
ob_config *ob_pipeline_get_config(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Waiting for the return of a set of frames in the form of synchronous blocking
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] timeout_ms Waiting timeout (ms)
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_frame* returns the waiting frameset, frameset is a special frame, you can use the frameset related interface to obtain the independent frame in the set
|
||||
* \else
|
||||
* @brief 以同步阻塞的形式等待返回一组帧集合
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] timeout_ms 等待超时时间(毫秒)
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_frame* 返回等待的帧集合frameset,frameset是特殊的frame,可以使用frameset相关接口获取集合内的独立frame
|
||||
* \endif
|
||||
*/
|
||||
ob_frame *ob_pipeline_wait_for_frameset(ob_pipeline *pipeline, uint32_t timeout_ms, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device from the pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_device* returns the device object
|
||||
* \else
|
||||
* @brief 从pipeline中获取设备
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_device* 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
ob_device *ob_pipeline_get_device(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get playback object from pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline objet
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_playback* returns the playback object
|
||||
* \else
|
||||
* @brief 从pipeline中获取回放对象
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_playback* 返回回放对象
|
||||
* \endif
|
||||
*/
|
||||
ob_playback *ob_pipeline_get_playback(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream profile from the pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] sensor_type sensor type, the sensor_type type supported by the camera can be obtained through the ob_device_get_sensor_list() interface
|
||||
* @param[out] profile_count The number of stream configurations obtained
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_profile_list* returns to the stream profile list
|
||||
* \else
|
||||
* @brief 获取传感器相应的流配置
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] sensor_type 传感器类型 ,相机支持的sensor_type类型可通过ob_device_get_sensor_list()接口获知
|
||||
* @param[out] profile_count 获取的流配置数量
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_profile_list* 返回流配置列表
|
||||
* \endif
|
||||
*/
|
||||
ob_stream_profile_list *ob_pipeline_get_stream_profile_list(ob_pipeline *pipeline, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enable frame synchronization
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 打开帧同步功能
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_enable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Disable frame synchronization
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 关闭帧同步功能
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_disable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch the corresponding config configuration
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 动态切换对应的config配置
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] config pipeline的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_switch_config(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @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 returns camera internal parameters
|
||||
* \else
|
||||
* @brief 获取当前相机参数
|
||||
* @attention 如果开启了D2C将返回D2C后的相机参数,如果没有将返回默认参数
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_camera_param 返回相机内参
|
||||
* \endif
|
||||
*/
|
||||
ob_camera_param ob_pipeline_get_camera_param(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Returns a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] color_profile Input resolution of Color Sensor
|
||||
* @param[in] align_mode Input align mode
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_profile_list*
|
||||
* \else
|
||||
* @brief 返回与输入的彩色传感器分辨率对应的支持D2C的深度传感器分辨率列表
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] color_profile 输入的Color Sensor的分辨率
|
||||
* @param[in] align_mode 输入的对齐模式
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_profile_list*
|
||||
* \endif
|
||||
*/
|
||||
ob_stream_profile_list *ob_get_d2c_depth_profile_list(ob_pipeline *pipeline, ob_stream_profile *color_profile,ob_align_mode align_mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get valid area after D2C
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] distance working distance
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_rect returns the area information valid after D2C at working distance
|
||||
* \else
|
||||
* @brief 获取D2C后有效的区域
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] distance 工作距离
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_rect 返回在工作距离下D2C后有效的区域信息
|
||||
* \endif
|
||||
*/
|
||||
ob_rect ob_get_d2c_valid_area(ob_pipeline *pipeline, uint32_t distance, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start recording
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] file_name Recorded file path
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 开启录制
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[in] file_name 录制的文件路径
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_start_record(ob_pipeline *pipeline, const char *file_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Turn off recording
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 关闭录制
|
||||
*
|
||||
* @param[in] pipeline pipeline对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_pipeline_stop_record(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create the pipeline configuration
|
||||
*
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_config* returns the configuration object
|
||||
* \else
|
||||
* @brief 创建pipeline的配置
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_config* 返回配置对象
|
||||
* \endif
|
||||
*/
|
||||
ob_config *ob_create_config(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete the pipeline configuration
|
||||
*
|
||||
* @param[in] config Configuration to be deleted
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除pipeline的配置
|
||||
*
|
||||
* @param[in] config 要删除的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_config(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be enabled
|
||||
*
|
||||
* @param[in] config Configuration of pipeline
|
||||
* @param[in] profile The configuration of the stream to be opened
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 配置要打开的流
|
||||
*
|
||||
* @param[in] config pipeline的配置
|
||||
* @param[in] profile 要打开的流的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_config_enable_stream(ob_config *config, ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be enabled
|
||||
*
|
||||
* @param[in] config Configuration of pipeline
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 配置打开所有的流
|
||||
*
|
||||
* @param[in] config pipeline的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_config_enable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be disabled
|
||||
*
|
||||
* @param[in] config Configuration of pipeline
|
||||
* @param[in] profile The configuration of the stream to be closed
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 配置要关闭的流
|
||||
*
|
||||
* @param[in] config pipeline的配置
|
||||
* @param[in] profile 要关闭的流的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_config_disable_stream(ob_config *config, ob_stream_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be disabled
|
||||
*
|
||||
* @param[in] config Configuration of pipeline
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 配置关闭所有的流
|
||||
*
|
||||
* @param[in] config pipeline的配置
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_config_disable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the alignment mode
|
||||
*
|
||||
* @param[in] config config object
|
||||
* @param[in] mode alignment mode
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 设置对齐模式
|
||||
*
|
||||
* @param[in] config config对象
|
||||
* @param[in] mode 对齐模式
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_config_set_align_mode(ob_config *config, ob_align_mode mode, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
// License: Apache 2.0. See LICENSE file in root directory.
|
||||
// Copyright(c) 2020 Orbbec Corporation. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @file Property.h
|
||||
* @brief Control command property list maintenance
|
||||
* \else
|
||||
* @file Property.h
|
||||
* @brief 控制命令属性列表维护
|
||||
* \endif
|
||||
*/
|
||||
|
||||
#ifndef _OB_PROPERTY_H_
|
||||
#define _OB_PROPERTY_H_
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enumeration value describing all attribute control commands of the device
|
||||
* \else
|
||||
* @brief 描述设备所有的属性控制命令的枚举值
|
||||
* \endif
|
||||
*/
|
||||
typedef enum {
|
||||
OB_PROP_LDP_BOOL = 2, /**< \if English LDP switch \else LDP开关 \endif */
|
||||
OB_PROP_LASER_BOOL = 3, /**< \if English Laser switch \else 激光开关 \endif */
|
||||
OB_PROP_LASER_PULSE_WIDTH_INT = 4, /**< \if English Read and write laser Time value (pulse width) \else 读写激光Time值(脉宽) \endif */
|
||||
OB_PROP_LASER_CURRENT_FLOAT = 5, /**< \if English Laser current \else 激光电流 \endif */
|
||||
OB_PROP_FLOOD_BOOL = 6, /**< \if English IR flood switch \else 泛光灯开关 \endif */
|
||||
OB_PROP_FLOOD_LEVEL_INT = 7, /**< \if English IR flood level \else 泛光灯等级 \endif */
|
||||
OB_PROP_DEPTH_MIRROR_BOOL = 14, /**< \if English Depth mirror \else 深度镜像 \endif */
|
||||
OB_PROP_DEPTH_FLIP_BOOL = 15, /**< \if English Depth flip \else 深度翻转 \endif */
|
||||
OB_PROP_DEPTH_POSTFILTER_BOOL = 16, /**< \if English Depth Postfilter \else 深度Postfilter \endif */
|
||||
OB_PROP_DEPTH_HOLEFILTER_BOOL = 17, /**< \if English Depth Holefilter \else 深度Holefilter \endif */
|
||||
OB_PROP_IR_MIRROR_BOOL = 18, /**< \if English IR mirror \else IR 镜像 \endif */
|
||||
OB_PROP_IR_FLIP_BOOL = 19, /**< \if English IR flip \else IR 翻转 \endif */
|
||||
OB_PROP_MIN_DEPTH_INT = 22, /**< \if English Minimum depth threshold \else 最小深度阈值 \endif */
|
||||
OB_PROP_MAX_DEPTH_INT = 23, /**< \if English Maximum depth threshold \else 最大深度阈值 \endif */
|
||||
OB_PROP_DEPTH_SOFT_FILTER_BOOL = 24, /**< \if English Software filter switch \else 软件滤波开关 \endif */
|
||||
OB_PROP_LDP_STATUS_BOOL = 32, /**< \if English LDP status \else LDP状态 \endif */
|
||||
OB_PROP_DEPTH_MAX_DIFF_INT = 40, /**< soft filter maxdiff param */
|
||||
OB_PROP_DEPTH_MAX_SPECKLE_SIZE_INT = 41, /**< soft filter maxSpeckleSize */
|
||||
OB_PROP_DEPTH_ALIGN_HARDWARE_BOOL = 42, /**< \if English Hardware d2c is on \else 硬件d2c开 \endif */
|
||||
OB_PROP_TIMESTAMP_OFFSET_INT = 43, /**< \if English Timestamp adjustment \else 时间戳调校 \endif */
|
||||
OB_PROP_HARDWARE_DISTORTION_SWITCH_BOOL = 61, /**< \if English Hardware distortion switch Rectify \else 硬件去畸变开关 Rectify \endif */
|
||||
OB_PROP_FAN_WORK_MODE_INT = 62, /**< \if English Fan mode switch \else 风扇开关模式 \endif */
|
||||
OB_PROP_DEPTH_ALIGN_HARDWARE_MODE_INT = 63, /**< \if English Multi-resolution D2C mode \else 多分辨率D2C模式 \endif */
|
||||
OB_PROP_ANTI_COLLUSION_ACTIVATION_STATUS_BOOL = 64, /**< \if English Anti_collusion activation status \else 防串货状态 \endif */
|
||||
OB_PROP_DEPTH_PRECISION_LEVEL_INT = 75, /**< \if English The depth precision level, which may change the depth frame data unit, needs to be confirmed through the ValueScale interface of DepthFrame \else 深度精度等级,可能会改变深度帧数据单位,需要通过DepthFrame的ValueScale接口确认 \endif */
|
||||
OB_PROP_TOF_FILTER_RANGE_INT = 76, /**< \if English tof filter range configuration \else tof滤波场景范围配置 \endif */
|
||||
OB_PROP_LASER_MODE_INT = 79, /**< \if English laser mode, the firmware terminal currently only returns 1: IR Drive, 2: Torch \else 激光点亮模式,固件端目前只返回 1: IR Drive, 2: Torch \endif */
|
||||
OB_PROP_RECTIFY2_BOOL = 80, /**< \if English brt2r-rectify function switch (brt2r is a special module on mx6600), 0: Disable, 1: Rectify Enable \else brt2r-rectify功能开关(brt2r是mx6600上的一个特殊模块),0:关闭, 1:打开 \endif */
|
||||
OB_PROP_COLOR_MIRROR_BOOL = 81, /**< \if English Color mirror \else 彩色镜像 \endif */
|
||||
OB_PROP_COLOR_FLIP_BOOL = 82, /**< \if English Color flip \else 彩色翻转 \endif */
|
||||
OB_PROP_INDICATOR_LIGHT_BOOL = 83, /**< \if English Indicator switch, 0: Disable, 1: Enable \else 指示灯开关,0:关闭, 1:打开 \endif */
|
||||
OB_PROP_DISPARITY_TO_DEPTH_BOOL = 85, /**< \if English Disparity to depth switch, 0: off, the depth stream outputs the disparity map; 1. On, the depth stream outputs the depth map. \else 视差转深度开关, 0:关闭,深度流输出视差图; 1. 打开,深度流输出深度图 \endif */
|
||||
OB_PROP_BRT_BOOL = 86, /**< \if English BRT function switch (anti-background interference), 0: Disable, 1: Enable \else BRT功能开关(抗背景干扰),0:关闭, 1:打开 \endif */
|
||||
OB_PROP_WATCHDOG_BOOL = 87, /**< \if English Watchdog function switch, 0: Disable, 1: Enable \else 看门狗功能开关,0:关闭, 1:打开 \endif */
|
||||
OB_PROP_EXTERNAL_SIGNAL_RESET_BOOL = 88, /**< \if English External signal trigger restart function switch, 0: Disable, 1: Enable \else 外部信号触发重启功能开关,0:关闭, 1:打开 \endif */
|
||||
OB_PROP_HEARTBEAT_BOOL = 89, /**< \if English Heartbeat monitoring function switch, 0: Disable, 1: Enable \else 心跳监测功能开关,0:关闭, 1:打开 \endif */
|
||||
OB_PROP_DEPTH_CROPPING_MODE_INT = 90, /**< \if English Depth cropping mode device: OB_DEPTH_CROPPING_MODE \else 深度裁剪模式设备: OB_DEPTH_CROPPING_MODE \endif */
|
||||
OB_PROP_D2C_PREPROCESS_BOOL = 91, /**< \if English D2C preprocessing switch (such as RGB cropping), 0: off, 1: on \else D2C前处理开关(如RGB裁剪),0:关闭,1:打开 \endif */
|
||||
OB_PROP_RGB_CUSTOM_CROP_BOOL = 94, /**< \if English Custom RGB cropping switch, 0 is off, 1 is on custom cropping, and the ROI cropping area is issued \else 自定义RGB裁剪开关,0为关闭,1为开启自定义裁剪,下发ROI裁剪区域\endif */
|
||||
OB_PROP_DEVICE_WORK_MODE_INT = 95, /**< \if English Device operating mode (power consumption) \else 设备工作模式(功耗) \endif */
|
||||
|
||||
OB_STRUCT_BASELINE_CALIBRATION_PARAM = 1002, /**< \if English Baseline calibration parameters \else 基线标定参数 \endif */
|
||||
OB_STRUCT_DEVICE_TEMPERATURE = 1003, /**< \if English Device temperature information \else 设备温度信息 \endif */
|
||||
OB_STRUCT_TOF_EXPOSURE_THRESHOLD_CONTROL = 1024, /**< \if English TOF exposure threshold range \else TOF曝光阈值范围 \endif */
|
||||
OB_STRUCT_DEVICE_SERIAL_NUMBER = 1035, /**< \if English get/set serial number \else 获取/设置序列号 \endif */
|
||||
OB_STRUCT_DEVICE_TIME = 1037, /**< \if English get/set device time \else 获取/设置设备时间 \endif */
|
||||
OB_STRUCT_MULTI_DEVICE_SYNC_CONFIG = 1038, /**< \if English Multi-device synchronization mode and parameter configuration \else 多设备同步模式和参数配置 \endif */
|
||||
OB_STRUCT_RGB_CROP_ROI = 1040, /**< \if English RGB cropping ROI \else RGB裁剪ROI \endif */
|
||||
|
||||
OB_PROP_COLOR_AUTO_EXPOSURE_BOOL = 2000, /**< \if English Color camera auto exposure \else 彩色相机自动曝光 \endif */
|
||||
OB_PROP_COLOR_EXPOSURE_INT = 2001, /**< \if English Color camera exposure adjustment \else 彩色相机曝光调节 \endif */
|
||||
OB_PROP_COLOR_GAIN_INT = 2002, /**< \if English Color camera gain adjustment \else 彩色相机增益调节 \endif */
|
||||
OB_PROP_COLOR_AUTO_WHITE_BALANCE_BOOL = 2003, /**< \if English Color camera automatic white balance \else 彩色相机自动白平衡 \endif */
|
||||
OB_PROP_COLOR_WHITE_BALANCE_INT = 2004, /**< \if English Color camera white balance adjustment \else 彩色相机白平衡调节 \endif */
|
||||
OB_PROP_COLOR_BRIGHTNESS_INT = 2005, /**< \if English Color camera brightness adjustment \else 彩色相机亮度调节 \endif */
|
||||
OB_PROP_COLOR_SHARPNESS_INT = 2006, /**< \if English Color camera sharpness adjustment \else 彩色相机锐度调节 \endif */
|
||||
OB_PROP_COLOR_SATURATION_INT = 2008, /**< \if English Color camera saturation adjustment \else 彩色相机饱和度调节 \endif */
|
||||
OB_PROP_COLOR_CONTRAST_INT = 2009, /**< \if English Color camera contrast adjustment \else 彩色相机对比度调节 \endif */
|
||||
OB_PROP_COLOR_GAMMA_INT = 2010, /**< \if English Color camera gamma adjustment \else 彩色相机伽马值调节 \endif */
|
||||
OB_PROP_COLOR_ROLL_INT = 2011, /**< \if English Color camera image rotation\else 彩色相机图像旋转 \endif */
|
||||
OB_PROP_COLOR_AUTO_EXPOSURE_PRIORITY_INT = 2012, /**< \if English Color camera auto exposure priority \else 彩色相机自动曝光优先 \endif */
|
||||
OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT = 2013, /**< \if English Color camera brightness compensation \else 彩色相机亮度补偿 \endif */
|
||||
OB_PROP_COLOR_HUE_INT = 2014, /**< \if English color camera color tint \else 彩色相机彩色色调 \endif */
|
||||
OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT = 2015, /**< \if English Color Camera Power Line Frequency \else 彩色相机电力线路频率 \endif */
|
||||
OB_PROP_DEPTH_AUTO_EXPOSURE_BOOL = 2016, /**< \if English Automatic exposure of depth camera (infrared camera will be set synchronously under some models of devices) \else 深度相机自动曝光(某些型号设备下会同步设置红外相机) \endif */
|
||||
OB_PROP_DEPTH_EXPOSURE_INT = 2017, /**< \if English Depth camera exposure adjustment (infrared cameras will be set synchronously under some models of devices) \else 深度相机曝光调节(某些型号设备下会同步设置红外相机) \endif */
|
||||
OB_PROP_DEPTH_GAIN_INT = 2018, /**< \if English Depth camera gain adjustment (infrared cameras will be set synchronously under some models of devices) \else 深度相机增益调节(某些型号设备下会同步设置红外相机) \endif */
|
||||
OB_PROP_IR_AUTO_EXPOSURE_BOOL = 2025, /**< \if English Infrared camera auto exposure (depth camera will be set synchronously under some models of devices) \else 红外相机自动曝光(某些型号设备下会同步设置深度相机) \endif */
|
||||
OB_PROP_IR_EXPOSURE_INT = 2026, /**< \if English Infrared camera exposure adjustment (some models of devices will set the depth camera synchronously) \else 红外相机曝光调节(某些型号设备下会同步设置深度相机) \endif */
|
||||
OB_PROP_IR_GAIN_INT = 2027, /**< \if English Infrared camera gain adjustment (the depth camera will be set synchronously under some models of devices) \else 红外相机增益调节(某些型号设备下会同步设置深度相机) \endif */
|
||||
|
||||
OB_PROP_SDK_DISPARITY_TO_DEPTH_BOOL = 3004, /**< \if English Disparity to depth \else 视差转深度 \endif */
|
||||
OB_PROP_SDK_DEPTH_FRAME_UNPACK_BOOL = 3007, /**< \if English Depth data unpacking function switch (it will be turned on by default every time the stream is opened, and supports RLE/Y10/Y11/Y12/Y14 format) \else Depth数据解包功能开关(每次开流都会默认打开,支持RLE/Y10/Y11/Y12/Y14格式) \endif */
|
||||
|
||||
OB_STRUCT_DEBUG_SENSOR_EXPOSURE_TIME = 5504, /**< \if English LDP status \else 曝光时间读写 \endif */
|
||||
|
||||
} OBPropertyID,
|
||||
ob_property_id;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief The data type used to describe all property settings
|
||||
* \else
|
||||
* @brief 用于描述所有属性设置的数据类型
|
||||
* \endif
|
||||
*/
|
||||
typedef enum OBPropertyType {
|
||||
OB_BOOL_PROPERTY = 0, /**< \if English Bool property \else bool类型数据的属性 \endif */
|
||||
OB_INT_PROPERTY = 1, /**< \if English int property \else int类型数据的属性\endif */
|
||||
OB_FLOAT_PROPERTY = 2, /**< \if English float property \else float类型数据的属性 \endif */
|
||||
OB_STRUCT_PROPERTY = 3, /**< \if English struct property \else struct类型数据的属性 \endif */
|
||||
} OBPropertyType,
|
||||
ob_property_type;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Used to describe the characteristics of each property
|
||||
* \else
|
||||
* @brief 用于描述每一个属性的特性
|
||||
* \endif
|
||||
*/
|
||||
typedef struct OBPropertyItem {
|
||||
OBPropertyID id; ///< \if English Property id \else 属性id \endif
|
||||
const char *name; ///< \if English Property name \else 属性名字 \endif
|
||||
OBPropertyType type; ///< \if English Property type \else 属性类型 \endif
|
||||
OBPermissionType permission; ///< \if English Property read and write permission \else 属性读写权限 \endif
|
||||
} OBPropertyItem, ob_property_item;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _OB_PROPERTY_H_
|
||||
@@ -0,0 +1,235 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file RecordPlayback.h
|
||||
* @brief For recording and playback functions
|
||||
* \else
|
||||
* @file RecordPlayback.h
|
||||
* @brief 用于录制和回放功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
*
|
||||
* @param[out] error log error messages
|
||||
* @return ob_recorder* returns the recorder object
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
*
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_recorder* 返回录制器对象
|
||||
* \endif
|
||||
*/
|
||||
ob_recorder *ob_create_recorder(ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
*
|
||||
* @param dev The device object used to create the recorder
|
||||
* @param[out] error log error messages
|
||||
* @return ob_recorder* returns the recorder object
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
*
|
||||
* @param dev 用于创建录制器的设备对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_recorder* 返回录制器对象
|
||||
* \endif
|
||||
*/
|
||||
ob_recorder *ob_create_recorder_with_device(ob_device *dev, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief delete recorder object
|
||||
*
|
||||
* @param recorder recorder object
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 删除录制器对象
|
||||
*
|
||||
* @param recorder 录制器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_recorder(ob_recorder *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief start recording
|
||||
*
|
||||
* @param[in] recorder recorder object
|
||||
* @param[in] filename Recorded file name
|
||||
* @param[in] async Whether to record asynchronously
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 开始录制
|
||||
*
|
||||
* @param[in] recorder 录制器对象
|
||||
* @param[in] filename 录制的文件名称
|
||||
* @param[in] async 是否异步录制
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_recorder_start(ob_recorder *recorder, const char *filename, bool async, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief stop recording
|
||||
*
|
||||
* @param[in] recorder recorder object
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 停止录制
|
||||
*
|
||||
* @param[in] recorder 录制器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_recorder_stop(ob_recorder *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Write frame data to the recorder
|
||||
*
|
||||
* @param[in] recorder recorder object
|
||||
* @param[in] frame Write frame data
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 向录制器内写入帧数据
|
||||
*
|
||||
* @param[in] recorder 录制器对象
|
||||
* @param[in] frame 写入的帧数据
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_recorder_write_frame(ob_recorder *recorder, ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create playback object
|
||||
* @param[in] filename Playback filename
|
||||
* @param[out] error log error messages
|
||||
* @return ob_playback* returns the playback object
|
||||
* \else
|
||||
* @brief 创建回放对象
|
||||
* @param[in] filename 回放的文件名
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_playback* 返回回放的对象
|
||||
* \endif
|
||||
*/
|
||||
ob_playback *ob_create_playback(const char *filename, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief delete playback object
|
||||
*
|
||||
* @param[in] playback playback object
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 删除回放对象
|
||||
*
|
||||
* @param[in] playback 回放对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_playback(ob_playback *playback, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start playback, playback data is returned from the callback
|
||||
*
|
||||
* @param[in] playback playback object
|
||||
* @param[in] callback Callback for playback data
|
||||
* @param[in] user_data User data
|
||||
* @param[in] type Type of playback data
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 开启回放,回放数据从回调中返回
|
||||
*
|
||||
* @param[in] playback 回放对象
|
||||
* @param[in] callback 回放数据的回调
|
||||
* @param[in] user_data 用户数据
|
||||
* @param[in] type 回放数据的类型
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_playback_start(ob_playback *playback, ob_playback_callback callback, void *user_data, ob_media_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief stop playback
|
||||
*
|
||||
* @param[in] playback playback object
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 停止回放
|
||||
*
|
||||
* @param[in] playback 回放对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_playback_stop(ob_playback *playback, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set playback state
|
||||
* @param[in] playback playback object
|
||||
* @param[in] callback playback status callback
|
||||
* @param[in] user_data User data
|
||||
* @param[out] error log error messages
|
||||
* \else
|
||||
* @brief 设置回放状态
|
||||
* @param[in] playback 回放对象
|
||||
* @param[in] callback 回放状态回调
|
||||
* @param[in] user_data 用户数据
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_set_playback_state_callback(ob_playback *playback, ob_media_state_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the device information in the recording file
|
||||
*
|
||||
* @param[in] playback playback object
|
||||
* @param[out] error log error messages
|
||||
* @return ob_device_info* returns device information
|
||||
* \else
|
||||
* @brief 获取录制文件内的设备信息
|
||||
*
|
||||
* @param[in] playback 回放对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_device_info* returns device information
|
||||
* \endif
|
||||
*/
|
||||
ob_device_info *ob_playback_get_device_info(ob_playback *playback, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the intrinsic and extrinsic parameter information in the recording file
|
||||
*
|
||||
* @param[in] playback playback object
|
||||
* @param[out] error log error messages
|
||||
* @return ob_camera_param returns internal and external parameter information
|
||||
* \else
|
||||
* @brief 获取录制文件内的内外参信息
|
||||
*
|
||||
* @param[in] playback 回放对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_camera_param 返回的内外参信息
|
||||
* \endif
|
||||
*/
|
||||
ob_camera_param ob_playback_get_camera_param(ob_playback *playback, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Sensor.h
|
||||
* @brief Sensor related types, used to obtain stream configuration, open and close streams, set and get sensor properties.
|
||||
* \else
|
||||
* @file Sensor.h
|
||||
* @brief 传感器相关函数,用于获取流配置,开关流,设置及获取传感器属性等操作
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sensor type
|
||||
*
|
||||
* @param[in] sensor Sensor object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_sensor_type returns the sensor type
|
||||
* \else
|
||||
* @brief 获取传感器类型
|
||||
*
|
||||
* @param[in] sensor 传感器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_sensor_type 返回传感器类型
|
||||
* \endif
|
||||
*/
|
||||
ob_sensor_type ob_sensor_get_type(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get all supported stream profiles
|
||||
*
|
||||
* @param[in] sensor Sensor object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_profile** returns a list of stream profiles
|
||||
* \else
|
||||
* @brief 获取传感器支持的所有流的配置
|
||||
*
|
||||
* @param[in] sensor 传感器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_profile_list* 返回流配置的列表
|
||||
* \endif
|
||||
*/
|
||||
ob_stream_profile_list *ob_sensor_get_stream_profile_list(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Open the current sensor, and set the callback data frame
|
||||
*
|
||||
* @param[in] sensor Sensor object
|
||||
* @param[in] profile Stream configuration information
|
||||
* @param[in] callback Callback function triggered when frame data arrives
|
||||
* @param[in] user_data pass in any user data and get it from the callback
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 打开传感器的流,并设置帧数据回调
|
||||
*
|
||||
* @param[in] sensor 传感器对象
|
||||
* @param[in] profile 流的配置信息
|
||||
* @param[in] callback 帧数据到达时触发的回调函数
|
||||
* @param[in] user_data 可以传入任意用户数据,并从回调中获取
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_sensor_start(ob_sensor *sensor, ob_stream_profile *profile, ob_frame_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop sensor stream
|
||||
*
|
||||
* @param[in] sensor sensor object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 停止传感器的流
|
||||
*
|
||||
* @param[in] sensor 传感器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_sensor_stop(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch resolutions
|
||||
*
|
||||
* @param[in] sensor Sensor object
|
||||
* @param[in] profile Stream configuration information
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 动态切换分辨率
|
||||
*
|
||||
* @param[in] sensor 传感器对象
|
||||
* @param[in] profile 流的配置信息
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_sensor_switch_profile(ob_sensor *sensor, ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete sensor object list
|
||||
*
|
||||
* @param[in] sensor_list List of sensor objects to delete
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除传感器对象列表
|
||||
*
|
||||
* @param[in] sensor_list 要删除的传感器对象列表
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_sensor_list(ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the number of sensors in the sensor list
|
||||
*
|
||||
* @param[in] sensor_list List of sensor objects to delete
|
||||
* @param[in] count Number of sensors
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 获取传感器列表内传感器个数
|
||||
*
|
||||
* @param[in] sensor_list 要删除的传感器对象列表
|
||||
* @param[in] count 传感器数量
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_sensor_list_get_sensor_count(ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the sensor types
|
||||
*
|
||||
* @param index Sensor index
|
||||
* @return OBSensorType returns the Sensor type
|
||||
* \else
|
||||
* @brief 获取指定Sensor的类型
|
||||
*
|
||||
* @param index Sensor索引
|
||||
* @return OBSensorType 返回Sensor类型
|
||||
* \endif
|
||||
*/
|
||||
ob_sensor_type ob_sensor_list_get_sensor_type(ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sensor by sensor type
|
||||
*
|
||||
* @param sensor_list Get the returned sensor list through device
|
||||
* @param sensorType Sensor type to be obtained
|
||||
* @return Return the Sensor pointer, if the specified type of Sensor does not exist, it will return null
|
||||
* \else
|
||||
* @brief 通过Sensor类型获取Sensor
|
||||
*
|
||||
* @param sensor_list 通过device获取返回的sensor列表
|
||||
* @param sensorType 要获取的Sensor类型
|
||||
* @return 返回Sensor指针,如果指定类型Sensor不存在,将返回空
|
||||
* \endif
|
||||
*/
|
||||
ob_sensor *ob_sensor_list_get_sensor_by_type(ob_sensor_list *sensor_list, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get Sensor by index number
|
||||
*
|
||||
* @param sensor_list Get the returned sensor list through device
|
||||
* @param index To create a device cable, the range is [0, count-1], if the index exceeds the range, an exception will be thrown
|
||||
* @return std::shared_ptr<Sensor> returns the Sensor object
|
||||
* \else
|
||||
* @brief 通过索引号获取Sensor
|
||||
*
|
||||
* @param sensor_list 通过device获取返回的sensor列表
|
||||
* @param index 要创建设备的索,范围 [0, count-1],如果index超出范围将抛异常
|
||||
* @return std::shared_ptr<Sensor> 返回Sensor对象
|
||||
* \endif
|
||||
*/
|
||||
ob_sensor *ob_sensor_list_get_sensor(ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete sensor object
|
||||
*
|
||||
* @param[in] sensor The sensor object to delete
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除传感器对象
|
||||
*
|
||||
* @param[in] sensor 要删除的传感器对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_sensor(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,266 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file StreamProfile.h
|
||||
* @brief The stream configuration related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
* \else
|
||||
* @file StreamProfile.h
|
||||
* @brief 流配置相关函数,用于获取流的宽、高、帧率及格式等信息
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream profile format
|
||||
*
|
||||
* @param[in] profile Stream configuration object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_format returns the format of the stream
|
||||
* \else
|
||||
* @brief 获取流配置的格式
|
||||
*
|
||||
* @param[in] profile 流配置对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_format 返回流的格式
|
||||
* \endif
|
||||
*/
|
||||
ob_format ob_stream_profile_format(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream profile type
|
||||
*
|
||||
* @param[in] profile Stream configuration object
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_type stream type
|
||||
* \else
|
||||
* @brief 获取流的类型
|
||||
*
|
||||
* @param[in] profile 流配置对象
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_type 流的类型
|
||||
* \endif
|
||||
*/
|
||||
ob_stream_type ob_stream_profile_type(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame rate of the video stream configuration
|
||||
*
|
||||
* @param[in] profile Stream configuration object
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the frame rate of the stream
|
||||
* \else
|
||||
* @brief 获取视频流配置的帧率
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是视频流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回流的帧率
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_stream_profile_fps(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the width of the video stream configuration
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the width of the stream
|
||||
* \else
|
||||
* @brief 获取视频流配置的宽
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是视频流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回流的宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_stream_profile_width(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the height of the video stream configuration
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the height of the stream
|
||||
* \else
|
||||
* @brief 获取视频流配置的高
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是视频流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回流的高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_video_stream_profile_height(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get scale range of accelerometer stream
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not the accelerometer stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_accel_full_scale_range range
|
||||
* \else
|
||||
* @brief 获取加速度计流配置的量程范围
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是加速度计流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_accel_full_scale_range 量程范围
|
||||
* \endif
|
||||
*/
|
||||
ob_accel_full_scale_range ob_accel_stream_profile_full_scale_range(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sampling frequency of the accelerometer frame
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not the accelerometer stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_accel_sample_rate sampling frequency
|
||||
* \else
|
||||
* @brief 获取加速度计流配置的采样频率
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是加速度计流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_accel_sample_rate 采样频率
|
||||
* \endif
|
||||
*/
|
||||
ob_accel_sample_rate ob_accel_stream_profile_sample_rate(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get scale range of gyroscope stream
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not a gyroscope stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_gyro_full_scale_range range
|
||||
* \else
|
||||
* @brief 获取陀螺仪流配置的量程范围
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是陀螺仪流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_gyro_full_scale_range 量程范围
|
||||
* \endif
|
||||
*/
|
||||
ob_gyro_full_scale_range ob_gyro_stream_profile_full_scale_range(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the sampling frequency of the gyro flow configuration
|
||||
*
|
||||
* @param[in] profile Stream configuration object, if the configuration is not a gyroscope stream configuration, an error will be returned
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_gyro_sample_rate sampling frequency
|
||||
* \else
|
||||
* @brief 获取陀螺仪流配置的采样频率
|
||||
*
|
||||
* @param[in] profile 流配置对象, 如果该配置不是陀螺仪流配置,将会返错误
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_gyro_sample_rate 采样频率
|
||||
* \endif
|
||||
*/
|
||||
ob_gyro_sample_rate ob_gyro_stream_profile_sample_rate(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @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.
|
||||
*
|
||||
* @param profile_list Resolution list
|
||||
* @param width Width, if you don't need to add matching conditions, you can pass 0
|
||||
* @param height Height, if you don't need to add matching conditions, you can pass 0
|
||||
* @param format Format, if you don't need to add matching conditions, you can pass OB_FORMAT_UNKNOWN
|
||||
* @param fps Frame rate, if you don't need to add matching conditions, you can pass 0
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_profile* returns the matching profile
|
||||
* \else
|
||||
* @brief 通过传入的参数进行匹配对应的ob_stream_profile,若有多个匹配项默认返回列表中的第一个
|
||||
*
|
||||
* @param profile_list 分辨率列表
|
||||
* @param width 宽度, 如不要求加入匹配条件,可传0
|
||||
* @param height 高度, 如不要求加入匹配条件,可传0
|
||||
* @param format 格式, 如不要求加入匹配条件,可传OB_FORMAT_UNKNOWN
|
||||
* @param fps 帧率, 如不要求加入匹配条件,可传0
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_profile* 返回匹配的profile
|
||||
* \endif
|
||||
*/
|
||||
ob_stream_profile *ob_stream_profile_list_get_video_stream_profile(ob_stream_profile_list *profile_list, int width, int height, ob_format format, int fps,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the corresponding StreamProfile by subscripting
|
||||
*
|
||||
* @param[in] profile_list StreamProfile lists
|
||||
* @param[in] index
|
||||
* @param[out] error Log error messages
|
||||
* @return ob_stream_profile* returns the matching profile
|
||||
* \else
|
||||
* @brief 通过下标获取对应的StreamProfile
|
||||
*
|
||||
* @param[in] profile_list StreamProfile列表
|
||||
* @param[in] index 索引
|
||||
* @param[out] error 记录错误信息
|
||||
* @return ob_stream_profile* 返回匹配的profile
|
||||
*\endif
|
||||
*/
|
||||
ob_stream_profile *ob_stream_profile_list_get_profile(ob_stream_profile_list *profile_list, int index, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the number of StreamProfile lists
|
||||
*
|
||||
* @param[in] profile_list StreamProfile list
|
||||
* @param[out] error Log error messages
|
||||
* @return uint32_t returns the number of StreamProfile lists
|
||||
* \else
|
||||
* @brief 获取StreamProfile列表的数量
|
||||
*
|
||||
* @param[in] profile_list StreamProfile列表
|
||||
* @param[out] error 记录错误信息
|
||||
* @return uint32_t 返回StreamProfile列表的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t ob_stream_profile_list_count(ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Delete stream configuration list
|
||||
*
|
||||
* @param[in] profiles Stream configuration list
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除流配置列表
|
||||
*
|
||||
* @param[in] profiles 流配置列表
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_stream_profile_list(ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
/**
|
||||
*\if English
|
||||
* @brief Delete stream configuration
|
||||
*
|
||||
* @param[in] profile Stream configuration object
|
||||
* @param[out] error Log error messages
|
||||
* \else
|
||||
* @brief 删除流配置
|
||||
*
|
||||
* @param[in] profile 流配置对象
|
||||
* @param[out] error 记录错误信息
|
||||
* \endif
|
||||
*/
|
||||
void ob_delete_stream_profile(ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Version.h
|
||||
* @brief Get the SDK version number information function
|
||||
* \else
|
||||
* @file Version.h
|
||||
* @brief 获取SDK版本号相关信息函数
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK version
|
||||
*
|
||||
* @return int returns the SDK version
|
||||
* \else
|
||||
* @brief 获取SDK版本号
|
||||
*
|
||||
* @return int 返回SDK版本号
|
||||
* \endif
|
||||
*/
|
||||
int ob_get_version();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK major version
|
||||
*
|
||||
* @return int returns the SDK major version
|
||||
* \else
|
||||
* @brief 获取SDK主版本号
|
||||
*
|
||||
* @return int 返回SDK主版本号
|
||||
* \endif
|
||||
*/
|
||||
int ob_get_major_version();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK minor version
|
||||
*
|
||||
* @return int returns the SDK minor version
|
||||
* \else
|
||||
* @brief 获取SDK副版本号
|
||||
*
|
||||
* @return int 返回SDK副版本号
|
||||
* \endif
|
||||
*/
|
||||
int ob_get_minor_version();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK patch version
|
||||
*
|
||||
* @return int returns the SDK patch version
|
||||
* \else
|
||||
* @brief 获取SDK修订版本号
|
||||
*
|
||||
* @return int 返回SDK修订版本号
|
||||
* \endif
|
||||
*/
|
||||
int ob_get_patch_version();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Context.hpp
|
||||
* @brief The SDK context class, the entry to the underlying SDK, is used to query device lists,handle device callbacks,set the level of the log
|
||||
* \else
|
||||
* @file Context.hpp
|
||||
* @brief SDK上下文环境类,底层SDK的入口,用于获取设备列表,处理设备的回调,日志等级的设置操作
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct ContextImpl;
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
class DeviceInfo;
|
||||
class DeviceList;
|
||||
|
||||
class OB_EXTENSION_API Context {
|
||||
private:
|
||||
std::unique_ptr<ContextImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Context is a management class that describes the runtime of the SDK. It is responsible for the applying and releasing of resources for the SDK.
|
||||
* The context has the ability to manage multiple devices, is responsible for enumerating devices, monitoring device callbacks, and enabling functions such as multi-device synchronization.
|
||||
* \else
|
||||
* @brief context是描述SDK的runtime一个管理类,负责SDK的资源申请与释放
|
||||
* context具备多设备的管理能力,负责枚举设备,监听设备回调,启用多设备同步等功能
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
Context(const char *configPath = "");
|
||||
virtual ~Context() noexcept;
|
||||
|
||||
/**
|
||||
*\if English
|
||||
* @brief Query enumerated device list
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList> returns a pointer to the device list class
|
||||
* \else
|
||||
* @brief 获取枚举到设备列表
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList>返回设备列表类的指针
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceList> queryDeviceList();
|
||||
|
||||
using DeviceChangedCallback = std::function<void(std::shared_ptr<DeviceList> removedList, std::shared_ptr<DeviceList> addedList)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set device plug-in callback function
|
||||
*
|
||||
* @param callback function triggered when the device is plugged and unplugged
|
||||
* \else
|
||||
* @brief 设置设备插拔回调函数
|
||||
*
|
||||
* @param callback 设备插拔时触发的回调函数
|
||||
* \endif
|
||||
*/
|
||||
void setDeviceChangedCallback(DeviceChangedCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Activate the multi-device synchronization function to synchronize the clock of the created device(the device needs support this function)
|
||||
*
|
||||
* @param repeatInterval synchronization time interval (unit: ms; if repeatInterval=0, it means that it will only be synchronized once and will not be executed regularly)
|
||||
* \else
|
||||
* @brief 启动多设备同步功能,同步已创建设备的时钟(需要使用的设备支持该功能)
|
||||
*
|
||||
* @param repeatInterval 定时同步时间间隔(单位ms;如果repeatInterval=0,表示只同步一次,不再定时执行)
|
||||
* \endif
|
||||
*/
|
||||
void enableMultiDeviceSync(uint64_t repeatInterval);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the level of the global log will affect both the log level output to the terminal and output to the file
|
||||
*
|
||||
* @param severity log output level
|
||||
* \else
|
||||
* @brief 设置全局日志的等级,会同时作用于输出到终端和输出到文件的日志等级
|
||||
*
|
||||
* @param severity 日志输出等级
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerSeverity(OBLogSeverity severity);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set log output to file
|
||||
*
|
||||
* @param severity log level output to file
|
||||
* @param 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)
|
||||
* \else
|
||||
* @brief 设置日志输出到文件
|
||||
*
|
||||
* @param severity 输出到文件的日志等级
|
||||
* @param directory 日志文件输出路径,如果路径为空,则继续使用已有设置(已有配置也为空则不输出日志到文件)
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerToFile(OBLogSeverity severity, const char *directory);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set log output to terminal
|
||||
*
|
||||
* @param severity log level output to the terminal
|
||||
* \else
|
||||
* @brief 设置日志输出到终端
|
||||
*
|
||||
* @param severity 输出到终端的日志等级
|
||||
* \endif
|
||||
*/
|
||||
static void setLoggerToConsole(OBLogSeverity severity);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,923 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Device.hpp
|
||||
* @brief Device related types, including operations such as getting and creating a device, setting and obtaining device attributes, and obtaining sensors
|
||||
* \else
|
||||
* @file Device.hpp
|
||||
* @brief 设备相关类型,包括获取创建设备,设置及获取设备属性,获取传感器等操作
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Types.hpp"
|
||||
|
||||
#include "libobsensor/h/Property.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
struct DeviceImpl;
|
||||
struct DeviceInfoImpl;
|
||||
struct DeviceListImpl;
|
||||
struct CameraParamListImpl;
|
||||
|
||||
namespace ob {
|
||||
class SensorList;
|
||||
class Context;
|
||||
class DeviceInfo;
|
||||
class Sensor;
|
||||
class CameraParamList;
|
||||
|
||||
class OB_EXTENSION_API Device {
|
||||
private:
|
||||
std::unique_ptr<DeviceImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Describe the entity of the RGBD camera, representing a specific model of RGBD camera
|
||||
* \else
|
||||
* @brief 描述RGBD相机的实体,代表一个具体型号的RGBD相机
|
||||
* \endif
|
||||
*/
|
||||
Device(std::unique_ptr<DeviceImpl> impl);
|
||||
virtual ~Device() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device information
|
||||
*
|
||||
* @return std::shared_ptr<DeviceInfo> returns device information
|
||||
* \else
|
||||
* @brief 获取设备信息
|
||||
*
|
||||
* @return std::shared_ptr<DeviceInfo> 返回设备的信息
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceInfo> getDeviceInfo();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device sensor list
|
||||
*
|
||||
* @return std::shared_ptr<SensorList> returns the sensor list
|
||||
* \else
|
||||
* @brief 获取设备传感器列表
|
||||
*
|
||||
* @return std::shared_ptr<SensorList> 返回传感器列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<SensorList> getSensorList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get specific type of sensor
|
||||
* if device not open, SDK will automatically open the connected device and return to the instance
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> eturns the sensor example, if the device does not have the device,returns nullptr
|
||||
* \else
|
||||
* @brief 获取指定类型传感器
|
||||
* 如果设备没有打开传感器,在SDK内部会自动打开设备并返回实例
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> 返回传感器示例,如果设备没有该设备,返回nullptr
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType type);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set int type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置int类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setIntProperty(OBPropertyID propertyId, int32_t property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set float type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置float类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setFloatProperty(OBPropertyID propertyId, float property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set bool type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param property Property to be set
|
||||
* \else
|
||||
* @brief 设置bool类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param property 要设置的属性
|
||||
* \endif
|
||||
*/
|
||||
void setBoolProperty(OBPropertyID propertyId, bool property);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get int type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return int32_t Property to get
|
||||
* \else
|
||||
* @brief 获取int类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return int32_t 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
int32_t getIntProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get float type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return float Property to get
|
||||
* \else
|
||||
* @brief 获取float类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return float 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
float getFloatProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get bool type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return bool Property to get
|
||||
* \else
|
||||
* @brief 获取bool类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return bool 获取的属性数据
|
||||
* \endif
|
||||
*/
|
||||
bool getBoolProperty(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get int type device property range (ncluding current valueand default value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBIntPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取int类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBIntPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBIntPropertyRange getIntPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get float type device property range((including current valueand default value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBFloatPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取float类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBFloatPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBFloatPropertyRange getFloatPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get bool type device property range (including current value anddefault value)
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @return OBBoolPropertyRange Property range
|
||||
* \else
|
||||
* @brief 获取bool类型的设备属性的范围(包括当前值和默认值)
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @return OBBoolPropertyRange 属性的范围
|
||||
* \endif
|
||||
*/
|
||||
OBBoolPropertyRange getBoolPropertyRange(OBPropertyID propertyId);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief AHB register write
|
||||
*
|
||||
* @param reg Register to be written
|
||||
* @param mask The mask to be writen
|
||||
* @param value The value to be written
|
||||
* \else
|
||||
* @brief AHB写寄存器
|
||||
*
|
||||
* @param reg 要写入的寄存器
|
||||
* @param mask 要写入的掩码
|
||||
* @param value 要写入的值
|
||||
* \endif
|
||||
*/
|
||||
void writeAHB(uint32_t reg, uint32_t mask, uint32_t value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief AHB AHB register read
|
||||
*
|
||||
* @param reg Register to be read
|
||||
* @param mask The mask to be read
|
||||
* @param value The value to be returned
|
||||
* \else
|
||||
* @brief AHB读寄存器
|
||||
*
|
||||
* @param reg 要读取的寄存器
|
||||
* @param mask 要读取的掩码
|
||||
* @param value 读取的值返回
|
||||
* \endif
|
||||
*/
|
||||
void readAHB(uint32_t reg, uint32_t mask, uint32_t *value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief I2C register write
|
||||
*
|
||||
* @param reg I2C module ID to be written
|
||||
* @param reg Register to be written
|
||||
* @param mask The mask to be written
|
||||
* @param value he value to be written
|
||||
* \else
|
||||
* @brief I2C写寄存器
|
||||
*
|
||||
* @param reg 要写入的I2C模块ID
|
||||
* @param reg 要写入的寄存器
|
||||
* @param mask 要写入的掩码
|
||||
* @param value 要写入的值
|
||||
* \endif
|
||||
*/
|
||||
void writeI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief I2C registers read
|
||||
*
|
||||
* @param reg I2C module ID to be read
|
||||
* @param reg Register to be read
|
||||
* @param mask The mask to be read
|
||||
* @param value The value to be returned
|
||||
* \else
|
||||
* @brief I2C读寄存器
|
||||
*
|
||||
* @param reg 要读取的I2C模块ID
|
||||
* @param reg 要读取的寄存器
|
||||
* @param mask 要读取的掩码
|
||||
* @param value 读取的值返回
|
||||
* \endif
|
||||
*/
|
||||
void readI2C(uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t *value);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the properties of writing to Flash
|
||||
*
|
||||
* @param offset flash offset address
|
||||
* @param data Property data to be written
|
||||
* @param dataSize The size of the property to be written
|
||||
* @param callback Write flash progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 设置写入Flash的属性
|
||||
*
|
||||
* @param offset flash 偏移地址
|
||||
* @param data 要写入的属性数据
|
||||
* @param dataSize 要写入的属性大小
|
||||
* @param callback 写flash进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void writeFlash(uint32_t offset, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Read Flash property
|
||||
*
|
||||
* @param offset flash offset address
|
||||
* @param data Property data to be read
|
||||
* @param dataSize The size of the property to get
|
||||
* @param callback Read data returned by flash and progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 读取Flash的属性
|
||||
*
|
||||
* @param offset flash 偏移地址
|
||||
* @param data 读取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* @param callback 读flash返回的数据及进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void readFlash(uint32_t offset, uint32_t dataSize, GetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set raw data type of device property [Asynchronous callback]
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data to be set
|
||||
* @param dataSize The size of the property data to be set
|
||||
* @param callback rawdata set progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 设置raw data类型的设备属性数据[异步回调]
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 要设置的属性数据
|
||||
* @param dataSize 要设置的属性数据大小
|
||||
* @param callback rawdata设置进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void setRawData(OBPropertyID propertyId, const void *data, uint32_t dataSize, SetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get raw data type of device property [Asynchronous callback]
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data obtained
|
||||
* @param dataSize Get the size of the property
|
||||
* @param callback Get the returned data and progress callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 获取raw data类型的设备属性数据[异步回调]
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 获取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* @param callback 获取返回的数据及进度回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void getRawData(OBPropertyID propertyId, GetDataCallback callback, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set structured data type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data to be set
|
||||
* @param dataSize The size of the attribute to be set
|
||||
* \else
|
||||
* @brief 设置structured data类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 要设置的属性数据
|
||||
* @param dataSize 要设置的属性大小
|
||||
* \endif
|
||||
*/
|
||||
void setStructuredData(OBPropertyID propertyId, const void *data, uint32_t dataSize);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get structured data type of device property
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param data Property data obtained
|
||||
* @param dataSize Get the size of the attribute
|
||||
* \else
|
||||
* @brief 获取structured data类型的设备属性
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param data 获取的属性数据
|
||||
* @param dataSize 获取的属性大小
|
||||
* \endif
|
||||
*/
|
||||
void getStructuredData(OBPropertyID propertyId, void *data, uint32_t *dataSize);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get number of devices supported property
|
||||
*
|
||||
* @return uint32_t returns the number of supported attributes
|
||||
* \else
|
||||
* @brief 获取设备支持的属性的数量
|
||||
*
|
||||
* @return uint32_t 返回支持的属性的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t getSupportedPropertyCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device supported properties
|
||||
*
|
||||
* @param uint32_t Property index
|
||||
* @return OBPropertyItem returns the type of supported properties
|
||||
* \else
|
||||
* @brief 获取设备支持的属性
|
||||
*
|
||||
* @param uint32_t 属性的index
|
||||
* @return OBPropertyItem 返回支持的属性的类型
|
||||
* \endif
|
||||
*/
|
||||
OBPropertyItem getSupportedProperty(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Judge property permission support
|
||||
*
|
||||
* @param propertyId Property id
|
||||
* @param permission Types of read and write permissions that need to be interpreted
|
||||
* @return bool returns whether it is supported
|
||||
* \else
|
||||
* @brief 判断属性权限支持情况
|
||||
*
|
||||
* @param propertyId 属性id
|
||||
* @param permission 需要判读的读写权限类型
|
||||
* @return bool 返回是否支持
|
||||
* \endif
|
||||
*/
|
||||
bool isPropertySupported(OBPropertyID propertyId, OBPermissionType permission);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Synchronize device time (synchronize local systemtime to device)
|
||||
* @return uint64_t command (round trip time, rtt)
|
||||
* \else
|
||||
* @brief 同步设备时间(向设备授时,同步本地系统时间到设备)
|
||||
* @return uint64_t 命令往返时间延时(round trip time, rtt)
|
||||
* \endif
|
||||
*/
|
||||
uint64_t syncDeviceTime();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Upgrade the device firmware
|
||||
*
|
||||
* @param filePath Firmware path
|
||||
* @param callback Firmware upgrade progress and status callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 升级设备固件
|
||||
*
|
||||
* @param filePath 固件的路径
|
||||
* @param callback 固件升级进度及状态回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void deviceUpgrade(const char *filePath, DeviceUpgradeCallback callback, bool async = true);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Send files to the specified path on the device side [Asynchronouscallback]
|
||||
*
|
||||
* @param filePath Original file path
|
||||
* @param dstPath Accept the save path on the device side
|
||||
* @param callback File transfer callback
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 发送文件到设备端指定路径[异步回调]
|
||||
*
|
||||
* @param filePath 原文件路径
|
||||
* @param dstPath 设备端接受保存路径
|
||||
* @param callback 文件传输回调
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void sendFile(const char *filePath, const char *dstPath, SendFileCallback callback, bool async = true);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the current state
|
||||
* @return OBDeviceState device state information
|
||||
* \else
|
||||
* @brief 获取当前设备状态
|
||||
* @return OBDeviceState 设备状态信息
|
||||
* \endif
|
||||
*/
|
||||
OBDeviceState getDeviceState();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the device state changed callbacks
|
||||
*
|
||||
* @param callback The callback function that is triggered when the device status changes (for example, the frame rate is automatically reduced or the stream is closed due to high temperature, etc.)
|
||||
* \else
|
||||
* @brief 设置设备状态改变回调函数
|
||||
*
|
||||
* @param callback 设备状态改变(如,由于温度过高自动降低帧率或关流等)时触发的回调函数
|
||||
* \endif
|
||||
*/
|
||||
void setDeviceStateChangedCallback(DeviceStateChangedCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Verify device authorization code
|
||||
* @param authCode Authorization code
|
||||
* @return bool whether the activation is successfu
|
||||
* \else
|
||||
* @brief 验证设备授权码
|
||||
* @param authCode 授权码
|
||||
* @return bool 激活是否成功
|
||||
* \endif
|
||||
*/
|
||||
bool activateAuthorization(const char *authCode);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Write authorization code
|
||||
* @param authCode Authorization code
|
||||
* \else
|
||||
* @brief 写入设备授权码
|
||||
* @param authCode 授权码
|
||||
* \endif
|
||||
*/
|
||||
void writeAuthorizationCode(const char *authCodeStr);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the original parameter list of camera calibration saved in the device. The parameters in the list do not correspond to the current open-current 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 Pipeline::getCameraParam() interface.
|
||||
*
|
||||
* @return std::shared_ptr<CameraParamList> camera parameter list
|
||||
* \else
|
||||
* @brief 获取设备内保存的相机标定的原始参数列表,列表内参数不与当前开流配置相对应,
|
||||
* 需要自行根据实际情况选用参数并可能需要做缩放、镜像等处理。非专业用户建议使用Pipeline::getCameraParam()接口。
|
||||
*
|
||||
* @return std::shared_ptr<CameraParamList> 相机参数列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<CameraParamList> getCalibrationCameraParamList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Device restart
|
||||
* @attention The device will be disconnected and reconnected. After the device is disconnected, the access to the Device object interface may be abnormal.
|
||||
* Please delete the object directly and obtain it again after the device is reconnected.
|
||||
* \else
|
||||
* @brief 设备重启
|
||||
* @attention 设备会掉线重连,设备掉线后对Device对象接口访问可能会发生异常,请直接删除该对象,
|
||||
* 待设备重连后可重新获取。
|
||||
* \endif
|
||||
*/
|
||||
void reboot();
|
||||
|
||||
friend class Pipeline;
|
||||
friend class Recorder;
|
||||
};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief A class describing device information, representing the name, id, serial number and other basic information of an RGBD camera.
|
||||
* \else
|
||||
* @brief 描述设备信息的类,代表一个RGBD相机的名称,id,序列号等其他设备自身基本信息。
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
class OB_EXTENSION_API DeviceInfo {
|
||||
private:
|
||||
std::unique_ptr<DeviceInfoImpl> impl_;
|
||||
|
||||
public:
|
||||
DeviceInfo(std::unique_ptr<DeviceInfoImpl> impl);
|
||||
virtual ~DeviceInfo() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device name
|
||||
*
|
||||
* @return const char * returns the device name
|
||||
* \else
|
||||
* @brief 获取设备名称
|
||||
*
|
||||
* @return const char * 返回设备名称
|
||||
* \endif
|
||||
*/
|
||||
const char *name();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the pid of the device
|
||||
*
|
||||
* @return int returns the pid of the device
|
||||
* \else
|
||||
* @brief 获取设备的pid
|
||||
*
|
||||
* @return int 返回设备的pid
|
||||
* \endif
|
||||
*/
|
||||
int pid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the vid of the device
|
||||
*
|
||||
* @return int returns the vid of the device
|
||||
* \else
|
||||
* @brief 获取设备的vid
|
||||
*
|
||||
* @return int 返回设备的vid
|
||||
* \endif
|
||||
*/
|
||||
int vid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get system assigned uid for distinguishing between different devices
|
||||
*
|
||||
* @return const char * returns the uid of the device
|
||||
* \else
|
||||
* @brief 获取设备的uid,该uid标识设备接入os操作系统时,给当前设备分派的唯一id,用来区分不同的设备
|
||||
*
|
||||
* @return const char * 返回设备的uid
|
||||
* \endif
|
||||
*/
|
||||
const char *uid();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the serial number of the device
|
||||
*
|
||||
* @return const char * returns the serial number of the device
|
||||
* \else
|
||||
* @brief 获取设备的序列号
|
||||
*
|
||||
* @return const char * 返回设备的序列号
|
||||
* \endif
|
||||
*/
|
||||
const char *serialNumber();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the version number of the firmware
|
||||
*
|
||||
* @return const char* returns the version number of the firmware
|
||||
* \else
|
||||
* @brief 获取固件的版本号
|
||||
*
|
||||
* @return const char* 返回固件的版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *firmwareVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get usb connection type
|
||||
*
|
||||
* @return const char* returns usb connection type
|
||||
* \else
|
||||
* @brief 获取usb连接类型
|
||||
*
|
||||
* @return const char* 返回usb连接类型
|
||||
* \endif
|
||||
*/
|
||||
const char *usbType();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the version number of the hardware
|
||||
*
|
||||
* @return const char* returns the version number of the hardware
|
||||
* \else
|
||||
* @brief 获取硬件的版本号
|
||||
*
|
||||
* @return const char* 返回硬件的版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *hardwareVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the minimum version number of the SDK supported by the device
|
||||
*
|
||||
* @return const char* returns the minimum SDK version number supported by the device
|
||||
* \else
|
||||
* @brief 获取设备支持的SDK最小版本号
|
||||
*
|
||||
* @return const char* 返回设备支持的SDK最小版本号
|
||||
* \endif
|
||||
*/
|
||||
const char *supportedMinSdkVersion();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get chip type name
|
||||
*
|
||||
* @return const char* returns the chip type name
|
||||
* \else
|
||||
* @brief 获取芯片类型名称
|
||||
*
|
||||
* @return const char* 返回芯片类型名称
|
||||
* \endif
|
||||
*/
|
||||
const char *asicName();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device type
|
||||
*
|
||||
* @return OBDeviceType returns the device type
|
||||
* \else
|
||||
* @brief 获取设备类型
|
||||
*
|
||||
* @return OBDeviceType 返回设备类型
|
||||
* \endif
|
||||
*/
|
||||
OBDeviceType deviceType();
|
||||
|
||||
friend class Context;
|
||||
friend class DeviceList;
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API DeviceList {
|
||||
private:
|
||||
std::unique_ptr<DeviceListImpl> impl_;
|
||||
|
||||
public:
|
||||
DeviceList(std::unique_ptr<DeviceListImpl> impl);
|
||||
~DeviceList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device count
|
||||
*
|
||||
* @return uint32_t returns the number of devices
|
||||
* \else
|
||||
* @brief 获取设备数量
|
||||
*
|
||||
* @return uint32_t 返回设备的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t deviceCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the name of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the name of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的名称
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的名称
|
||||
* \endif
|
||||
*/
|
||||
const char *name(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the pid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the pid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的pid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的pid
|
||||
* \endif
|
||||
*/
|
||||
int pid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the vid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return int returns the vid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的vid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return int 返回设备的vid
|
||||
* \endif
|
||||
*/
|
||||
int vid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the uid of the specified device
|
||||
*
|
||||
* @param index Device index
|
||||
* @return const char * returns the uid of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的uid
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return const char * 返回设备的uid
|
||||
* \endif
|
||||
*/
|
||||
const char *uid(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the serial number of the specified device
|
||||
*
|
||||
* @param index device index
|
||||
* @return const char * returns the serial number of the device
|
||||
* \else
|
||||
* @brief 获取指定设备的序列号
|
||||
*
|
||||
* @param index 设备索引
|
||||
* @return const char * 返回设备的序列号
|
||||
* \endif
|
||||
*/
|
||||
const char *serialNumber(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param index index of the device to create
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象,
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param index 要创建设备的索引
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param serialNumber The serial number of the device to be created
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param serialNumber 要创建设备的序列号
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceBySN(const char *serialNumber);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the specified device object from the device list
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @param uid If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* @return std::shared_ptr<Device> If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
* \else
|
||||
* @brief 从设备列表中获取指定设备对象
|
||||
* @attention 如果设备有在其他地方被获取创建,重复获取将会抛异常
|
||||
* @param uid 要创建设备的uid
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceByUid(const char *uid);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API CameraParamList {
|
||||
private:
|
||||
std::unique_ptr<CameraParamListImpl> impl_;
|
||||
|
||||
public:
|
||||
CameraParamList(std::unique_ptr<CameraParamListImpl> impl);
|
||||
~CameraParamList() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Number of camera parameter groups
|
||||
*
|
||||
* @return uint32_t returns the number of camera parameter groups
|
||||
* \else
|
||||
* @brief 相机参数组数
|
||||
*
|
||||
* @return uint32_t 返回相机参数组数
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get camera parameters
|
||||
*
|
||||
* @param index parameter index
|
||||
* @return OBCameraParam returns the corresponding group parameters
|
||||
* \else
|
||||
* @brief 获取相机参数
|
||||
*
|
||||
* @param index 参数索引
|
||||
* @return OBCameraParam 返回对应组参数
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam(uint32_t index);
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Error.hpp
|
||||
* @brief Error describes the abnormal error within the SDK, and the detailed information of the exception can be realized through this class.
|
||||
* \else
|
||||
* @file Error.hpp
|
||||
* @brief Error描述SDK内部的异常错误,通过该类可以实现异常的详细信息。
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <memory>
|
||||
|
||||
struct ErrorImpl;
|
||||
|
||||
namespace ob {
|
||||
class OB_EXTENSION_API Error {
|
||||
private:
|
||||
std::unique_ptr<ErrorImpl> impl_;
|
||||
|
||||
public:
|
||||
Error(std::unique_ptr<ErrorImpl> impl) noexcept;
|
||||
|
||||
Error(const Error &error) noexcept;
|
||||
|
||||
~Error() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Obtain detailed error logs of SDK internal exceptions.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的详细错误日志。
|
||||
* \endif
|
||||
*/
|
||||
const char *getMessage() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the exception type of the error, and determine which module is abnormal.
|
||||
* @return OBExceptionType
|
||||
* \else
|
||||
* @brief 获取该错误的异常类型,判断是具体哪个模块异常。
|
||||
* @return OBExceptionType
|
||||
*/
|
||||
OBExceptionType getExceptionType() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the name of the error function.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的错误接口函数名称。
|
||||
* \endif
|
||||
*/
|
||||
const char *getName() const noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the parameter passed in to the error interface.
|
||||
* \else
|
||||
* @brief 获取SDK内部异常的错误接口函数传入参数。
|
||||
* \endif
|
||||
*/
|
||||
const char *getArgs() const noexcept;
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Filter.hpp
|
||||
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
|
||||
* \else
|
||||
* @file Filter.hpp
|
||||
* @brief SDK的处理单元,可以进行点云的生成,格式转换等功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Frame;
|
||||
|
||||
typedef std::function<void(std::shared_ptr<Frame>)> FilterCallback;
|
||||
|
||||
class OB_EXTENSION_API Filter {
|
||||
public:
|
||||
Filter();
|
||||
|
||||
virtual ~Filter() = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief filter reset, free the internal cache, stop the processing thread and clear the pending buffer frame when asynchronous processing
|
||||
* \else
|
||||
* @brief filter重置,释放内部缓存,异步处理时停止处理线程并清空待处理的缓存帧
|
||||
* \endif
|
||||
*/
|
||||
virtual void reset();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Processing frames (synchronous interface)
|
||||
*
|
||||
* @param frame frame to be processed
|
||||
* @return std::shared_ptr< Frame > processed frame
|
||||
* \else
|
||||
* @brief 处理帧(同步接口)
|
||||
*
|
||||
* @param frame 需要处理的frame
|
||||
* @return std::shared_ptr< Frame > 处理后的frame
|
||||
* \endif
|
||||
*/
|
||||
virtual std::shared_ptr<Frame> process(std::shared_ptr<Frame> frame);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Push the pending frame into the cache (asynchronous callback interface)
|
||||
*
|
||||
* @param frame The pending frame processing result is returned by the callback function
|
||||
* \else
|
||||
* @brief 压入待处理frame到缓存(异步回调接口)
|
||||
*
|
||||
* @param frame 待处理的frame处理结果通过回调函数返回
|
||||
* \endif
|
||||
*/
|
||||
|
||||
virtual void pushFrame(std::shared_ptr<Frame> frame);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the callback function (asynchronous callback interface)
|
||||
*
|
||||
* @param callback Processing result callback
|
||||
* \else
|
||||
* @brief 设置回调函数(异步回调接口)
|
||||
*
|
||||
* @param callback 处理结果回调
|
||||
* \endif
|
||||
*/
|
||||
virtual void setCallBack(FilterCallback callback);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<FilterImpl> impl_;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API PointCloudFilter : public Filter {
|
||||
public:
|
||||
PointCloudFilter();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set point cloud type parameters
|
||||
*
|
||||
* @param type Point cloud type depth point cloud or RGBD point cloud
|
||||
* \else
|
||||
* @brief 设置点云类型参数
|
||||
*
|
||||
* @param type 点云类型 深度点云或RGBD点云
|
||||
* \endif
|
||||
*/
|
||||
void setCreatePointFormat(OBFormat type);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set camera parameters
|
||||
*
|
||||
* @param param Camera internal and external parameters
|
||||
* \else
|
||||
* @brief 设置相机参数
|
||||
*
|
||||
* @param param 相机内外参数
|
||||
* \endif
|
||||
*/
|
||||
void setCameraParam(OBCameraParam param);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the frame alignment state that will be input to generate point cloud (it needs to be enabled in D2C mode, as the basis for the algorithm to select the set of camera internal parameters)
|
||||
*
|
||||
* @param state Alignment status, True: enable alignment; False: disable alignment
|
||||
* \else
|
||||
* @brief 设置将要输入的用于生成点云的帧对齐状态(D2C模式下需要开启,作为算法选用那组相机内参的依据)
|
||||
*
|
||||
* @param state 对齐状态,True:开启对齐; False:关闭对齐
|
||||
* \endif
|
||||
*/
|
||||
void setFrameAlignState(bool state);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API FormatConvertFilter : public Filter {
|
||||
public:
|
||||
FormatConvertFilter();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set format conversion type
|
||||
*
|
||||
* @param type Format conversion type
|
||||
* \else
|
||||
* @brief 设置格式转化类型
|
||||
*
|
||||
* @param type 格式转化类型
|
||||
* \endif
|
||||
*/
|
||||
void setFormatConvertType(OBConvertFormat type);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,483 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Frame.hpp
|
||||
* @brief Frame related type, which is mainly used to obtain frame data and frame information.
|
||||
* \else
|
||||
* @file Frame.hpp
|
||||
* @brief 帧相关类型,主要用于获取帧数据及帧的信息
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
|
||||
/**
|
||||
* Frame类继承关系:
|
||||
* Frame
|
||||
* |
|
||||
* +------+----------+----------+-----------+
|
||||
* | | | | |
|
||||
* VideoFrame PointFrame AccelFrame GyroFrame FrameSet
|
||||
* |
|
||||
* +--+------+---------+
|
||||
* | | |
|
||||
* ColorFrame DepthFrame IRFrame
|
||||
*
|
||||
*/
|
||||
|
||||
struct FrameImpl;
|
||||
|
||||
namespace ob {
|
||||
class StreamProfile;
|
||||
class Filter;
|
||||
|
||||
class OB_EXTENSION_API Frame : public std::enable_shared_from_this<Frame> {
|
||||
protected:
|
||||
std::unique_ptr<FrameImpl> impl_;
|
||||
|
||||
public:
|
||||
Frame(std::unique_ptr<FrameImpl> impl);
|
||||
Frame(Frame &frame);
|
||||
|
||||
virtual ~Frame() noexcept;
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of frame
|
||||
*
|
||||
* @return OBFrameType returns the type of frame
|
||||
* \else
|
||||
* @brief 获取帧的类型
|
||||
*
|
||||
* @return OBFrameType 返回帧的类型
|
||||
* \endif
|
||||
*/
|
||||
virtual OBFrameType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the format of the frame
|
||||
*
|
||||
* @return OBFormat returns the format of the frame
|
||||
* \else
|
||||
* @brief 获取帧的格式
|
||||
*
|
||||
* @return OBFormat 返回帧的格式
|
||||
* \endif
|
||||
*/
|
||||
virtual OBFormat format();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the sequence number of the frame
|
||||
*
|
||||
* @return uint64_t returns the sequence number of the frame
|
||||
* \else
|
||||
* @brief 获取帧的序号
|
||||
*
|
||||
* @return uint64_t 返回帧的序号
|
||||
* \endif
|
||||
*/
|
||||
virtual uint64_t index();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame data
|
||||
*
|
||||
* @return void* returns frame data
|
||||
* \else
|
||||
* @brief 获取帧数据
|
||||
*
|
||||
* @return void* 返回帧数据
|
||||
* \endif
|
||||
*/
|
||||
virtual void *data();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the frame data size
|
||||
*
|
||||
* @return uint32_t returns the frame data size
|
||||
* If it is point cloud data, it returns the number of bytes occupied by all point sets. If you need to find the number of points, you need to divide the dataSize by the structure size of the corresponding point type.
|
||||
* \else
|
||||
* @brief 获取帧数据大小
|
||||
*
|
||||
* @return uint32_t 返回帧数据的大小
|
||||
* 如果是点云数据返回的是所有点集合占的字节数,若需要求出点的个数需要将dataSize除以对应的点类型的结构体大小
|
||||
* \endif
|
||||
*/
|
||||
virtual uint32_t dataSize();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the hardware timestamp of the frame
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware
|
||||
* \else
|
||||
* @brief 获取帧的硬件时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧硬件的时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t timeStamp();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the hardware timestamp of the frame us
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware, unit us
|
||||
* \else
|
||||
* @brief 获取帧的硬件时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧硬件的时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t timeStampUs();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame system timestamp
|
||||
*
|
||||
* @return uint64_t returns the time stamp of the frame hardware
|
||||
* \else
|
||||
* @brief 获取帧的系统时间戳
|
||||
*
|
||||
* @return uint64_t 返回帧的系统时间戳
|
||||
* \endif
|
||||
*/
|
||||
uint64_t systemTimeStamp();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Check if the runtime type of the frame object is compatible with a given type
|
||||
*
|
||||
* @tparam T Given type
|
||||
* @return bool returns result
|
||||
* \else
|
||||
* @brief 检查帧对象的运行时类型是否与给定类型兼容
|
||||
*
|
||||
* @tparam T 给定的类型
|
||||
* @return bool 返回结果
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> bool is();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Frame object type conversion
|
||||
*
|
||||
* @tparam T Target type
|
||||
* @return std::shared_ptr<T> returns the result, if it cannot be converted, an exception will be thrown
|
||||
* \else
|
||||
* @brief 帧对象类型转换
|
||||
*
|
||||
* @tparam T 目标类型
|
||||
* @return std::shared_ptr<T> 返回结果, 如果不能够转换,将抛异常
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>())
|
||||
throw "unsupported operation, object's type is not require type";
|
||||
|
||||
return std::static_pointer_cast<T>(std::const_pointer_cast<Frame>(shared_from_this()));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Filter;
|
||||
friend class Recorder;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API VideoFrame : public Frame {
|
||||
public:
|
||||
VideoFrame(Frame &frame);
|
||||
virtual ~VideoFrame() noexcept {};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame width
|
||||
*
|
||||
* @return uint32_t returns the width of the frame
|
||||
* \else
|
||||
* @brief 获取帧的宽
|
||||
*
|
||||
* @return uint32_t 返回帧的宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t width();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame height
|
||||
*
|
||||
* @return uint32_t returns the height of the frame
|
||||
* \else
|
||||
* @brief 获取帧的高
|
||||
*
|
||||
* @return uint32_t 返回帧的高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t height();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the metadata of the frame
|
||||
*
|
||||
* @return void* returns the metadata of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据
|
||||
*
|
||||
* @return void* 返回帧的元数据
|
||||
* \endif
|
||||
*/
|
||||
void *metadata();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the metadata size of the frame
|
||||
*
|
||||
* @return uint32_t returns the metadata size of the frame
|
||||
* \else
|
||||
* @brief 获取帧的元数据大小
|
||||
*
|
||||
* @return uint32_t 返回帧的元数据大小
|
||||
* \endif
|
||||
*/
|
||||
uint32_t metadataSize();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are valid bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @return uint8_t returns the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
* \else
|
||||
* @brief 获取像素有效位数(如Y16格式帧,每个像素占16bit,但实际只有低10位是有效位,高6位填充0)
|
||||
* @attention 仅对Y8/Y10/Y11/Y12/Y14/Y16格式有效
|
||||
*
|
||||
* @return uint8_t 返回像素有效位数,如果是不支持的格式,返回0
|
||||
* \endif
|
||||
*/
|
||||
uint8_t pixelAvailableBitSize();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API ColorFrame : public VideoFrame {
|
||||
public:
|
||||
ColorFrame(Frame &frame);
|
||||
~ColorFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API DepthFrame : public VideoFrame {
|
||||
public:
|
||||
DepthFrame(Frame &frame);
|
||||
~DepthFrame() noexcept {};
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the value scale of the depth frame, the unit is mm/step,
|
||||
* such as valueScale=0.1, and a certain coordinate pixel value is pixelValue=10000,
|
||||
* then the depth value value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @return float
|
||||
* \else
|
||||
* @brief 获取深度帧的值刻度,单位为 mm/step,
|
||||
* 如valueScale=0.1, 某坐标像素值为pixelValue=10000,
|
||||
* 则表示深度值value = pixelValue*valueScale = 10000*0.1=1000mm。
|
||||
*
|
||||
* @return float
|
||||
* \endif
|
||||
*/
|
||||
float getValueScale();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API IRFrame : public VideoFrame {
|
||||
public:
|
||||
IRFrame(Frame &frame);
|
||||
virtual ~IRFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API PointsFrame : public Frame {
|
||||
public:
|
||||
PointsFrame(Frame &frame);
|
||||
~PointsFrame() noexcept {};
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API FrameSet : public Frame {
|
||||
|
||||
public:
|
||||
// FrameSet();
|
||||
FrameSet(Frame &frame);
|
||||
~FrameSet() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame count
|
||||
*
|
||||
* @return uint32_t returns the number of frames
|
||||
* \else
|
||||
* @brief 帧集合中包含的帧数量
|
||||
*
|
||||
* @return uint32_t 返回帧的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t frameCount();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get depth frame
|
||||
*
|
||||
* @return std::shared_ptr<DepthFrame> returns the depth frame
|
||||
* \else
|
||||
* @brief 获取深度帧
|
||||
*
|
||||
* @return std::shared_ptr<DepthFrame> 返回深度帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DepthFrame> depthFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get color frame
|
||||
*
|
||||
* @return std::shared_ptr<ColorFrame> returns the color frame
|
||||
* \else
|
||||
* @brief 获取彩色帧
|
||||
*
|
||||
* @return std::shared_ptr<ColorFrame> 返回彩色帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<ColorFrame> colorFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get infrared frame
|
||||
*
|
||||
* @return std::shared_ptr<IRFrame> returns infrared frame
|
||||
* \else
|
||||
* @brief 获取红外帧
|
||||
*
|
||||
* @return std::shared_ptr<IRFrame> 返回红外帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<IRFrame> irFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get point cloud frame
|
||||
*
|
||||
* @return std::shared_ptr<PointsFrame> returns the point cloud data frame
|
||||
* \else
|
||||
* @brief 获取点云帧
|
||||
*
|
||||
* @return std::shared_ptr<PointsFrame> 返回点云帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<PointsFrame> pointsFrame();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get frame by sensor type
|
||||
*
|
||||
* @param frameType Type of sensor
|
||||
* @return std::shared_ptr<Frame> returns the corresponding type of frame
|
||||
* \else
|
||||
* @brief 通过传感器类型获取帧
|
||||
*
|
||||
* @param frameType 传感器的类型
|
||||
* @return std::shared_ptr<Frame> 返回相应类型的帧
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Frame> getFrame(OBSensorType sensorType);
|
||||
|
||||
friend class Pipeline;
|
||||
friend class Filter;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API AccelFrame : public Frame {
|
||||
public:
|
||||
AccelFrame(Frame &frame);
|
||||
~AccelFrame() noexcept = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Accelerometer frame data
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \else
|
||||
* @brief 获取加速度帧X数据
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \endif
|
||||
*/
|
||||
OBAccelValue value();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the temperature when the frame is sampled
|
||||
*
|
||||
* @return float temperature value
|
||||
* \else
|
||||
* @brief 获取帧采样时的温度
|
||||
*
|
||||
* @return float 温度值
|
||||
* \endif
|
||||
*/
|
||||
float temperature();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API GyroFrame : public Frame {
|
||||
public:
|
||||
GyroFrame(Frame &frame);
|
||||
~GyroFrame() noexcept = default;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get gyro frame data
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \else
|
||||
* @brief 获取陀螺仪帧数据
|
||||
*
|
||||
* @return OBAccelValue
|
||||
* \endif
|
||||
*/
|
||||
OBGyroValue value();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get temperature when the frame is sampled.
|
||||
*
|
||||
* @return float temperature value
|
||||
* \else
|
||||
* @brief 获取帧采样时的温度
|
||||
*
|
||||
* @return float 温度值
|
||||
* \endif
|
||||
*/
|
||||
float temperature();
|
||||
};
|
||||
|
||||
template <typename T> bool Frame::is() {
|
||||
switch(this->type()) {
|
||||
case OB_FRAME_IR:
|
||||
return (typeid(T) == typeid(IRFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_DEPTH:
|
||||
return (typeid(T) == typeid(DepthFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_COLOR:
|
||||
return (typeid(T) == typeid(ColorFrame) || typeid(T) == typeid(VideoFrame));
|
||||
case OB_FRAME_GYRO:
|
||||
return (typeid(T) == typeid(GyroFrame));
|
||||
case OB_FRAME_ACCEL:
|
||||
return (typeid(T) == typeid(AccelFrame));
|
||||
case OB_FRAME_SET:
|
||||
return (typeid(T) == typeid(FrameSet));
|
||||
case OB_FRAME_POINTS:
|
||||
return (typeid(T) == typeid(PointsFrame));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,349 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Pipeline.hpp
|
||||
* @brief The SDK's advanced API type can quickly implement switching streaming, frame synchronization, software filtering, and generating point cloud operations.
|
||||
* \else
|
||||
* @file Pipeline.hpp
|
||||
* @brief SDK的高级API类型,可以快速实现开关流,帧同步,软件滤波,生成点云等操作
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct PipelineImpl;
|
||||
struct ConfigImpl;
|
||||
|
||||
namespace ob {
|
||||
class FrameSet;
|
||||
class Frame;
|
||||
class Device;
|
||||
class Playback;
|
||||
class DeviceInfo;
|
||||
class Config;
|
||||
class StreamProfile;
|
||||
class StreamProfileList;
|
||||
|
||||
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
|
||||
|
||||
class OB_EXTENSION_API Pipeline {
|
||||
private:
|
||||
std::unique_ptr<PipelineImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @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.
|
||||
* \else
|
||||
* @brief Pipeline 是SDK的高级接口,适用于应用,算法等重点关注RGBD数据流常见,Pipeline在SDK内部可以提供对齐,同步后的FrameSet桢集合
|
||||
* 直接方便客户使用。
|
||||
* Pipeline()无参数版本,默认打开连接到OS的设备列表中的第一个设备。若应用已经通过DeviceList获取设备,此时打开Pipeline()会抛出设备已经创建异常。
|
||||
* 需要开发者捕获异常处理。
|
||||
* \endif
|
||||
*/
|
||||
Pipeline();
|
||||
/**
|
||||
* \if English
|
||||
* @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.
|
||||
* \else
|
||||
* @brief
|
||||
* Pipeline(std::shared_ptr< Device > device )函数,适用于多设备操作常见,此时需要通过DeviceList获取多个设备,通过该接口实现device和pipeline绑定。
|
||||
* \endif
|
||||
*/
|
||||
Pipeline(std::shared_ptr<Device> device);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a pipeline for playback of recorded stream files
|
||||
*
|
||||
* @param filename Playback file path
|
||||
* \else
|
||||
* @brief 创建pipeline用于回放录制好的流文件
|
||||
*
|
||||
* @param filename 回放文件路径
|
||||
* \endif
|
||||
*/
|
||||
Pipeline(const char *filename);
|
||||
~Pipeline() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param config Parameter configuration of pipeline
|
||||
* \else
|
||||
* @brief 启动pipeline并配置参数
|
||||
*
|
||||
* @param config pipeline的参数配置
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start the pipeline and set the frameset data callback
|
||||
*
|
||||
* @param config parameter configuration of pipeline
|
||||
* @param callback Set the callback to be triggered when all frame data in the frame set arrives
|
||||
* \else
|
||||
* @brief 启动pipeline并设置帧集合数据回调
|
||||
*
|
||||
* @param config pipeline的参数配置
|
||||
* @param callback 设置帧集合中的所有帧数据都到达时触发回调
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config, FrameSetCallback callback);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop pipeline
|
||||
* \else
|
||||
* @brief 停止pipeline
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get pipeline configuration parameters
|
||||
*
|
||||
* @return std::shared_ptr<Config> returns the configured parameters
|
||||
* \else
|
||||
* @brief 获取pipeline的配置参数
|
||||
*
|
||||
* @return std::shared_ptr<Config> 返回配置的参数
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Config> getConfig();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Waiting for frame set data
|
||||
*
|
||||
* @param timeout_ms Waiting timeout (ms)
|
||||
* @return std::shared_ptr<FrameSet> returns the waiting frame set data
|
||||
* \else
|
||||
* @brief 等待帧集合数据
|
||||
*
|
||||
* @param timeout_ms 等待超时时间(毫秒)
|
||||
* @return std::shared_ptr<FrameSet> 返回等待的帧集合数据
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<FrameSet> waitForFrames(uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get device object
|
||||
*
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
* \else
|
||||
* @brief 获取设备对象
|
||||
*
|
||||
* @return std::shared_ptr<Device> 返回设备对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get playback object
|
||||
*
|
||||
* @return std::shared_ptr<Playback> returns the playback object
|
||||
* \else
|
||||
* @brief 获取回放对象
|
||||
*
|
||||
* @return std::shared_ptr<Playback> 返回回放对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Playback> getPlayback();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the stream profile of specified sensor
|
||||
*
|
||||
* @param sensorType Type of sensor
|
||||
|
||||
* @return std::shared_ptr<StreamProfileList> returns the stream configuration list
|
||||
* \else
|
||||
* @brief 获取指定传感器的流配置
|
||||
*
|
||||
* @param sensorType 传感器的类型
|
||||
* @return std::shared_ptr<StreamProfileList> 返回流配置列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList(OBSensorType sensorType);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Turn on frame synchronization
|
||||
* \else
|
||||
* @brief 打开帧同步功能
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
void enableFrameSync();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Turn off frame synchronization
|
||||
* \else
|
||||
* @brief 关闭帧同步功能
|
||||
* \endif
|
||||
*/
|
||||
void disableFrameSync();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get camera parameters
|
||||
* @attention If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
|
||||
*
|
||||
* @return OBCameraParam returns camera parameters
|
||||
* \else
|
||||
* @brief 获取相机参数
|
||||
* @attention 如果开启了D2C将返回D2C后的相机参数,如果没有将返回默认参数
|
||||
*
|
||||
* @return OBCameraParam返回相机参数
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Return a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
|
||||
* @param colorProfile Input color sensor resolution
|
||||
* @param alignMode Input align mode
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> returns a list of depth sensor resolutions
|
||||
* \else
|
||||
* @brief 返回与输入的彩色传感器分辨率对应的支持D2C的深度传感器分辨率列表
|
||||
* @param colorProfile 输入的彩色传感器分辨率
|
||||
* @param alignMode 输入的对齐模式
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> 返回深度传感器分辨率列表
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getD2CDepthProfileList(std::shared_ptr<StreamProfile> colorProfile,OBAlignMode alignMode);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Valid area after getting D2C
|
||||
*
|
||||
* @param depthDistance working distance
|
||||
* @return OBRect returns the area information valid after D2C at the working distance
|
||||
* \else
|
||||
* @brief 获取D2C后有效的区域
|
||||
*
|
||||
* @param depthDistance 工作距离
|
||||
* @return OBRect 返回在工作距离下D2C后有效的区域信息
|
||||
* \endif
|
||||
*/
|
||||
OBRect getD2CValidArea(uint32_t depthDistance);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch the corresponding config configuration
|
||||
*
|
||||
* @param config Updated config configuration
|
||||
* \else
|
||||
* @brief 动态切换对应的config配置
|
||||
*
|
||||
* @param config 更新后的config配置
|
||||
* \endif
|
||||
*/
|
||||
void switchConfig(std::shared_ptr<Config> config);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief start recording
|
||||
*
|
||||
* @param filename Record file name
|
||||
* \else
|
||||
* @brief 开始录制
|
||||
*
|
||||
* @param filename 录制文件名
|
||||
* \endif
|
||||
*/
|
||||
void startRecord(const char *filename);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop recording
|
||||
* \else
|
||||
* @brief 停止录制
|
||||
* \endif
|
||||
*/
|
||||
void stopRecord();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API Config {
|
||||
private:
|
||||
std::unique_ptr<ConfigImpl> impl_;
|
||||
|
||||
public:
|
||||
Config();
|
||||
~Config() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be enabled
|
||||
*
|
||||
* @param streamProfile Stream configuration
|
||||
* \else
|
||||
* @brief 设置要打开的流配置
|
||||
*
|
||||
* @param streamProfile 流的配置
|
||||
* \endif
|
||||
*/
|
||||
void enableStream(std::shared_ptr<StreamProfile> streamProfile);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be enabled
|
||||
* \else
|
||||
* @brief 设置打开所有的流
|
||||
* \endif
|
||||
*/
|
||||
void enableAllStream();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure the stream to be disabled
|
||||
*
|
||||
* @param streamType Stream configuration
|
||||
* \else
|
||||
* @brief 设置要关闭的流配置
|
||||
*
|
||||
* @param streamType 流的配置
|
||||
* \endif
|
||||
*/
|
||||
void disableStream(OBStreamType streamType);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Configure all streams to be disabled
|
||||
* \else
|
||||
* @brief 设置关闭所有的流
|
||||
* \endif
|
||||
*/
|
||||
void disableAllStream();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set the alignment mode
|
||||
*
|
||||
* @param mode Align State Mode
|
||||
* \else
|
||||
* @brief 设置对齐模式
|
||||
*
|
||||
* @param mode 对齐状态模式
|
||||
* \endif
|
||||
*/
|
||||
void setAlignMode(OBAlignMode mode);
|
||||
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief For recording and playback functions
|
||||
* \else
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief 用于录制和回放功能
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include <memory>
|
||||
|
||||
struct RecorderImpl;
|
||||
struct PlaybackImpl;
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
class Frame;
|
||||
class DeviceInfo;
|
||||
|
||||
using PlaybackCallback = std::function<void(std::shared_ptr<Frame> frame, void *pCookies)>;
|
||||
using MediaStateCallback = std::function<void(OBMediaState state)>;
|
||||
|
||||
class OB_EXTENSION_API Recorder {
|
||||
private:
|
||||
std::unique_ptr<RecorderImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
* \endif
|
||||
*/
|
||||
Recorder();
|
||||
Recorder(std::unique_ptr<RecorderImpl> impl);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create a recorder for data recording
|
||||
* @param device Devices that need to record device information
|
||||
* \else
|
||||
* @brief 创建录制器用于数据的录制
|
||||
* @param device 需要录制设备信息的设备
|
||||
* \endif
|
||||
*/
|
||||
Recorder(std::shared_ptr<Device> device);
|
||||
|
||||
virtual ~Recorder() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Enable the recorder, throw an exception after failure
|
||||
*
|
||||
* @param filename Recorded file name
|
||||
* @param async Whether to execute asynchronously
|
||||
* \else
|
||||
* @brief 开启录制器,失败后抛出异常
|
||||
*
|
||||
* @param filename 录制的文件名称
|
||||
* @param async 是否异步执行
|
||||
* \endif
|
||||
*/
|
||||
void start(const char *filename, bool async = false);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop the recorder, throw an exception on failure
|
||||
* \else
|
||||
* @brief 停止录制器,失败后抛出异常
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Write frame data to the recorder
|
||||
*
|
||||
* @param frame Write frame data
|
||||
* \else
|
||||
* @brief 向录制器内写入帧数据
|
||||
*
|
||||
* @param frame 写入的帧数据
|
||||
* \endif
|
||||
*/
|
||||
void write(std::shared_ptr<Frame> frame);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API Playback {
|
||||
private:
|
||||
std::unique_ptr<PlaybackImpl> impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Create playback object
|
||||
* @param filename Playback filename
|
||||
* \else
|
||||
* @brief 创建回放对象
|
||||
* @param filename 回放的文件名
|
||||
* \endif
|
||||
*/
|
||||
Playback(const char *filename);
|
||||
Playback(std::unique_ptr<PlaybackImpl> impl);
|
||||
virtual ~Playback() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Start playback, the playback data is returned from the callback, and an exception is thrown after failure
|
||||
* @param filename Playback filename
|
||||
* @param callback Callback for playback data
|
||||
* @param type Type of playback data
|
||||
* \else
|
||||
* @brief 开启回放,回放数据从回调中返回,失败后抛出异常
|
||||
* @param filename 回放的文件名
|
||||
* @param callback 回放数据的回调
|
||||
* @param type 回放数据的类型
|
||||
* \endif
|
||||
*/
|
||||
void start(PlaybackCallback callback, OBMediaType type = OB_MEDIA_ALL);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop playback and throw an exception if it fails
|
||||
* \else
|
||||
* @brief 停止回放,失败后抛出异常
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Set playback state
|
||||
* @param state playback status callback
|
||||
* \else
|
||||
* @brief 设置回放状态
|
||||
* @param state 回放状态回调
|
||||
* \endif
|
||||
*/
|
||||
void setPlaybackStateCallback(MediaStateCallback state);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the device information in the recording file
|
||||
*
|
||||
* @return DeviceInfo returns device information
|
||||
* \else
|
||||
* @brief 获取录制文件内的设备信息
|
||||
*
|
||||
* @return DeviceInfo 返回的设备信息
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<DeviceInfo> getDeviceInfo();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the intrinsic and extrinsic parameter information in the recording file
|
||||
*
|
||||
* @return OBCameraParam returns internal and external parameter information
|
||||
* \else
|
||||
* @brief 获取录制文件内的内外参信息
|
||||
*
|
||||
* @return OBCameraParam 返回的内外参信息
|
||||
* \endif
|
||||
*/
|
||||
OBCameraParam getCameraParam();
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Sensor.hpp
|
||||
* @brief Sensor related types, used to obtain stream configuration, open and close streams, set and get sensor properties.
|
||||
* \else
|
||||
* @file Sensor.hpp
|
||||
* @brief 传感器相关类型,用于获取流配置,开关流,设置及获取传感器属性等操作
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
struct SensorImpl;
|
||||
struct SensorListImpl;
|
||||
|
||||
namespace ob {
|
||||
class StreamProfile;
|
||||
class StreamProfileList;
|
||||
class Device;
|
||||
class Frame;
|
||||
class ImuFrame;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief frame data callback
|
||||
*
|
||||
* @param frame frame data
|
||||
* \else
|
||||
* @brief 帧数据回调
|
||||
*
|
||||
* @param frame 帧数据
|
||||
* \endif
|
||||
*/
|
||||
using FrameCallback = std::function<void(std::shared_ptr<Frame> frame)>;
|
||||
|
||||
class OB_EXTENSION_API Sensor {
|
||||
protected:
|
||||
std::unique_ptr<SensorImpl> impl_;
|
||||
|
||||
public:
|
||||
Sensor(std::unique_ptr<SensorImpl> impl);
|
||||
virtual ~Sensor() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief sensor type
|
||||
*
|
||||
* @return OBSensorType returns the sensor type
|
||||
* \else
|
||||
* @brief 传感器类型
|
||||
*
|
||||
* @return OBSensorType 返回传感器类型
|
||||
* \endif
|
||||
*/
|
||||
OBSensorType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the list of stream profiles
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> returns the stream configuration list
|
||||
* \else
|
||||
* @brief 获取传感器的流配置列表
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> 返回流配置列表
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<StreamProfileList> getStreamProfileList();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Open frame data stream and set up a callback
|
||||
*
|
||||
* @param streamProfile Stream configuration
|
||||
* @param callback Set the callback when frame data arrives
|
||||
* \else
|
||||
* @brief 开启流并设置帧数据回调
|
||||
*
|
||||
* @param streamProfile 流的配置
|
||||
* @param callback 设置帧数据到达时的回调
|
||||
* \endif
|
||||
*/
|
||||
void start(std::shared_ptr<StreamProfile> streamProfile, FrameCallback callback);
|
||||
/**
|
||||
* \if English
|
||||
* @brief Stop stream
|
||||
* \else
|
||||
* @brief 停止流
|
||||
* \endif
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Dynamically switch resolutions
|
||||
*
|
||||
* @param streamProfile Resolution to switch
|
||||
* \else
|
||||
* @brief 动态切换分辨率
|
||||
*
|
||||
* @param streamProfile 需要切换的分辨率
|
||||
* \endif
|
||||
*/
|
||||
void switchProfile(std::shared_ptr<StreamProfile> streamProfile);
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API SensorList {
|
||||
private:
|
||||
std::unique_ptr<SensorListImpl> impl_;
|
||||
|
||||
public:
|
||||
SensorList(std::unique_ptr<SensorListImpl> impl);
|
||||
|
||||
virtual ~SensorList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sensor count
|
||||
*
|
||||
* @return uint32_t returns the number of Sensors
|
||||
* \else
|
||||
* @brief 获取Sensor数量
|
||||
*
|
||||
* @return uint32_t 返回Sensor的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of the specified Sensor
|
||||
*
|
||||
* @param index Sensor index
|
||||
* @return OBSensorType returns the Sensor type
|
||||
* \else
|
||||
* @brief 获取指定Sensor的类型
|
||||
*
|
||||
* @param index Sensor索引
|
||||
* @return OBSensorType 返回Sensor类型
|
||||
* \endif
|
||||
*/
|
||||
OBSensorType type(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get Sensor by index number
|
||||
*
|
||||
* @param index To create a device cable, the range is [0, count-1], if the index exceeds the range, an exception will be thrown
|
||||
|
||||
* @return std::shared_ptr<Sensor> returns the Sensor object
|
||||
* \else
|
||||
* @brief 通过索引号获取Sensor
|
||||
*
|
||||
* @param index 要创建设备的索,范围 [0, count-1],如果index超出范围将抛异常
|
||||
* @return std::shared_ptr<Sensor> 返回Sensor对象
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Obtain the Sensor through the Sensor type
|
||||
*
|
||||
* @param sensorType Sensor type to be obtained
|
||||
* @return std::shared_ptr<Sensor> returns a Sensor object, if the specified type of Sensor does not exist, it will return empty
|
||||
* \else
|
||||
* @brief 通过Sensor类型获取Sensor
|
||||
*
|
||||
* @param sensorType 要获取的Sensor类型
|
||||
* @return std::shared_ptr<Sensor> 返回Sensor对象,如果指定类型Sensor不存在,将返回空
|
||||
* \endif
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType sensorType);
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,282 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file StreamProfile.hpp
|
||||
* @brief The stream configuration related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
* \else
|
||||
* @file StreamProfile.hpp
|
||||
* @brief 流配置相关类型,用于获取流的宽、高、帧率及格式等信息
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct StreamProfileImpl;
|
||||
struct StreamProfileListImpl;
|
||||
|
||||
namespace ob {
|
||||
|
||||
class VideoStreamProfile;
|
||||
class GyroStreamProfile;
|
||||
class AccelStreamProfile;
|
||||
class Config;
|
||||
|
||||
class OB_EXTENSION_API StreamProfile : public std::enable_shared_from_this<StreamProfile> {
|
||||
protected:
|
||||
std::unique_ptr<StreamProfileImpl> impl_;
|
||||
|
||||
public:
|
||||
StreamProfile(std::unique_ptr<StreamProfileImpl> impl);
|
||||
StreamProfile(StreamProfile &streamProfile);
|
||||
~StreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the format of the stream
|
||||
*
|
||||
* @return OBFormat returns the format of the stream
|
||||
* \else
|
||||
* @brief 获取流的格式
|
||||
*
|
||||
* @return OBFormat 返回流的格式
|
||||
* \endif
|
||||
*/
|
||||
OBFormat format();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the type of stream
|
||||
*
|
||||
* @return OBStreamType returns the type of the stream
|
||||
* \else
|
||||
* @brief 获取流的类型
|
||||
*
|
||||
* @return OBStreamType 返回流的类型
|
||||
* \endif
|
||||
*/
|
||||
OBStreamType type();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Check if frame object is compatible with the given type
|
||||
*
|
||||
* @tparam T Given type
|
||||
* @return bool return result
|
||||
* \else
|
||||
* @brief 检查帧对象的运行时类型是否与给定类型兼容
|
||||
*
|
||||
* @tparam T 给定的类型
|
||||
* @return bool 返回结果
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> bool is();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Object type conversion
|
||||
*
|
||||
* @tparam T Target type
|
||||
* @return std::shared_ptr<T> returns the result, if it cannot be converted, an exception will be thrown
|
||||
* \else
|
||||
* @brief 对象类型转换
|
||||
*
|
||||
* @tparam T 目标类型
|
||||
* @return std::shared_ptr<T> 返回结果, 如果不能够转换,将抛异常
|
||||
* \endif
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>())
|
||||
throw "unsupported operation, object's type is not require type";
|
||||
|
||||
return std::static_pointer_cast<T>(std::const_pointer_cast<StreamProfile>(shared_from_this()));
|
||||
}
|
||||
|
||||
friend class Sensor;
|
||||
friend class Config;
|
||||
friend class Pipeline;
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API VideoStreamProfile : public StreamProfile {
|
||||
public:
|
||||
VideoStreamProfile(StreamProfile &profile);
|
||||
~VideoStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream frame rate
|
||||
*
|
||||
* @return uint32_t returns the frame rate of the stream
|
||||
* \else
|
||||
* @brief 获取流的帧率
|
||||
*
|
||||
* @return uint32_t 返回流的帧率
|
||||
* \endif
|
||||
*/
|
||||
uint32_t fps();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream width
|
||||
*
|
||||
* @return uint32_t returns the width of the stream
|
||||
* \else
|
||||
* @brief 获取流的宽
|
||||
*
|
||||
* @return uint32_t 返回流的宽
|
||||
* \endif
|
||||
*/
|
||||
uint32_t width();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream height
|
||||
*
|
||||
* @return uint32_t returns the high of the stream
|
||||
* \else
|
||||
* @brief 获取流的高
|
||||
*
|
||||
* @return uint32_t 返回流的高
|
||||
* \endif
|
||||
*/
|
||||
uint32_t height();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API AccelStreamProfile : public StreamProfile {
|
||||
public:
|
||||
AccelStreamProfile(StreamProfile &profile);
|
||||
~AccelStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get full scale range
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the scale range value
|
||||
* \else
|
||||
* @brief 获取满量程范围
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回量程范围值
|
||||
* \endif
|
||||
*/
|
||||
OBAccelFullScaleRange fullScaleRange();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sampling frequency
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the sampling frequency
|
||||
* \else
|
||||
* @brief 获取采样频率
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回采样频率
|
||||
* \endif
|
||||
*/
|
||||
OBAccelSampleRate sampleRate();
|
||||
};
|
||||
|
||||
class OB_EXTENSION_API GyroStreamProfile : public StreamProfile {
|
||||
public:
|
||||
GyroStreamProfile(StreamProfile &profile);
|
||||
~GyroStreamProfile() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get full scale range
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the scale range value
|
||||
* \else
|
||||
* @brief 获取满量程范围
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回量程范围值
|
||||
* \endif
|
||||
*/
|
||||
OBGyroFullScaleRange fullScaleRange();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get sampling frequency
|
||||
*
|
||||
* @return OBAccelFullScaleRange returns the sampling frequency
|
||||
* \else
|
||||
* @brief 获取采样频率
|
||||
*
|
||||
* @return OBAccelFullScaleRange 返回采样频率
|
||||
* \endif
|
||||
*/
|
||||
OBGyroSampleRate sampleRate();
|
||||
};
|
||||
|
||||
template <typename T> bool StreamProfile::is() {
|
||||
switch(this->type()) {
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_DEPTH:
|
||||
return typeid(T) == typeid(VideoStreamProfile);
|
||||
case OB_STREAM_ACCEL:
|
||||
return typeid(T) == typeid(AccelStreamProfile);
|
||||
case OB_STREAM_GYRO:
|
||||
return typeid(T) == typeid(GyroStreamProfile);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class OB_EXTENSION_API StreamProfileList {
|
||||
protected:
|
||||
std::unique_ptr<StreamProfileListImpl> impl_;
|
||||
|
||||
public:
|
||||
StreamProfileList(std::unique_ptr<StreamProfileListImpl> impl);
|
||||
~StreamProfileList() noexcept;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get stream profile count
|
||||
*
|
||||
* @return uint32_t returns the number of StreamProfile
|
||||
* \else
|
||||
* @brief 获取StreamProfile数量
|
||||
*
|
||||
* @return uint32_t 返回StreamProfile的数量
|
||||
* \endif
|
||||
*/
|
||||
uint32_t count();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get StreamProfile by index number
|
||||
*
|
||||
* @param index Device index to be created,the range is [0, count-1],if the index exceeds the range, an exception will be thrown
|
||||
* @return std::shared_ptr<StreamProfile> returns StreamProfile object
|
||||
* \else
|
||||
* @brief 通过索引号获取StreamProfile
|
||||
*
|
||||
* @param index 要创建设备的索,范围 [0, count-1],如果index超出范围将抛异常
|
||||
* @return std::shared_ptr<StreamProfile> 返回StreamProfile对象
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<StreamProfile> getProfile(uint32_t index);
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Match the corresponding streamprofile through the passed in parameters. If there are multiple matches, the first one in the list will be returned by default.
|
||||
*
|
||||
* @param width Width. If no matching condition is required, it can be passed to 0
|
||||
* @param height Height. If no matching condition is required, it can be passed to 0
|
||||
* @param format Type. If no matching condition is required, it can be passed to OB_FORMAT_UNKNOWN
|
||||
* @param fps Frame rate. If no matching condition is required, it can be passed to 0
|
||||
* @return std::shared_ptr<StreamProfile> Returns the matching resolution
|
||||
* \else
|
||||
* @brief 通过传入的参数进行匹配对应的StreamProfile,若有多个匹配项默认返回列表中的第一个
|
||||
*
|
||||
* @param width 宽度,如不要求加入匹配条件,可传0
|
||||
* @param height 高度,如不要求加入匹配条件,可传0
|
||||
* @param format 类型,如不要求加入匹配条件,可传OB_FORMAT_UNKNOWN
|
||||
* @param fps 帧率,如不要求加入匹配条件,可传0
|
||||
* @return std::shared_ptr<StreamProfile> 返回匹配的分辨率
|
||||
* \endif
|
||||
*/
|
||||
const std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = 0, int height = 0, OBFormat format = OB_FORMAT_UNKNOWN, int fps = 0);
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* \if English
|
||||
* \file Types.hpp
|
||||
* \brief Provide SDK structure and enumeration constant definition (depending on libobsensor/h/ObTypes.h)
|
||||
* \else
|
||||
* \file Types.hpp
|
||||
* \brief 提供SDK的结构体、枚举常量定义(依赖libobsensor/h/ObTypes.h)
|
||||
*
|
||||
* \endif
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/ObTypes.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief file transfer callbacks
|
||||
*
|
||||
* @param state file transfer status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 文件传输回调
|
||||
*
|
||||
* @param state 文件传输状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using SendFileCallback = std::function<void(OBFileTranState state, const char *message, uint8_t percent)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device upgrade callback
|
||||
*
|
||||
* @param state upgrade status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 设备升级回调
|
||||
*
|
||||
* @param state 升级状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using DeviceUpgradeCallback = std::function<void(OBUpgradeState state, const char *message, uint8_t percent)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief device status callback
|
||||
*
|
||||
* @param state device status
|
||||
* @param message status information
|
||||
* \else
|
||||
* @brief 设备状态回调
|
||||
*
|
||||
* @param state 设备状态
|
||||
* @param message 状态信息
|
||||
* \endif
|
||||
*/
|
||||
using DeviceStateChangedCallback = std::function<void(OBDeviceState state, const char *message)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief get raw data property data when data and progress callbacks
|
||||
*
|
||||
* @param dataChunk data chunk
|
||||
* @param state get the data status
|
||||
* \else
|
||||
* @brief 获取raw data属性数据时数据及进度回调
|
||||
*
|
||||
* @param dataChunk 数据块
|
||||
* @param state 获取数据状态
|
||||
* \endif
|
||||
*/
|
||||
using GetDataCallback = std::function<void(OBDataTranState state, OBDataChunk *dataChunk)>;
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief set the raw data property when the progress callback is made
|
||||
*
|
||||
* @param percent progress percentage
|
||||
* @param state set the data status
|
||||
* \else
|
||||
* @brief 设置raw data属性数据时进度回调
|
||||
*
|
||||
* @param percent 进度百分比
|
||||
* @param state 设置数据状态
|
||||
* \endif
|
||||
*/
|
||||
using SetDataCallback = std::function<void(OBDataTranState state, uint8_t percent)>;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* \if English
|
||||
* @file Version.hpp
|
||||
* @brief Get the SDK version information
|
||||
* \else
|
||||
* @file Version.hpp
|
||||
* @brief 获取SDK版本号相关信息的类
|
||||
* \endif
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace ob {
|
||||
class OB_EXTENSION_API Version {
|
||||
public:
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK major version number
|
||||
*
|
||||
* @return int returns the SDK major version number
|
||||
* \else
|
||||
* @brief 获取SDK主版本号
|
||||
*
|
||||
* @return int 返回SDK主版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getMajor();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK minor version number
|
||||
*
|
||||
* @return int returns the SDK minor version number
|
||||
* \else
|
||||
* @brief 获取SDK副版本号
|
||||
*
|
||||
* @return int 返回SDK副版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getMinor();
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK revision number
|
||||
*
|
||||
* @return int returns the SDK revision number
|
||||
* \else
|
||||
* @brief 获取SDK修订版本号
|
||||
*
|
||||
* @return int 返回SDK修订版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getPatch();
|
||||
|
||||
/**
|
||||
* \if English
|
||||
* @brief Get the SDK version number
|
||||
*
|
||||
* @return int returns the SDK version number
|
||||
* \else
|
||||
* @brief 获取SDK版本号
|
||||
*
|
||||
* @return int 返回SDK版本号
|
||||
* \endif
|
||||
*/
|
||||
static int getVersion();
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1 @@
|
||||
libOrbbecSDK.so.1.2
|
||||
@@ -0,0 +1 @@
|
||||
libOrbbecSDK.so.1.2.8
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:deed206e6ab233ea1ea5ee5492211d497afaea851dd319ffbf9aaf1d7575a282
|
||||
size 83283968
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b7da0ca8328798b9709b1ddd794163cf18a4d966534e65efc0f29998dc458a03
|
||||
size 21961
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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>orbbec_camera</name>
|
||||
<version>0.0.1</version>
|
||||
<description>Orbbec Camera package</description>
|
||||
<maintainer email="weikang@todo.todo">weikang</maintainer>
|
||||
<license>TODO: License declaration</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
<depend>ament_lint_auto</depend>
|
||||
<depend>ament_lint_common</depend>
|
||||
<depend>ament_index_cpp</depend>
|
||||
<depend>image_transport</depend>
|
||||
<depend>rclcpp_components</depend>
|
||||
<depend>cv_bridge</depend>
|
||||
<depend>orbbec_camera_msgs</depend>
|
||||
<depend> builtin_interfaces</depend>
|
||||
<depend>rclcpp</depend>
|
||||
<depend>sensor_msgs</depend>
|
||||
<depend>std_msgs</depend>
|
||||
<depend>std_srvs</depend>
|
||||
<depend>tf2</depend>
|
||||
<depend>tf2_ros</depend>
|
||||
<depend>tf2_sensor_msgs</depend>
|
||||
<depend>tf2_msgs</depend>
|
||||
<depend>ORBBEC_SDK</depend>
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,20 @@
|
||||
orbbec_camera_node:
|
||||
ros__parameters:
|
||||
color_width: 640
|
||||
color_height: 480
|
||||
color_fps: 30
|
||||
color_frame_id: "color_frame"
|
||||
color_optical_frame_id: "color_optical_frame"
|
||||
ir_width: 640
|
||||
ir_height: 480
|
||||
ir_fps: 30
|
||||
ir_frame_id: "ir_frame"
|
||||
ir_optical_frame_id: "ir_optical_frame"
|
||||
depth_width: 640
|
||||
depth_height: 480
|
||||
depth_fps: 30
|
||||
depth_frame_id: "depth_frame"
|
||||
depth_optical_frame_id: "depth_optical_frame"
|
||||
publish_tf: true
|
||||
align_depth: true
|
||||
tf_publish_rate: 10.0
|
||||
@@ -0,0 +1,190 @@
|
||||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 70
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /Image1
|
||||
- /Image1/Topic1
|
||||
- /PointCloud21
|
||||
- /Image2
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 486
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Image
|
||||
Enabled: true
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
Name: Image
|
||||
Normalize Range: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Best Effort
|
||||
Value: /camera/color/image_raw
|
||||
Value: true
|
||||
- Alpha: 1
|
||||
Autocompute Intensity Bounds: true
|
||||
Autocompute Value Bounds:
|
||||
Max Value: 10
|
||||
Min Value: -10
|
||||
Value: true
|
||||
Axis: Z
|
||||
Channel Name: intensity
|
||||
Class: rviz_default_plugins/PointCloud2
|
||||
Color: 255; 255; 255
|
||||
Color Transformer: RGB8
|
||||
Decay Time: 0
|
||||
Enabled: true
|
||||
Invert Rainbow: false
|
||||
Max Color: 255; 255; 255
|
||||
Max Intensity: 3.5733110840282835e-43
|
||||
Min Color: 0; 0; 0
|
||||
Min Intensity: 2.802596928649634e-44
|
||||
Name: PointCloud2
|
||||
Position Transformer: XYZ
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.01
|
||||
Style: Flat Squares
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /camera/depth/color/points
|
||||
Use Fixed Frame: true
|
||||
Use rainbow: true
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Image
|
||||
Enabled: true
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
Name: Image
|
||||
Normalize Range: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /camera/color/image_raw
|
||||
Value: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: camera_link
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 0.6009803414344788
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: -0.009601986967027187
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 2.695401906967163
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 984
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
Image:
|
||||
collapsed: false
|
||||
QMainWindow State: 000000ff00000000fd0000000400000000000002ba0000037efc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000269000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d00610067006500000001f4000000870000002800fffffffb0000000a0049006d00610067006501000002ac0000010f0000002800ffffff000000010000011e00000317fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000317000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004760000037e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1846
|
||||
X: 72
|
||||
Y: 27
|
||||
@@ -0,0 +1,249 @@
|
||||
#include "orbbec_camera/ob_camera_node.h"
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <thread>
|
||||
|
||||
#include "orbbec_camera/utils.h"
|
||||
namespace orbbec_camera {
|
||||
void OBCameraNode::setupCameraCtrlServices() {
|
||||
using std_srvs::srv::SetBool;
|
||||
for (auto stream_index : IMAGE_STREAMS) {
|
||||
auto stream_name = stream_name_[stream_index.first];
|
||||
if (enable_[stream_index]) {
|
||||
std::string service_name = "/get/" + stream_name + "/exposure";
|
||||
get_exposure_srv_[stream_index] = node_->create_service<GetInt32>(
|
||||
service_name, [this, stream_index = stream_index](
|
||||
const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<GetInt32::Request> request,
|
||||
std::shared_ptr<GetInt32::Response> response) {
|
||||
getExposureCallback(request, response, stream_index);
|
||||
});
|
||||
|
||||
service_name = "/set/" + stream_name + "/exposure";
|
||||
set_exposure_srv_[stream_index] = node_->create_service<SetInt32>(
|
||||
service_name, [this, stream_index = stream_index](
|
||||
const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetInt32::Request> request,
|
||||
std::shared_ptr<SetInt32::Response> response) {
|
||||
setExposureCallback(request, response, stream_index);
|
||||
});
|
||||
service_name = "/get/" + stream_name + "/gain";
|
||||
get_gain_srv_[stream_index] = node_->create_service<GetInt32>(
|
||||
service_name, [this, stream_index = stream_index](
|
||||
const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<GetInt32::Request> request,
|
||||
std::shared_ptr<GetInt32::Response> response) {
|
||||
getGainCallback(request, response, stream_index);
|
||||
});
|
||||
|
||||
service_name = "set/" + stream_name + "/gain";
|
||||
set_gain_srv_[stream_index] = node_->create_service<SetInt32>(
|
||||
service_name, [this, stream_index = stream_index](
|
||||
const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetInt32::Request> request,
|
||||
std::shared_ptr<SetInt32::Response> response) {
|
||||
setGainCallback(request, response, stream_index);
|
||||
});
|
||||
if (stream_index.first == OB_STREAM_COLOR || stream_index.first == OB_STREAM_DEPTH) {
|
||||
service_name = "/set/" + stream_name +
|
||||
"/"
|
||||
"auto_exposure";
|
||||
set_auto_exposure_srv_[stream_index] = node_->create_service<SetBool>(
|
||||
service_name, [this, stream_index = stream_index](
|
||||
const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetBool::Request> request,
|
||||
std::shared_ptr<SetBool::Response> response) {
|
||||
setAutoExposureCallback(request, response, stream_index);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
set_fan_mode_srv_ = node_->create_service<SetInt32>(
|
||||
"/set_fan_mode", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetInt32::Request> request,
|
||||
std::shared_ptr<SetInt32::Response> response) {
|
||||
setFanModeCallback(request_header, request, response);
|
||||
});
|
||||
set_floor_enable_srv_ = node_->create_service<SetBool>(
|
||||
"/set_floor_enable", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetBool::Request> request,
|
||||
std::shared_ptr<SetBool::Response> response) {
|
||||
setFloorEnableCallback(request_header, request, response);
|
||||
});
|
||||
set_laser_enable_srv_ = node_->create_service<SetBool>(
|
||||
"/set_laser_enable", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetBool::Request> request,
|
||||
std::shared_ptr<SetBool::Response> response) {
|
||||
setLaserEnableCallback(request_header, request, response);
|
||||
});
|
||||
set_ldp_enable_srv_ = node_->create_service<SetBool>(
|
||||
"/set_ldp_enable", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetBool::Request> request,
|
||||
std::shared_ptr<SetBool::Response> response) {
|
||||
setLdpEnableCallback(request_header, request, response);
|
||||
});
|
||||
|
||||
get_white_balance_srv_ = node_->create_service<GetInt32>(
|
||||
"/get/white_balance", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<GetInt32::Request> request,
|
||||
std::shared_ptr<GetInt32::Response> response) {
|
||||
getWhiteBalanceCallback(request_header, request, response);
|
||||
});
|
||||
|
||||
set_white_balance_srv_ = node_->create_service<SetInt32>(
|
||||
"/set/white_balance", [this](const std::shared_ptr<rmw_request_id_t> request_header,
|
||||
const std::shared_ptr<SetInt32::Request> request,
|
||||
std::shared_ptr<SetInt32::Response> response) {
|
||||
setWhiteBalanceCallback(request_header, request, response);
|
||||
});
|
||||
}
|
||||
|
||||
void OBCameraNode::setExposureCallback(const std::shared_ptr<SetInt32::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index) {
|
||||
auto stream = stream_index.first;
|
||||
switch (stream) {
|
||||
case OB_STREAM_IR:
|
||||
device_->setIntProperty(OB_PROP_IR_EXPOSURE_INT, request->data);
|
||||
break;
|
||||
case OB_STREAM_DEPTH:
|
||||
device_->setIntProperty(OB_PROP_DEPTH_EXPOSURE_INT, request->data);
|
||||
break;
|
||||
case OB_STREAM_COLOR:
|
||||
device_->setIntProperty(OB_PROP_COLOR_EXPOSURE_INT, request->data);
|
||||
break;
|
||||
default:
|
||||
RCLCPP_ERROR(logger_, "%s NOT a video stream", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::getGainCallback(const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index) {
|
||||
auto stream = stream_index.first;
|
||||
switch (stream) {
|
||||
case OB_STREAM_IR:
|
||||
response->data = device_->getIntProperty(OB_PROP_IR_GAIN_INT);
|
||||
break;
|
||||
case OB_STREAM_DEPTH:
|
||||
response->data = device_->getIntProperty(OB_PROP_DEPTH_GAIN_INT);
|
||||
break;
|
||||
case OB_STREAM_COLOR:
|
||||
response->data = device_->getIntProperty(OB_PROP_COLOR_GAIN_INT);
|
||||
break;
|
||||
default:
|
||||
RCLCPP_ERROR(logger_, " %s NOT a video stream", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void OBCameraNode::setGainCallback(const std::shared_ptr<SetInt32 ::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response,
|
||||
const stream_index_pair& stream_index) {
|
||||
auto stream = stream_index.first;
|
||||
switch (stream) {
|
||||
case OB_STREAM_IR:
|
||||
device_->setIntProperty(OB_PROP_IR_GAIN_INT, request->data);
|
||||
break;
|
||||
case OB_STREAM_DEPTH:
|
||||
device_->setIntProperty(OB_PROP_DEPTH_GAIN_INT, request->data);
|
||||
break;
|
||||
case OB_STREAM_COLOR:
|
||||
device_->setIntProperty(OB_PROP_COLOR_GAIN_INT, request->data);
|
||||
break;
|
||||
default:
|
||||
RCLCPP_ERROR(logger_, "%s NOT a video stream", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::getWhiteBalanceCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32::Response>& response) {
|
||||
response->data = device_->getIntProperty(OB_PROP_COLOR_WHITE_BALANCE_INT);
|
||||
}
|
||||
|
||||
void OBCameraNode::setWhiteBalanceCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<SetInt32 ::Request>& request,
|
||||
std::shared_ptr<SetInt32 ::Response>& response) {
|
||||
device_->setIntProperty(OB_PROP_COLOR_WHITE_BALANCE_INT, request->data);
|
||||
}
|
||||
|
||||
void OBCameraNode::setAutoExposureCallback(
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response,
|
||||
const stream_index_pair& stream_index) {
|
||||
auto stream = stream_index.first;
|
||||
switch (stream) {
|
||||
case OB_STREAM_IR:
|
||||
response->message = "IR not support set auto exposure";
|
||||
break;
|
||||
case OB_STREAM_DEPTH:
|
||||
device_->setIntProperty(OB_PROP_DEPTH_AUTO_EXPOSURE_BOOL, request->data);
|
||||
break;
|
||||
case OB_STREAM_COLOR:
|
||||
device_->setIntProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, request->data);
|
||||
break;
|
||||
default:
|
||||
RCLCPP_ERROR(logger_, "%s NOT a video stream", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::setFanModeCallback(const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<SetInt32::Request>& request,
|
||||
std::shared_ptr<SetInt32::Response>& response) {
|
||||
(void)request_header;
|
||||
(void)response;
|
||||
bool fan_mode = request->data;
|
||||
device_->setBoolProperty(OB_PROP_FAN_WORK_MODE_INT, fan_mode);
|
||||
}
|
||||
|
||||
void OBCameraNode::setFloorEnableCallback(
|
||||
const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response) {
|
||||
(void)request_header;
|
||||
(void)response;
|
||||
bool floor_enable = request->data;
|
||||
device_->setBoolProperty(OB_PROP_FLOOD_BOOL, floor_enable);
|
||||
}
|
||||
|
||||
void OBCameraNode::setLaserEnableCallback(
|
||||
const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response) {
|
||||
(void)request_header;
|
||||
(void)response;
|
||||
bool laser_enable = request->data;
|
||||
device_->setBoolProperty(OB_PROP_LASER_BOOL, laser_enable);
|
||||
}
|
||||
|
||||
void OBCameraNode::setLdpEnableCallback(
|
||||
const std::shared_ptr<rmw_request_id_t>& request_header,
|
||||
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
|
||||
std::shared_ptr<std_srvs::srv::SetBool::Response>& response) {
|
||||
(void)request_header;
|
||||
(void)response;
|
||||
bool ldp_enable = request->data;
|
||||
device_->setBoolProperty(OB_PROP_LDP_BOOL, ldp_enable);
|
||||
}
|
||||
void OBCameraNode::getExposureCallback(const std::shared_ptr<GetInt32::Request>& request,
|
||||
std::shared_ptr<GetInt32 ::Response>& response,
|
||||
const stream_index_pair& stream_index) {
|
||||
auto stream = stream_index.first;
|
||||
switch (stream) {
|
||||
case OB_STREAM_IR:
|
||||
response->data = device_->getIntProperty(OB_PROP_IR_EXPOSURE_INT);
|
||||
break;
|
||||
case OB_STREAM_DEPTH:
|
||||
response->data = device_->getIntProperty(OB_PROP_DEPTH_EXPOSURE_INT);
|
||||
break;
|
||||
case OB_STREAM_COLOR:
|
||||
response->data = device_->getIntProperty(OB_PROP_COLOR_EXPOSURE_INT);
|
||||
break;
|
||||
default:
|
||||
RCLCPP_ERROR(logger_, " %s NOT a video stream", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,488 @@
|
||||
#include "orbbec_camera/ob_camera_node.h"
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
#include <thread>
|
||||
#include <geometry_msgs/msg/transform_stamped.hpp>
|
||||
|
||||
#include "orbbec_camera/utils.h"
|
||||
namespace orbbec_camera {
|
||||
using namespace std::chrono_literals;
|
||||
OBCameraNode::OBCameraNode(rclcpp::Node* node, std::shared_ptr<ob::Device> device)
|
||||
: node_(node), device_(device), logger_(node->get_logger()) {
|
||||
static_tf_broadcaster_ = std::make_shared<tf2_ros::StaticTransformBroadcaster>(node);
|
||||
dynamic_tf_broadcaster_ = std::make_shared<tf2_ros::TransformBroadcaster>(node);
|
||||
// FIXME:
|
||||
is_running_.store(true);
|
||||
format_[DEPTH] = OB_FORMAT_Y16;
|
||||
image_format_[OB_STREAM_DEPTH] = CV_16UC1;
|
||||
encoding_[DEPTH] = sensor_msgs::image_encodings::TYPE_16UC1;
|
||||
stream_name_[OB_STREAM_DEPTH] = "depth";
|
||||
unit_step_size_[DEPTH] = sizeof(uint16_t);
|
||||
format_[IR0] = OB_FORMAT_Y16;
|
||||
image_format_[OB_STREAM_IR] = CV_16UC1;
|
||||
encoding_[IR0] = sensor_msgs::image_encodings::MONO16;
|
||||
stream_name_[OB_STREAM_IR] = "ir";
|
||||
unit_step_size_[IR0] = sizeof(uint8_t);
|
||||
|
||||
format_[COLOR] = OB_FORMAT_I420;
|
||||
image_format_[OB_STREAM_COLOR] = CV_8UC3;
|
||||
encoding_[COLOR] = sensor_msgs::image_encodings::BGR8;
|
||||
stream_name_[OB_STREAM_COLOR] = "color";
|
||||
unit_step_size_[COLOR] = 3;
|
||||
|
||||
compression_params_.push_back(cv::IMWRITE_PNG_COMPRESSION);
|
||||
compression_params_.push_back(0);
|
||||
compression_params_.push_back(cv::IMWRITE_PNG_STRATEGY);
|
||||
compression_params_.push_back(cv::IMWRITE_PNG_STRATEGY_DEFAULT);
|
||||
setupTopics();
|
||||
startPipeline();
|
||||
}
|
||||
|
||||
OBCameraNode::~OBCameraNode() {
|
||||
if (tf_thread_->joinable()) {
|
||||
tf_thread_->join();
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::setupDevices() {
|
||||
auto sensor_list = device_->getSensorList();
|
||||
for (size_t i = 0; i < sensor_list->count(); i++) {
|
||||
auto sensor = sensor_list->getSensor(i);
|
||||
auto profiles = sensor->getStreamProfileList();
|
||||
for (size_t j = 0; j < profiles->count(); j++) {
|
||||
auto profile = profiles->getProfile(j);
|
||||
stream_index_pair sip{profile->type(), 0};
|
||||
if (sensors_.find(sip) != sensors_.end()) {
|
||||
continue;
|
||||
}
|
||||
sensors_[sip] = sensor;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [stream_index, enable] : enable_) {
|
||||
if (enable && sensors_.find(stream_index) == sensors_.end()) {
|
||||
RCLCPP_INFO_STREAM(logger_,
|
||||
magic_enum::enum_name(stream_index.first)
|
||||
<< "sensor isn't supported by current device! -- Skipping...");
|
||||
enable_[stream_index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
auto camera_param_list = device_->getCalibrationCameraParamList();
|
||||
for (size_t i = 0; i < camera_param_list->count(); i++) {
|
||||
auto camera_param = camera_param_list->getCameraParam(i);
|
||||
RCLCPP_ERROR_STREAM(logger_, "param \n" << camera_param);
|
||||
camera_params_.emplace_back(camera_param);
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::setupProfiles() {
|
||||
config_ = std::make_shared<ob::Config>();
|
||||
config_->setAlignMode(ALIGN_D2C_HW_MODE);
|
||||
for (const auto& elem : IMAGE_STREAMS) {
|
||||
if (enable_[elem]) {
|
||||
const auto& sensor = sensors_[elem];
|
||||
auto profiles = sensor->getStreamProfileList();
|
||||
for (size_t i = 0; i < profiles->count(); i++) {
|
||||
auto profile = profiles->getProfile(i)->as<ob::VideoStreamProfile>();
|
||||
RCLCPP_DEBUG_STREAM(
|
||||
logger_, "Sensor profile: "
|
||||
<< "stream_type: " << magic_enum::enum_name(profile->type())
|
||||
<< "Format: " << profile->format() << ", Width: " << profile->width()
|
||||
<< ", Height: " << profile->height() << ", FPS: " << profile->fps());
|
||||
enabled_profiles_[elem].emplace_back(profile);
|
||||
}
|
||||
|
||||
auto selected_profile =
|
||||
profiles->getVideoStreamProfile(width_[elem], height_[elem], format_[elem], fps_[elem]);
|
||||
auto default_profile = profiles->getVideoStreamProfile();
|
||||
if (!selected_profile) {
|
||||
RCLCPP_WARN_STREAM(logger_, "Given stream configuration is not supported by the device! "
|
||||
<< " Stream: " << magic_enum::enum_name(elem.first)
|
||||
<< ", Stream Index: " << elem.second
|
||||
<< ", Width: " << width_[elem]
|
||||
<< ", Height: " << height_[elem] << ", FPS: " << fps_[elem]
|
||||
<< ", Format: " << format_[elem]);
|
||||
if (default_profile) {
|
||||
RCLCPP_WARN_STREAM(logger_, "Using default profile instead.");
|
||||
selected_profile = default_profile;
|
||||
} else {
|
||||
RCLCPP_ERROR_STREAM(
|
||||
logger_, " NO default_profile found , Stream: " << magic_enum::enum_name(elem.first)
|
||||
<< " will be disable");
|
||||
enable_[elem] = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
CHECK_NOTNULL(selected_profile);
|
||||
config_->enableStream(selected_profile);
|
||||
images_[elem] =
|
||||
cv::Mat(height_[elem], width_[elem], image_format_[elem.first], cv::Scalar(0, 0, 0));
|
||||
RCLCPP_INFO_STREAM(
|
||||
logger_, " stream is enabled - width: " << width_[elem] << ", height: " << height_[elem]
|
||||
<< ", fps: " << fps_[elem] << ", "
|
||||
<< "Format: " << selected_profile->format());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::startPipeline() {
|
||||
pipeline_ = std::make_unique<ob::Pipeline>(device_);
|
||||
pipeline_->start(config_, [this](std::shared_ptr<ob::FrameSet> frame_set) {
|
||||
frameSetCallback(std::move(frame_set));
|
||||
});
|
||||
}
|
||||
|
||||
void OBCameraNode::getParameters() {
|
||||
for (auto stream_index : IMAGE_STREAMS) {
|
||||
std::string param_name = stream_name_[stream_index.first] + "_width";
|
||||
width_[stream_index] = node_->declare_parameter<int>(param_name, IMAGE_WIDTH);
|
||||
param_name = stream_name_[stream_index.first] + "_height";
|
||||
height_[stream_index] = node_->declare_parameter<int>(param_name, IMAGE_HEIGHT);
|
||||
param_name = stream_name_[stream_index.first] + "_fps";
|
||||
fps_[stream_index] = node_->declare_parameter<int>(param_name, IMAGE_FPS);
|
||||
param_name = "enable_" + stream_name_[stream_index.first];
|
||||
enable_[stream_index] = node_->declare_parameter<bool>(param_name, true);
|
||||
param_name = stream_name_[stream_index.first] + "_frame_id";
|
||||
std::string default_frame_id = "camera_" + stream_name_[stream_index.first] + "_frame";
|
||||
frame_id_[stream_index] = node_->declare_parameter<std::string>(param_name, default_frame_id);
|
||||
std::string default_optical_frame_id =
|
||||
"camera_" + stream_name_[stream_index.first] + "_optical_frame";
|
||||
param_name = stream_name_[stream_index.first] + "_optical_frame_id";
|
||||
optical_frame_id_[stream_index] =
|
||||
node_->declare_parameter<std::string>(param_name, default_optical_frame_id);
|
||||
depth_aligned_frame_id_[stream_index] = stream_name_[OB_STREAM_COLOR] + "_optical_frame";
|
||||
}
|
||||
publish_tf_ = node_->declare_parameter<bool>("publish_tf", true);
|
||||
align_depth_ = node_->declare_parameter<bool>("align_depth", true);
|
||||
tf_publish_rate_ = node_->declare_parameter<double>("tf_publish_rate", 10.0);
|
||||
}
|
||||
|
||||
void OBCameraNode::setupTopics() {
|
||||
getParameters();
|
||||
setupDevices();
|
||||
updateStreamCalibData();
|
||||
setupProfiles();
|
||||
setupCameraCtrlServices();
|
||||
setupPublishers();
|
||||
publishStaticTransforms();
|
||||
}
|
||||
|
||||
void OBCameraNode::setupPublishers() {
|
||||
static_tf_broadcaster_ = std::make_shared<tf2_ros::StaticTransformBroadcaster>(node_);
|
||||
using PointCloud2 = sensor_msgs::msg::PointCloud2;
|
||||
using CameraInfo = sensor_msgs::msg::CameraInfo;
|
||||
point_cloud_publisher_ =
|
||||
node_->create_publisher<PointCloud2>("depth/points", rclcpp::QoS{1}.best_effort());
|
||||
for (const auto& stream_index : IMAGE_STREAMS) {
|
||||
std::string name = stream_name_[stream_index.first];
|
||||
std::string topic = name + "/image_raw";
|
||||
image_publishers_[stream_index] = image_transport::create_publisher(node_, topic);
|
||||
topic = name + "/camera_info";
|
||||
camera_info_publishers_[stream_index] =
|
||||
node_->create_publisher<CameraInfo>(topic, rclcpp::QoS{1}.best_effort());
|
||||
}
|
||||
extrinsics_publisher_ = node_->create_publisher<orbbec_camera_msgs::msg::Extrinsics>(
|
||||
"extrinsic", rclcpp::QoS{1}.transient_local());
|
||||
}
|
||||
|
||||
void OBCameraNode::publishPointCloud(std::shared_ptr<ob::FrameSet> frame_set,
|
||||
const rclcpp::Time& t) {
|
||||
static int cnt = 0;
|
||||
const std::string home_dir = std::getenv("HOME");
|
||||
const std::string pc_file_name = home_dir + "/pc/point_cloud.ply";
|
||||
auto camera_param = findCameraParam();
|
||||
CHECK(camera_param.has_value());
|
||||
if ((++cnt) % 20 == 0) {
|
||||
if (frame_set->depthFrame() != nullptr && frame_set->colorFrame() != nullptr) {
|
||||
RCLCPP_INFO_STREAM(logger_, "has rgb pc");
|
||||
point_cloud_filter_.setCameraParam(*camera_param);
|
||||
point_cloud_filter_.setCreatePointFormat(OB_FORMAT_RGB_POINT);
|
||||
auto frame = point_cloud_filter_.process(frame_set);
|
||||
saveRGBPointsToPly(frame, pc_file_name);
|
||||
} else if (frame_set->depthFrame() != nullptr) {
|
||||
RCLCPP_INFO_STREAM(logger_, "has depth pc");
|
||||
point_cloud_filter_.setCreatePointFormat(OB_FORMAT_POINT);
|
||||
auto frame = point_cloud_filter_.process(frame_set);
|
||||
savePointsToPly(frame, pc_file_name);
|
||||
}
|
||||
}
|
||||
if (frame_set->depthFrame() != nullptr && frame_set->colorFrame() != nullptr) {
|
||||
//publishColorPointCloud(frame_set, t);
|
||||
publishDepthPointCloud(frame_set, t);
|
||||
|
||||
} else if (frame_set->depthFrame() != nullptr) {
|
||||
publishDepthPointCloud(frame_set, t);
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::publishDepthPointCloud(std::shared_ptr<ob::FrameSet> frame_set,
|
||||
const rclcpp::Time& t) {
|
||||
point_cloud_filter_.setCreatePointFormat(OB_FORMAT_POINT);
|
||||
auto frame = point_cloud_filter_.process(frame_set);
|
||||
size_t point_size = frame->dataSize() / sizeof(OBPoint);
|
||||
auto* points = (OBPoint*)frame->data();
|
||||
sensor_msgs::PointCloud2Modifier modifier(point_cloud_msg_);
|
||||
modifier.setPointCloud2FieldsByString(1, "xyz");
|
||||
modifier.resize(point_size);
|
||||
point_cloud_msg_.width = width_[DEPTH];
|
||||
point_cloud_msg_.height = height_[DEPTH];
|
||||
std::string format_str = "intensity";
|
||||
|
||||
point_cloud_msg_.point_step =
|
||||
addPointField(point_cloud_msg_, format_str.c_str(), 1, sensor_msgs::msg::PointField::FLOAT32,
|
||||
point_cloud_msg_.point_step);
|
||||
point_cloud_msg_.row_step = point_cloud_msg_.width * point_cloud_msg_.point_step;
|
||||
point_cloud_msg_.data.resize(point_cloud_msg_.height * point_cloud_msg_.row_step);
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_x(point_cloud_msg_, "x");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_y(point_cloud_msg_, "y");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_z(point_cloud_msg_, "z");
|
||||
size_t valid_count = 0;
|
||||
for (size_t point_idx = 0; point_idx < point_size; point_idx++, points++) {
|
||||
bool valid_pixel(points->z > 0);
|
||||
if (valid_pixel) {
|
||||
*iter_x = points->x / 1000.0;
|
||||
*iter_y = points->y / 1000.0;
|
||||
*iter_z = points->z / 1000.0;
|
||||
|
||||
++iter_x;
|
||||
++iter_y;
|
||||
++iter_z;
|
||||
++valid_count;
|
||||
}
|
||||
}
|
||||
point_cloud_msg_.header.stamp = t;
|
||||
point_cloud_msg_.header.frame_id = "camera_link";
|
||||
// TODO: fill frame_id
|
||||
point_cloud_publisher_->publish(point_cloud_msg_);
|
||||
}
|
||||
|
||||
void OBCameraNode::publishColorPointCloud(std::shared_ptr<ob::FrameSet> frame_set,
|
||||
const rclcpp::Time& t) {
|
||||
point_cloud_filter_.setCreatePointFormat(OB_FORMAT_RGB_POINT);
|
||||
auto frame = point_cloud_filter_.process(frame_set);
|
||||
size_t point_size = frame->dataSize() / sizeof(OBColorPoint);
|
||||
auto* points = (OBColorPoint*)frame->data();
|
||||
sensor_msgs::PointCloud2Modifier modifier(point_cloud_msg_);
|
||||
modifier.setPointCloud2FieldsByString(2, "xyz", "rgb");
|
||||
modifier.resize(point_size);
|
||||
point_cloud_msg_.width = width_[DEPTH];
|
||||
point_cloud_msg_.height = height_[DEPTH];
|
||||
std::string format_str = "intensity";
|
||||
|
||||
point_cloud_msg_.point_step =
|
||||
addPointField(point_cloud_msg_, format_str.c_str(), 1, sensor_msgs::msg::PointField::FLOAT32,
|
||||
point_cloud_msg_.point_step);
|
||||
point_cloud_msg_.row_step = point_cloud_msg_.width * point_cloud_msg_.point_step;
|
||||
point_cloud_msg_.data.resize(point_cloud_msg_.height * point_cloud_msg_.row_step);
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_x(point_cloud_msg_, "x");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_y(point_cloud_msg_, "y");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_z(point_cloud_msg_, "z");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_r(point_cloud_msg_, "r");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_g(point_cloud_msg_, "g");
|
||||
sensor_msgs::PointCloud2Iterator<float> iter_b(point_cloud_msg_, "b");
|
||||
size_t valid_count = 0;
|
||||
for (size_t point_idx = 0; point_idx < point_size; point_idx++, points++) {
|
||||
bool valid_pixel(points->z > 0);
|
||||
if (valid_pixel) {
|
||||
*iter_x = points->x;
|
||||
*iter_y = points->y;
|
||||
*iter_z = points->z;
|
||||
*iter_r = points->r;
|
||||
*iter_g = points->g;
|
||||
*iter_b = points->b;
|
||||
|
||||
++iter_x;
|
||||
++iter_y;
|
||||
++iter_z;
|
||||
++iter_r;
|
||||
++iter_g;
|
||||
++iter_b;
|
||||
++valid_count;
|
||||
}
|
||||
}
|
||||
point_cloud_msg_.header.stamp = t;
|
||||
point_cloud_msg_.header.frame_id = "camera_link";
|
||||
point_cloud_publisher_->publish(point_cloud_msg_);
|
||||
}
|
||||
void OBCameraNode::frameSetCallback(std::shared_ptr<ob::FrameSet> frame_set) {
|
||||
// FIXME:
|
||||
auto nano_sec = static_cast<uint64_t>(frame_set->timeStampUs() * 1e3);
|
||||
rclcpp::Time t = rclcpp::Time(0, nano_sec);
|
||||
stream_index_pair sip;
|
||||
if (auto color_frame = frame_set->colorFrame()) {
|
||||
publishColorFrame(color_frame, t);
|
||||
}
|
||||
if (auto depth_frame = frame_set->depthFrame()) {
|
||||
publishDepthFrame(depth_frame, t);
|
||||
}
|
||||
// if (auto ir_frame = frame_set->irFrame()) {
|
||||
// publishFrame(ir_frame, t, IR0);
|
||||
// }
|
||||
publishPointCloud(frame_set, t);
|
||||
}
|
||||
std::optional<OBCameraParam> OBCameraNode::findCameraParam() {
|
||||
for (auto param : camera_params_) {
|
||||
int depth_w = param.depthIntrinsic.width;
|
||||
int depth_h = param.depthIntrinsic.height;
|
||||
int color_w = param.rgbIntrinsic.width;
|
||||
int color_h = param.rgbIntrinsic.height;
|
||||
if ((depth_w * height_[DEPTH] == depth_h * width_[DEPTH]) &&
|
||||
(color_w * height_[COLOR] == color_h * width_[COLOR])) {
|
||||
return param;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
void OBCameraNode::updateStreamCalibData() {
|
||||
auto param = findCameraParam();
|
||||
CHECK(param.has_value());
|
||||
camera_infos_[DEPTH] = convertToCameraInfo(param->depthIntrinsic, param->depthDistortion);
|
||||
camera_infos_[COLOR] = convertToCameraInfo(param->rgbIntrinsic, param->rgbDistortion);
|
||||
camera_infos_[IR0] = camera_infos_[DEPTH];
|
||||
}
|
||||
|
||||
void OBCameraNode::publishStaticTF(const rclcpp::Time& t, const std::vector<float>& trans,
|
||||
const tf2::Quaternion& q, const std::string& from,
|
||||
const std::string& to) {
|
||||
CHECK_EQ(trans.size(), 3u);
|
||||
geometry_msgs::msg::TransformStamped msg;
|
||||
msg.header.stamp = t;
|
||||
msg.header.frame_id = from;
|
||||
msg.child_frame_id = to;
|
||||
msg.transform.translation.x = trans.at(2) / 1000.0;
|
||||
msg.transform.translation.y = -trans.at(0) / 1000.0;
|
||||
msg.transform.translation.z = -trans.at(1) / 1000.0;
|
||||
msg.transform.rotation.x = q.getX();
|
||||
msg.transform.rotation.y = q.getY();
|
||||
msg.transform.rotation.z = q.getZ();
|
||||
msg.transform.rotation.w = q.getW();
|
||||
static_tf_msgs_.push_back(msg);
|
||||
}
|
||||
|
||||
void OBCameraNode::calcAndPublishStaticTransform() {
|
||||
tf2::Quaternion quaternion_optical, zero_rot;
|
||||
zero_rot.setRPY(0.0, 0.0, 0.0);
|
||||
quaternion_optical.setRPY(-M_PI / 2, 0.0, -M_PI / 2);
|
||||
std::vector<float> zero_trans = {0, 0, 0};
|
||||
auto camera_param = findCameraParam();
|
||||
CHECK(camera_param.has_value());
|
||||
auto ex = camera_param->transform;
|
||||
auto Q = rotationMatrixToQuaternion(ex.rot);
|
||||
Q = quaternion_optical * Q * quaternion_optical.inverse();
|
||||
std::vector<float> trans = {ex.trans[0], ex.trans[1], ex.trans[2]};
|
||||
rclcpp::Time tf_timestamp = node_->now();
|
||||
|
||||
publishStaticTF(tf_timestamp, trans, Q, frame_id_[DEPTH], frame_id_[COLOR]);
|
||||
publishStaticTF(tf_timestamp, trans, Q, "camera_link", frame_id_[COLOR]);
|
||||
publishStaticTF(tf_timestamp, zero_trans, quaternion_optical, frame_id_[COLOR],
|
||||
optical_frame_id_[COLOR]);
|
||||
publishStaticTF(tf_timestamp, zero_trans, quaternion_optical, frame_id_[DEPTH],
|
||||
optical_frame_id_[DEPTH]);
|
||||
publishStaticTF(tf_timestamp, zero_trans, zero_rot, "camera_link", frame_id_[DEPTH]);
|
||||
extrinsics_publisher_->publish(obExtrinsicsToMsg(ex, frame_id_[COLOR]));
|
||||
}
|
||||
|
||||
void OBCameraNode::publishStaticTransforms() {
|
||||
calcAndPublishStaticTransform();
|
||||
if (tf_publish_rate_ > 0) {
|
||||
tf_thread_ = std::make_shared<std::thread>([this]() { publishDynamicTransforms(); });
|
||||
} else {
|
||||
static_tf_broadcaster_->sendTransform(static_tf_msgs_);
|
||||
}
|
||||
}
|
||||
void OBCameraNode::publishDynamicTransforms() {
|
||||
RCLCPP_WARN(logger_, "Publishing dynamic camera transforms (/tf) at %g Hz", tf_publish_rate_);
|
||||
std::mutex mu;
|
||||
std::unique_lock<std::mutex> lock(mu);
|
||||
while (rclcpp::ok() && is_running_) {
|
||||
tf_cv_.wait_for(lock, std::chrono::milliseconds((int)(1000.0 / tf_publish_rate_)),
|
||||
[this] { return (!(is_running_)); });
|
||||
{
|
||||
rclcpp::Time t = node_->now();
|
||||
for (auto& msg : static_tf_msgs_) {
|
||||
msg.header.stamp = t;
|
||||
}
|
||||
dynamic_tf_broadcaster_->sendTransform(static_tf_msgs_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::publishColorFrame(std::shared_ptr<ob::ColorFrame> frame, const rclcpp::Time& t) {
|
||||
RCLCPP_INFO_STREAM(logger_, "publish color frame");
|
||||
format_convert_filter.setFormatConvertType(FORMAT_I420_TO_RGB888);
|
||||
frame = format_convert_filter.process(frame)->as<ob::ColorFrame>();
|
||||
format_convert_filter.setFormatConvertType(FORMAT_RGB888_TO_BGR);
|
||||
frame = format_convert_filter.process(frame)->as<ob::ColorFrame>();
|
||||
auto width = frame->width();
|
||||
auto height = frame->height();
|
||||
auto stream = COLOR;
|
||||
RCLCPP_INFO_STREAM(logger_, "stream " << magic_enum::enum_name(stream.first)
|
||||
<< " get image width " << width << ", height " << height
|
||||
<< ", format " << magic_enum::enum_name(frame->format()));
|
||||
auto& image = images_[stream];
|
||||
if (image.size() != cv::Size(width, height)) {
|
||||
image.create(height, width, image.type());
|
||||
}
|
||||
image.data = (uint8_t*)frame->data();
|
||||
auto& camera_info_publisher = camera_info_publishers_.at(stream);
|
||||
auto& image_publisher = image_publishers_.at(stream);
|
||||
auto& cam_info = camera_infos_.at(stream);
|
||||
if (cam_info.width != width) {
|
||||
RCLCPP_ERROR(logger_, "cam info error");
|
||||
cam_info.height = height;
|
||||
cam_info.width = width;
|
||||
}
|
||||
cam_info.header.stamp = t;
|
||||
camera_info_publisher->publish(cam_info);
|
||||
sensor_msgs::msg::Image::SharedPtr img;
|
||||
img = cv_bridge::CvImage(std_msgs::msg::Header(), encoding_.at(stream), image).toImageMsg();
|
||||
|
||||
img->width = width;
|
||||
img->height = height;
|
||||
img->is_bigendian = false;
|
||||
img->step = width * unit_step_size_[stream];
|
||||
img->header.frame_id = depth_aligned_frame_id_[stream];
|
||||
img->header.stamp = t;
|
||||
image_publisher.publish(img);
|
||||
}
|
||||
|
||||
void OBCameraNode::publishDepthFrame(std::shared_ptr<ob::DepthFrame> frame, const rclcpp::Time& t) {
|
||||
RCLCPP_INFO_STREAM(logger_, "publish depth frame");
|
||||
auto width = frame->width();
|
||||
auto height = frame->height();
|
||||
auto stream = DEPTH;
|
||||
RCLCPP_INFO_STREAM(logger_, "stream " << magic_enum::enum_name(stream.first)
|
||||
<< " get image width " << width << ", height " << height
|
||||
<< ", format " << magic_enum::enum_name(frame->format()));
|
||||
auto& image = images_[stream];
|
||||
if (image.size() != cv::Size(width, height)) {
|
||||
image.create(height, width, image.type());
|
||||
}
|
||||
image.data = (uint8_t*)frame->data();
|
||||
auto& camera_info_publisher = camera_info_publishers_.at(stream);
|
||||
auto& image_publisher = image_publishers_.at(stream);
|
||||
auto& cam_info = camera_infos_.at(stream);
|
||||
if (cam_info.width != width) {
|
||||
RCLCPP_ERROR(logger_, "cam info error");
|
||||
cam_info.height = height;
|
||||
cam_info.width = width;
|
||||
}
|
||||
cam_info.header.stamp = t;
|
||||
camera_info_publisher->publish(cam_info);
|
||||
sensor_msgs::msg::Image::SharedPtr img;
|
||||
img = cv_bridge::CvImage(std_msgs::msg::Header(), encoding_.at(stream), image).toImageMsg();
|
||||
|
||||
img->width = width;
|
||||
img->height = height;
|
||||
img->is_bigendian = false;
|
||||
img->step = width * unit_step_size_[stream];
|
||||
img->header.frame_id = depth_aligned_frame_id_[stream];
|
||||
img->header.stamp = t;
|
||||
image_publisher.publish(img);
|
||||
}
|
||||
|
||||
void OBCameraNode::publishIRFrame(std::shared_ptr<ob::IRFrame> frame, const rclcpp::Time& t) {}
|
||||
|
||||
void OBCameraNode::publishFrame(std::shared_ptr<ob::Frame> frame, const rclcpp::Time& t,
|
||||
const stream_index_pair& stream) {}
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "orbbec_camera/ob_camera_node_factory.h"
|
||||
namespace orbbec_camera {
|
||||
OBCameraNodeFactory::OBCameraNodeFactory(const rclcpp::NodeOptions &node_options)
|
||||
: Node("orbbec_camera_node", "/", node_options),
|
||||
ctx_(std::make_unique<ob::Context>()),
|
||||
logger_(this->get_logger()) {
|
||||
init();
|
||||
}
|
||||
OBCameraNodeFactory::OBCameraNodeFactory(const std::string &node_name, const std::string &ns,
|
||||
const rclcpp::NodeOptions &node_options)
|
||||
: Node(node_name, ns, node_options),
|
||||
ctx_(std::make_unique<ob::Context>()),
|
||||
logger_(this->get_logger()) {
|
||||
init();
|
||||
}
|
||||
|
||||
OBCameraNodeFactory::~OBCameraNodeFactory() {
|
||||
is_alive_.store(false);
|
||||
if (query_thread_.joinable()) {
|
||||
query_thread_.join();
|
||||
}
|
||||
}
|
||||
void OBCameraNodeFactory::init() {
|
||||
is_alive_.store(true);
|
||||
serial_number_ = declare_parameter<std::string>("serial_number", "BX4NC10000S");
|
||||
query_thread_ = std::thread([=]() {
|
||||
std::chrono::milliseconds timespan(static_cast<int>(reconnect_timeout_ * 1e3));
|
||||
rclcpp::Time first_try_time = this->now();
|
||||
while (is_alive_ && !device_) {
|
||||
CHECK_NOTNULL(ctx_);
|
||||
auto list = ctx_->queryDeviceList();
|
||||
getDevice(list);
|
||||
if (device_) {
|
||||
ctx_->setDeviceChangedCallback([this](std::shared_ptr<ob::DeviceList> removed_list,
|
||||
std::shared_ptr<ob::DeviceList> added_list) {
|
||||
deviceDisconnectCallback(removed_list);
|
||||
deviceConnectCallback(added_list);
|
||||
});
|
||||
startDevice();
|
||||
} else {
|
||||
std::chrono::milliseconds actual_timespan(timespan);
|
||||
if (wait_for_device_timeout_ > 0) {
|
||||
auto time_to_timeout(wait_for_device_timeout_ -
|
||||
(this->get_clock()->now() - first_try_time).seconds());
|
||||
if (time_to_timeout < 0) {
|
||||
RCLCPP_ERROR_STREAM(logger_, "wait for device timeout of " << wait_for_device_timeout_
|
||||
<< " secs expired");
|
||||
exit(1);
|
||||
} else {
|
||||
double max_timespan_secs = static_cast<double>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(timespan).count());
|
||||
actual_timespan = std::chrono::milliseconds(
|
||||
static_cast<int>(std::min(max_timespan_secs, time_to_timeout) * 1e3));
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(actual_timespan);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void OBCameraNodeFactory::deviceConnectCallback(
|
||||
const std::shared_ptr<ob::DeviceList> &device_list) {
|
||||
CHECK_NOTNULL(device_list);
|
||||
if (!device_) {
|
||||
getDevice(device_list);
|
||||
if (device_) {
|
||||
startDevice();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNodeFactory::deviceDisconnectCallback(
|
||||
const std::shared_ptr<ob::DeviceList> &device_list) {
|
||||
CHECK_NOTNULL(device_list);
|
||||
auto dev = device_list->getDeviceBySN(serial_number_.c_str());
|
||||
if (dev) {
|
||||
RCLCPP_ERROR_STREAM(logger_, "The device has been disconnected!");
|
||||
ob_camera_node_.reset(nullptr);
|
||||
device_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNodeFactory::getDevice(const std::shared_ptr<ob::DeviceList> &list) {
|
||||
if (device_) {
|
||||
return;
|
||||
}
|
||||
if (0 == list->deviceCount()) {
|
||||
RCLCPP_WARN_STREAM(logger_, "No orbbec devices were found!");
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < list->deviceCount(); i++) {
|
||||
auto dev = list->getDevice(i);
|
||||
if (dev != nullptr) {
|
||||
device_ = dev;
|
||||
RCLCPP_INFO_STREAM(logger_, "get device name " << dev->getDeviceInfo()->name());
|
||||
RCLCPP_INFO_STREAM(logger_, "get device pid " << dev->getDeviceInfo()->pid());
|
||||
RCLCPP_INFO_STREAM(logger_, "get device vid " << dev->getDeviceInfo()->vid());
|
||||
RCLCPP_INFO_STREAM(logger_,
|
||||
"get device serial_name " << dev->getDeviceInfo()->serialNumber());
|
||||
RCLCPP_INFO_STREAM(logger_,
|
||||
"get device firmware version " << dev->getDeviceInfo()->firmwareVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNodeFactory::startDevice() {
|
||||
if (ob_camera_node_) {
|
||||
ob_camera_node_.reset();
|
||||
}
|
||||
CHECK_NOTNULL(device_);
|
||||
ob_camera_node_ = std::make_unique<OBCameraNode>(this, device_);
|
||||
}
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,133 @@
|
||||
#include "orbbec_camera/utils.h"
|
||||
namespace orbbec_camera {
|
||||
sensor_msgs::msg::CameraInfo convertToCameraInfo(OBCameraIntrinsic intrinsic,
|
||||
OBCameraDistortion distortion) {
|
||||
sensor_msgs::msg::CameraInfo info;
|
||||
info.distortion_model = sensor_msgs::distortion_models::PLUMB_BOB;
|
||||
info.width = intrinsic.width;
|
||||
info.height = intrinsic.height;
|
||||
info.d.resize(5, 0.0);
|
||||
info.d[0] = distortion.k1;
|
||||
info.d[1] = distortion.k2;
|
||||
info.d[2] = distortion.k3;
|
||||
info.d[3] = distortion.k4;
|
||||
info.d[4] = distortion.k5;
|
||||
|
||||
info.k.fill(0.0);
|
||||
info.k[0] = intrinsic.fx;
|
||||
info.k[2] = intrinsic.cx;
|
||||
info.k[4] = intrinsic.fy;
|
||||
info.k[5] = intrinsic.cy;
|
||||
info.k[8] = 1.0;
|
||||
|
||||
info.r.fill(0.0);
|
||||
info.r[0] = 1;
|
||||
info.r[4] = 1;
|
||||
info.r[8] = 1;
|
||||
|
||||
info.p.fill(0.0);
|
||||
info.p[0] = info.k[0];
|
||||
info.p[2] = info.k[2];
|
||||
info.p[5] = info.k[4];
|
||||
info.p[6] = info.k[5];
|
||||
info.p[10] = 1.0;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void saveRGBPointsToPly(std::shared_ptr<ob::Frame> frame, std::string fileName) {
|
||||
size_t point_size = frame->dataSize() / sizeof(OBColorPoint);
|
||||
FILE *fp = fopen(fileName.c_str(), "wb+");
|
||||
fprintf(fp, "ply\n");
|
||||
fprintf(fp, "format ascii 1.0\n");
|
||||
fprintf(fp, "element vertex %zu\n", point_size);
|
||||
fprintf(fp, "property float x\n");
|
||||
fprintf(fp, "property float y\n");
|
||||
fprintf(fp, "property float z\n");
|
||||
fprintf(fp, "property uchar red\n");
|
||||
fprintf(fp, "property uchar green\n");
|
||||
fprintf(fp, "property uchar blue\n");
|
||||
fprintf(fp, "end_header\n");
|
||||
|
||||
auto *point = (OBColorPoint *)frame->data();
|
||||
for (size_t i = 0; i < point_size; i++) {
|
||||
fprintf(fp, "%.3f %.3f %.3f %d %d %d\n", point->x, point->y, point->z, (int)point->r,
|
||||
(int)point->g, (int)point->b);
|
||||
point++;
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void savePointsToPly(std::shared_ptr<ob::Frame> frame, std::string fileName) {
|
||||
size_t point_size = frame->dataSize() / sizeof(OBPoint);
|
||||
FILE *fp = fopen(fileName.c_str(), "wb+");
|
||||
fprintf(fp, "ply\n");
|
||||
fprintf(fp, "format ascii 1.0\n");
|
||||
fprintf(fp, "element vertex %zu\n", point_size);
|
||||
fprintf(fp, "property float x\n");
|
||||
fprintf(fp, "property float y\n");
|
||||
fprintf(fp, "property float z\n");
|
||||
fprintf(fp, "end_header\n");
|
||||
|
||||
auto *points = (OBPoint *)frame->data();
|
||||
for (size_t i = 0; i < point_size; i++) {
|
||||
fprintf(fp, "%.3f %.3f %.3f\n", points->x, points->y, points->z);
|
||||
points++;
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
tf2::Quaternion rotationMatrixToQuaternion(const float rotation[9]) {
|
||||
Eigen::Matrix3f m;
|
||||
// We need to be careful about the order, as RS2 rotation matrix is
|
||||
// column-major, while Eigen::Matrix3f expects row-major.
|
||||
m << rotation[0], rotation[3], rotation[6], rotation[1], rotation[4], rotation[7], rotation[2],
|
||||
rotation[5], rotation[8];
|
||||
Eigen::Quaternionf q(m);
|
||||
return {q.x(), q.y(), q.z(), q.w()};
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &os, const OBCameraParam &rhs) {
|
||||
auto depth_intrinsic = rhs.depthIntrinsic;
|
||||
auto rgb_intrinsic = rhs.rgbIntrinsic;
|
||||
os << "=====depth intrinsic=====\n";
|
||||
os << "fx : " << depth_intrinsic.fx << "\n";
|
||||
os << "fy : " << depth_intrinsic.fy << "\n";
|
||||
os << "cx : " << depth_intrinsic.cx << "\n";
|
||||
os << "cy : " << depth_intrinsic.cy << "\n";
|
||||
os << "width : " << depth_intrinsic.width << "\n";
|
||||
os << "height : " << depth_intrinsic.height << "\n";
|
||||
os << "=====rgb intrinsic=====\n";
|
||||
os << "fx : " << rgb_intrinsic.fx << "\n";
|
||||
os << "fy : " << rgb_intrinsic.fy << "\n";
|
||||
os << "cx : " << rgb_intrinsic.cx << "\n";
|
||||
os << "cy : " << rgb_intrinsic.cy << "\n";
|
||||
os << "width : " << rgb_intrinsic.width << "\n";
|
||||
os << "height : " << rgb_intrinsic.height << "\n";
|
||||
return os;
|
||||
}
|
||||
std::string strToLowercase(const std::string &str) {
|
||||
std::string ret;
|
||||
for (char ch : str) {
|
||||
ret += tolower(ch);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
orbbec_camera_msgs::msg::Extrinsics obExtrinsicsToMsg(const OBD2CTransform &extrinsics,
|
||||
const std::string &frame_id) {
|
||||
orbbec_camera_msgs::msg::Extrinsics msg;
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
msg.rotation[i] = extrinsics.rot[i];
|
||||
if (i < 3) {
|
||||
msg.translation[i] = extrinsics.trans[i];
|
||||
}
|
||||
}
|
||||
|
||||
msg.header.frame_id = frame_id;
|
||||
return msg;
|
||||
}
|
||||
} // namespace orbbec_camera
|
||||
@@ -0,0 +1,40 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(orbbec_camera_msgs)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif ()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(rosidl_default_generators REQUIRED)
|
||||
find_package(sensor_msgs REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
# uncomment the following section in order to fill in
|
||||
# further dependencies manually.
|
||||
# find_package(<dependency> REQUIRED)
|
||||
|
||||
rosidl_generate_interfaces(${PROJECT_NAME}
|
||||
"msg/DeviceInfo.msg"
|
||||
"msg/Extrinsics.msg"
|
||||
"msg/Metadata.msg"
|
||||
"srv/GetDeviceList.srv"
|
||||
"srv/GetCameraInfo.srv"
|
||||
"srv/GetInt32.srv"
|
||||
"srv/SetInt32.srv"
|
||||
DEPENDENCIES
|
||||
sensor_msgs
|
||||
std_msgs)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
# the following line skips the linter which checks for copyrights
|
||||
# uncomment the line when a copyright and license is not present in all source files
|
||||
#set(ament_cmake_copyright_FOUND TRUE)
|
||||
# the following line skips cpplint (only works in a git repo)
|
||||
# uncomment the line when this package is not in a git repo
|
||||
#set(ament_cmake_cpplint_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif ()
|
||||
|
||||
ament_package()
|
||||
@@ -0,0 +1,5 @@
|
||||
std_msgs/Header header
|
||||
string name
|
||||
int32 vid
|
||||
int32 pid
|
||||
string serial_number
|
||||
@@ -0,0 +1,3 @@
|
||||
std_msgs/Header header
|
||||
float64[9] rotation
|
||||
float64[3] translation
|
||||
@@ -0,0 +1,2 @@
|
||||
std_msgs/Header header
|
||||
string json_data
|
||||
@@ -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>orbbec_camera_msgs</name>
|
||||
<version>1.0.0</version>
|
||||
<description>A package containing orbbec camera messages definitions.</description>
|
||||
<maintainer email="mocun@orbbec.com">Jian Dong</maintainer>
|
||||
<license>all copyrights reserved</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
<build_depend>rosidl_default_generators</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<exec_depend>rosidl_default_runtime</exec_depend>
|
||||
<exec_depend>sensor_msgs</exec_depend>
|
||||
<member_of_group>rosidl_interface_packages</member_of_group>
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
sensor_msgs/CameraInfo info
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
DeviceInfo[] dev_infos
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
int32 data
|
||||
string message
|
||||
@@ -0,0 +1,4 @@
|
||||
int32 data
|
||||
---
|
||||
bool success
|
||||
string message
|
||||
Reference in New Issue
Block a user