Skip to content

Instantly share code, notes, and snippets.

@asymingt
Created June 27, 2023 21:28
Show Gist options
  • Save asymingt/1d833ac9857ecba36eb2fa523137a7ba to your computer and use it in GitHub Desktop.
Save asymingt/1d833ac9857ecba36eb2fa523137a7ba to your computer and use it in GitHub Desktop.
Problem with static transforms
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
foxglove_bridge = Node(
name="foxglove_bridge",
package="foxglove_bridge",
executable="foxglove_bridge")
transforms = [
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0",
"--y", "0",
"--z", "0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "bar",
"--child-frame-id", "foo",
],
),
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0",
"--y", "0",
"--z", "0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "baz",
"--child-frame-id", "bar",
],
),
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0.5",
"--y", "1.0",
"--z", "2.0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "bar",
"--child-frame-id", "bar_child1",
],
),
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0",
"--y", "0",
"--z", "0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "bar_child1",
"--child-frame-id", "bar_child1_grandchild",
],
),
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0.5",
"--y", "-1.0",
"--z", "2.0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "bar",
"--child-frame-id", "bar_child2",
],
),
Node(
package="tf2_ros",
executable="static_transform_publisher",
arguments=[
"--x", "0",
"--y", "0",
"--z", "0",
"--yaw", "0",
"--pitch", "0",
"--roll", "0",
"--frame-id", "bar_child2",
"--child-frame-id", "bar_child2_grandchild",
],
),
]
# Return everything
return LaunchDescription([foxglove_bridge] + transforms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment