Skip to content

Commit

Permalink
Moveit_controller (#4)
Browse files Browse the repository at this point in the history
* Move static_transform from moveit to robot launch file.

Signed-off-by: Jelmer de Wolde <[email protected]>

* Improve argument name.

Signed-off-by: Jelmer de Wolde <[email protected]>

---------

Signed-off-by: Jelmer de Wolde <[email protected]>
  • Loading branch information
Jelmerdw authored Nov 11, 2024
1 parent db24236 commit 6102305
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions rcdt_panther/launch/panther.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
LaunchArgument,
)

run_rviz_arg = LaunchArgument("rviz", False, [True, False])
use_rviz_arg = LaunchArgument("rviz", False, [True, False])


def launch_setup(context: LaunchContext) -> None:
use_rviz = use_rviz_arg.value(context)

xacro_path = get_file_path("panther_description", ["urdf"], "panther.urdf.xacro")
xacro_arguments = {"use_sim": "true"}
robot_description = get_robot_description(xacro_path, xacro_arguments)
Expand All @@ -30,6 +32,13 @@ def launch_setup(context: LaunchContext) -> None:
get_file_path("rcdt_utilities", ["launch"], "gazebo_robot.launch.py")
)

static_transform_publisher = Node(
package="tf2_ros",
executable="static_transform_publisher",
name="static_tf_world",
arguments=["--frame-id", "world", "--child-frame-id", "odom"],
)

joint_state_broadcaster = Node(
package="controller_manager",
executable="spawner",
Expand All @@ -41,8 +50,7 @@ def launch_setup(context: LaunchContext) -> None:
)

rviz = IncludeLaunchDescription(
get_file_path("rcdt_utilities", ["launch"], "rviz.launch.py"),
launch_arguments={"rviz_frame": "odom"}.items(),
get_file_path("rcdt_utilities", ["launch"], "rviz.launch.py")
)

joy = Node(
Expand All @@ -67,9 +75,10 @@ def launch_setup(context: LaunchContext) -> None:
SetParameter(name="use_sim_time", value=True),
robot_state_publisher,
robot,
static_transform_publisher,
joint_state_broadcaster,
controllers,
rviz if run_rviz_arg.value(context) else skip,
rviz if use_rviz else skip,
joy,
joy_to_twist_node,
]
Expand All @@ -78,7 +87,7 @@ def launch_setup(context: LaunchContext) -> None:
def generate_launch_description() -> LaunchDescription:
return LaunchDescription(
[
run_rviz_arg.declaration,
use_rviz_arg.declaration,
OpaqueFunction(function=launch_setup),
]
)

0 comments on commit 6102305

Please sign in to comment.