Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
# active versions: https://devguide.python.org/versions/
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -72,7 +73,8 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
# active versions: https://devguide.python.org/versions/
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v3
Expand All @@ -87,13 +89,11 @@ jobs:
# Using older boost version to avoid compiler errors with io_service
- name: Install dependencies
run: |
brew install eigen boost@1.85
pip install cmake ninja wheel
brew install eigen boost
pip install cmake ninja wheel setuptools

- name: Build
run: |
export LDFLAGS="-L/opt/homebrew/opt/boost@1.85/lib"
export CPPFLAGS="-I/opt/homebrew/opt/boost@1.85/include"
python setup.py bdist_wheel

- name: Upload Build Artifact
Expand All @@ -108,7 +108,8 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
# active versions: https://devguide.python.org/versions/
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v3
Expand All @@ -122,15 +123,17 @@ jobs:

- name: Install dependencies
run: |
pip install wheel
pip install wheel setuptools
vcpkg install eigen3:x64-windows

- name: Install boost
uses: MarkusJx/install-boost@v1.0.1
uses: MarkusJx/install-boost@v2
id: install-boost
with:
boost_version: 1.73.0
toolset: msvc14.2
boost_version: 1.87.0
platform_version: 2022
toolset: msvc
link: static

- name: Build
run: python setup.py bdist_wheel
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ set(my_include_directories
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)
set(my_link_directories)
set(my_link_directories
${Boost_LIBRARY_DIRS}
)
set(my_files
src/motioncapture.cpp
src/mock.cpp
Expand Down Expand Up @@ -83,6 +85,10 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK)
${my_files}
src/optitrack.cpp
)
set(my_libraries
${my_libraries}
Boost::system
)
endif()

if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK_CLOSED_SOURCE)
Expand Down
2 changes: 1 addition & 1 deletion deps/vicon-datastream-sdk
2 changes: 1 addition & 1 deletion include/libmotioncapture/fzmotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace libmotioncapture {
static MotionCaptureFZMotion* s_pInstance;
static recursive_mutex s_mutex;

boost::asio::io_service m_IOService;
boost::asio::io_context m_IOContext;
udp::socket m_TransmissionSocket;
udp::socket m_ConnectionSocket;
udp::resolver m_Resolver;
Expand Down
20 changes: 9 additions & 11 deletions src/fzmotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace libmotioncapture {
const int iLocalPort,
const string& strRemoteIP,
const int iRemotePort
) : m_ConnectionSocket(m_IOService),
m_TransmissionSocket(m_IOService),
m_Resolver(m_IOService){
) : m_ConnectionSocket(m_IOContext),
m_TransmissionSocket(m_IOContext),
m_Resolver(m_IOContext){
this->init();
this->setConnectionInfo(strLocalIP, iLocalPort, strRemoteIP, iRemotePort);
this->connect();
Expand Down Expand Up @@ -54,11 +54,9 @@ namespace libmotioncapture {
this->m_strRemoteIP = strRemoteIP;
this->m_iRemoteCPort = iRemotePort;

this->m_localCEndpoint = udp::endpoint(address_v4::from_string(this->m_strLocalIP), this->m_iLocalCPort);

udp::resolver::query query(udp::v4(), this->m_strRemoteIP, std::to_string(this->m_iRemoteCPort));
this->m_remoteCEndpoint = *this->m_Resolver.resolve(query);

this->m_localCEndpoint = udp::endpoint(make_address_v4(this->m_strLocalIP), this->m_iLocalCPort);
this->m_remoteCEndpoint = udp::endpoint(make_address(this->m_strRemoteIP), this->m_iRemoteCPort);

s_mutex.unlock();
}
//connect with the server
Expand Down Expand Up @@ -162,13 +160,13 @@ namespace libmotioncapture {
ReleaseBuffer(pBuffer);

//joint multicast group
this->m_localMEndpoint = udp::endpoint(address_v4::from_string(this->m_strMulticastGroup), this->m_iDataReceivePort);
this->m_localMEndpoint = udp::endpoint(make_address_v4(this->m_strMulticastGroup), this->m_iDataReceivePort);
if (this->m_TransmissionSocket.is_open() == false) {
this->m_TransmissionSocket.open(this->m_localMEndpoint.protocol());
this->m_TransmissionSocket.set_option(udp::socket::reuse_address(true));
this->m_TransmissionSocket.set_option(ip::multicast::hops(5));
this->m_TransmissionSocket.set_option(ip::multicast::enable_loopback(true));
this->m_TransmissionSocket.set_option(ip::multicast::join_group(address_v4::from_string(this->m_strMulticastGroup), address_v4::from_string(this->m_strLocalIP)));
this->m_TransmissionSocket.set_option(ip::multicast::join_group(make_address_v4(this->m_strMulticastGroup), make_address_v4(this->m_strLocalIP)));
this->m_TransmissionSocket.bind(this->m_localMEndpoint);
}

Expand All @@ -189,7 +187,7 @@ namespace libmotioncapture {
}

if (this->m_TransmissionSocket.is_open() == true) {
this->m_TransmissionSocket.set_option(ip::multicast::leave_group(address_v4::from_string(this->m_strMulticastGroup), address_v4::from_string(this->m_strLocalIP)));
this->m_TransmissionSocket.set_option(ip::multicast::leave_group(make_address_v4(this->m_strMulticastGroup), make_address_v4(this->m_strLocalIP)));
this->m_TransmissionSocket.close();
}

Expand Down
18 changes: 9 additions & 9 deletions src/optitrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ namespace libmotioncapture {
: version()
, versionMajor(0)
, versionMinor(0)
, io_service()
, socket(io_service)
, io_context()
, socket(io_context)
, sender_endpoint()
, data(MAX_PACKETSIZE)
{
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace libmotioncapture {
int versionMinor;
uint64_t clockFrequency; // ticks/second for timestamps

boost::asio::io_service io_service;
boost::asio::io_context io_context;
boost::asio::ip::udp::socket socket;
boost::asio::ip::udp::endpoint sender_endpoint;
std::vector<char> data;
Expand Down Expand Up @@ -285,10 +285,10 @@ namespace libmotioncapture {
pImpl = new MotionCaptureOptitrackImpl;

// Connect to command port to query version
boost::asio::io_service io_service_cmd;
udp::socket socket_cmd(io_service_cmd, udp::endpoint(udp::v4(), 0));
udp::resolver resolver_cmd(io_service_cmd);
udp::endpoint endpoint_cmd = *resolver_cmd.resolve({udp::v4(), hostname, std::to_string(port_command)});
boost::asio::io_context io_context_cmd;
udp::socket socket_cmd(io_context_cmd, udp::endpoint(udp::v4(), 0));
udp::resolver resolver_cmd(io_context_cmd);
udp::endpoint endpoint_cmd(boost::asio::ip::make_address(hostname), port_command);

typedef struct
{
Expand Down Expand Up @@ -354,8 +354,8 @@ namespace libmotioncapture {
pImpl->parseModelDef(modelDef.data());

// connect to data port to receive mocap data
auto listen_address_boost = boost::asio::ip::address_v4::from_string(interface_ip);
auto multicast_address_boost = boost::asio::ip::address_v4::from_string(multicast_address);
auto listen_address_boost = boost::asio::ip::make_address_v4(interface_ip);
auto multicast_address_boost = boost::asio::ip::make_address_v4(multicast_address);

// Create the socket so that multiple may be bound to the same address.
boost::asio::ip::udp::endpoint listen_endpoint(
Expand Down
1 change: 1 addition & 0 deletions src/vrpn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <iostream>
#include <thread>
#include <memory>
#include <chrono>

// VRPN
#include <vrpn_Tracker.h>
Expand Down