From a0e4649c139c3c0dae99eb6408e643374f02dd60 Mon Sep 17 00:00:00 2001 From: Tristan McGinnis Date: Wed, 19 Feb 2025 20:09:25 -0600 Subject: [PATCH] created anchor package and launch file --- .../__pycache__/rover_launch.cpython-312.pyc | Bin 0 -> 1911 bytes launch/rover_launch.py | 100 ++++++++++++++++++ src/anchor_pkg/anchor_pkg/__init__.py | 0 src/anchor_pkg/package.xml | 20 ++++ src/anchor_pkg/resource/anchor_pkg | 0 src/anchor_pkg/setup.cfg | 4 + src/anchor_pkg/setup.py | 24 +++++ 7 files changed, 148 insertions(+) create mode 100644 launch/__pycache__/rover_launch.cpython-312.pyc create mode 100644 launch/rover_launch.py create mode 100644 src/anchor_pkg/anchor_pkg/__init__.py create mode 100644 src/anchor_pkg/package.xml create mode 100644 src/anchor_pkg/resource/anchor_pkg create mode 100644 src/anchor_pkg/setup.cfg create mode 100644 src/anchor_pkg/setup.py diff --git a/launch/__pycache__/rover_launch.cpython-312.pyc b/launch/__pycache__/rover_launch.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7099b21b0a6e223d8191f3ba9d5e378739c4565 GIT binary patch literal 1911 zcmbtV&2Jk;6rc5e+Pik+B<=@p;!T?mEG2FcsgO{MfCeN~V-P_cEQGc3P8>J(?lQZZ zrd1;Oz=8Hadn;$eAt*WXPjGQ*C03(UL~1YGEF3O9@n&~zB|=duF{_<@GxO%Rzc>4P zZ+}atQwZ8mKm6LLY6!hxgF#EgMt=#6$H+t`*FtTs%5lt2v=VK;%D0885RUnl*p{kN zXbUa5tyC4T#qUrxX-d$i?#e~wF9uoUXtr$lR()*=yLHlZyryjx6EwGk>n(%eXzc^i z@Y~q(Xy!A=_}0fC!-mk2qhpcBP1{;+Hhf~l(?Z2Iah;1aq4BUMRvyYKCTr;`d z*uKp($K!1a4OX}L2HF<3cr&s7CPHLwOSml__hlnb9?Y4%DZnL~(iY$38r+_|8~YCs zIdm$9VkY7Ge;6q<0oN%Q%LpPl@QFpH+5SFxEQPat;?$w5c?m8N~~#wXT> z(Q2AHW2HO9-e{WGEa^AbY}>`UZNa_zt`6kpb%r*t!>)Nff-Dt9A~7i0!DQ8D0T_;h zEt4>vQPCky%VPo5ZOg-(9u*)UmrCn**pskhqM`*ac3mbuowZlzOIM=kuK*cLYSEzN z+@)H4DlYbXhv=|Ff!qBM5~PD(s*^u%JXL4^P)kqL($1Zy>N}mKK+AMKI*`@xH-DGU z9VqFC+I?+b8wt)&1$jNly%C%%1QW%b#qPzc-TYgJs+7(g@=7w*8%4>?(D_o3p9*sM z6P>4zI!_1r%Rz49MCY$Lq-8th-YpKLGTrRlljPiidgjr!2R8yO`>=e!ygxD?T$~9C z)4_#FhBdXY<8}4LZs8j6%Z>uSbf&iyqr8nWqmRCN@XgV^vq51dxKKE8@70jNp$M$I znNOc7l>>F8Q|`l2qB`pajeS{GbNXLGcf2M+#`1f@Zd{SJkvFVOTgV&M9giV|ZBHEJ zK_fA+ARDAgr~$&N-@Vy#sQFNc{}r4~V$DJMO`CYt@LOIDl7buzF z>|`*0{ZJOhq|U8F4QUgBGPbXr{aJgaEc8TvQtBgKlY594WikaDD@Bz`k&HuLG!x6) z2!9!F#F&w#4@@f^qfBOz|)PxStCwD=rd{#*E*Vo0{{q{p&t(7r literal 0 HcmV?d00001 diff --git a/launch/rover_launch.py b/launch/rover_launch.py new file mode 100644 index 0000000..2e2a759 --- /dev/null +++ b/launch/rover_launch.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 + +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, OpaqueFunction +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node + +def launch_setup(context, *args, **kwargs): + # Retrieve the resolved value of the launch argument 'mode' + mode = LaunchConfiguration('mode').perform(context) + nodes = [] + + if mode == 'anchor': + # Launch every node and pass "anchor" as the parameter + nodes.append( + Node( + package='arm_pkg', + executable='arm', # change as needed + name='arm', + output='screen', + parameters=[{'launch_arg': mode}] + ) + ) + nodes.append( + Node( + package='core_pkg', + executable='core', # change as needed + name='core', + output='screen', + parameters=[{'launch_arg': mode}] + ) + ) + # nodes.append( + # Node( + # package='bio_pkg', + # executable='bio', # change as needed + # name='bio', + # output='screen', + # parameters=[{'launch_arg': mode}] + # ) + # ) + nodes.append( + Node( + package='anchor_pkg', + executable='anchor', # change as needed + name='anchor', + output='screen', + parameters=[{'launch_arg': mode}] + ) + ) + elif mode in ['arm', 'core', 'bio']: + # Only launch the node corresponding to the provided mode. + if mode == 'arm': + nodes.append( + Node( + package='arm_pkg', + executable='arm', + name='arm', + output='screen', + parameters=[{'launch_arg': mode}] + ) + ) + elif mode == 'core': + nodes.append( + Node( + package='core_pkg', + executable='core', + name='core', + output='screen', + parameters=[{'launch_arg': mode}] + ) + ) + # elif mode == 'bio': + # nodes.append( + # Node( + # package='bio_pkg', + # executable='bio', + # name='bio', + # output='screen', + # parameters=[{'launch_arg': mode}] + # ) + # ) + else: + # If an invalid mode is provided, print an error. + # (You might want to raise an exception or handle it differently.) + print("Invalid mode provided. Choose one of: arm, core, bio, anchor.") + + return nodes + +def generate_launch_description(): + declare_arg = DeclareLaunchArgument( + 'mode', + default_value='anchor', + description='Launch mode: arm, core, bio, or anchor' + ) + + return LaunchDescription([ + declare_arg, + OpaqueFunction(function=launch_setup) + ]) diff --git a/src/anchor_pkg/anchor_pkg/__init__.py b/src/anchor_pkg/anchor_pkg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/anchor_pkg/package.xml b/src/anchor_pkg/package.xml new file mode 100644 index 0000000..8366b03 --- /dev/null +++ b/src/anchor_pkg/package.xml @@ -0,0 +1,20 @@ + + + + anchor_pkg + 0.0.0 + TODO: Package description + tristan + TODO: License declaration + + rclpy + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/src/anchor_pkg/resource/anchor_pkg b/src/anchor_pkg/resource/anchor_pkg new file mode 100644 index 0000000..e69de29 diff --git a/src/anchor_pkg/setup.cfg b/src/anchor_pkg/setup.cfg new file mode 100644 index 0000000..9a77caa --- /dev/null +++ b/src/anchor_pkg/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/anchor_pkg +[install] +install_scripts=$base/lib/anchor_pkg diff --git a/src/anchor_pkg/setup.py b/src/anchor_pkg/setup.py new file mode 100644 index 0000000..376e0a1 --- /dev/null +++ b/src/anchor_pkg/setup.py @@ -0,0 +1,24 @@ +from setuptools import find_packages, setup + +package_name = 'anchor_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='tristan', + maintainer_email='tristanmcginnis26@gmail.com', + description='TODO: Package description', + license='TODO: License declaration', + entry_points={ + 'console_scripts': [ + ], + }, +)