-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(asv_simulator) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
# find dependencies | ||
find_package(ament_cmake_python REQUIRED) | ||
find_package(rclpy REQUIRED) | ||
find_package(vortex_msgs REQUIRED) | ||
find_package(geometry_msgs REQUIRED) | ||
|
||
ament_python_install_package(${PROJECT_NAME}) | ||
|
||
install(DIRECTORY | ||
launch | ||
config | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
install(PROGRAMS | ||
asv_simulator/asv_simulator_node.py | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
ament_package() |
Empty file.
30 changes: 30 additions & 0 deletions
30
simulation/asv_simulator/asv_simulator/asv_simulator_node.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python3 | ||
import rclpy | ||
from rclpy.node import Node | ||
from asv_simulator.plotting_matplotlib import plot_matplotlib | ||
from asv_simulator.realtime_plotting_foxglove import plot_foxglove | ||
|
||
class PlottingNode(Node): | ||
def __init__(self): | ||
super().__init__('asv_simulator_node') | ||
|
||
self.declare_parameter('plotting_method', 'matplotlib') | ||
plotting_library = self.get_parameter('plotting_method').value | ||
|
||
logger = self.get_logger() | ||
|
||
if plotting_library == 'matplotlib': | ||
plot_matplotlib(logger) | ||
elif plotting_library == 'foxglove': | ||
plot_foxglove(logger) | ||
else: | ||
self.get_logger().error("Invalid plotting method choice!") | ||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
node = PlottingNode() | ||
rclpy.spin(node) | ||
rclpy.shutdown() | ||
|
||
if __name__ == '__main__': | ||
main() |
2 changes: 2 additions & 0 deletions
2
simulation/asv_simulator/asv_simulator/plotting_matplotlib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def plot_matplotlib(logger): | ||
logger.info("U chose matplotlib XD") |
2 changes: 2 additions & 0 deletions
2
simulation/asv_simulator/asv_simulator/realtime_plotting_foxglove.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def plot_foxglove(logger): | ||
logger.info("U chose foxglove lol") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, LogInfo | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import Node | ||
|
||
def generate_launch_description(): | ||
return LaunchDescription([ | ||
DeclareLaunchArgument( | ||
'plotting_method', | ||
default_value='matplotlib', | ||
description='Choose the plotting library: matplotlib or foxglove' | ||
), | ||
Node( | ||
package='asv_simulator', | ||
executable='asv_simulator_node.py', | ||
name='asv_simulator_node', | ||
output='screen', | ||
parameters=[{'plotting_method': LaunchConfiguration('plotting_method')}] | ||
) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>asv_simulator</name> | ||
<version>0.0.0</version> | ||
<description>This package provides the implementation of the asv_simulator for the Vortex ASV.</description> | ||
<maintainer email="[email protected]">vortex</maintainer> | ||
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake_python</buildtool_depend> | ||
|
||
<depend>rclpy</depend> | ||
<depend>python-transforms3d-pip</depend> | ||
<depend>geometry_msgs</depend> | ||
<depend>vortex_msgs</depend> | ||
|
||
<test_depend>python3-pytest</test_depend> | ||
|
||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |