Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set CI. Add Vicon SDK sources. Adapt to REP 144 #20

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 36 additions & 0 deletions .github/workflows/rolling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: rolling

on:
pull_request:
branches:
- rolling
push:
branches:
- rolling

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
fail-fast: false
steps:
- name: Setup ROS 2
uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- name: build and test
uses: ros-tooling/[email protected]
with:
package-name: mocap4r2_vicon_driver
target-ros2-distro: humble
vcs-repo-file-url: https://raw.githubusercontent.com/MOCAP4ROS2-Project/mocap4ros2_vicon/rolling/dependency_repos.repos
- name: Codecov
uses: codecov/[email protected]
with:
file: ros_ws/lcov/total_coverage.info
flags: unittests
name: codecov-umbrella
# yml: ./codecov.yml
fail_ci_if_error: false
3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ This project provides support for ROS2 integration with Vicon cameras (MOCAP sys
# Installation

## Dependencies:
Vicon drivers for ROS2 are based on Vicon DataStream SDK 1.11.0. When compiling the `mocap_vicon_driver`, SDK is downloaded and installed, requiring packages `wget` and `p7zip-full` for this.
Vicon drivers for ROS2 are based on Vicon DataStream SDK 1.11.0. When compiling the `mocap4r2_vicon_driver`, SDK is downloaded and installed, requiring packages `wget` and `p7zip-full` for this.
Also, our package depends on other two repositories from MOCAP4ROS2 Project:
- [mocap_msgs](https://github.com/MOCAP4ROS2-Project/mocap_msgs)
- [mocap_control](https://github.com/MOCAP4ROS2-Project/mocap)
- [mocap4r2_msgs](https://github.com/MOCAP4ROS2-Project/mocap4r2_msgs)
- [mocap4r2_control](https://github.com/MOCAP4ROS2-Project/mocap)

A rosinstall file is provided to automatically manage them.

Expand All @@ -22,8 +22,8 @@ The following commands cover all the necessary steps to install DataStream SDK,
sudo apt-get install wget git p7zip-full

## create workspace
mkdir -p ~/mocap_ws/src
cd ~/mocap_ws/src
mkdir -p ~/mocap4r2_ws/src
cd ~/mocap4r2_ws/src

## clone vicon repository
git clone https://github.com/MOCAP4ROS2-Project/mocap4ros2_vicon.git -b master
Expand All @@ -38,22 +38,22 @@ rosdep update
rosdep install --from-paths . --ignore-packages-from-source --rosdistro humble -y

## build all
cd ~/mocap_ws/
colcon build --symlink-install --packages-up-to mocap_vicon_driver
cd ~/mocap4r2_ws/
colcon build --symlink-install --packages-up-to mocap4r2_vicon_driver
```

# Configuration

Check `config/mocap_vicon_driver_params.yaml` for the available parameters. Note that `host_name` should be the IP address and port of the machine running VICON tracker.
Check `config/mocap4r2_vicon_driver_params.yaml` for the available parameters. Note that `host_name` should be the IP address and port of the machine running VICON tracker.

# Launching
After sourcing the workspace, the Vicon driver can be started using the provided launcher:

`ros2 launch mocap_vicon_driver mocap_vicon_driver_launch.py`
`ros2 launch mocap4r2_vicon_driver mocap4r2_vicon_driver_launch.py`

Remember that the vicon driver is a lifecycle node, so it needs to be signaled to start:

`ros2 lifecycle set /mocap_vicon_driver_node activate`
`ros2 lifecycle set /mocap4r2_vicon_driver_node activate`

# About MOCAP4ROS2

Expand Down
9 changes: 9 additions & 0 deletions dependency_repos.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repositories:
mocap4r2_msgs:
type: git
url: https://github.com/MOCAP4ROS2-Project/mocap4r2_msgs.git
version: rolling
mocap4r2:
type: git
url: https://github.com/MOCAP4ROS2-Project/mocap4r2.git
version: rolling
130 changes: 130 additions & 0 deletions mocap4r2_vicon_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
cmake_minimum_required(VERSION 3.5)

project(mocap4r2_vicon_driver)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()


find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(mocap4r2_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(mocap4r2_control REQUIRED)

# Used by Vicon SDK. Now we dont copy boost binaries shipped with driver.
find_package(Boost REQUIRED COMPONENTS thread date_time chrono)

set(dependencies
rclcpp
rclcpp_lifecycle
mocap4r2_msgs
mocap4r2_control
geometry_msgs
)

file(GLOB_RECURSE VICON_HEADER_FILES "ThirdParty/*.h")
file(GLOB_RECURSE VICON_SOURCES "ThirdParty/*.cpp")

set(VICON_INCLUDE_DIRS "")
foreach(HEADER ${VICON_HEADER_FILES})
get_filename_component(DIR ${HEADER} DIRECTORY)
set(VICON_INCLUDE_DIRS ${VICON_INCLUDE_DIRS} ${DIR})
endforeach()
list(REMOVE_DUPLICATES VICON_INCLUDE_DIRS)


include_directories(
include
ThirdParty/DataStream
ThirdParty
${VICON_INCLUDE_DIRS}
)

add_library(vicon_sdk SHARED ${VICON_SOURCES})
target_link_libraries(vicon_sdk PUBLIC ${Boost_LIBRARIES})


add_library(
${PROJECT_NAME}
src/mocap4r2_vicon_driver/mocap4r2_vicon_driver.cpp)

ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_compile_definitions(${PROJECT_NAME}
PRIVATE "VICON_BUILDING_LIBRARY")

add_executable(mocap4r2_vicon_driver_main
src/mocap4r2_vicon_driver_main.cpp
)
ament_target_dependencies(mocap4r2_vicon_driver_main ${dependencies})
target_link_libraries(mocap4r2_vicon_driver_main
${PROJECT_NAME}
vicon_sdk
)

ament_target_dependencies(mocap4r2_vicon_driver ${dependencies})
target_link_libraries(mocap4r2_vicon_driver
vicon_sdk
)

install(DIRECTORY include/
DESTINATION include/
)

install(DIRECTORY
launch
config
DESTINATION share/${PROJECT_NAME}
)

install(TARGETS
mocap4r2_vicon_driver_main
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(TARGETS
${PROJECT_NAME} vicon_sdk
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

if(BUILD_TESTING)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)
find_package(ament_cmake_uncrustify REQUIRED)


file(GLOB_RECURSE EXCLUDE_FILES ThirdParty/*)

ament_copyright(EXCLUDE ${EXCLUDE_FILES})
ament_cppcheck(
EXCLUDE ${EXCLUDE_FILES}
LANGUAGE c++
)
ament_cpplint(EXCLUDE ${EXCLUDE_FILES})
ament_lint_cmake()
ament_uncrustify(
EXCLUDE ${EXCLUDE_FILES}
LANGUAGE c++
)

find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(test_mocap4r2_vicon_driver test/test_mocap4r2_vicon_driver.cpp)
target_link_libraries(test_mocap4r2_vicon_driver ${PROJECT_NAME})
endif()

ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(${dependencies})
ament_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

//////////////////////////////////////////////////////////////////////////////////
// MIT License
//
// Copyright (c) 2020 Vicon Motion Systems Ltd
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Item.h"
#include <set>

namespace ViconCGStream
{
//-------------------------------------------------------------------------------------------------

/// Used by the client to enable and disable haptics on Apex device.
class VApexHaptics : public VItem
{
public:

/// List of devices with haptics feedback on
std::set< unsigned int > m_OnDevicesList;


/// Equality operator
bool operator == ( const VApexHaptics & i_rOther ) const
{
return m_OnDevicesList == i_rOther.m_OnDevicesList;
}

/// Object type enum.
virtual ViconCGStreamType::Enum TypeID() const
{
return ViconCGStreamEnum::ApexHaptics;
}

/// Filter ID
virtual ViconCGStreamType::UInt32 FilterID() const
{
return FILTER_NA;
}

/// Read function.
virtual bool Read( const ViconCGStreamIO::VBuffer & i_rBuffer )
{
return i_rBuffer.Read( m_OnDevicesList );
}

/// Write function.
virtual void Write( ViconCGStreamIO::VBuffer & i_rBuffer ) const
{
i_rBuffer.Write( m_OnDevicesList );
}

};

//-------------------------------------------------------------------------------------------------
};

Loading
Loading