Skip to content

Commit

Permalink
updated tf_connector
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Nov 13, 2023
1 parent b4c510d commit ff654db
Show file tree
Hide file tree
Showing 8 changed files with 473 additions and 523 deletions.
10 changes: 5 additions & 5 deletions tf_connector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(tf_connector)
project(mrs_tf_connector)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -21,7 +21,7 @@ find_package(catkin REQUIRED COMPONENTS
)

set(LIBRARIES
MrsUtils_TFConnector
MrsUtils_MRSTFConnector
)

catkin_package(
Expand All @@ -34,15 +34,15 @@ include_directories(
${catkin_INCLUDE_DIRS}
)

add_library(MrsUtils_TFConnector
add_library(MrsUtils_MRSTFConnector
src/tf_connector.cpp
)

add_dependencies(MrsUtils_TFConnector
add_dependencies(MrsUtils_MRSTFConnector
${catkin_EXPORTED_TARGETS}
)

target_link_libraries(MrsUtils_TFConnector
target_link_libraries(MrsUtils_MRSTFConnector
${LIBS}
${catkin_LIBRARIES}
)
Expand Down
2 changes: 1 addition & 1 deletion tf_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The frame IDs `uav1/gps_origin` and `uav2/gps_origin` are the **equal frame IDs*
The trees will be connected through a **common frame ID** called `common_origin` (it's name doesn't matter much, just make sure that it doesn't overlap with any existing frame IDs) through transforms from the **root frames**.
These transforms will be calculated and automatically updated by the *TF connector* so that the **equal frames** always correspond to the same frame.

You can test this by spawning two UAVs in the [MRS simulation](https://github.com/ctu-mrs/mrs_simulation) called UAV1 and UAV2 and running `roslaunch tf_connector tf_connector.launch`.
You can test this by spawning two UAVs in the [MRS simulation](https://github.com/ctu-mrs/mrs_simulation) called UAV1 and UAV2 and running `roslaunch mrs_tf_connector tf_connector.launch`.

## Advanced functionality

Expand Down
7 changes: 3 additions & 4 deletions tf_connector/config/tf_connector.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# the connecting root frame will be named like this
connecting_frame_id:
"common_origin"
connecting_frame_id: "common_origin"

# these are the tf subtrees to be connected through the respective root frames so that the equal frames are equal
connections:
- root_frame_id: "uav1/fcu"
equal_frame_id: "uav1/gps_origin"
equal_frame_id: "uav1/world_origin"

- root_frame_id: "uav2/fcu"
equal_frame_id: "uav2/gps_origin"
equal_frame_id: "uav2/world_origin"

# you can add further connections here:
# - root_frame_id: "another_root"
Expand Down
7 changes: 3 additions & 4 deletions tf_connector/config/tf_connector_offsets.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# the connecting root frame will be named like this
connecting_frame_id:
"common_origin"
connecting_frame_id: "common_origin"

# these are the tf subtrees to be connected through the respective root frames so that the equal frames are equal
connections:
- root_frame_id: "uav1/fcu"
equal_frame_id: "uav1/gps_origin"
equal_frame_id: "uav1/world_origin"

# optionally, you can also specify offsets to be applied to the resulting transformation (e.g. to compensate GPS drift)
offsets:
Expand All @@ -22,7 +21,7 @@ connections:
]

- root_frame_id: "uav2/fcu"
equal_frame_id: "uav2/gps_origin"
equal_frame_id: "uav2/world_origin"

# if true, older messages than the last update of the respective frame connection will be ignored
ignore_older_messages: false
Expand Down
4 changes: 2 additions & 2 deletions tf_connector/launch/tf_connector.launch
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<arg if="$(arg debug)" name="launch_prefix" value="debug_roslaunch" />
<arg unless="$(arg debug)" name="launch_prefix" value="" />

<node pkg="nodelet" type="nodelet" name="tf_connector" args="$(arg nodelet) tf_connector/TFConnector $(arg nodelet_manager)" output="screen" launch-prefix="$(arg launch_prefix)">
<node pkg="nodelet" type="nodelet" name="tf_connector" args="$(arg nodelet) mrs_tf_connector/TFConnector $(arg nodelet_manager)" output="screen" launch-prefix="$(arg launch_prefix)">

<rosparam unless="$(eval not arg('custom_config') == '')" file="$(find tf_connector)/config/tf_connector_offsets.yaml" />
<rosparam unless="$(eval not arg('custom_config') == '')" file="$(find mrs_tf_connector)/config/tf_connector_offsets.yaml" />

<!-- Load a user param file -->
<rosparam if="$(eval not arg('custom_config') == '')" file="$(arg custom_config)" />
Expand Down
4 changes: 2 additions & 2 deletions tf_connector/nodelets.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library path="lib/libMrsUtils_TFConnector">
<class name="tf_connector/TFConnector" type="tf_connector::TFConnector" base_class_type="nodelet::Nodelet">
<library path="lib/libMrsUtils_MRSTFConnector">
<class name="mrs_tf_connector/TFConnector" type="mrs_tf_connector::TFConnector" base_class_type="nodelet::Nodelet">
<description>TFConnector nodelet</description>
</class>
</library>
2 changes: 1 addition & 1 deletion tf_connector/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">

<name>tf_connector</name>
<name>mrs_tf_connector</name>
<version>1.0.0</version>
<description>A package for connecting two transform trees via root frames</description>

Expand Down

0 comments on commit ff654db

Please sign in to comment.