Skip to content

Commit d810315

Browse files
author
santiago barragan
committed
refactor[andino_bringup]: add joystick and keyboard config files for better tuning and maintenance
1 parent 645639f commit d810315

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

andino_bringup/config/joystick.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
joy_linux_node:
22
ros__parameters:
3-
device_id: 0
3+
# dev: /dev/input/js2 <---- Use this if you have more than one joystick and want to specify which one to use.
4+
# For example:
5+
# - Nintendo Switch with Ubuntu: dev: /dev/input/js2
6+
dev: 0
47
deadzone: 0.05
58
autorepeat_rate: 20.0
69

710
teleop_node:
811
ros__parameters:
912
axis_linear:
1013
x: 1
14+
y: 3
1115
scale_linear:
12-
x: 0.5
16+
x: 0.3
17+
y: 0.3
1318
scale_linear_turbo:
1419
x: 1.0
20+
y: 1.0
1521

1622
axis_angular:
17-
yaw: 3
23+
yaw: 0
1824
scale_angular:
19-
yaw: 1.0
25+
yaw: 4.0
2026
scale_angular_turbo:
21-
yaw: 2.0
27+
yaw: 10.0
2228

2329

24-
enable_button: 4
30+
enable_button: 7
2531
enable_turbo_button: 5
2632

2733
require_enable_button: true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
teleop_twist_keyboard_node:
2+
ros__parameters:
3+
speed: 0.3
4+
turn: 4.0

andino_bringup/launch/teleop_joystick.launch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def generate_launch_description():
4949
joy_linux_node = Node(
5050
package='joy_linux',
5151
executable='joy_linux_node',
52+
name='joy_linux_node',
5253
parameters=[joystick_config],
5354
)
5455

@@ -57,7 +58,7 @@ def generate_launch_description():
5758
executable='teleop_node',
5859
name='teleop_node',
5960
parameters=[joystick_config],
60-
remappings=[('/cmd_vel', cmd_vel_topic)]
61+
remappings=[('cmd_vel', cmd_vel_topic)]
6162
)
6263

6364
return LaunchDescription([

andino_bringup/launch/teleop_keyboard.launch.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31+
import os
32+
33+
from ament_index_python import get_package_share_directory
3134
from launch import LaunchDescription
3235
from launch.actions import DeclareLaunchArgument
3336
from launch.conditions import IfCondition, UnlessCondition
@@ -37,6 +40,8 @@
3740

3841

3942
def generate_launch_description():
43+
keyboard_config = os.path.join(get_package_share_directory('andino_bringup'),'config','keyboard.yaml')
44+
4045
stamped_arg = DeclareLaunchArgument(
4146
'stamped',
4247
default_value='true',
@@ -51,7 +56,7 @@ def generate_launch_description():
5156
name='teleop_twist_keyboard_node',
5257
output='screen',
5358
prefix='xterm -e',
54-
parameters=[{'stamped': True}],
59+
parameters=[{'stamped': True}, keyboard_config],
5560
remappings=[('/cmd_vel', 'cmd_vel_stamped')],
5661
condition=IfCondition(stamped),
5762
)
@@ -62,7 +67,7 @@ def generate_launch_description():
6267
name='teleop_twist_keyboard_node',
6368
output='screen',
6469
prefix='xterm -e',
65-
parameters=[{'stamped': False}],
70+
parameters=[{'stamped': False}, keyboard_config],
6671
remappings=[('/cmd_vel', 'cmd_vel')],
6772
condition=UnlessCondition(stamped),
6873
)

0 commit comments

Comments
 (0)