├── .bashrc
├── Dockerfile
├── LICENSE
├── README.md
├── docs
└── logos
│ ├── qualisys_logo.png
│ └── vicon_logo.jpeg
├── mocap_base
├── CMakeLists.txt
├── include
│ └── mocap_base
│ │ ├── KalmanFilter.h
│ │ └── MoCapDriverBase.h
├── package.xml
└── src
│ ├── KalmanFilter.cpp
│ └── MoCapDriverBase.cpp
├── mocap_vicon
├── CMakeLists.txt
├── config
│ └── model_list.yaml
├── include
│ └── mocap_vicon
│ │ └── ViconDriver.h
├── launch
│ └── vicon_launch.py
├── package.xml
└── src
│ ├── ViconDriver.cpp
│ ├── vicon.cpp
│ └── vicon_sdk
│ ├── CMakeLists.txt
│ └── Vicon
│ └── CrossMarket
│ ├── DataStream
│ ├── ViconCGStream
│ │ ├── ApexHaptics.h
│ │ ├── ApplicationInfo.h
│ │ ├── CameraCalibrationHealth.h
│ │ ├── CameraCalibrationHealthDetail.h
│ │ ├── CameraCalibrationInfo.h
│ │ ├── CameraInfo.h
│ │ ├── CameraTimingInfo.h
│ │ ├── CameraWand2d.h
│ │ ├── CameraWand2dDetail.h
│ │ ├── CameraWand3d.h
│ │ ├── CameraWand3dDetail.h
│ │ ├── CentreOfPressureFrame.h
│ │ ├── CentroidTracks.h
│ │ ├── CentroidTracksDetail.h
│ │ ├── CentroidWeights.h
│ │ ├── Centroids.h
│ │ ├── CentroidsDetail.h
│ │ ├── ChannelInfo.h
│ │ ├── Contents.h
│ │ ├── DeviceInfo.h
│ │ ├── Dummy.cpp
│ │ ├── EdgePairs.h
│ │ ├── EdgePairsDetail.h
│ │ ├── Enum.h
│ │ ├── EyeTrackerFrame.h
│ │ ├── EyeTrackerInfo.h
│ │ ├── Filter.h
│ │ ├── ForceFrame.h
│ │ ├── ForcePlateInfo.h
│ │ ├── FrameInfo.h
│ │ ├── FrameRateInfo.h
│ │ ├── GlobalSegments.h
│ │ ├── GlobalSegmentsDetail.h
│ │ ├── GreyscaleBlobs.h
│ │ ├── GreyscaleBlobsDetail.h
│ │ ├── HardwareFrameInfo.h
│ │ ├── IsEqual.h
│ │ ├── Item.h
│ │ ├── KeepAlive.h
│ │ ├── LabeledReconRayAssignments.h
│ │ ├── LabeledRecons.h
│ │ ├── LabeledReconsDetail.h
│ │ ├── LatencyInfo.h
│ │ ├── LatencyInfoDetail.h
│ │ ├── LocalSegments.h
│ │ ├── LocalSegmentsDetail.h
│ │ ├── MomentFrame.h
│ │ ├── ObjectEnums.h
│ │ ├── ObjectQuality.h
│ │ ├── ReconRayAssignmentsDetail.h
│ │ ├── RequestFrame.h
│ │ ├── ScopedReader.h
│ │ ├── ScopedWriter.h
│ │ ├── StartMulticastSender.h
│ │ ├── StopMulticastSender.h
│ │ ├── StreamInfo.h
│ │ ├── SubjectHealth.h
│ │ ├── SubjectInfo.h
│ │ ├── SubjectInfoDetail.h
│ │ ├── SubjectTopology.h
│ │ ├── SubjectTopologyDetail.h
│ │ ├── Timecode.h
│ │ ├── UnlabeledReconRayAssignments.h
│ │ ├── UnlabeledRecons.h
│ │ ├── UnlabeledReconsDetail.h
│ │ ├── VideoFrame.h
│ │ ├── VoltageFrame.h
│ │ └── makefile
│ ├── ViconCGStreamClient
│ │ ├── CGStreamReaderWriter.cpp
│ │ ├── CGStreamReaderWriter.h
│ │ ├── IViconCGStreamClientCallback.h
│ │ ├── ViconCGStreamBayer.cpp
│ │ ├── ViconCGStreamBayer.h
│ │ ├── ViconCGStreamClient.cpp
│ │ ├── ViconCGStreamClient.h
│ │ └── makefile
│ ├── ViconCGStreamClientSDK
│ │ ├── CGClient.cpp
│ │ ├── CGClient.h
│ │ ├── ICGClient.h
│ │ ├── ICGFrameState.h
│ │ └── makefile
│ ├── ViconDataStreamSDKCore
│ │ ├── AxisMapping.cpp
│ │ ├── AxisMapping.h
│ │ ├── ClientUtils.cpp
│ │ ├── ClientUtils.h
│ │ ├── Constants.h
│ │ ├── CoreClient.cpp
│ │ ├── CoreClient.h
│ │ ├── RetimerUtils.cpp
│ │ ├── RetimerUtils.h
│ │ ├── RetimingClient.cpp
│ │ ├── RetimingClient.h
│ │ ├── ViconDataStreamSDKCoreVersion.h
│ │ └── makefile
│ ├── ViconDataStreamSDK_C
│ │ ├── CClient.cpp
│ │ ├── CClient.h
│ │ ├── CRetimingClient.cpp
│ │ ├── CRetimingClient.h
│ │ ├── CTypeDefs.h
│ │ ├── VersionInfoResource.rc2
│ │ ├── ViconDataStreamSDK_C.rc
│ │ ├── ViconDataStreamSDK_CVersion.h
│ │ ├── makefile
│ │ └── resource.h
│ ├── ViconDataStreamSDK_CPP
│ │ ├── CoreAdapters.h
│ │ ├── DataStreamClient.cpp
│ │ ├── DataStreamClient.h
│ │ ├── DataStreamRetimingClient.cpp
│ │ ├── DataStreamRetimingClient.h
│ │ ├── IDataStreamClientBase.h
│ │ ├── ReadMe.txt
│ │ ├── StringFactory.h
│ │ ├── VersionInfoResource.rc2
│ │ ├── ViconDataStreamSDK_CPP.rc
│ │ ├── ViconDataStreamSDK_CPPVersion.h
│ │ ├── makefile
│ │ └── resource.h
│ ├── ViconDataStreamSDK_CPPRetimerTest
│ │ ├── ViconDataStreamSDK_CPPRetimerTest.cpp
│ │ └── makefile
│ ├── ViconDataStreamSDK_CPPTest
│ │ ├── ViconDataStreamSDK_CPPTest.cpp
│ │ └── makefile
│ └── ViconDataStreamSDK_CTest
│ │ ├── ViconDataStreamSDK_CTest.c
│ │ └── makefile
│ └── StreamCommon
│ ├── Buffer.h
│ ├── BufferDetail.h
│ ├── BufferImpl.h
│ ├── CGStreamAsyncReaderWriter.cpp
│ ├── CGStreamAsyncReaderWriter.h
│ ├── Type.h
│ └── makefile
└── run_ros2_docker.sh
/.bashrc:
--------------------------------------------------------------------------------
1 | # ~/.bashrc: executed by bash(1) for non-login shells.
2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3 | # for examples
4 |
5 | # If not running interactively, don't do anything
6 | [ -z "$PS1" ] && return
7 |
8 | # don't put duplicate lines in the history. See bash(1) for more options
9 | # ... or force ignoredups and ignorespace
10 | HISTCONTROL=ignoredups:ignorespace
11 |
12 | # append to the history file, don't overwrite it
13 | shopt -s histappend
14 |
15 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
16 | HISTSIZE=1000
17 | HISTFILESIZE=2000
18 |
19 | # check the window size after each command and, if necessary,
20 | # update the values of LINES and COLUMNS.
21 | shopt -s checkwinsize
22 |
23 | # make less more friendly for non-text input files, see lesspipe(1)
24 | [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
25 |
26 | # set variable identifying the chroot you work in (used in the prompt below)
27 | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
28 | debian_chroot=$(cat /etc/debian_chroot)
29 | fi
30 |
31 | # set a fancy prompt (non-color, unless we know we "want" color)
32 | case "$TERM" in
33 | xterm-color) color_prompt=yes;;
34 | esac
35 |
36 | # uncomment for a colored prompt, if the terminal has the capability; turned
37 | # off by default to not distract the user: the focus in a terminal window
38 | # should be on the output of commands, not on the prompt
39 | #force_color_prompt=yes
40 |
41 | if [ -n "$force_color_prompt" ]; then
42 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
43 | # We have color support; assume it's compliant with Ecma-48
44 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
45 | # a case would tend to support setf rather than setaf.)
46 | color_prompt=yes
47 | else
48 | color_prompt=
49 | fi
50 | fi
51 |
52 | if [ "$color_prompt" = yes ]; then
53 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
54 | else
55 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
56 | fi
57 | unset color_prompt force_color_prompt
58 |
59 | # If this is an xterm set the title to user@host:dir
60 | case "$TERM" in
61 | xterm*|rxvt*)
62 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
63 | ;;
64 | *)
65 | ;;
66 | esac
67 |
68 | # enable color support of ls and also add handy aliases
69 | if [ -x /usr/bin/dircolors ]; then
70 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
71 | alias ls='ls --color=auto'
72 | #alias dir='dir --color=auto'
73 | #alias vdir='vdir --color=auto'
74 |
75 | alias grep='grep --color=auto'
76 | alias fgrep='fgrep --color=auto'
77 | alias egrep='egrep --color=auto'
78 | fi
79 |
80 | # some more ls aliases
81 | alias ll='ls -alF'
82 | alias la='ls -A'
83 | alias l='ls -CF'
84 |
85 | # Alias definitions.
86 | # You may want to put all your additions into a separate file like
87 | # ~/.bash_aliases, instead of adding them here directly.
88 | # See /usr/share/doc/bash-doc/examples in the bash-doc package.
89 |
90 | if [ -f ~/.bash_aliases ]; then
91 | . ~/.bash_aliases
92 | fi
93 |
94 | # enable programmable completion features (you don't need to enable
95 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
96 | # sources /etc/bash.bashrc).
97 | #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
98 | # . /etc/bash_completion
99 | #fi
100 | . /opt/ros/humble/setup.bash
101 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM osrf/ros:humble-desktop
2 | # nvidia-container-runtime
3 | ENV NVIDIA_VISIBLE_DEVICES=all
4 | ENV NVIDIA_DRIVER_CAPABILITIES=all
5 |
6 | #ROS-Domain
7 | ENV ROS_DOMAIN_ID=1
8 | LABEL maintainer="kashg@seas.upenn.edu"
9 |
10 | RUN mkdir -p /run/user/1000
11 | RUN chmod 0700 /run/user/1000
12 |
13 | RUN apt-get update && apt-get install -y \
14 | vim \
15 | python3-pip \
16 | iproute2 \
17 | ros-humble-tf2-eigen
18 | RUN mkdir -p ~/ros_ws/src/motion_capture_system/
19 | WORKDIR /root/ros_ws/src/motion_capture_system
20 |
21 | # ROS2 Specific
22 | COPY ./mocap_base ./mocap_base
23 | COPY ./mocap_qualisys ./mocap_qualisys
24 | COPY ./mocap_vicon ./mocap_vicon
25 |
26 | # Dev Specific
27 | # COPY ./bags ../../../
28 | COPY ./.bashrc ../../../
29 |
30 | WORKDIR /root/ros_ws/
31 | #RUN . /opt/ros/humble/setup.sh && colcon build
32 |
33 |
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ROS Driver for Motion Capture Systems
2 |
3 |
4 |
5 |
6 | This package contains ROS drivers for two different motion capture systems,**VICON** And **QUALISYS**.
7 |
8 | ## License
9 | For the VICON driver, we use the [offical SDK](http://www.vicon.com/products/software/datastream-sdk).
10 |
11 | For the QUALISYS driver, we use the interface from [Qualisys2Ros](https://github.com/omwdunkley/Qualisys2Ros).
12 |
13 | For the rest of the software, the license is Apache 2.0 wherever not specified.
14 |
15 | ## Compiling
16 | This is a catkin package. Make sure the package is on `ROS_PACKAGE_PATH` after cloning the package to your workspace. Drivers for different motion capture system can be independently compiled.
17 |
18 | ```
19 | cd your_work_space
20 | catkin_make --pkg mocap_{sys} --cmake-args -DCMAKE_BUILD_TYPE=Release
21 | ```
22 |
23 | This will compile the drivers for `{sys}`
24 |
25 | ## Example Usage
26 |
27 | **Common Parameters**
28 |
29 | `server` (`string`)
30 |
31 | Address of the server of the motion capture system to be connected.
32 |
33 | `frame_rate` (`int`, `default: 100`)
34 |
35 | The frame rate of the motion capture system
36 |
37 | `max_accel` (`double`, `default: 10.0`)
38 |
39 | The max possible acceleration which serves to construct the noise parameters.
40 |
41 | `publish_tf` (`bool`, `default: false`)
42 |
43 | If set to true, tf msgs for the subjects are published.
44 |
45 | `fixed_frame_id` (`string`, `mocap`)
46 |
47 | The fixed frame ID of the tf msgs for each subject. Note that the child frame id is automatically set to the name of the subject.
48 |
49 | `model_list` (`vector`, `default: []`)
50 |
51 | A vector of subjects of interest. Leave the vector empty if all subjects are to be tracked.
52 |
53 | **Published Topics**
54 |
55 | `/{mocap_sys}/{subject_name}/odom` (`nav_msgs/Odometry`)
56 |
57 | Odometry message for each specified subject in `model_list`.
58 |
59 | To be compatible with the name of the topics published of `vicon_odom` in [vicon repo of KumarRobotics](https://github.com/KumarRobotics/vicon), you can uncomment the following line in the launch file:
60 | ``
61 |
62 | **Node**
63 |
64 | `roslaunch {mocap_sys} {sys}.launch`
65 |
66 | For example,
67 |
68 | `roslaunch mocap_vicon vicon.launch`
69 |
70 | ## FAQ
71 |
72 | 1. Will the msgs be delayed if the driver is handling several subjects?
73 | The driver is multi-threaded. It uses different threads to process the msg from different subjects. So, emmmmm, don't worry =).
74 |
75 | 2. How to calibrate the transformation between the subject frame (centered at the centroid of the markers) and the body frame of a robot?
76 | This functionality is not provided, since few people use that now. If you really want that, please consider [vicon repo of KumarRobotics](https://github.com/KumarRobotics/vicon) or [vicon_bridge repo of ethz-asl](https://github.com/ethz-asl/vicon_bridge).
77 |
78 | ## Bug Report
79 |
80 | Prefer to open an issue. You can also send an e-mail to sunke.polyu@gmail.com.
81 |
82 | ## OSX Support
83 |
84 | You will need to compile ROS from source for OSX first. The vicon node is supported, but the qualisys node is not. There are no current plans to extend compatibility to OSX for the qualisys driver.
85 |
--------------------------------------------------------------------------------
/docs/logos/qualisys_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KumarRobotics/motion_capture_system/2592b1eca1718c4eb562b462021da5486d5661ff/docs/logos/qualisys_logo.png
--------------------------------------------------------------------------------
/docs/logos/vicon_logo.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KumarRobotics/motion_capture_system/2592b1eca1718c4eb562b462021da5486d5661ff/docs/logos/vicon_logo.jpeg
--------------------------------------------------------------------------------
/mocap_base/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(mocap_base)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | # Find dependencies
9 | find_package(ament_cmake REQUIRED)
10 | find_package(rclcpp REQUIRED)
11 | find_package(Boost REQUIRED)
12 | find_package(Eigen3 REQUIRED)
13 | find_package(geometry_msgs REQUIRED)
14 | find_package(tf2_ros REQUIRED)
15 | find_package(tf2_eigen REQUIRED)
16 | find_package(nav_msgs REQUIRED)
17 |
18 | # Include directories
19 | include_directories(
20 | include
21 | ${Eigen3_INCLUDE_DIRS}
22 | ${Boost_INCLUDE_DIRS}
23 | )
24 |
25 | # Kalman Filter Library
26 | add_library(mocap_kalman_filter SHARED
27 | src/KalmanFilter.cpp
28 | )
29 |
30 | target_link_libraries(mocap_kalman_filter
31 | ${Boost_LIBRARIES}
32 | Eigen3::Eigen
33 | )
34 | ament_target_dependencies(mocap_kalman_filter Eigen3 rclcpp)
35 |
36 | # MoCap Driver Library
37 | add_library(mocap_base_driver SHARED
38 | src/MoCapDriverBase.cpp
39 | )
40 |
41 | ament_target_dependencies(mocap_base_driver
42 | rclcpp
43 | geometry_msgs
44 | tf2_eigen
45 | tf2_ros
46 | nav_msgs
47 | )
48 |
49 | target_link_libraries(mocap_base_driver
50 | mocap_kalman_filter
51 | )
52 | ament_export_targets(export_mocap_base_driver HAS_LIBRARY_TARGET)
53 | ament_export_include_directories(include)
54 |
55 | install(
56 | DIRECTORY include/
57 | DESTINATION include
58 | )
59 |
60 | install(
61 | TARGETS mocap_base_driver mocap_kalman_filter
62 | EXPORT export_mocap_base_driver
63 | ARCHIVE DESTINATION lib
64 | LIBRARY DESTINATION lib
65 | RUNTIME DESTINATION bin
66 | INCLUDES DESTINATION include
67 | )
68 |
69 | if(BUILD_TESTING)
70 | find_package(ament_lint_auto REQUIRED)
71 | # the following line skips the linter which checks for copyrights
72 | # comment the line when a copyright and license is added to all source files
73 | set(ament_cmake_copyright_FOUND TRUE)
74 | # the following line skips cpplint (only works in a git repo)
75 | # comment the line when this package is in a git repo and when
76 | # a copyright and license is added to all source files
77 | set(ament_cmake_cpplint_FOUND TRUE)
78 | ament_lint_auto_find_test_dependencies()
79 | endif()
80 |
81 | ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
82 | ament_package()
83 |
84 |
85 |
--------------------------------------------------------------------------------
/mocap_base/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | mocap_base
4 | 0.0.1
5 | Base class for different motion capture systems
6 |
7 | Ke Sun
8 | Kashsh Garg
9 | Apache-2.0
10 | Ke Sun
11 |
12 | ament_cmake
13 | geometry_msgs
14 | rclcpp
15 | eigen_conversions
16 |
17 |
18 | ament_cmake
19 |
20 |
21 |
--------------------------------------------------------------------------------
/mocap_vicon/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(mocap_vicon)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/install/mocap_base/lib/mocap_base/")
9 |
10 | find_package(ament_cmake REQUIRED)
11 | find_package(rclcpp REQUIRED)
12 | find_package(tf2_eigen REQUIRED)
13 | find_package(tf2_ros REQUIRED)
14 | find_package(mocap_base REQUIRED)
15 | find_package(geometry_msgs REQUIRED)
16 | find_package(nav_msgs REQUIRED)
17 | find_package(Boost REQUIRED COMPONENTS thread chrono)
18 | find_package(Eigen3 REQUIRED)
19 |
20 | # find_package(catkin REQUIRED COMPONENTS
21 | # roscpp
22 | # geometry_msgs
23 | # tf
24 | # tf_conversions
25 | # mocap_base
26 | # )
27 |
28 | # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
29 |
30 | # Include directories
31 | include_directories(
32 | include
33 | ${Eigen3_INCLUDE_DIRS}
34 | ${Boost_INCLUDE_DIRS}
35 | ${mocap_base_INCLUDE_DIRS}
36 | )
37 |
38 |
39 | add_subdirectory(src/vicon_sdk)
40 |
41 | add_library(mocap_vicon_driver
42 | src/ViconDriver.cpp
43 | )
44 |
45 | target_include_directories(mocap_vicon_driver PUBLIC
46 | $
47 | $
48 | )
49 |
50 | ament_target_dependencies(mocap_vicon_driver mocap_base Eigen3 rclcpp tf2_eigen geometry_msgs nav_msgs)
51 |
52 | target_link_libraries(mocap_vicon_driver
53 | ViconDataStreamSDK_CPP
54 | ${VICON_BOOST_LIBS}
55 | Eigen3::Eigen
56 | )
57 |
58 | install(TARGETS mocap_vicon_driver
59 | DESTINATION lib
60 | )
61 |
62 | add_executable(mocap_vicon_node
63 | src/vicon.cpp
64 | )
65 |
66 | target_link_libraries(mocap_vicon_node
67 | mocap_vicon_driver
68 | ViconDataStreamSDK_CPP
69 | ${VICON_BOOST_LIBS}
70 | Eigen3::Eigen
71 |
72 | )
73 |
74 | ament_target_dependencies(mocap_vicon_node mocap_base Eigen3 rclcpp tf2_eigen geometry_msgs nav_msgs)
75 |
76 | install(TARGETS mocap_vicon_node
77 | DESTINATION lib/${PROJECT_NAME}/
78 | )
79 | install(
80 | DIRECTORY launch/
81 | DESTINATION share/${PROJECT_NAME}/
82 | )
83 | if(BUILD_TESTING)
84 | find_package(ament_lint_auto REQUIRED)
85 | # the following line skips the linter which checks for copyrights
86 | # comment the line when a copyright and license is added to all source files
87 | set(ament_cmake_copyright_FOUND TRUE)
88 | # the following line skips cpplint (only works in a git repo)
89 | # comment the line when this package is in a git repo and when
90 | # a copyright and license is added to all source files
91 | set(ament_cmake_cpplint_FOUND TRUE)
92 | ament_lint_auto_find_test_dependencies()
93 | endif()
94 |
95 | ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
96 | ament_package()
97 |
--------------------------------------------------------------------------------
/mocap_vicon/config/model_list.yaml:
--------------------------------------------------------------------------------
1 | model_list: ["box0"]
2 |
--------------------------------------------------------------------------------
/mocap_vicon/include/mocap_vicon/ViconDriver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2015]
3 | * [Kartik Mohta ]
4 | * [Ke Sun ]
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | #ifndef VICON_DRIVER_H
20 | #define VICON_DRIVER_H
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | // #include
28 | #include "rclcpp/rclcpp.hpp"
29 | #include
30 | #include "ViconDataStreamSDK_CPP/DataStreamClient.h" // From Vicon's SDK
31 |
32 |
33 | namespace mocap{
34 |
35 | class ViconDriver: public MoCapDriverBase {
36 |
37 | public:
38 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW
39 | /*
40 | * @brief Constructor
41 | * @param nh Ros node
42 | */
43 | ViconDriver(const std::shared_ptr n):
44 | MoCapDriverBase (n),
45 | client (new ViconDataStreamSDK::CPP::Client()),
46 | max_accel (10.0),
47 | frame_interval (0.01),
48 | process_noise (Eigen::Matrix::Zero()),
49 | measurement_noise (Eigen::Matrix::Zero()) {
50 | return;
51 | }
52 |
53 | /*
54 | * @brief Destructor
55 | */
56 | ~ViconDriver() {
57 | disconnect();
58 | delete client;
59 | return;
60 | }
61 |
62 | /*
63 | * @brief init Initialize the object
64 | * @return True if successfully initialized
65 | */
66 | bool init();
67 |
68 | /*
69 | * @brief run Start acquiring data from the server
70 | */
71 | void run();
72 |
73 | /*
74 | * @brief disconnect Disconnect to the server
75 | * @Note The function is called automatically when the
76 | * destructor is called.
77 | */
78 | void disconnect();
79 |
80 | private:
81 | // Disable the copy constructor and assign operator
82 | ViconDriver(const ViconDriver& );
83 | ViconDriver& operator=(const ViconDriver& );
84 |
85 | // Handle a frame which contains the info of all subjects
86 | void handleFrame();
87 |
88 | // Handle a the info of a single subject
89 | void handleSubject(const int& sub_idx);
90 |
91 | // Portal to communicate with the server
92 | ViconDataStreamSDK::CPP::Client* client;
93 |
94 | // Max acceleration
95 | double max_accel;
96 |
97 | // Average time interval between two frames
98 | double frame_interval;
99 |
100 | // A set to hold the model names
101 | std::set model_set;
102 |
103 | // Convariance matrices for initializing kalman filters
104 | Eigen::Matrix process_noise;
105 | Eigen::Matrix measurement_noise;
106 |
107 | // For multi-threading
108 | boost::shared_mutex mtx;
109 |
110 | };
111 | }
112 |
113 |
114 | #endif
115 |
--------------------------------------------------------------------------------
/mocap_vicon/launch/vicon_launch.py:
--------------------------------------------------------------------------------
1 | from launch import LaunchDescription
2 | from launch_ros.actions import Node
3 |
4 | def generate_launch_description():
5 | return LaunchDescription([
6 | Node(
7 | package='mocap_vicon',
8 | executable='mocap_vicon_node',
9 | name='vicon',
10 | output='screen',
11 | parameters=[
12 | {'server_address': 'mocap.perch'},
13 | {'frame_rate': 100},
14 | {'max_accel': 10.0},
15 | {'publish_tf': False},
16 | {'publish_pts': False},
17 | {'fixed_frame_id': 'mocap'},
18 | # Set to [''] to take in ALL models from Vicon
19 | {'model_list': ['']},
20 | ],
21 | remappings=[
22 | # Uncomment and modify the remapping if needed
23 | # ('vicon/model_name/odom', '/model_name/odom'),
24 | ]
25 | )
26 | ])
27 |
--------------------------------------------------------------------------------
/mocap_vicon/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | mocap_vicon
4 | 0.0.1
5 | Driver for Vicon
6 |
7 | Ke Sun
8 | Kartik Mohta
9 | Kashsh Garg
10 |
11 | Apache-2.0
12 |
13 | Ke Sun
14 |
15 | ament_cmake
16 |
17 |
18 |
19 | ros2launch
20 | geometry_msgs
21 | roscpp
22 | tf
23 | tf_conversions
24 | mocap_base
25 |
26 |
27 | ament_cmake
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2015]
3 | * [Kartik Mohta ]
4 | * [Ke Sun ]
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | #include "rclcpp/rclcpp.hpp"
20 | #include
21 |
22 | int main(int argc, char *argv[]) {
23 |
24 | rclcpp::init(argc, argv);
25 | std::shared_ptr nh = std::make_shared("vicon_node");
26 |
27 | mocap::ViconDriver driver(nh);
28 | if(!driver.init()) {
29 | RCLCPP_ERROR(nh->get_logger(), "Initialization of the Vicon driver failed");
30 | return -1;
31 | }
32 | RCLCPP_INFO(nh->get_logger(), "Successfully initialize Vicon connection!");
33 |
34 | while(rclcpp::ok())
35 | {
36 | driver.run();
37 | rclcpp::spin_some(nh);
38 | }
39 |
40 | // ROS_INFO("Shutting down");
41 | driver.disconnect();
42 |
43 | return 0;
44 | }
45 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 |
3 | add_library(ViconDataStreamSDK_CPP
4 | Vicon/CrossMarket/DataStream/ViconDataStreamSDK_CPP/DataStreamClient.cpp
5 | Vicon/CrossMarket/DataStream/ViconDataStreamSDKCore/CoreClient.cpp
6 | Vicon/CrossMarket/DataStream/ViconDataStreamSDKCore/ClientUtils.cpp
7 | Vicon/CrossMarket/DataStream/ViconDataStreamSDKCore/AxisMapping.cpp
8 | Vicon/CrossMarket/DataStream/ViconCGStreamClientSDK/CGClient.cpp
9 | Vicon/CrossMarket/DataStream/ViconCGStreamClient/ViconCGStreamClient.cpp
10 | Vicon/CrossMarket/DataStream/ViconCGStreamClient/ViconCGStreamBayer.cpp
11 | Vicon/CrossMarket/DataStream/ViconCGStreamClient/CGStreamReaderWriter.cpp
12 | )
13 | target_include_directories(ViconDataStreamSDK_CPP
14 | PUBLIC Vicon/CrossMarket/DataStream
15 | PRIVATE Vicon/CrossMarket)
16 | target_link_libraries(ViconDataStreamSDK_CPP ${Boost_LIBRARIES})
17 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/ApexHaptics.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | #include "Item.h"
28 | #include
29 |
30 | namespace ViconCGStream
31 | {
32 | //-------------------------------------------------------------------------------------------------
33 |
34 | /// Used by the client to enable and disable haptics on Apex device.
35 | class VApexHaptics : public VItem
36 | {
37 | public:
38 |
39 | /// List of devices with haptics feedback on
40 | std::set< unsigned int > m_OnDevicesList;
41 |
42 |
43 | /// Equality operator
44 | bool operator == ( const VApexHaptics & i_rOther ) const
45 | {
46 | return m_OnDevicesList == i_rOther.m_OnDevicesList;
47 | }
48 |
49 | /// Object type enum.
50 | virtual ViconCGStreamType::Enum TypeID() const
51 | {
52 | return ViconCGStreamEnum::ApexHaptics;
53 | }
54 |
55 | /// Filter ID
56 | virtual ViconCGStreamType::UInt32 FilterID() const
57 | {
58 | return FILTER_NA;
59 | }
60 |
61 | /// Read function.
62 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
63 | {
64 | return i_rBuffer.Read( m_OnDevicesList );
65 | }
66 |
67 | /// Write function.
68 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
69 | {
70 | i_rBuffer.Write( m_OnDevicesList );
71 | }
72 |
73 | };
74 |
75 | //-------------------------------------------------------------------------------------------------
76 | };
77 |
78 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/ApplicationInfo.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VApplicationInfo class.
29 |
30 | #include "Item.h"
31 |
32 | namespace ViconCGStream
33 | {
34 | //-------------------------------------------------------------------------------------------------
35 |
36 | /// Contains information about specific application settings that relate to the datastream
37 | class VApplicationInfo : public VItem
38 | {
39 | public:
40 |
41 | enum EAxisOrientation : ViconCGStreamType::Char
42 | {
43 | EZUp,
44 | EYUp
45 | };
46 |
47 | /// Default construct this to have Z-up orientation, to maintain back compatibility with old servers
48 | VApplicationInfo() : m_AxisOrientation( EZUp ) {}
49 |
50 | /// A transformation matrix representing the axis orientation of the application
51 | EAxisOrientation m_AxisOrientation;
52 |
53 | /// Equality operator
54 | bool operator == ( const VApplicationInfo& i_rOther ) const
55 | {
56 | return m_AxisOrientation == i_rOther.m_AxisOrientation;
57 | }
58 |
59 | /// Object type enum.
60 | virtual ViconCGStreamType::Enum TypeID() const
61 | {
62 | return ViconCGStreamEnum::ApplicationInfo;
63 | }
64 |
65 | /// Filter ID
66 | virtual ViconCGStreamType::UInt32 FilterID() const
67 | {
68 | return FILTER_NA;
69 | }
70 |
71 | /// Read function.
72 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
73 | {
74 | return i_rBuffer.Read( m_AxisOrientation ) ;
75 | }
76 |
77 | /// Write function.
78 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
79 | {
80 | i_rBuffer.Write( m_AxisOrientation );
81 | }
82 |
83 | };
84 |
85 | //-------------------------------------------------------------------------------------------------
86 | };
87 |
88 | namespace ViconCGStreamIO
89 | {
90 | //-------------------------------------------------------------------------------------------------
91 |
92 | template<>
93 | struct VIsPod< ViconCGStream::VApplicationInfo::EAxisOrientation >
94 | {
95 | enum
96 | {
97 | Answer = 1
98 | };
99 | };
100 |
101 | //-------------------------------------------------------------------------------------------------
102 | };
103 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraCalibrationHealth.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCameraCalibrationHealth class.
29 |
30 | #include "Item.h"
31 | #include "CameraCalibrationHealthDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a overall system Camera calibration health indicator as well as an individual indicator for each camera
39 | /// Camera Health indicators vary from 0.0 (bad) to 1.0 (good)
40 | class VCameraCalibrationHealth : public VItem
41 | {
42 | public:
43 |
44 | /// Calibration Health for entire system
45 | ViconCGStreamType::Double m_SystemHealth;
46 |
47 | /// Individual Calibration Health for cameras
48 | std::vector< ViconCGStreamDetail::VCameraCalibrationHealth_Camera > m_Cameras;
49 |
50 | VCameraCalibrationHealth()
51 | : m_SystemHealth( 0.0 )
52 | {
53 | }
54 |
55 | /// Equality operator
56 | bool operator == ( const VCameraCalibrationHealth & i_rOther ) const
57 | {
58 | return m_SystemHealth == i_rOther.m_SystemHealth &&
59 | m_Cameras == i_rOther.m_Cameras;
60 | }
61 |
62 | /// Object type enum.
63 | virtual ViconCGStreamType::Enum TypeID() const
64 | {
65 | return ViconCGStreamEnum::CameraCalibrationHealth;
66 | }
67 |
68 | /// Filter ID
69 | virtual ViconCGStreamType::UInt32 FilterID() const
70 | {
71 | return FILTER_NA;
72 | }
73 |
74 | /// Read function.
75 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
76 | {
77 | return i_rBuffer.Read( m_SystemHealth ) &&
78 | i_rBuffer.Read( m_Cameras );
79 | }
80 |
81 | /// Write function.
82 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
83 | {
84 | i_rBuffer.Write( m_SystemHealth );
85 | i_rBuffer.Write( m_Cameras );
86 | }
87 |
88 | };
89 |
90 | //-------------------------------------------------------------------------------------------------
91 | };
92 |
93 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraTimingInfo.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | #include "Item.h"
28 | #include
29 |
30 | namespace ViconCGStream
31 | {
32 | //-------------------------------------------------------------------------------------------------
33 |
34 | /// Contains the camera timing info.
35 | class VCameraTimingInfo : public VItem
36 | {
37 | public:
38 |
39 | /// Camera identifier
40 | ViconCGStreamType::UInt32 m_CameraID;
41 |
42 | /// Camera frame period. Defined as the numbers of ticks per frame on a 135Mhz clock.
43 | ViconCGStreamType::UInt64 m_FramePeriod;
44 |
45 | /// Camera frame offset. Tick offset in time of frame zero.
46 | ViconCGStreamType::Int64 m_FrameOffset;
47 |
48 | /// Equality function
49 | bool IsEqual( const VCameraTimingInfo & i_rOther ) const
50 | {
51 | return m_CameraID == i_rOther.m_CameraID &&
52 | m_FramePeriod == i_rOther.m_FramePeriod &&
53 | m_FrameOffset == i_rOther.m_FrameOffset;
54 | }
55 |
56 | /// Equality operator
57 | bool operator == ( const VCameraTimingInfo & i_rOther ) const
58 | {
59 | return IsEqual( i_rOther );
60 | }
61 |
62 | /// Object type enum.
63 | virtual ViconCGStreamType::Enum TypeID() const
64 | {
65 | return ViconCGStreamEnum::CameraTimingInfo;
66 | }
67 |
68 | /// Filter ID
69 | virtual ViconCGStreamType::UInt32 FilterID() const
70 | {
71 | return m_CameraID;
72 | }
73 |
74 | /// Read function.
75 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
76 | {
77 | return i_rBuffer.Read( m_CameraID ) &&
78 | i_rBuffer.Read( m_FramePeriod ) &&
79 | i_rBuffer.Read( m_FrameOffset );
80 | }
81 |
82 | /// Write function.
83 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
84 | {
85 | i_rBuffer.Write( m_CameraID );
86 | i_rBuffer.Write( m_FramePeriod );
87 | i_rBuffer.Write( m_FrameOffset );
88 | }
89 |
90 | };
91 |
92 | //-------------------------------------------------------------------------------------------------
93 | };
94 |
95 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraWand2d.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCameraWand2d class.
29 |
30 | #include "Item.h"
31 | #include "CameraWand2dDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a 2d wand captured in a camera during a wand wave.
39 | class VCameraWand2d : public VItem
40 | {
41 | public:
42 |
43 | /// Camera identifier
44 | ViconCGStreamType::UInt32 m_CameraID;
45 |
46 | /// Wand session
47 | ViconCGStreamType::UInt32 m_WaveSession;
48 |
49 | /// Wand points
50 | std::vector< ViconCGStreamDetail::VCameraWand2d_Point > m_WandPoints;
51 |
52 | /// Cameras with wand
53 | ViconCGStreamType::UInt32 m_CamerasWithWand;
54 |
55 | /// Moving
56 | bool m_bMoving;
57 |
58 | /// Equality operator
59 | bool operator == ( const VCameraWand2d & i_rOther ) const
60 | {
61 | return m_CameraID == i_rOther.m_CameraID &&
62 | m_WaveSession == i_rOther.m_WaveSession &&
63 | m_WandPoints == i_rOther.m_WandPoints &&
64 | m_CamerasWithWand == i_rOther.m_CamerasWithWand &&
65 | m_bMoving == i_rOther.m_bMoving;
66 | }
67 |
68 | /// Object type enum.
69 | virtual ViconCGStreamType::Enum TypeID() const
70 | {
71 | return ViconCGStreamEnum::CameraWand2d;
72 | }
73 |
74 | /// Filter ID
75 | virtual ViconCGStreamType::UInt32 FilterID() const
76 | {
77 | return m_CameraID;
78 | }
79 |
80 | /// Read function.
81 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
82 | {
83 | return i_rBuffer.Read( m_CameraID ) &&
84 | i_rBuffer.Read( m_WaveSession ) &&
85 | i_rBuffer.Read( m_WandPoints ) &&
86 | i_rBuffer.Read( m_CamerasWithWand ) &&
87 | i_rBuffer.Read( m_bMoving );
88 | }
89 |
90 | /// Write function.
91 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
92 | {
93 | i_rBuffer.Write( m_CameraID );
94 | i_rBuffer.Write( m_WaveSession );
95 | i_rBuffer.Write( m_WandPoints );
96 | i_rBuffer.Write( m_CamerasWithWand );
97 | i_rBuffer.Write( m_bMoving );
98 | }
99 |
100 | };
101 |
102 | //-------------------------------------------------------------------------------------------------
103 | };
104 |
105 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraWand2dDetail.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the Detail of the ViconCGStream::VCameraWand2d class
29 |
30 | #include "Enum.h"
31 | #include
32 |
33 |
34 | namespace ViconCGStreamDetail
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a wand point
39 | class VCameraWand2d_Point
40 | {
41 | public:
42 |
43 | // Position
44 | ViconCGStreamType::Double m_Position[ 2 ];
45 |
46 | /// Equality operator
47 | bool operator == ( const VCameraWand2d_Point & i_rOther ) const
48 | {
49 | return m_Position[ 0 ] == i_rOther.m_Position[ 0 ] &&
50 | m_Position[ 1 ] == i_rOther.m_Position[ 1 ];
51 | }
52 |
53 | /// Read function.
54 | bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
55 | {
56 | return i_rBuffer.Read( m_Position );
57 | }
58 |
59 | /// Write function.
60 | void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
61 | {
62 | i_rBuffer.Write( m_Position );
63 | }
64 |
65 | };
66 |
67 | //-------------------------------------------------------------------------------------------------
68 | };
69 |
70 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraWand3d.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCameraWand3d class.
29 |
30 | #include "Item.h"
31 | #include "CameraWand3dDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a 3d wand captured in a camera during a wand wave.
39 | class VCameraWand3d : public VItem
40 | {
41 | public:
42 |
43 | /// Wand session
44 | ViconCGStreamType::UInt32 m_WaveSession;
45 |
46 | /// Wand points
47 | std::vector< ViconCGStreamDetail::VCameraWand3d_Point > m_WandPoints;
48 |
49 | /// Cameras with wand
50 | ViconCGStreamType::UInt32 m_CamerasWithWand;
51 |
52 | /// Moving
53 | bool m_bMoving;
54 |
55 | /// Equality operator
56 | bool operator == ( const VCameraWand3d & i_rOther ) const
57 | {
58 | return m_WaveSession == i_rOther.m_WaveSession &&
59 | m_WandPoints == i_rOther.m_WandPoints &&
60 | m_CamerasWithWand == i_rOther.m_CamerasWithWand &&
61 | m_bMoving == i_rOther.m_bMoving;
62 | }
63 |
64 | /// Object type enum.
65 | virtual ViconCGStreamType::Enum TypeID() const
66 | {
67 | return ViconCGStreamEnum::CameraWand3d;
68 | }
69 |
70 | /// Filter ID
71 | virtual ViconCGStreamType::UInt32 FilterID() const
72 | {
73 | return m_WaveSession;
74 | }
75 |
76 | /// Read function.
77 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
78 | {
79 | return i_rBuffer.Read( m_WaveSession ) &&
80 | i_rBuffer.Read( m_WandPoints ) &&
81 | i_rBuffer.Read( m_CamerasWithWand ) &&
82 | i_rBuffer.Read( m_bMoving );
83 | }
84 |
85 | /// Write function.
86 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
87 | {
88 | i_rBuffer.Write( m_WaveSession );
89 | i_rBuffer.Write( m_WandPoints );
90 | i_rBuffer.Write( m_CamerasWithWand );
91 | i_rBuffer.Write( m_bMoving );
92 | }
93 |
94 | };
95 |
96 | //-------------------------------------------------------------------------------------------------
97 | };
98 |
99 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CameraWand3dDetail.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the Detail of the ViconCGStream::VCameraWand3d class
29 |
30 | #include "Enum.h"
31 | #include
32 |
33 | namespace ViconCGStreamDetail
34 | {
35 | //-------------------------------------------------------------------------------------------------
36 |
37 | /// Contains a wand point
38 | class VCameraWand3d_Point
39 | {
40 | public:
41 |
42 | // Position
43 | ViconCGStreamType::Double m_Position[ 3 ];
44 |
45 | /// Equality operator
46 | bool operator == ( const VCameraWand3d_Point & i_rOther ) const
47 | {
48 | return m_Position[ 0 ] == i_rOther.m_Position[ 0 ] &&
49 | m_Position[ 1 ] == i_rOther.m_Position[ 1 ] &&
50 | m_Position[ 2 ] == i_rOther.m_Position[ 2 ];
51 | }
52 |
53 | /// Read function.
54 | bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
55 | {
56 | return i_rBuffer.Read( m_Position );
57 | }
58 |
59 | /// Write function.
60 | void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
61 | {
62 | i_rBuffer.Write( m_Position );
63 | }
64 |
65 | };
66 |
67 | //-------------------------------------------------------------------------------------------------
68 | };
69 |
70 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CentreOfPressureFrame.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCentreOfPressureFrame class.
29 |
30 | #include "Item.h"
31 | #include
32 |
33 | namespace ViconCGStream
34 | {
35 | //-------------------------------------------------------------------------------------------------
36 |
37 | /// Contains a frame number, device and channel identifiers, and a frame of pressure centre samples in component order (measured in mm).
38 | class VCentreOfPressureFrame : public VItem
39 | {
40 | public:
41 |
42 | /// Device frame number
43 | ViconCGStreamType::UInt32 m_FrameID;
44 |
45 | /// Device identifier
46 | ViconCGStreamType::UInt32 m_DeviceID;
47 |
48 | /// Channel identifier
49 | ViconCGStreamType::UInt32 m_ChannelID;
50 |
51 | /// Centre of pressure samples (in component order)
52 | std::vector< ViconCGStreamType::Float > m_Samples;
53 |
54 | /// Equality operator
55 | bool operator == ( const VCentreOfPressureFrame & i_rOther ) const
56 | {
57 | return m_FrameID == i_rOther.m_FrameID &&
58 | m_DeviceID == i_rOther.m_DeviceID &&
59 | m_ChannelID == i_rOther.m_ChannelID &&
60 | m_Samples == i_rOther.m_Samples;
61 | }
62 |
63 | /// Object type enum.
64 | virtual ViconCGStreamType::Enum TypeID() const
65 | {
66 | return ViconCGStreamEnum::CentreOfPressureFrame;
67 | }
68 |
69 | /// Filter ID
70 | virtual ViconCGStreamType::UInt32 FilterID() const
71 | {
72 | return m_DeviceID;
73 | }
74 |
75 | /// Read function.
76 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
77 | {
78 | return i_rBuffer.Read( m_FrameID ) &&
79 | i_rBuffer.Read( m_DeviceID ) &&
80 | i_rBuffer.Read( m_ChannelID ) &&
81 | i_rBuffer.Read( m_Samples );
82 | }
83 |
84 | /// Write function.
85 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
86 | {
87 | i_rBuffer.Write( m_FrameID );
88 | i_rBuffer.Write( m_DeviceID );
89 | i_rBuffer.Write( m_ChannelID );
90 | i_rBuffer.Write( m_Samples );
91 | }
92 |
93 | };
94 |
95 | //-------------------------------------------------------------------------------------------------
96 | };
97 |
98 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CentroidTracks.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCentroidTracks class.
29 |
30 | #include "Item.h"
31 | #include "CentroidTracksDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a frame of umlabeled circles, along with the camera identifier and frame number.
39 | class VCentroidTracks : public VItem
40 | {
41 | public:
42 |
43 | /// Camera frame number
44 | ViconCGStreamType::UInt32 m_FrameID;
45 |
46 | /// Camera identifier
47 | ViconCGStreamType::UInt32 m_CameraID;
48 |
49 | /// Centroid tracks
50 | std::vector< ViconCGStreamDetail::VCentroidTracks_CentroidTrack > m_CentroidTracks;
51 |
52 | /// Equality operator
53 | bool operator == ( const VCentroidTracks & i_rOther ) const
54 | {
55 | return m_FrameID == i_rOther.m_FrameID &&
56 | m_CameraID == i_rOther.m_CameraID &&
57 | m_CentroidTracks == i_rOther.m_CentroidTracks;
58 | }
59 |
60 | /// Object type enum.
61 | virtual ViconCGStreamType::Enum TypeID() const
62 | {
63 | return ViconCGStreamEnum::CentroidTracks;
64 | }
65 |
66 | /// Filter ID
67 | virtual ViconCGStreamType::UInt32 FilterID() const
68 | {
69 | return m_CameraID;
70 | }
71 |
72 | /// Read function.
73 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
74 | {
75 | return i_rBuffer.Read( m_FrameID ) &&
76 | i_rBuffer.Read( m_CameraID ) &&
77 | i_rBuffer.Read( m_CentroidTracks );
78 | }
79 |
80 | /// Write function.
81 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
82 | {
83 | i_rBuffer.Write( m_FrameID );
84 | i_rBuffer.Write( m_CameraID );
85 | i_rBuffer.Write( m_CentroidTracks );
86 | }
87 |
88 | };
89 |
90 | //-------------------------------------------------------------------------------------------------
91 | };
92 |
93 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CentroidTracksDetail.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the details declaration of the ViconCGStream::VCentroidTracks class.
29 |
30 | #include "Enum.h"
31 | #include
32 |
33 | namespace ViconCGStreamDetail
34 | {
35 | //-------------------------------------------------------------------------------------------------
36 |
37 | /// Contains the centroid index, track id, track length and track quality.
38 | class VCentroidTracks_CentroidTrack
39 | {
40 | public:
41 |
42 | /// Centroid index
43 | ViconCGStreamType::UInt32 m_CentroidIndex;
44 |
45 | /// 64 bit track id.
46 | ViconCGStreamType::UInt64 m_TrackId;
47 |
48 | /// Length of track (saturates).
49 | ViconCGStreamType::UInt32 m_TrackLength;
50 |
51 | /// Track quality.
52 | ViconCGStreamType::Float m_TrackQuality;
53 |
54 | // Equality operator
55 | bool operator == ( const VCentroidTracks_CentroidTrack & i_rOther ) const
56 | {
57 | return m_CentroidIndex == i_rOther.m_CentroidIndex &&
58 | m_TrackId == i_rOther.m_TrackId &&
59 | m_TrackLength == i_rOther.m_TrackLength &&
60 | m_TrackQuality == i_rOther.m_TrackQuality;
61 | }
62 |
63 | /// Read function.
64 | bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
65 | {
66 | return i_rBuffer.Read( m_CentroidIndex ) &&
67 | i_rBuffer.Read( m_TrackId ) &&
68 | i_rBuffer.Read( m_TrackLength ) &&
69 | i_rBuffer.Read( m_TrackQuality );
70 | }
71 |
72 | /// Write function.
73 | void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
74 | {
75 | i_rBuffer.Write( m_CentroidIndex );
76 | i_rBuffer.Write( m_TrackId );
77 | i_rBuffer.Write( m_TrackLength );
78 | i_rBuffer.Write( m_TrackQuality );
79 | }
80 | };
81 |
82 | //-------------------------------------------------------------------------------------------------
83 | };
84 |
85 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CentroidWeights.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCentroids class.
29 |
30 | #include "Item.h"
31 | #include "CentroidsDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a set of weights corresponding to unlabeled centroids, along with the camera identifier and frame number.
39 | class VCentroidWeights : public VItem
40 | {
41 | public:
42 |
43 | /// Camera frame number
44 | ViconCGStreamType::UInt32 m_FrameID;
45 |
46 | /// Camera identifier
47 | ViconCGStreamType::UInt32 m_CameraID;
48 |
49 | /// Centroids
50 | std::vector< float > m_Weights;
51 |
52 | /// Equality operator
53 | bool operator == ( const VCentroidWeights & i_rOther ) const
54 | {
55 | return m_FrameID == i_rOther.m_FrameID &&
56 | m_CameraID == i_rOther.m_CameraID &&
57 | m_Weights == i_rOther.m_Weights;
58 | }
59 |
60 | /// Object type enum.
61 | virtual ViconCGStreamType::Enum TypeID() const
62 | {
63 | return ViconCGStreamEnum::CentroidWeights;
64 | }
65 |
66 | /// Filter ID
67 | virtual ViconCGStreamType::UInt32 FilterID() const
68 | {
69 | return m_CameraID;
70 | }
71 |
72 | /// Read function.
73 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
74 | {
75 | return i_rBuffer.Read( m_FrameID ) &&
76 | i_rBuffer.Read( m_CameraID ) &&
77 | i_rBuffer.Read( m_Weights );
78 | }
79 |
80 | /// Write function.
81 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
82 | {
83 | i_rBuffer.Write( m_FrameID );
84 | i_rBuffer.Write( m_CameraID );
85 | i_rBuffer.Write( m_Weights );
86 | }
87 |
88 | };
89 |
90 | //-------------------------------------------------------------------------------------------------
91 | };
92 |
93 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/Centroids.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VCentroids class.
29 |
30 | #include "Item.h"
31 | #include "CentroidsDetail.h"
32 | #include
33 |
34 | namespace ViconCGStream
35 | {
36 | //-------------------------------------------------------------------------------------------------
37 |
38 | /// Contains a frame of unlabeled centroids, along with the camera identifier and frame number.
39 | class VCentroids : public VItem
40 | {
41 | public:
42 |
43 | /// Camera frame number
44 | ViconCGStreamType::UInt32 m_FrameID;
45 |
46 | /// Camera identifier
47 | ViconCGStreamType::UInt32 m_CameraID;
48 |
49 | /// Centroids
50 | std::vector< ViconCGStreamDetail::VCentroids_Centroid > m_Centroids;
51 |
52 | /// Equality operator
53 | bool operator == ( const VCentroids & i_rOther ) const
54 | {
55 | return m_FrameID == i_rOther.m_FrameID &&
56 | m_CameraID == i_rOther.m_CameraID &&
57 | m_Centroids == i_rOther.m_Centroids;
58 | }
59 |
60 | /// Object type enum.
61 | virtual ViconCGStreamType::Enum TypeID() const
62 | {
63 | return ViconCGStreamEnum::Centroids;
64 | }
65 |
66 | /// Filter ID
67 | virtual ViconCGStreamType::UInt32 FilterID() const
68 | {
69 | return m_CameraID;
70 | }
71 |
72 | /// Read function.
73 | virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
74 | {
75 | return i_rBuffer.Read( m_FrameID ) &&
76 | i_rBuffer.Read( m_CameraID ) &&
77 | i_rBuffer.Read( m_Centroids );
78 | }
79 |
80 | /// Write function.
81 | virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
82 | {
83 | i_rBuffer.Write( m_FrameID );
84 | i_rBuffer.Write( m_CameraID );
85 | i_rBuffer.Write( m_Centroids );
86 | }
87 |
88 | };
89 |
90 | //-------------------------------------------------------------------------------------------------
91 | };
92 |
93 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/CentroidsDetail.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the details declaration of the ViconCGStream::VCentroids class.
29 |
30 | #include "Enum.h"
31 | #include
32 |
33 | namespace ViconCGStreamDetail
34 | {
35 | //-------------------------------------------------------------------------------------------------
36 |
37 | /// Contains the circle position, radius and accuracy
38 | class VCentroids_Centroid
39 | {
40 | public:
41 | /// Circle position
42 | ViconCGStreamType::Double m_Position[ 2 ];
43 |
44 | /// Circle radius
45 | ViconCGStreamType::Double m_Radius;
46 |
47 | /// Circle accuracy
48 | ViconCGStreamType::Double m_Accuracy;
49 |
50 | // Equality operator
51 | bool operator == ( const VCentroids_Centroid & i_rOther ) const
52 | {
53 | return m_Position[ 0 ] == i_rOther.m_Position[ 0 ] &&
54 | m_Position[ 1 ] == i_rOther.m_Position[ 1 ] &&
55 | m_Radius == i_rOther.m_Radius &&
56 | m_Accuracy == i_rOther.m_Accuracy;
57 | }
58 |
59 | /// Read function.
60 | bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
61 | {
62 | return i_rBuffer.Read( m_Position ) &&
63 | i_rBuffer.Read( m_Radius ) &&
64 | i_rBuffer.Read( m_Accuracy );
65 | }
66 |
67 | /// Write function.
68 | void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
69 | {
70 | i_rBuffer.Write( m_Position );
71 | i_rBuffer.Write( m_Radius );
72 | i_rBuffer.Write( m_Accuracy );
73 | }
74 | };
75 |
76 | //-------------------------------------------------------------------------------------------------
77 | };
78 |
79 |
--------------------------------------------------------------------------------
/mocap_vicon/src/vicon_sdk/Vicon/CrossMarket/DataStream/ViconCGStream/Contents.h:
--------------------------------------------------------------------------------
1 |
2 | //////////////////////////////////////////////////////////////////////////////////
3 | // MIT License
4 | //
5 | // Copyright (c) 2017 Vicon Motion Systems Ltd
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in all
15 | // copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | // SOFTWARE.
24 | //////////////////////////////////////////////////////////////////////////////////
25 | #pragma once
26 |
27 | /// \file
28 | /// Contains the declaration of the ViconCGStream::VContents class.
29 |
30 | #include "Item.h"
31 | #include