diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0934f06 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.5) +project(rocket_tracker) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +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 REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + + +install( + DIRECTORY description launch worlds + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/README.md b/README.md index a2de4dd..f54e614 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,8 @@ To run the tracker IRL, do `python3 control_telescope.py` ## Installing camera software: https://pypi.org/project/camera-zwo-asi/ + + +## ROS commands + +ros2 launch rocket_tracker rsp_sim.launch.py \ No newline at end of file diff --git a/description/README.md b/description/README.md new file mode 100644 index 0000000..6d2a280 --- /dev/null +++ b/description/README.md @@ -0,0 +1 @@ +all these files are copied from https://github.com/joshnewans/urdf_example \ No newline at end of file diff --git a/description/example_gazebo.xacro b/description/example_gazebo.xacro new file mode 100644 index 0000000..f8470d6 --- /dev/null +++ b/description/example_gazebo.xacro @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + Gazebo/Green + + + + Gazebo/Blue + + + + Gazebo/Orange + + + + + + + + + + + + + 20 + azi_joint + alt_joint + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + true + + 1.3962634 + + 640 + 480 + R8B8G8 + + + 0.02 + 10000 + + + gaussian + 0.0 + 0.007 + + + + camera_link_optical + 0.1 + 10000 + + + + + + + + diff --git a/description/example_include.xacro b/description/example_include.xacro new file mode 100644 index 0000000..274cf3d --- /dev/null +++ b/description/example_include.xacro @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/description/example_robot.urdf.xacro b/description/example_robot.urdf.xacro new file mode 100644 index 0000000..b3b5672 --- /dev/null +++ b/description/example_robot.urdf.xacro @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch/example.launch.py b/launch/example.launch.py new file mode 100644 index 0000000..420a6b9 --- /dev/null +++ b/launch/example.launch.py @@ -0,0 +1,85 @@ +# Author: Addison Sears-Collins +# Date: September 19, 2021 +# Description: Load a world file into Gazebo. +# https://automaticaddison.com +# https://automaticaddison.com/how-to-load-a-world-file-into-gazebo-ros-2/ + +import os +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription +from launch.conditions import IfCondition, UnlessCondition +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import Command, LaunchConfiguration, PythonExpression +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +def generate_launch_description(): + + # Set the path to the Gazebo ROS package + pkg_gazebo_ros = FindPackageShare(package='gazebo_ros').find('gazebo_ros') + + # Set the path to this package. + pkg_share = FindPackageShare(package='two_wheeled_robot').find('two_wheeled_robot') + + # Set the path to the world file + world_file_name = 'cafe.world' + world_path = os.path.join(pkg_share, 'worlds', world_file_name) + + # Set the path to the SDF model files. + gazebo_models_path = os.path.join(pkg_share, 'models') + os.environ["GAZEBO_MODEL_PATH"] = gazebo_models_path + + ########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ############## + # Launch configuration variables specific to simulation + headless = LaunchConfiguration('headless') + use_sim_time = LaunchConfiguration('use_sim_time') + use_simulator = LaunchConfiguration('use_simulator') + world = LaunchConfiguration('world') + + declare_simulator_cmd = DeclareLaunchArgument( + name='headless', + default_value='False', + description='Whether to execute gzclient') + + declare_use_sim_time_cmd = DeclareLaunchArgument( + name='use_sim_time', + default_value='true', + description='Use simulation (Gazebo) clock if true') + + declare_use_simulator_cmd = DeclareLaunchArgument( + name='use_simulator', + default_value='True', + description='Whether to start the simulator') + + declare_world_cmd = DeclareLaunchArgument( + name='world', + default_value=world_path, + description='Full path to the world model file to load') + + # Specify the actions + + # Start Gazebo server + start_gazebo_server_cmd = IncludeLaunchDescription( + PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')), + condition=IfCondition(use_simulator), + launch_arguments={'world': world}.items()) + + # Start Gazebo client + start_gazebo_client_cmd = IncludeLaunchDescription( + PythonLaunchDescriptionSource(os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')), + condition=IfCondition(PythonExpression([use_simulator, ' and not ', headless]))) + + # Create the launch description and populate + ld = LaunchDescription() + + # Declare the launch options + ld.add_action(declare_simulator_cmd) + ld.add_action(declare_use_sim_time_cmd) + ld.add_action(declare_use_simulator_cmd) + ld.add_action(declare_world_cmd) + + # Add any actions + ld.add_action(start_gazebo_server_cmd) + ld.add_action(start_gazebo_client_cmd) + + return ld \ No newline at end of file diff --git a/launch/rsp.launch.py b/launch/rsp.launch.py new file mode 100644 index 0000000..1613ea7 --- /dev/null +++ b/launch/rsp.launch.py @@ -0,0 +1,32 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch_ros.actions import Node +import xacro + + +def generate_launch_description(): + + # Specify the name of the package and path to xacro file within the package + pkg_name = 'rocket_tracker' + file_subpath = 'description/example_robot.urdf.xacro' + + + # Use xacro to process the file + xacro_file = os.path.join(get_package_share_directory(pkg_name),file_subpath) + robot_description_raw = xacro.process_file(xacro_file).toxml() + + + # Configure the node + node_robot_state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + output='screen', + parameters=[{'robot_description': robot_description_raw}] # add other parameters here if required + ) + + + # Run the node + return LaunchDescription([ + node_robot_state_publisher + ]) diff --git a/launch/rsp_sim.launch.py b/launch/rsp_sim.launch.py new file mode 100644 index 0000000..7408429 --- /dev/null +++ b/launch/rsp_sim.launch.py @@ -0,0 +1,67 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument +from launch.launch_description_sources import PythonLaunchDescriptionSource + +from launch_ros.substitutions import FindPackageShare + +from launch_ros.actions import Node +import xacro + + +def generate_launch_description(): + + # Specify the name of the package and path to xacro file within the package + pkg_name = 'rocket_tracker' + file_subpath = 'description/example_robot.urdf.xacro' + + + # Use xacro to process the file + xacro_file = os.path.join(get_package_share_directory(pkg_name),file_subpath) + robot_description_raw = xacro.process_file(xacro_file).toxml() + + + # Configure the node + node_robot_state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + output='screen', + parameters=[{'robot_description': robot_description_raw, + 'use_sim_time': True}] # add other parameters here if required + ) + + pkg_share = FindPackageShare(package=pkg_name).find(pkg_name) + world_file_name = 'gz_world.sdf' + world_path = os.path.join(pkg_share, 'worlds', world_file_name) + + declare_world_cmd = DeclareLaunchArgument( + name='world', + default_value=world_path, + description='Full path to the world model file to load') + + gazebo = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), + ) + + + spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', + arguments=['-topic', 'robot_description', + '-entity', 'my_bot'], + output='screen') + + + + + + + # Run the node + return LaunchDescription([ + declare_world_cmd, + gazebo, + node_robot_state_publisher, + spawn_entity + ]) + + diff --git a/package.xml b/package.xml new file mode 100644 index 0000000..f2ba407 --- /dev/null +++ b/package.xml @@ -0,0 +1,18 @@ + + + + rocket_tracker + 0.0.0 + 2DOF Telescope Tracker + epedley + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/requirements.txt b/requirements.txt index 86e52e6..23f86fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ absl-py==2.1.0 annotated-types==0.7.0 asttokens==2.4.1 astunparse==1.6.3 -catkin==0.8.10 certifi==2024.7.4 cftime==1.6.4 charset-normalizer==3.3.2 @@ -105,9 +104,10 @@ tensorboard-data-server==0.7.2 tensorflow==2.17.0 tensorflow-io-gcs-filesystem==0.37.1 termcolor==2.4.0 -torch==2.4.0+cpu -torchaudio==2.4.0+cpu -torchvision==0.19.0+cpu +# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu +# torch==2.4.0+cpu +# torchaudio==2.4.0+cpu +# torchvision==0.19.0+cpu tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 diff --git a/textures/desert_sky_2k.dds b/textures/desert_sky_2k.dds new file mode 100644 index 0000000..ce922da Binary files /dev/null and b/textures/desert_sky_2k.dds differ diff --git a/worlds/gz_world.sdf b/worlds/gz_world.sdf new file mode 100644 index 0000000..5a5e368 --- /dev/null +++ b/worlds/gz_world.sdf @@ -0,0 +1,216 @@ + + + + 1 + 0 0 10 0 -0 0 + 0.8 0.8 0.8 1 + 0.2 0.2 0.2 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.5 0.1 -0.9 + + 0 + 0 + 0 + + + + 1 + + + + + 0 0 1 + 100 100 + + + + + 65535 + + + + + 100 + 50 + + + + + + + + 10 + + + 0 + + + 0 0 1 + 100 100 + + + + + + + 0 + 0 + 0 + + + 0 0 -9.8 + 6e-06 2.3e-05 -4.2e-05 + + + 0.001 + 1 + 1000 + + + 0.4 0.4 0.4 1 + + + + 12 + + + + + + 1 + + + + + EARTH_WGS84 + 0 + 0 + 0 + 0 + + + + 8.9754 0.654111 0.5 0 -0 0 + + + 1 + + 0.145833 + 0 + 0 + 0.145833 + 0 + 0.125 + + 0 0 0 0 -0 0 + + + + + 0.5 + 1 + + + 10 + + + + + + + + + + + + + + + + + 0.5 + 1 + + + + + + + 0 + 0 + 0 + + + + 113 90000000 + 114 164911718 + 1726311650 346233797 + 113090 + + 0 0 0 0 -0 0 + 1 1 1 + + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + + 0 0 -0 0 -0 0 + 1 1 1 + + 2 1 0.3 0 -3e-06 5e-06 + -0 -0 0 0 0.000285 0 + -0 0 0 -4e-06 -0 4e-06 + -0 0 0 0 -0 0 + + + 1.75 1 0.15 0 -1e-06 5e-06 + 0 -0 0 0 -0 0 + 0 0 -0 0 -0 0 + 0 0 -0 0 -0 0 + + + 1.5 1 0 0 -0 0 + 0 -0 0 0 -0 0 + -0 -0 0 0 -0 0 + -0 -0 0 0 -0 0 + + + + 4.7476 0.060037 0.499997 3e-06 4e-06 -0 + 1 1 1 + + 4.7476 0.060037 0.499997 3e-06 4e-06 -0 + 0 0 0 0 -0 0 + 0 0 -9.8 0 -0 0 + 0 0 -9.8 0 -0 0 + + + + 0 0 10 0 -0 0 + + + + + -0.37963 -1.27587 1.16663 -0 0.255643 0.276212 + orbit + perspective + + + +