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

Added mocap interfaces to comply with Rep mocap #21

Open
wants to merge 12 commits into
base: rep-mocap
Choose a base branch
from
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Issue Report

### Description
Describe the issue or suggestion you are reporting.

### Steps to Reproduce
1. Step 1
2. Step 2
3. Step 3
.. Step N

### Expected Result
Describe what you expected to happen.

### Actual Result
Describe what actually happened.

### Screenshots
Attach screenshots if relevant.

### Environment
- **Operating System**:
- **ROS Distribution**:
- **Additional Details**:

### Configuration
Please paste the configuration file used (yaml) located in the config folder

### Execution Log
Include the execution log of the driver to assist in diagnosing the issue. This log should capture any error messages or warnings related to the YAML configuration.
38 changes: 38 additions & 0 deletions .github/workflows/rep-mocap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: rep-mocap
on:
pull_request:
branches:
- rep-mocap
push:
branches:
- rep-mocap

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]
fail-fast: false
steps:
- name: Repo checkout
uses: actions/checkout@v2

- name: Setup ROS 2
uses: ros-tooling/[email protected]
with:
required-ros-distributions: rolling
- name: build and test
uses: ros-tooling/[email protected]
with:
package-name: mocap4r2_vicon_driver
target-ros2-distro: rolling
vcs-repo-file-url: ${GITHUB_WORKSPACE}/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
18 changes: 10 additions & 8 deletions .github/workflows/rolling.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: rolling

on:
pull_request:
branches:
Expand All @@ -13,19 +12,22 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
os: [ubuntu-24.04]
fail-fast: false
steps:
- name: Repo checkout
uses: actions/checkout@v2

- name: Setup ROS 2
uses: ros-tooling/[email protected].1
uses: ros-tooling/[email protected].9
with:
required-ros-distributions: humble
required-ros-distributions: rolling
- name: build and test
uses: ros-tooling/[email protected].5
uses: ros-tooling/[email protected].15
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
package-name: mocap4r2_control mocap4r2_control_msgs rqt_mocap4r2_control mocap4r2_marker_publisher mocap4r2_marker_viz mocap4r2_marker_viz_srvs
target-ros2-distro: rolling
vcs-repo-file-url: ${GITHUB_WORKSPACE}/dependency_repos.repos
- name: Codecov
uses: codecov/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project provides support for ROS2 integration with Vicon cameras (MOCAP sys
## Dependencies:
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:
- [mocap4r2_msgs](https://github.com/MOCAP4ROS2-Project/mocap4r2_msgs)
- [mocap_interfaces](https://github.com/MOCAP4ROS2-Project/mocap_interfaces)
- [mocap4r2_control](https://github.com/MOCAP4ROS2-Project/mocap)

A rosinstall file is provided to automatically manage them.
Expand All @@ -26,7 +26,7 @@ mkdir -p ~/mocap4r2_ws/src
cd ~/mocap4r2_ws/src

## clone vicon repository
git clone https://github.com/MOCAP4ROS2-Project/mocap4ros2_vicon.git -b master
git clone https://github.com/MOCAP4ROS2-Project/mocap4ros2_vicon.git -b rolling
## clone necessary mocap repositories
cp mocap4ros2_vicon/mocap4ros2.rosinstall .rosinstall
wstool update
Expand Down
4 changes: 2 additions & 2 deletions dependency_repos.repos
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repositories:
mocap4r2_msgs:
mocap_interfaces:
type: git
url: https://github.com/MOCAP4ROS2-Project/mocap4r2_msgs.git
url: https://github.com/MOCAP4ROS2-Project/mocap_interfaces.git
version: rolling
mocap4r2:
type: git
Expand Down
4 changes: 2 additions & 2 deletions mocap4r2_vicon_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(mocap4r2_msgs REQUIRED)
find_package(mocap_interfaces REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(mocap4r2_control REQUIRED)

Expand All @@ -25,7 +25,7 @@ find_package(Boost REQUIRED COMPONENTS thread date_time chrono)
set(dependencies
rclcpp
rclcpp_lifecycle
mocap4r2_msgs
mocap_interfaces
mocap4r2_control
geometry_msgs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "rclcpp/rclcpp.hpp"
#include "mocap4r2_control/ControlledLifecycleNode.hpp"

#include "mocap4r2_msgs/msg/marker.hpp"
#include "mocap4r2_msgs/msg/markers.hpp"
#include "mocap4r2_msgs/msg/rigid_bodies.hpp"
#include "mocap_interfaces/msg/marker.hpp"
#include "mocap_interfaces/msg/marker_array.hpp"
#include "mocap_interfaces/msg/rigid_body_array.hpp"

namespace mocap4r2_vicon_driver
{
Expand All @@ -56,8 +56,8 @@ class ViconDriverNode : public mocap4r2_control::ControlledLifecycleNode

protected:
ViconDataStreamSDK::CPP::Client client;
rclcpp_lifecycle::LifecyclePublisher<mocap4r2_msgs::msg::Markers>::SharedPtr markers_pub_;
rclcpp_lifecycle::LifecyclePublisher<mocap4r2_msgs::msg::RigidBodies>::SharedPtr
rclcpp_lifecycle::LifecyclePublisher<mocap_interfaces::msg::MarkerArray>::SharedPtr markers_pub_;
rclcpp_lifecycle::LifecyclePublisher<mocap_interfaces::msg::RigidBodyArray>::SharedPtr
rigid_bodies_pub_;
rclcpp::TimerBase::SharedPtr timer_;

Expand Down
2 changes: 1 addition & 1 deletion mocap4r2_vicon_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<depend>rclcpp_lifecycle</depend>
<depend>std_msgs</depend>
<depend>geometry_msgs</depend>
<depend>mocap4r2_msgs</depend>
<depend>mocap_interfaces</depend>
<depend>mocap4r2_control</depend>
<depend>boost</depend>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,24 @@ void ViconDriverNode::process_frame()

// rclcpp::Duration frame_delay = rclcpp::Duration(client.GetLatencyTotal().Total);

mocap4r2_msgs::msg::RigidBodies rigid_bodies_msg;
mocap_interfaces::msg::RigidBodyArray rigid_bodies_msg;
rigid_bodies_msg.header.stamp = now(); // TODO(any): add client.GetLatencyTotal() ?
rigid_bodies_msg.header.frame_id = frame_id_;
rigid_bodies_msg.frame_number = frameCount_++;
rigid_bodies_msg.seq = frameCount_++;

mocap4r2_msgs::msg::Markers markers_msg;
mocap_interfaces::msg::MarkerArray markers_msg;
markers_msg.header.stamp = now(); // TODO(any): add client.GetLatencyTotal() ?
markers_msg.header.frame_id = frame_id_;
markers_msg.frame_number = frameCount_++;
markers_msg.seq = frameCount_++;

unsigned int SubjectCount = client.GetSubjectCount().SubjectCount;
for (unsigned int SubjectIndex = 0; SubjectIndex < SubjectCount; ++SubjectIndex) {
std::string this_subject_name = client.GetSubjectName(SubjectIndex).SubjectName;

unsigned int num_subject_markers = client.GetMarkerCount(this_subject_name).MarkerCount;
for (unsigned int MarkerIndex = 0; MarkerIndex < num_subject_markers; ++MarkerIndex) {
mocap4r2_msgs::msg::Marker this_marker;
this_marker.id_type = mocap4r2_msgs::msg::Marker::USE_NAME;
mocap_interfaces::msg::Marker this_marker;
this_marker.id_type = mocap_interfaces::msg::Marker::USE_NAME;
this_marker.marker_name = client.GetMarkerName(this_subject_name, MarkerIndex).MarkerName;

ViconDataStreamSDK::CPP::Output_GetMarkerGlobalTranslation
Expand All @@ -154,7 +154,7 @@ void ViconDriverNode::process_frame()
ViconDataStreamSDK::CPP::Output_GetSegmentGlobalRotationQuaternion rot =
client.GetSegmentGlobalRotationQuaternion(this_subject_name, this_segment_name);

mocap4r2_msgs::msg::RigidBody this_segment;
mocap_interfaces::msg::RigidBody this_segment;
std::string rigid_body_name = this_subject_name + "." + this_segment_name;
this_segment.rigid_body_name = rigid_body_name;
this_segment.pose.position.x = trans.Translation[0] / 1000.0;
Expand All @@ -165,14 +165,14 @@ void ViconDriverNode::process_frame()
this_segment.pose.orientation.z = rot.Rotation[2];
this_segment.pose.orientation.w = rot.Rotation[3];
this_segment.markers = markers_msg.markers;
rigid_bodies_msg.rigidbodies.push_back(this_segment);
rigid_bodies_msg.rigid_bodies.push_back(this_segment);
}
}
// Publishing messages
if (markers_msg.markers.size() > 0) {
markers_pub_->publish(markers_msg);
}
if (rigid_bodies_msg.rigidbodies.size() > 0) {
if (rigid_bodies_msg.rigid_bodies.size() > 0) {
rigid_bodies_pub_->publish(rigid_bodies_msg);
}
}
Expand All @@ -188,8 +188,9 @@ ViconDriverNode::on_configure(const rclcpp_lifecycle::State &)
{
initParameters();

markers_pub_ = create_publisher<mocap4r2_msgs::msg::Markers>("/markers", rclcpp::QoS(1000));
rigid_bodies_pub_ = create_publisher<mocap4r2_msgs::msg::RigidBodies>(
markers_pub_ = create_publisher<mocap_interfaces::msg::MarkerArray>(
"/markers", rclcpp::QoS(1000));
rigid_bodies_pub_ = create_publisher<mocap_interfaces::msg::RigidBodyArray>(
"/rigid_bodies", rclcpp::QoS(1000));

auto stat = client.Connect(host_name_).Result;
Expand Down
Loading