Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added teleop and ArduSub launch files #6

Merged
merged 63 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
218eb50
Started thruster hardware
evan-palmer Mar 13, 2024
4492f00
Implemented initial version of thruster hardware interface
evan-palmer Mar 13, 2024
52ff0ad
Added a few notes for future work
evan-palmer Mar 13, 2024
2a5eeca
Added commented out code from initial testing
evan-palmer Mar 14, 2024
5f3f4a2
Working state for thruster hardware
evan-palmer Mar 14, 2024
777a8d9
Finished last bit of todos
evan-palmer Mar 14, 2024
8a2f1f8
Updated CI/CD to reflect project structure
evan-palmer Mar 14, 2024
f0d503f
Added simple ardusub manager
evan-palmer Mar 15, 2024
21d70ac
Fixed ardusub manager build
evan-palmer Mar 15, 2024
090eede
Fixed bug in parameters
evan-palmer Mar 15, 2024
915b8d5
Started thruster hardware docs
evan-palmer Mar 18, 2024
22e2019
cleaned up command interfaces section and specified required mavros p…
evan-palmer Mar 18, 2024
c91690b
Fixed grammatical error
evan-palmer Mar 18, 2024
c5111e9
Added manager readme
evan-palmer Mar 18, 2024
17a98e1
Added top level readme
evan-palmer Mar 18, 2024
a8e0ad9
Added missing mavros link
evan-palmer Mar 18, 2024
26c82c4
cleanup
evan-palmer Mar 18, 2024
aace9f1
Fixed grammatical errors in ardusub manager readme
evan-palmer Mar 18, 2024
6ea30c6
Noted the support for simulation and hardware deployment
evan-palmer Mar 18, 2024
4bb3b16
Fixed linting error
evan-palmer Mar 18, 2024
6ee304b
Added launch file for manager
evan-palmer Mar 22, 2024
59bfa89
added missing parameter to launch file
evan-palmer Mar 23, 2024
981ca77
Potential fix for service call bug
evan-palmer Mar 23, 2024
c0304a2
Probably should have tried building first
evan-palmer Mar 23, 2024
7f5d631
Distinguished error messages
evan-palmer Mar 23, 2024
1b95f53
I forgot what I changed
evan-palmer Mar 23, 2024
0bbd739
Added new callback group to service
evan-palmer Mar 23, 2024
798b003
More tests
evan-palmer Mar 23, 2024
fcce4b1
Trying multithreaded executor
evan-palmer Mar 23, 2024
6013776
Almost forgot to build again
evan-palmer Mar 23, 2024
8e83d55
Fixed activate method
evan-palmer Mar 23, 2024
4c8fa74
Nevermind
evan-palmer Mar 23, 2024
045cded
Back to potentially working state
evan-palmer Mar 23, 2024
c87c0b0
That worked
evan-palmer Mar 23, 2024
02fa148
Removed set home
evan-palmer Mar 23, 2024
55ccdbc
Added waits for publisher and services
evan-palmer Mar 26, 2024
106b65e
Switched ekf origin publisher to transient local qos
evan-palmer Mar 26, 2024
4230cf9
Ported launch files from Blue
evan-palmer Mar 28, 2024
5e62a53
Fixed reference to sitl launch file
evan-palmer Mar 28, 2024
0d121e9
fixed another reference to sitl launch file
evan-palmer Mar 28, 2024
c752e4d
Testing previous version now that config file is fixed
evan-palmer Mar 28, 2024
662a959
Didn't work; sad
evan-palmer Mar 29, 2024
c5b079e
Shortened interval to 20s
evan-palmer Mar 29, 2024
808f18a
Finished up for pr
evan-palmer Apr 9, 2024
39234b8
Ported joystick configuration
evan-palmer Apr 19, 2024
b6c8a2d
Fixed build file
evan-palmer Apr 19, 2024
f948248
Fixed build file
evan-palmer Apr 19, 2024
c30ac3c
Added joystick driver to launch file
evan-palmer Apr 19, 2024
0b6614f
Fixed bug in cmd mapping
evan-palmer Apr 19, 2024
31ceb17
Fixed dockerignore
evan-palmer Apr 19, 2024
0baf78a
Added docs
evan-palmer Apr 19, 2024
9d13194
More documentation cleanup
evan-palmer Apr 19, 2024
04893bb
Should be good now
evan-palmer Apr 19, 2024
080e576
Fixed up readme
evan-palmer Apr 19, 2024
2c3a348
Fixed grammar
evan-palmer Apr 19, 2024
164845e
Last change
evan-palmer Apr 19, 2024
3025cf5
I lied
evan-palmer Apr 19, 2024
71ea171
Fixed precommit
evan-palmer Apr 19, 2024
0ca9b36
Fixed merge conflicts
evan-palmer Apr 19, 2024
b7ab1bf
Fixed additional merge conflicts
evan-palmer Apr 19, 2024
6d0af38
I don't know how i missed these conflicts
evan-palmer Apr 19, 2024
8fe1356
Fixed linting errors
evan-palmer Apr 19, 2024
18bdd70
Added codespell config
evan-palmer Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
ignore-words-list = sitl
3 changes: 3 additions & 0 deletions .devcontainer/nouveau/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ RUN sudo apt-get -q update \
&& sudo apt-get clean -y \
&& sudo rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install \
pre-commit

# Disable the setuputils installation warning
# This prevents us from needing to pin the setuputils version (which doesn't always work)
ENV PYTHONWARNINGS="ignore"
3 changes: 3 additions & 0 deletions .devcontainer/nvidia/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ RUN sudo apt-get -q update \
&& sudo apt-get clean -y \
&& sudo rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install \
pre-commit

# Disable the setuputils installation warning
# This prevents us from needing to pin the setuputils version (which doesn't always work)
ENV PYTHONWARNINGS="ignore"
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# Allow your ROS 2 packages here, e.g.:
!thruster_hardware
!ardusub_bringup
!ardusub_manager
!ardusub_teleop
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
build
install
log

# Linters
.ruff_cache
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ repos:
rev: v2.2.4
hooks:
- id: codespell
args: ["--write-changes"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]

- repo: local
hooks:
Expand Down
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@

ardusub_driver is a collection of packages designed to enable integration of
ROS 2 into marine vehicles that use ArduSub (e.g., the [BlueROV](https://bluerobotics.com/)).

## Main features

The main features of the ArduSub driver include

* thruster_hardware: A ros2_control hardware interface that enables individual
thruster-level control in simulation or on hardware. This can be used
alongside projects like [auv_controllers](https://github.com/Robotic-Decision-Making-Lab/auv_controllers)
to control marine robots.
* ardusub_manager: A high-level node that simplifies ROS 2 integration with
marine vehicles by providing interfaces for tasks like setting the interval
at which MAVLINK messages are published by the autopilot.
You can learn more about the features that ardusub_driver offers in the
documentation provided by each package.

## Installation

ardusub_driver is currently supported on Linux and is available for the ROS 2
Iron distribution. Prior to installing this project, first install [MAVROS](https://github.com/mavlink/mavros).
Once MAVROS has been successfully installed, clone ardusub_driver to the
`src` directory of your ROS workspace:
Iron distribution. Prior to installing this project, first install [MAVROS](https://github.com/mavlink/mavros)
and its dependencies. Once MAVROS has been successfully installed, clone
ardusub_driver to the `src` directory of your ROS workspace:

```bash
git clone [email protected]:Robotic-Decision-Making-Lab/ardusub_driver.git
Expand Down
17 changes: 17 additions & 0 deletions ardusub_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.8)
project(ardusub_bringup)

set(THIS_PACKAGE_INCLUDE_DEPENDS
ament_cmake
)

foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()

install(
DIRECTORY launch
DESTINATION share/ardusub_bringup
)

ament_package()
17 changes: 17 additions & 0 deletions ardusub_bringup/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
72 changes: 72 additions & 0 deletions ardusub_bringup/launch/ardusub.launch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
launch:

# Arguments
- arg:
name: mavros_file

- arg:
name: use_sim
default: "false"

- arg:
name: use_manager
default: "false"

- arg:
name: use_joy
default: "false"

- arg:
name: model_name
default: ""

- arg:
name: gazebo_world_file
default: ""

- arg:
name: ardusub_params_file
default: ""

- arg:
name: manager_file
default: ""

- arg:
name: joy_file
default: $(find-pkg-share ardusub_teleop)/config/joy_teleop.yaml

# Nodes
- node:
pkg: mavros
exec: mavros_node
param:
- from: $(var mavros_file)
- name: use_sim_time
value: $(var use_sim)

# Includes
- include:
file: $(find-pkg-share ardusub_bringup)/launch/sitl.launch.yaml
if: $(var use_sim)
arg:
- name: model_name
value: $(var model_name)
- name: gazebo_world_file
value: $(var gazebo_world_file)
- name: ardusub_params_file
value: $(var ardusub_params_file)

- include:
file: $(find-pkg-share ardusub_manager)/launch/ardusub_manager.launch.py
if: $(var use_manager)
arg:
- name: ardusub_manager_file
value: $(var manager_file)

- include:
file: $(find-pkg-share ardusub_teleop)/launch/teleop.launch.yaml
if: $(var use_joy)
arg:
- name: joy_file
value: $(var joy_file)
43 changes: 43 additions & 0 deletions ardusub_bringup/launch/sitl.launch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
launch:

# Arguments
- arg:
name: model_name

- arg:
name: gazebo_world_file

- arg:
name: ardusub_params_file

# Nodes
- node:
pkg: ros_gz_bridge
exec: parameter_bridge
args: /clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock

- node:
pkg: ros_gz_bridge
exec: parameter_bridge
args: /camera/image_raw@sensor_msgs/msg/Image[gz.msgs.Image

- node:
pkg: ros_gz_bridge
exec: parameter_bridge
args: /model/$(var model_name)/odometry@nav_msgs/msg/Odometry[gz.msgs.Odometry

- node:
pkg: ros_gz_sim
exec: create
args: -name $(var model_name) -topic robot_description

# Processes
- executable:
cmd: ardusub -S -w -M JSON --defaults $(var ardusub_params_file) -IO --home 44.65870,-124.06556,0.0,270.0

# Includes
- include:
file: $(find-pkg-share ros_gz_sim)/launch/gz_sim.launch.py
arg:
- name: gz_args
value: -v 4 -r $(var gazebo_world_file)
23 changes: 23 additions & 0 deletions ardusub_bringup/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">

<name>ardusub_bringup</name>
<version>0.0.1</version>
<description>Launch files for the ArduSub driver</description>

<maintainer email="[email protected]">Evan Palmer</maintainer>
<license>MIT</license>

<url type="repository">https://github.com/Robotic-Decision-Making-Lab/ardusub_driver.git</url>
<url type="bugtracker">https://github.com/Robotic-Decision-Making-Lab/ardusub_driver/issues</url>

<author>Evan Palmer</author>

<exec_depend>mavros</exec_depend>
<exec_depend>mavros_extras</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
5 changes: 5 additions & 0 deletions ardusub_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ install(
DESTINATION lib/ardusub_manager
)

install(
DIRECTORY launch
DESTINATION share/ardusub_manager
)

ament_package()
13 changes: 3 additions & 10 deletions ardusub_manager/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# ardusub_manager

The ArduSub manager provides a high-level interface for some common pieces
ardusub_manager provides a high-level interface for some common pieces
of functionality that are used by marine vehicles, including:

* Setting the message intervals for MAVLINK messages
* Setting the home position of the vehicle
* Setting the EKF origin of the vehicle
* Publishing the `map -> base_link` transformation. Support for this
*technically* exists in MAVROS, but we have encountered difficulties
enabling its use with ArduSub, which has encouraged this alternative.

> [!IMPORTANT]
> This node should be launched *after* MAVROS has fully loaded the "local_*",
> "home_position", and "global_position" plugins.
> This node should be launched *after* MAVROS has fully loaded the "local_*"
> and "global_position" plugins.

## Parameters

Expand All @@ -26,10 +25,4 @@ of functionality that are used by marine vehicles, including:
* latitude: The latitude of the EKF origin. [double]
* longitude: The longitude of the EKF origin. [double]
* altitude: The altitude of the EKF origin. [double]
* set_home_position: Whether or not to set the home position on startup. [bool]
* home_position (only required when `set_home_position = True`):
* latitude: The latitude of the home position. [double]
* longitude: The longitude of the home position. [double]
* altitude: The altitude of the home position. [double]
* yaw: The yaw of the home position. [double]
* publish_tf: Whether or not to publish the TF frames for the vehicle. [bool]
72 changes: 72 additions & 0 deletions ardusub_manager/launch/ardusub_manager.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2024, Evan Palmer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from launch import LaunchDescription
from launch_ros.actions import LifecycleNode
from launch.actions import EmitEvent
from launch.actions import RegisterEventHandler
from launch_ros.events.lifecycle import ChangeState
from launch_ros.event_handlers import OnStateTransition
from launch.events import matches_action
from lifecycle_msgs.msg import Transition
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument


def generate_launch_description():
declare_manager_file = DeclareLaunchArgument(
"ardusub_manager_file", default_value=""
)

ardusub_manager_node = LifecycleNode(
package="ardusub_manager",
executable="ardusub_manager",
name="ardusub_manager",
namespace="",
output="screen",
parameters=[LaunchConfiguration("ardusub_manager_file")],
)

configure_event = EmitEvent(
event=ChangeState(
lifecycle_node_matcher=matches_action(ardusub_manager_node),
transition_id=Transition.TRANSITION_CONFIGURE,
)
)

activate_event = RegisterEventHandler(
OnStateTransition(
target_lifecycle_node=ardusub_manager_node,
start_state="configuring",
goal_state="inactive",
entities=[
EmitEvent(
event=ChangeState(
lifecycle_node_matcher=matches_action(ardusub_manager_node),
transition_id=Transition.TRANSITION_ACTIVATE,
)
)
],
)
)

return LaunchDescription(
[declare_manager_file, ardusub_manager_node, configure_event, activate_event]
)
Loading