-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
82 changes: 32 additions & 50 deletions
82
arlobot_ros/launch/xbox360_teleop.launch.py
100644 → 100755
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,44 @@ | ||
import os | ||
# https://docs.ros.org/en/ros2_packages/iron/api/teleop_twist_joy/standard_docs/README.html | ||
# Based on: jazzy/share/teleop_twist_joy/launch/teleop-launch.py | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
import launch | ||
import launch_ros.actions | ||
from launch.substitutions import EnvironmentVariable, LaunchConfiguration | ||
from launch import LaunchDescription | ||
|
||
|
||
# Push the left frontal button labeled as 'LB' to activate cmd_vel publishing. | ||
# Move the left stick around to control the velocity. | ||
|
||
# TODO: Does teleop_tiwst_joy_node need paramemter 'scale_angular': 1.5? | ||
|
||
def generate_launch_description(): | ||
return LaunchDescription([ | ||
launch.actions.DeclareLaunchArgument( | ||
name='joy_config', | ||
default_value='xbox' | ||
), | ||
launch.actions.DeclareLaunchArgument( | ||
name='config_filepath', | ||
default_value=LaunchConfiguration( | ||
'joy_config') | ||
), | ||
launch.actions.DeclareLaunchArgument( | ||
name='joy_topic', | ||
default_value='joy' | ||
), | ||
joy_config = launch.substitutions.LaunchConfiguration('joy_config') | ||
joy_dev = launch.substitutions.LaunchConfiguration('joy_dev') | ||
publish_stamped_twist = launch.substitutions.LaunchConfiguration('publish_stamped_twist') | ||
config_filepath = launch.substitutions.LaunchConfiguration('config_filepath') | ||
|
||
return launch.LaunchDescription([ | ||
launch.actions.DeclareLaunchArgument('joy_vel', default_value='joy_vel'), | ||
launch.actions.DeclareLaunchArgument('joy_config', default_value='xbox'), | ||
launch.actions.DeclareLaunchArgument('joy_dev', default_value='0'), | ||
launch.actions.DeclareLaunchArgument('publish_stamped_twist', default_value='false'), | ||
launch.actions.DeclareLaunchArgument('config_filepath', default_value=[ | ||
launch.substitutions.TextSubstitution(text=os.path.join( | ||
get_package_share_directory('teleop_twist_joy'), 'config', '')), | ||
joy_config, launch.substitutions.TextSubstitution(text='.config.yaml')]), | ||
|
||
launch_ros.actions.Node( | ||
package='joy', | ||
executable='joy_node', | ||
name='joy_node', | ||
parameters=[ | ||
{ | ||
'dev': EnvironmentVariable('JOY_DEVICE') | ||
}, | ||
{ | ||
'deadzone': 0.3 | ||
}, | ||
{ | ||
# ROS requires a repeat on the output to keep moving the robot, | ||
# although this means you need a cooldown on button inputs if you use them for anything else. | ||
'autorepeat_rate': 20.0 | ||
} | ||
] | ||
), | ||
package='joy', executable='joy_node', name='joy_node', | ||
parameters=[{ | ||
'device_id': joy_dev, | ||
'deadzone': 0.3, | ||
'autorepeat_rate': 20.0, | ||
}]), | ||
launch_ros.actions.Node( | ||
package='teleop_twist_joy', | ||
executable='teleop_node', | ||
name='teleop_twist_joy', | ||
parameters=[ | ||
{ | ||
'scale_angular': 1.5 | ||
}, | ||
{ | ||
'enable_button': 4 | ||
}, | ||
LaunchConfiguration('config_filepath') | ||
] | ||
) | ||
package='teleop_twist_joy', executable='teleop_node', | ||
name='teleop_twist_joy_node', | ||
parameters=[config_filepath, {'publish_stamped_twist': publish_stamped_twist, 'enable_button': 4}], | ||
remappings={('/cmd_vel', launch.substitutions.LaunchConfiguration('joy_vel'))}, | ||
), | ||
]) | ||
|
||
|
||
if __name__ == '__main__': | ||
generate_launch_description() |
This file contains 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