Skip to content

Commit 9d8fd18

Browse files
authored
Merge pull request #761 from JdeRobot/test-drones-again
Test drones in urdf
2 parents df6758f + 8b3e738 commit 9d8fd18

43 files changed

Lines changed: 168 additions & 995 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CustomRobots/quadrotor/launch/quadrotor.launch.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ def launch_setup(context):
6666
gz_spawn_entity = Node(
6767
package="ros_gz_sim",
6868
executable="create",
69+
namespace=gz_namespace,
6970
arguments=[
7071
"-topic",
71-
namespace + "/robot_description",
72+
"robot_description",
7273
"-name",
73-
"quadrotor",
74+
namespace,
7475
"-allow_renaming",
7576
"true",
7677
"-x",
@@ -104,9 +105,9 @@ def launch_setup(context):
104105
output="screen",
105106
parameters=[
106107
{
107-
"name_space": gz_namespace,
108+
"name_space": namespace,
108109
"pose_frame_id": "earth",
109-
"twist_frame_id": [gz_namespace, "/base_link"],
110+
"twist_frame_id": namespace + "/base_link",
110111
},
111112
],
112113
)
@@ -119,7 +120,7 @@ def launch_setup(context):
119120
]
120121
),
121122
launch_arguments={
122-
"namespace": namespace,
123+
"namespace": gz_namespace,
123124
}.items(),
124125
)
125126

CustomRobots/quadrotor/models/quadrotor/quadrotor.urdf.xacro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<xacro:quadrotor namespace="${namespace}"/>
1313

1414
<xacro:if value="$(arg camera)">
15-
<xacro:camera xyz="0 0 0" rpy="0 -1.57 0" mass="0.035" name="frontal_cam" parent="base_link" namespace="${namespace}"/>
16-
<xacro:camera xyz="0 0 0" rpy="0 -1.57 0" mass="0.035" name="ventral_cam" parent="base_link" namespace="${namespace}"/>
15+
<xacro:camera xyz="0 0 0" rpy="0 0 0" mass="0.035" name="frontal_cam" parent="base_link" namespace="${namespace}"/>
16+
<xacro:camera xyz="0 0 0" rpy="0 1.57 0" mass="0.035" name="ventral_cam" parent="base_link" namespace="${namespace}"/>
1717
</xacro:if>
1818
</robot>

CustomRobots/quadrotor/models/quadrotor/quadrotor_common.urdf.xacro

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<color rgba="0 0 1 1.0"/>
1111
</material>
1212

13-
<xacro:macro name="rotor" params="rotor parent xyz color">
13+
<xacro:macro name="rotor" params="rotor parent xyz color namespace">
1414
<link name='rotor_${rotor}'>
1515
<inertial>
1616
<mass value="0.005"/>
1717
<inertia ixx="9.75e-07" ixy="0" ixz="0" iyy="4.17041e-05" iyz="0" izz="4.26041e-05"/>
1818
</inertial>
1919

20-
<collision name='rotor_${rotor}_collision'>
20+
<collision>
2121
<geometry>
2222
<cylinder length="0.005" radius="0.1"/>
2323
</geometry>
2424
</collision>
25-
<visual name='rotor_${rotor}_visual'>
25+
<visual>
2626
<geometry>
2727
<mesh filename="$(find as2_gazebo_assets)/models/quadrotor_base/meshes/propeller_ccw.dae" scale="0.1 0.1 0.1"/>
2828
</geometry>
@@ -44,11 +44,11 @@
4444

4545
<xacro:macro name="quadrotor" params="namespace">
4646

47-
<link name="base"></link>
48-
4947
<!-- This is from quadrotor_base from as2 -->
5048
<link name="base_link">
51-
<enable_wind>true</enable_wind>
49+
<gazebo>
50+
<enable_wind>true</enable_wind>
51+
</gazebo>
5252
<inertial>
5353
<mass value="1.5"/>
5454
<inertia ixx="0.025" ixy="0" ixz="0" iyy="0.009" iyz="0" izz="0.033"/>
@@ -58,7 +58,7 @@
5858
<box size="0.47 0.47 0.11"/>
5959
</geometry>
6060
</collision>
61-
<visual name='base_link_inertia_visual'>
61+
<visual>
6262
<geometry>
6363
<mesh filename="$(find as2_gazebo_assets)/models/quadrotor_base/meshes/quadrotor.dae"/>
6464
</geometry>
@@ -86,21 +86,15 @@
8686
</visual>
8787
</link>
8888

89-
<joint name="base_to_base_link" type="fixed">
90-
<parent link="base"/>
91-
<child link="base_link"/>
92-
<origin xyz="0 0 0" rpy="0 0 0"/>
93-
</joint>
94-
95-
<xacro:rotor rotor="0" parent="base_link" xyz="0.13 -0.22 0.023" color="Blue"/>
96-
<xacro:rotor rotor="1" parent="base_link" xyz="-0.13 0.2 0.023" color="Red"/>
97-
<xacro:rotor rotor="2" parent="base_link" xyz="0.13 0.22 0.023" color="Blue"/>
98-
<xacro:rotor rotor="3" parent="base_link" xyz="-0.13 -0.2 0.023" color="Red"/>
89+
<xacro:rotor rotor="0" parent="base_link" xyz="0.13 -0.22 0.023" color="Blue" namespace="${namespace}"/>
90+
<xacro:rotor rotor="1" parent="base_link" xyz="-0.13 0.2 0.023" color="Red" namespace="${namespace}"/>
91+
<xacro:rotor rotor="2" parent="base_link" xyz="0.13 0.22 0.023" color="Blue" namespace="${namespace}"/>
92+
<xacro:rotor rotor="3" parent="base_link" xyz="-0.13 -0.2 0.023" color="Red" namespace="${namespace}"/>
9993

100-
<xacro:imu mass="0.005" parent="base_link"/>
101-
<xacro:velocity namespace="${namespace}"/>
10294
<xacro:tf freq="100"/>
103-
<xacro:odom topic="/${namespace}/odom" freq="100"/>
95+
<xacro:imu mass="0.005" parent="base_link" namespace="${namespace}"/>
96+
<xacro:odom topic="odom" freq="100" namespace="${namespace}"/>
10497
<xacro:motors namespace="${namespace}"/>
98+
<xacro:velocity namespace="${namespace}"/>
10599
</xacro:macro>
106100
</robot>

CustomRobots/quadrotor/models/quadrotor/quadrotor_gz.urdf.xacro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,19 @@
100100
</gazebo>
101101
</xacro:macro>
102102

103-
<xacro:macro name="odom" params="topic freq">
103+
<xacro:macro name="odom" params="topic freq namespace">
104104
<gazebo>
105105
<plugin filename="gz-sim-odometry-publisher-system" name="gz::sim::systems::OdometryPublisher">
106106
<!-- <odom_frame>odom</odom_frame>
107-
<robot_base_frame>base</robot_base_frame>
107+
<robot_base_frame>base_link</robot_base_frame>
108108
<odom_topic>${topic}</odom_topic> -->
109109
<odom_publish_frequency>${freq}</odom_publish_frequency>
110110
<dimensions>3</dimensions>
111111
</plugin>
112112
</gazebo>
113113
</xacro:macro>
114114

115-
<xacro:macro name="imu" params="parent mass">
115+
<xacro:macro name="imu" params="parent mass namespace">
116116
<gazebo>
117117
<plugin filename="gz-sim-imu-system" name="gz::sim::systems::Imu">
118118
</plugin>
@@ -244,7 +244,7 @@
244244
<motorConstant>8.54858e-06</motorConstant>
245245
<momentConstant>0.016</momentConstant>
246246
<commandSubTopic>command/motor_speed</commandSubTopic>
247-
<motorNumber>${rotor-1}</motorNumber>
247+
<actuator_number>${rotor-1}</actuator_number>
248248
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
249249
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
250250
<motorSpeedPubTopic>motor_speed/${rotor-1}</motorSpeedPubTopic>

Launchers/3d_reconstruction.launch.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import os
22

33
from ament_index_python.packages import get_package_share_directory
4+
45
from launch import LaunchDescription
5-
from launch.actions import (
6-
IncludeLaunchDescription,
7-
SetEnvironmentVariable,
8-
AppendEnvironmentVariable,
9-
)
6+
from launch.actions import IncludeLaunchDescription
107
from launch.launch_description_sources import PythonLaunchDescriptionSource
118
from launch_ros.actions import Node
129

1310

1411
def generate_launch_description():
15-
package_dir = get_package_share_directory("custom_robots")
1612
ros_gz_sim = get_package_share_directory("ros_gz_sim")
1713

18-
gazebo_models_path = os.path.join(package_dir, "models")
19-
2014
world_file_name = "kobuki_1_reconstruction3d.world"
2115
worlds_dir = "/opt/jderobot/Worlds"
2216
world_path = os.path.join(worlds_dir, world_file_name)
@@ -39,13 +33,6 @@ def generate_launch_description():
3933
)
4034

4135
ld = LaunchDescription()
42-
43-
ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path))
44-
set_env_vars_resources = AppendEnvironmentVariable(
45-
"GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models")
46-
)
47-
ld.add_action(set_env_vars_resources)
48-
4936
ld.add_action(gazebo_server)
5037
ld.add_action(world_entity_cmd)
5138

Launchers/autopark_battery.launch.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@
33
from ament_index_python.packages import get_package_share_directory
44

55
from launch import LaunchDescription
6-
from launch.actions import (
7-
DeclareLaunchArgument,
8-
IncludeLaunchDescription,
9-
SetEnvironmentVariable,
10-
AppendEnvironmentVariable,
11-
)
6+
from launch.actions import IncludeLaunchDescription
127
from launch.launch_description_sources import PythonLaunchDescriptionSource
13-
from launch.substitutions import LaunchConfiguration, Command
148
from launch_ros.actions import Node
15-
from launch.substitutions import LaunchConfiguration
16-
from launch_ros.actions import Node
17-
from launch_ros.parameter_descriptions import ParameterValue
189

1910

2011
def generate_launch_description():
21-
package_dir = get_package_share_directory("custom_robots")
2212
ros_gz_sim = get_package_share_directory("ros_gz_sim")
2313

24-
gazebo_models_path = os.path.join(package_dir, "models")
25-
2614
world_file_name = "autopark_battery.world"
2715
worlds_dir = "/opt/jderobot/Worlds"
2816
world_path = os.path.join(worlds_dir, world_file_name)
@@ -45,13 +33,6 @@ def generate_launch_description():
4533
)
4634

4735
ld = LaunchDescription()
48-
49-
ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path))
50-
set_env_vars_resources = AppendEnvironmentVariable(
51-
"GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models")
52-
)
53-
ld.add_action(set_env_vars_resources)
54-
5536
ld.add_action(gazebo_server)
5637
ld.add_action(world_entity_cmd)
5738

Launchers/autopark_line.launch.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@
33
from ament_index_python.packages import get_package_share_directory
44

55
from launch import LaunchDescription
6-
from launch.actions import (
7-
DeclareLaunchArgument,
8-
IncludeLaunchDescription,
9-
SetEnvironmentVariable,
10-
AppendEnvironmentVariable,
11-
)
6+
from launch.actions import IncludeLaunchDescription
127
from launch.launch_description_sources import PythonLaunchDescriptionSource
13-
from launch.substitutions import LaunchConfiguration, Command
148
from launch_ros.actions import Node
15-
from launch.substitutions import LaunchConfiguration
16-
from launch_ros.actions import Node
17-
from launch_ros.parameter_descriptions import ParameterValue
189

1910

2011
def generate_launch_description():
21-
package_dir = get_package_share_directory("custom_robots")
2212
ros_gz_sim = get_package_share_directory("ros_gz_sim")
2313

24-
gazebo_models_path = os.path.join(package_dir, "models")
25-
2614
world_file_name = "autopark_line.world"
2715
worlds_dir = "/opt/jderobot/Worlds"
2816
world_path = os.path.join(worlds_dir, world_file_name)
@@ -45,13 +33,6 @@ def generate_launch_description():
4533
)
4634

4735
ld = LaunchDescription()
48-
49-
ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path))
50-
set_env_vars_resources = AppendEnvironmentVariable(
51-
"GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models")
52-
)
53-
ld.add_action(set_env_vars_resources)
54-
5536
ld.add_action(gazebo_server)
5637
ld.add_action(world_entity_cmd)
5738

Launchers/autopark_sideways.launch.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@
33
from ament_index_python.packages import get_package_share_directory
44

55
from launch import LaunchDescription
6-
from launch.actions import (
7-
DeclareLaunchArgument,
8-
IncludeLaunchDescription,
9-
SetEnvironmentVariable,
10-
AppendEnvironmentVariable,
11-
)
6+
from launch.actions import IncludeLaunchDescription
127
from launch.launch_description_sources import PythonLaunchDescriptionSource
13-
from launch.substitutions import LaunchConfiguration, Command
148
from launch_ros.actions import Node
15-
from launch.substitutions import LaunchConfiguration
16-
from launch_ros.actions import Node
17-
from launch_ros.parameter_descriptions import ParameterValue
189

1910

2011
def generate_launch_description():
21-
package_dir = get_package_share_directory("custom_robots")
2212
ros_gz_sim = get_package_share_directory("ros_gz_sim")
2313

24-
gazebo_models_path = os.path.join(package_dir, "models")
25-
2614
world_file_name = "autopark_sideways.world"
2715
worlds_dir = "/opt/jderobot/Worlds"
2816
world_path = os.path.join(worlds_dir, world_file_name)
@@ -45,13 +33,6 @@ def generate_launch_description():
4533
)
4634

4735
ld = LaunchDescription()
48-
49-
ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path))
50-
set_env_vars_resources = AppendEnvironmentVariable(
51-
"GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models")
52-
)
53-
ld.add_action(set_env_vars_resources)
54-
5536
ld.add_action(gazebo_server)
5637
ld.add_action(world_entity_cmd)
5738

Launchers/basic_city.launch.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import os
22

33
from ament_index_python.packages import get_package_share_directory
4+
45
from launch import LaunchDescription
5-
from launch.actions import (
6-
IncludeLaunchDescription,
7-
SetEnvironmentVariable,
8-
AppendEnvironmentVariable,
9-
)
6+
from launch.actions import IncludeLaunchDescription
107
from launch.launch_description_sources import PythonLaunchDescriptionSource
118
from launch_ros.actions import Node
129

1310

1411
def generate_launch_description():
15-
package_dir = get_package_share_directory("custom_robots")
1612
ros_gz_sim = get_package_share_directory("ros_gz_sim")
1713

18-
gazebo_models_path = os.path.join(package_dir, "models")
19-
2014
world_file_name = "basic_city.world"
2115
worlds_dir = "/opt/jderobot/Worlds"
2216
world_path = os.path.join(worlds_dir, world_file_name)
@@ -39,13 +33,6 @@ def generate_launch_description():
3933
)
4034

4135
ld = LaunchDescription()
42-
43-
ld.add_action(SetEnvironmentVariable("GZ_SIM_RESOURCE_PATH", gazebo_models_path))
44-
set_env_vars_resources = AppendEnvironmentVariable(
45-
"GZ_SIM_RESOURCE_PATH", os.path.join(package_dir, "models")
46-
)
47-
ld.add_action(set_env_vars_resources)
48-
4936
ld.add_action(gazebo_server)
5037
ld.add_action(world_entity_cmd)
5138

0 commit comments

Comments
 (0)