Johnliu/optitrack autonomy#358
Closed
JohnYanxinLiu wants to merge 24 commits into
Closed
Conversation
…os and linux versions
… Hand test in mocap room successful
…est. Unit tests workflows created
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What features did you add and/or bugs did you address?
GitHub issue:
Adds native OptiTrack motion capture integration to AirStack via the NatNet SDK.
The
natnet_ros2package receives rigid body pose data from an external Motive PCover NatNet UDP and publishes into the AirStack perception layer as standard ROS 2
PoseStamped/PoseWithCovarianceStampedtopics, with an optional MAVROS bridgefor PX4 external pose feedback.
Also included: unit testing infrastructure improvements — pytest registration fixes
for
lidar_point_cloud_filter, a YAML-driven colcon test manifest(
tests/colcon_unit_test_packages.yaml), and ~55 C++ gtests + 7 Python unit testsfor natnet logic.
How did you implement it?
C++ NatNet node (
natnet_ros2_node.cpp): connects to Motive via the NatNet SDK,registers a frame callback that decodes rigid body poses, and publishes them namespaced
under
/{ROBOT_NAME}/perception/optitrack/{body_name}.Python vision pose converter (
vision_pose_converter_node.py): subscribes to theraw optitrack pose and re-publishes as
/{ROBOT_NAME}/mavros/vision_pose/posewithcanonical quaternion normalization for PX4.
Opt-in by default:
LAUNCH_NATNETdefaults tofalseindocker-compose.yaml(
LAUNCH_NATNET=${LAUNCH_NATNET:-false}). SetLAUNCH_NATNET=truein.envtoactivate. If
truebut the SDK was not installed, the launch file raises aRuntimeError(fail-hard rather than silently skip).Conditional build:
CMakeLists.txtdetects the SDK at configure time. If absent,the
natnet_ros2_nodeexecutable is skipped with a warning — the package still buildscleanly for CI without the SDK.
SDK licensing: The OptiTrack NatNet SDK is proprietary and not redistributed.
Users install it locally via
airstack setup(explicit license acceptance). AirStackremains fully open-source.
LD_LIBRARY_PATH: An ament env-hook (
natnet_library_path.dsv.in) adds the SDK.sotoLD_LIBRARY_PATHonswsso no manual path configuration is needed.Unit test isolation: C++ logic (frame decoding, covariance matrix construction,
topic name building) is separated into a thin adapter class so it can be tested
without the real SDK or a live ROS node. Tests live in
robot/ros_ws/src/perception/natnet_ros2/test/test_natnet_logic.cpp.YAML test manifest:
tests/colcon_unit_test_packages.yamllists which packagesare gated under
colcon testin CI. This replaces a hardcoded list intest_build_packages.pyand makes it easy to add new packages without touching thetest harness.
How do you run and use it?
To install the NatNet SDK, run
airstack setupYou can launch airstack with NatNet enabled:
AUTOLAUNCH=true; LAUNCH_NATNET=true; airstack upFor now, this will only launch the natnet application without connecting to any server. Soon, an Isaac-Sim emulator will be implemented to give this more confidence. For now, NatNet is not launched by defualt.
(Listed above)
Testing with PyTest
What pytests did you add to ensure the feature is reliable and robust? What metrics are used?
Unit tests for lidar_filter_cloud are reorganized, and unit tests regarding the helper functions and coordinate framing for optitrack are added.
What's the exact command to run the pytests that test your feature? i.e.
airstack test -m ...To test python-based unit tests, run
airstack test -m unit -vTo run C++ unit tests and building, run
airstack test -m build_packages -k test_colcon_test_robot -vWhat are the expected results of the tests? What should a maintainer look at to understand whether the test succeeded?
All tests should pass.
Documentation
Was mkdocs.yml updated? (y/n)
y
Do the docs have sufficient scope such that a newcomer can easily reproduce and use your feature?
yes, the structure of the unit tests are decided and documented in the development procedure. SKILLS directory is updated with templates for new agents to contribute.
Is there sufficient visual media?
N/A
Versioning
.envfile according to semantic versioning?yes