Skip to content

Commit

Permalink
Fix lidar in simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Nov 27, 2024
1 parent 324d5c4 commit 5d135ba
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
15 changes: 13 additions & 2 deletions rosbot_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def generate_launch_description():
description="Whether to use mecanum drive controller (otherwise diff drive controller is used)",
)

simulation_engine = LaunchConfiguration("simulation_engine")
declare_simulation_engine_arg = DeclareLaunchArgument(
"simulation_engine",
default_value="ignition-gazebo",
description="Which simulation engine to be used",
choices=["ignition-gazebo", "webots"],
)

use_sim = LaunchConfiguration("use_sim")
declare_use_sim_arg = DeclareLaunchArgument(
"use_sim",
Expand Down Expand Up @@ -79,10 +87,12 @@ def generate_launch_description():
),
" mecanum:=",
mecanum,
" use_sim:=",
use_sim,
" namespace:=",
namespace,
" simulation_engine:=",
simulation_engine,
" use_sim:=",
use_sim,
]
)
robot_description = {"robot_description": robot_description_content}
Expand Down Expand Up @@ -172,6 +182,7 @@ def generate_launch_description():
[
declare_namespace_arg,
declare_mecanum_arg,
declare_simulation_engine_arg,
declare_use_sim_arg,
SetParameter("use_sim_time", value=use_sim),
control_node,
Expand Down
2 changes: 1 addition & 1 deletion rosbot_description/urdf/body.urdf.xacro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- body defining macro -->
<xacro:macro name="body" params="wheel_radius mecanum use_gpu namespace">
<xacro:macro name="body" params="wheel_radius mecanum namespace">
<xacro:include filename="$(find rosbot_description)/urdf/components/vl53lox.urdf.xacro" ns="range_sensor" />

<link name="base_link" />
Expand Down
4 changes: 1 addition & 3 deletions rosbot_description/urdf/rosbot.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<robot name="rosbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:arg name="use_sim" default="false" />
<xacro:arg name="use_gpu" default="false" />
<xacro:arg name="mecanum" default="false" />
<xacro:arg name="simulation_engine" default="ignition-gazebo" />
<xacro:arg name="namespace" default="None" />
Expand All @@ -11,7 +10,6 @@
<xacro:husarion.rosbot_robot
mecanum="$(arg mecanum)"
use_sim="$(arg use_sim)"
use_gpu="$(arg use_gpu)"
simulation_engine="$(arg simulation_engine)"
namespace="$(arg namespace)" />

Expand All @@ -20,7 +18,7 @@
parent_link="cover_link"
xyz="0.02 0.0 0.0"
rpy="0.0 0.0 0.0"
use_gpu="$(arg use_gpu)"
use_gpu="true"
namespace="$(arg namespace)"
simulation_engine="$(arg simulation_engine)" />

Expand Down
4 changes: 2 additions & 2 deletions rosbot_description/urdf/rosbot_macro.urdf.xacro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0'?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
<xacro:macro name="rosbot_robot" params="mecanum use_sim use_gpu simulation_engine namespace ">
<xacro:macro name="rosbot_robot" params="mecanum use_sim simulation_engine namespace ">

<xacro:if value="${namespace == 'None'}">
<xacro:property name="namespace_ext" value="" />
Expand All @@ -21,7 +21,7 @@
<xacro:include filename="$(find rosbot_description)/urdf/wheel.urdf.xacro" ns="wheel" />

<!-- BODY DECLARATION -->
<xacro:body.body wheel_radius="${wheel_radius}" mecanum="${mecanum}" use_gpu="${use_gpu}" namespace="${namespace}" />
<xacro:body.body wheel_radius="${wheel_radius}" mecanum="${mecanum}" namespace="${namespace}" />

<!-- WHEEL DECLARATION -->
<xacro:wheel.wheel wheel_radius="${wheel_radius}" side="fr" mecanum="${mecanum}" />
Expand Down

0 comments on commit 5d135ba

Please sign in to comment.