Skip to content

Commit

Permalink
add ZED urdf + list of choices (#49)
Browse files Browse the repository at this point in the history
* add ZED urdf + list of choices

* choices to root dir

* readme

* Update README.md

* Update README.md

* fix gz bridge

* Remapping

* Add word

* add suggestions

* add urdf tests

* Add None and velodyne to test

* Update pre-commit and fix tests
  • Loading branch information
rafal-gorecki authored Nov 13, 2023
1 parent 330e16e commit 4915d27
Show file tree
Hide file tree
Showing 22 changed files with 395 additions and 245 deletions.
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
extend-ignore = E203, B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202
import-order-style = google
max-line-length = 99
show-source = true
statistics = true
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ install/
log/
__pycache__/


# ROSbots submodules
rosbot_hardware_interfaces/
ros_components_description/
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args: [--pytest-test-first]

- repo: https://github.com/codespell-project/codespell
rev: v1.16.0
rev: v2.2.6
hooks:
- id: codespell
name: codespell
Expand All @@ -26,13 +26,13 @@ repos:
types: [text]

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.1
rev: 0.2.3
hooks:
- id: yamlfmt
files: ^.github|./\.yaml

- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black
args: ["--line-length=99", "--preview"]
Expand All @@ -41,7 +41,7 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
args: ["--ignore=E501,W503"] # ignore too long line and line break before binary operator,
args: ["--ignore=E501,W503,E203"] # ignore too long line and line break before binary operator,
# black checks it

- repo: local
Expand Down
2 changes: 2 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ gazebosim
msgs
nav
pytest
FIXME
TODO
nan
rclpy
utils
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ To run the software on real ROSbot XL, also communication with Digital Board wil
First update your firmware to make sure that you use the latest version, then run the `micro-ROS` agent.
For detailed instructions refer to the [rosbot_xl_firmware repository](https://github.com/husarion/rosbot_xl_firmware).

## Source build
## Prepare environment

### Prerequisites

Install `colcon`, `vsc` and `rosdep`:
1. **Install `colcon`, `vsc` and `rosdep`**
```
sudo apt-get update
sudo apt-get install -y python3-colcon-common-extensions python3-vcstool python3-rosdep
```

Create workspace folder and clone `rosbot_xl_ros` repository:
2. **Create workspace folder and clone `rosbot_xl_ros` repository:**
```
mkdir -p ros2_ws/src
cd ros2_ws
Expand All @@ -61,7 +59,7 @@ git clone https://github.com/husarion/rosbot_xl_ros src/

### Build and run on hardware

Building:
1. **Building**
```
export HUSARION_ROS_BUILD=hardware
Expand All @@ -77,19 +75,18 @@ rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
colcon build
```

> **Prerequisites**
>
> Before starting the software on the robot please make sure that you're using the latest firmware and run the `micro-ROS` agent (as described in the *Usage on hardware* step).
> [!NOTE]
> Before starting the software on the robot please make sure that you're using the latest firmware and run the `micro-ROS` agent as described in the [Usage on hardware](#usage-on-hardware) step.
Running:
2. **Running**
```
source install/setup.bash
ros2 launch rosbot_xl_bringup bringup.launch.py
```

### Build and run Gazebo simulation

Building:
1. **Building**
```
export HUSARION_ROS_BUILD=simulation
Expand All @@ -104,7 +101,7 @@ rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
colcon build
```

Running:
2. **Running**
```
source install/setup.bash
ros2 launch rosbot_xl_gazebo simulation.launch.py
Expand All @@ -123,6 +120,9 @@ pre-commit install

# manually run tests
pre-commit run -a

# update revision
pre-commit autoupdate
```

After initialization [pre-commit configuration](.pre-commit-config.yaml) will applied on every commit.
Expand Down
64 changes: 39 additions & 25 deletions rosbot_xl_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,36 @@ def generate_launch_description():
),
)

lidar_model = LaunchConfiguration("lidar_model")
declare_lidar_model_arg = DeclareLaunchArgument(
"lidar_model",
default_value="slamtec_rplidar_s1",
description="Lidar model added to the URDF",
)

camera_model = LaunchConfiguration("camera_model")
declare_camera_model_arg = DeclareLaunchArgument(
"camera_model",
default_value="None",
description="Camera model added to the URDF",
description="Add camera model to the robot URDF",
choices=[
"None",
"intel_realsense_d435",
"stereolabs_zed",
"stereolabs_zedm",
"stereolabs_zed2",
"stereolabs_zed2i",
"stereolabs_zedx",
"stereolabs_zedxm",
],
)

lidar_model = LaunchConfiguration("lidar_model")
declare_lidar_model_arg = DeclareLaunchArgument(
"lidar_model",
default_value="slamtec_rplidar_s1",
description="Add LiDAR model to the robot URDF",
choices=[
"None",
"ouster_os1_32",
"slamtec_rplidar_a2",
"slamtec_rplidar_a3",
"slamtec_rplidar_s1",
"velodyne_puck",
],
)

include_camera_mount = LaunchConfiguration("include_camera_mount")
Expand All @@ -72,13 +90,11 @@ def generate_launch_description():

controller_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
get_package_share_directory("rosbot_xl_controller"),
"launch",
"controller.launch.py",
]
)
PathJoinSubstitution([
get_package_share_directory("rosbot_xl_controller"),
"launch",
"controller.launch.py",
])
),
launch_arguments={
"mecanum": mecanum,
Expand All @@ -96,23 +112,21 @@ def generate_launch_description():
name="ekf_filter_node",
output="screen",
parameters=[
PathJoinSubstitution(
[get_package_share_directory("rosbot_xl_bringup"), "config", "ekf.yaml"]
)
PathJoinSubstitution([
get_package_share_directory("rosbot_xl_bringup"), "config", "ekf.yaml"
])
],
)

laser_filter_node = Node(
package="laser_filters",
executable="scan_to_scan_filter_chain",
parameters=[
PathJoinSubstitution(
[
get_package_share_directory("rosbot_xl_bringup"),
"config",
"laser_filter.yaml",
]
)
PathJoinSubstitution([
get_package_share_directory("rosbot_xl_bringup"),
"config",
"laser_filter.yaml",
])
],
)

Expand Down
12 changes: 5 additions & 7 deletions rosbot_xl_bringup/test/test_diff_drive_ekf_and_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ def generate_test_description():
rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup")
bringup_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
rosbot_xl_bringup,
"launch",
"bringup.launch.py",
]
)
PathJoinSubstitution([
rosbot_xl_bringup,
"launch",
"bringup.launch.py",
])
),
launch_arguments={
"use_sim": "False",
Expand Down
4 changes: 3 additions & 1 deletion rosbot_xl_bringup/test/test_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
# limitations under the License.

from ament_flake8.main import main_with_errors
from os.path import join, dirname
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
config_file = join(dirname(dirname(dirname(__file__))), ".flake8")
rc, errors = main_with_errors(argv=["--config", config_file])
assert rc == 0, "Found %d code style errors / warnings:\n" % len(errors) + "\n".join(errors)
12 changes: 5 additions & 7 deletions rosbot_xl_bringup/test/test_mecanum_ekf_and_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ def generate_test_description():
rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup")
bringup_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
rosbot_xl_bringup,
"launch",
"bringup.launch.py",
]
)
PathJoinSubstitution([
rosbot_xl_bringup,
"launch",
"bringup.launch.py",
])
),
launch_arguments={
"use_sim": "False",
Expand Down
Loading

0 comments on commit 4915d27

Please sign in to comment.