Skip to content

Commit dd620a8

Browse files
authored
Merge branch 'main' into 10-gps-navigation
2 parents 351b1e5 + 54e9f63 commit dd620a8

6 files changed

Lines changed: 107 additions & 11 deletions

File tree

config/joystick.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
joy_node:
2+
ros__parameters:
3+
device_id: 0
4+
deadzone: 0.05
5+
autorepeat_rate: 20.0
6+
7+
teleop_node:
8+
ros__parameters:
9+
axis_linear: # Left thumb stick vertical
10+
x: 1
11+
scale_linear:
12+
x: 0.5
13+
scale_linear_turbo:
14+
x: 1.0
15+
16+
axis_angular: # Left thumb stick horizontal
17+
yaw: 0
18+
scale_angular:
19+
yaw: 1.0
20+
scale_angular_turbo:
21+
yaw: 1.0
22+
23+
require_enable_button: false
24+
enable_turbo_button: 7 # Right shoulder button

launch/joystick.launch.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from launch import LaunchDescription
2+
from launch_ros.actions import Node
3+
4+
import os
5+
from ament_index_python.packages import get_package_share_directory
6+
7+
def generate_launch_description():
8+
9+
joy_params = os.path.join(get_package_share_directory('apricotka-robot-car'), 'config', 'joystick.yaml')
10+
11+
joy_node = Node(
12+
package='joy',
13+
executable='joy_node',
14+
parameters=[joy_params],
15+
)
16+
17+
teleop_node = Node(
18+
package='teleop_twist_joy',
19+
executable='teleop_node',
20+
name='teleop_node',
21+
parameters=[joy_params, {'publish_stamped_twist': True, 'frame': 'base_link'}],
22+
remappings=[('/cmd_vel', '/diff_drive_base_controller/cmd_vel')]
23+
)
24+
25+
ld = LaunchDescription()
26+
27+
ld.add_action(joy_node)
28+
ld.add_action(teleop_node)
29+
30+
return ld

launch/launch_gzui.launch.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
3+
from ament_index_python.packages import get_package_share_directory
4+
from launch import LaunchDescription
5+
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
6+
from launch.launch_description_sources import PythonLaunchDescriptionSource
7+
from launch.substitutions import LaunchConfiguration
8+
9+
def generate_launch_description():
10+
package_name = 'apricotka-robot-car'
11+
ros_gz_sim = get_package_share_directory('ros_gz_sim')
12+
13+
use_sim_time = LaunchConfiguration('use_sim_time', default='true')
14+
15+
gzclient_cmd = IncludeLaunchDescription(
16+
PythonLaunchDescriptionSource(
17+
os.path.join(ros_gz_sim, 'launch', 'gz_sim.launch.py')
18+
),
19+
launch_arguments={'gz_args': '-g -v4 '}.items()
20+
)
21+
22+
joystick_launch_cmd = IncludeLaunchDescription(
23+
PythonLaunchDescriptionSource(
24+
os.path.join(get_package_share_directory(package_name), 'launch', 'joystick.launch.py')
25+
),
26+
launch_arguments={'use_sim_time': use_sim_time}.items()
27+
)
28+
29+
ld = LaunchDescription()
30+
31+
ld.add_action(DeclareLaunchArgument('use_sim_time', default_value='true', description='Use simulation (Gazebo) clock if true'))
32+
ld.add_action(gzclient_cmd)
33+
ld.add_action(joystick_launch_cmd)
34+
35+
return ld

launch/launch_sim.launch.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ def generate_launch_description():
3030
),
3131
launch_arguments={'gz_args': ['-r -s -v4 ', world], 'on_exit_shutdown': 'true'}.items()
3232
)
33-
gzclient_cmd = IncludeLaunchDescription(
34-
PythonLaunchDescriptionSource(
35-
os.path.join(ros_gz_sim, 'launch', 'gz_sim.launch.py')
36-
),
37-
launch_arguments={'gz_args': '-g -v4 '}.items()
38-
)
3933
rsp_cmd = IncludeLaunchDescription(
4034
PythonLaunchDescriptionSource([os.path.join(
4135
package,'launch','rsp.launch.py')]
@@ -119,7 +113,6 @@ def generate_launch_description():
119113
ld = LaunchDescription()
120114

121115
ld.add_action(gzserver_cmd)
122-
ld.add_action(gzclient_cmd)
123116
ld.add_action(rsp_cmd)
124117
ld.add_action(spawn_robot_cmd)
125118
ld.add_action(load_joint_state_broadcaster)

launch/rsp.launch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ def generate_launch_description():
3232
executable='robot_state_publisher',
3333
name='robot_state_publisher',
3434
output='screen',
35-
parameters=[{'robot_description': robot_description_config, 'use_sim_time': use_sim_time}])
36-
])
35+
parameters=[{
36+
'robot_description': robot_description_config,
37+
'use_sim_time': use_sim_time
38+
}]
39+
)
40+
])

package.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<version>0.0.0</version>
66
<description>ros_sw</description>
77
<maintainer email="fastroof@todo.todo">fastroof</maintainer>
8-
<license>TODO: License declaration</license>
8+
<license>MIT</license>
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
1111

@@ -18,7 +18,17 @@
1818
<depend>mapviz_plugins</depend>
1919
<depend>tile_map</depend>
2020
<depend>ros2_control</depend>
21-
21+
<depend>joy</depend>
22+
<depend>teleop_twist_joy</depend>
23+
<depend>xacro</depend>
24+
<depend>ros_gz_sim</depend>
25+
<depend>ros_gz_bridge</depend>
26+
<depend>ros_gz_image</depend>
27+
<depend>gz_ros2_control</depend>
28+
<depend>robot_state_publisher</depend>
29+
<depend>joint_state_broadcaster</depend>
30+
<depend>diff_drive_controller</depend>
31+
2232
<export>
2333
<build_type>ament_cmake</build_type>
2434
</export>

0 commit comments

Comments
 (0)