Skip to content

Commit 2b4033d

Browse files
Merge pull request #4 from westonrobot/devel
Devel
2 parents bdb50db + 4fb567e commit 2b4033d

4 files changed

Lines changed: 266 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Remember to source the ROS Workspace first and optionally set ROS_DOMAIN_ID
8080

8181
* Bringup Robot
8282
```bash
83+
$ sudo ip link set can0 up type can bitrate 500000
84+
$ sudo ip link set can0 txqueuelen 1000
8385
$ ros2 launch wr_devkit_robot_bringup wr_devkit_robot_bringup.launch.py
8486
```
8587

@@ -105,3 +107,13 @@ Remember to source the ROS Workspace first and optionally set ROS_DOMAIN_ID
105107
```bash
106108
ros2 launch nav2_bringup rviz_launch.py
107109
```
110+
111+
## Additional Notes
112+
113+
* Sample launch files for ultrasonic sensors (not integrated with Nav2)
114+
115+
* Ranger Mini 2.0
116+
117+
```bash
118+
$ ros2 launch wr_devkit_robot_bringup wr_devkit_ultrasonic_bringup.launch.py
119+
```
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
from ament_index_python.packages import get_package_share_directory
2+
3+
from launch import LaunchDescription
4+
from launch.actions import DeclareLaunchArgument
5+
from launch.substitutions import Command, PathJoinSubstitution
6+
from launch.substitutions.launch_configuration import LaunchConfiguration
7+
8+
from launch_ros.actions import Node
9+
10+
import os
11+
12+
13+
def generate_launch_description():
14+
15+
pkg_dir = get_package_share_directory("wr_devkit_description")
16+
17+
# Create the launch configuration variables
18+
namespace = LaunchConfiguration("namespace")
19+
xacro_file = LaunchConfiguration("xacro_file")
20+
use_sim_time = LaunchConfiguration("use_sim_time")
21+
is_scout_mini = LaunchConfiguration("is_scout_mini")
22+
23+
declare_use_sim_time_cmd = DeclareLaunchArgument(
24+
"use_sim_time",
25+
default_value="true",
26+
description="use_sim_time",
27+
)
28+
29+
declare_robot_name_cmd = DeclareLaunchArgument(
30+
"robot_name", default_value="wr_devkit", description="WR Dev Kit"
31+
)
32+
declare_namespace_cmd = DeclareLaunchArgument(
33+
"namespace",
34+
default_value=LaunchConfiguration("robot_name"),
35+
description="Robot namespace",
36+
)
37+
38+
declare_is_scout_mini_cmd = DeclareLaunchArgument(
39+
"is_scout_mini",
40+
default_value="false",
41+
description="Is Scout Mini",
42+
)
43+
44+
xacro_file = PathJoinSubstitution(
45+
[pkg_dir, "urdf", "wr_devkit_ultrasonic.urdf.xacro"]
46+
)
47+
48+
ultrasonic_tf_publisher = Node(
49+
package="robot_state_publisher",
50+
executable="robot_state_publisher",
51+
name="ultrasonic_tf_publisher",
52+
output="screen",
53+
parameters=[
54+
{"use_sim_time": use_sim_time},
55+
{
56+
"robot_description": Command(
57+
[
58+
"xacro",
59+
" ",
60+
xacro_file,
61+
" ",
62+
"namespace:=",
63+
namespace,
64+
" ",
65+
"scout_mini:=",
66+
is_scout_mini,
67+
]
68+
)
69+
},
70+
],
71+
remappings=[("/tf", "tf"), ("/tf_static", "tf_static")],
72+
)
73+
74+
# Create the launch description and populate
75+
ld = LaunchDescription()
76+
77+
# Add nodes to LaunchDescription
78+
ld.add_action(declare_use_sim_time_cmd)
79+
ld.add_action(declare_robot_name_cmd)
80+
ld.add_action(declare_namespace_cmd)
81+
ld.add_action(declare_is_scout_mini_cmd)
82+
ld.add_action(ultrasonic_tf_publisher)
83+
return ld
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0"?>
2+
<robot name="ultrasonic_rangermini_description" xmlns:xacro="http://www.ros.org/wiki/xacro">
3+
4+
<xacro:arg name="scout_mini" default="false" />
5+
6+
<xacro:property name="z_offset" value="0.33" />
7+
<xacro:property name="x1_offset" value="0.385" />
8+
<xacro:property name="y1_offset" value="0.165" />
9+
10+
<xacro:property name="x2_offset" value="0.2725" />
11+
<xacro:property name="y2_offset" value="0.275" />
12+
13+
<xacro:if value="$(arg scout_mini)">
14+
<xacro:property name="z_offset" value="0.20" />
15+
<xacro:property name="x1_offset" value="0.3" />
16+
<xacro:property name="y1_offset" value="0.16" />
17+
18+
<xacro:property name="x2_offset" value="0.2" />
19+
<xacro:property name="y2_offset" value="0.2" />
20+
</xacro:if>
21+
22+
<link name="base_link">
23+
</link>
24+
25+
<link name="ultrasonic_link_0">
26+
</link>
27+
28+
<link name="ultrasonic_link_1">
29+
</link>
30+
31+
<link name="ultrasonic_link_2">
32+
</link>
33+
34+
<link name="ultrasonic_link_3">
35+
</link>
36+
37+
<link name="ultrasonic_link_4">
38+
</link>
39+
40+
<link name="ultrasonic_link_5">
41+
</link>
42+
43+
<link name="ultrasonic_link_6">
44+
</link>
45+
46+
<link name="ultrasonic_link_7">
47+
</link>
48+
49+
50+
<joint name="ultrasonic_joint_0" type="fixed">
51+
<origin xyz="${x1_offset} -${y1_offset} ${z_offset}" rpy="0 0 0" />
52+
<parent link="base_link" />
53+
<child link="ultrasonic_link_0" />
54+
</joint>
55+
56+
<joint name="ultrasonic_joint_1" type="fixed">
57+
<origin xyz="${x1_offset} ${y1_offset} ${z_offset}" rpy="0 0 0" />
58+
<parent link="base_link" />
59+
<child link="ultrasonic_link_1" />
60+
</joint>
61+
62+
<joint name="ultrasonic_joint_2" type="fixed">
63+
<origin xyz="${x2_offset} ${y2_offset} ${z_offset}" rpy="0 0 1.5708" />
64+
<parent link="base_link" />
65+
<child link="ultrasonic_link_2" />
66+
</joint>
67+
68+
<joint name="ultrasonic_joint_3" type="fixed">
69+
<origin xyz="-${x2_offset} ${y2_offset} ${z_offset}" rpy="0 0 1.5708" />
70+
<parent link="base_link" />
71+
<child link="ultrasonic_link_3" />
72+
</joint>
73+
74+
<joint name="ultrasonic_joint_4" type="fixed">
75+
<origin xyz="-${x1_offset} ${y1_offset} ${z_offset}" rpy="0 0 3.1416" />
76+
<parent link="base_link" />
77+
<child link="ultrasonic_link_4" />
78+
</joint>
79+
80+
<joint name="ultrasonic_joint_5" type="fixed">
81+
<origin xyz="-${x1_offset} -${y1_offset} ${z_offset}" rpy="0 0 3.1416" />
82+
<parent link="base_link" />
83+
<child link="ultrasonic_link_5" />
84+
</joint>
85+
86+
<joint name="ultrasonic_joint_6" type="fixed">
87+
<origin xyz="-${x2_offset} -${y2_offset} ${z_offset}" rpy="0 0 -1.5708" />
88+
<parent link="base_link" />
89+
<child link="ultrasonic_link_6" />
90+
</joint>
91+
92+
<joint name="ultrasonic_joint_7" type="fixed">
93+
<origin xyz="${x2_offset} -${y2_offset} ${z_offset}" rpy="0 0 -1.5708" />
94+
<parent link="base_link" />
95+
<child link="ultrasonic_link_7" />
96+
</joint>
97+
98+
</robot>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
from launch import LaunchDescription
2+
from launch.actions import IncludeLaunchDescription, GroupAction, DeclareLaunchArgument
3+
from launch.launch_description_sources import PythonLaunchDescriptionSource
4+
from launch_ros.actions import Node, PushRosNamespace
5+
from launch_ros.substitutions import FindPackageShare
6+
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
7+
from launch.conditions import IfCondition
8+
9+
10+
def generate_launch_description():
11+
use_namespace = LaunchConfiguration("use_namespace")
12+
namespace = LaunchConfiguration("namespace")
13+
device_path = LaunchConfiguration("device_path")
14+
15+
declare_use_namespace_cmd = DeclareLaunchArgument(
16+
"use_namespace",
17+
default_value="false",
18+
description="Whether to apply a namespace to nodes",
19+
)
20+
21+
declare_namespace_cmd = DeclareLaunchArgument(
22+
"namespace", default_value="", description="Top-level namespace"
23+
)
24+
25+
declare_device_path_cmd = DeclareLaunchArgument(
26+
"device_path",
27+
default_value="/dev/ttyS0",
28+
description="Path to device port",
29+
)
30+
31+
ultrasonic_bringup = GroupAction(
32+
[
33+
PushRosNamespace(condition=IfCondition(use_namespace), namespace=namespace),
34+
IncludeLaunchDescription(
35+
PythonLaunchDescriptionSource(
36+
[
37+
PathJoinSubstitution(
38+
[
39+
FindPackageShare("wr_devkit_description"),
40+
"launch/wr_devkit_ultrasonic.launch.py",
41+
]
42+
)
43+
]
44+
),
45+
launch_arguments={}.items(),
46+
),
47+
IncludeLaunchDescription(
48+
PythonLaunchDescriptionSource(
49+
[
50+
PathJoinSubstitution(
51+
[
52+
FindPackageShare("wrp_ros2"),
53+
"launch/peripheral/ultrasonic_sensor.launch.py",
54+
]
55+
)
56+
]
57+
),
58+
launch_arguments={
59+
"sensor_model": "w200d",
60+
"device_path": device_path,
61+
}.items(),
62+
),
63+
]
64+
)
65+
66+
ld = LaunchDescription()
67+
68+
ld.add_action(declare_use_namespace_cmd)
69+
ld.add_action(declare_namespace_cmd)
70+
ld.add_action(declare_device_path_cmd)
71+
ld.add_action(ultrasonic_bringup)
72+
73+
return ld

0 commit comments

Comments
 (0)