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

update cabot2/3-remote.launch.py to enable joy control in Docker #13

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cabot_base/launch/cabot2-remote.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.conditions import UnlessCondition
from launch.substitutions import EnvironmentVariable
from launch.substitutions import LaunchConfiguration
from launch.substitutions import OrSubstitution
Expand All @@ -51,6 +52,7 @@ def generate_launch_description():
model_name = LaunchConfiguration('model') # need to be set
touch_params = LaunchConfiguration('touch_params')
gamepad = LaunchConfiguration('gamepad')
use_joy_linux = LaunchConfiguration('use_joy_linux')
use_keyboard = LaunchConfiguration('use_keyboard')
is_model_ace = PythonExpression(['"', model_name, '"=="cabot2-ace"'])
use_imu = OrSubstitution(is_model_ace, LaunchConfiguration('use_imu'))
Expand Down Expand Up @@ -94,6 +96,11 @@ def generate_launch_description():
default_value='ps4',
description='Gamepad name ps4 or pro (Switch Pro Con)'
),
DeclareLaunchArgument(
'use_joy_linux',
default_value='False',
description='If true use joy_linux_node instead of joy_node'
),
DeclareLaunchArgument(
'use_keyboard',
default_value='False',
Expand Down Expand Up @@ -126,6 +133,7 @@ def generate_launch_description():
parameters=[*param_files],
remappings=[
('/imu', '/cabot/imu/data'),
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
],
),

Expand Down Expand Up @@ -171,6 +179,16 @@ def generate_launch_description():
namespace='cabot',
name='joy_node',
parameters=[*param_files],
condition=UnlessCondition(use_joy_linux),
),

Node(
package='joy_linux',
executable='joy_linux_node',
namespace='cabot',
name='joy_node', # keep the node name joy_node to keep using the same parameters
parameters=[*param_files],
condition=IfCondition(use_joy_linux),
),

Node(
Expand Down
17 changes: 17 additions & 0 deletions cabot_base/launch/cabot3-remote.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.conditions import UnlessCondition
from launch.substitutions import EnvironmentVariable
from launch.substitutions import LaunchConfiguration
from launch.substitutions import OrSubstitution
Expand All @@ -49,6 +50,7 @@ def generate_launch_description():
model_name = LaunchConfiguration('model') # need to be set
touch_params = LaunchConfiguration('touch_params')
gamepad = LaunchConfiguration('gamepad')
use_joy_linux = LaunchConfiguration('use_joy_linux')
use_keyboard = LaunchConfiguration('use_keyboard')
is_model_ace = PythonExpression(['"', model_name, '"=="cabot3-s1"'])
use_imu = OrSubstitution(is_model_ace, LaunchConfiguration('use_imu'))
Expand Down Expand Up @@ -94,6 +96,11 @@ def generate_launch_description():
default_value='ps4',
description='Gamepad name ps4 or pro (Switch Pro Con)'
),
DeclareLaunchArgument(
'use_joy_linux',
default_value='False',
description='If true use joy_linux_node instead of joy_node'
),
DeclareLaunchArgument(
'use_keyboard',
default_value='False',
Expand Down Expand Up @@ -136,6 +143,7 @@ def generate_launch_description():
parameters=[*param_files],
remappings=[
('/imu', '/cabot/imu/data'),
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
],
),

Expand Down Expand Up @@ -187,6 +195,15 @@ def generate_launch_description():
namespace='cabot',
name='joy_node',
parameters=[*param_files],
condition=UnlessCondition(use_joy_linux),
),
Node(
package='joy_linux',
executable='joy_linux_node',
namespace='cabot',
name='joy_node', # keep the node name joy_node to keep using the same parameters
parameters=[*param_files],
condition=IfCondition(use_joy_linux),
),

Node(
Expand Down
1 change: 1 addition & 0 deletions docker/driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt update && apt install -y \
python3-gi \
python3-dbus \
ros-${ROS_DISTRO}-diagnostic-updater \
ros-${ROS_DISTRO}-joy-linux \
ros-${ROS_DISTRO}-xacro \
ros-${ROS_DISTRO}-realsense2-description \
ros-${ROS_DISTRO}-pointcloud-to-laserscan
Expand Down