Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 19 additions & 1 deletion dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
#!/bin/bash

set -euo pipefail
ARCH=$(dpkg --print-architecture)
VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')
MAVSDK_VERSION="3.14.0"

echo "Architecture: $ARCH"
echo "Version ID: $VERSION_ID"

pkgs=(
python3-colcon-common-extensions
libgeographic-dev
geographiclib-tools
wget
)

for pkg in "${pkgs[@]}"; do
echo "Installing $pkg"
apt-get install -y "$pkg"
done
done

echo "Installing MAVSDK version $MAVSDK_VERSION"
if [[ "$ARCH" == "amd64" ]]; then
PACKAGE="libmavsdk-dev_${MAVSDK_VERSION}_ubuntu${VERSION_ID}_amd64.deb"
else
PACKAGE="libmavsdk-dev_${MAVSDK_VERSION}_debian12_${ARCH}.deb"
fi

wget https://github.com/mavlink/MAVSDK/releases/download/v${MAVSDK_VERSION}/${PACKAGE}
sudo dpkg -i ${PACKAGE}
20 changes: 0 additions & 20 deletions src/simulation/launch/bridge.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@

def generate_launch_description():
return LaunchDescription([
Node(
package='ros_gz_bridge',
executable='parameter_bridge',
name='imu_bridge',
output='screen',
arguments=[
'/imu@sensor_msgs/msg/Imu[gz.msgs.IMU',
],
),

Node(
package='ros_gz_bridge',
executable='parameter_bridge',
name='gps_bridge',
output='screen',
arguments=[
'/gps/fix@sensor_msgs/msg/NavSatFix@gz.msgs.NavSat',
],
),

Node(
package='ros_gz_bridge',
executable='parameter_bridge',
Expand Down
37 changes: 37 additions & 0 deletions src/subsystems/navigation/athena_gps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.5)
project(athena_gps)

# 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_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(MAVSDK REQUIRED)
add_executable(athena_gps src/PixhawkNode.cpp)

install(
DIRECTORY config launch
DESTINATION share/${PROJECT_NAME}
)

ament_target_dependencies(athena_gps
rclcpp
std_msgs
sensor_msgs
)
target_link_libraries(athena_gps
MAVSDK::mavsdk
)
install(TARGETS
athena_gps
DESTINATION lib/${PROJECT_NAME})

ament_package()
18 changes: 18 additions & 0 deletions src/subsystems/navigation/athena_gps/config/pixhawk_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
athena_gps:
ros__parameters:
usb_path: "serial:///dev/ttyACM0:57600"

imu_rate: 10.0
gps_info_rate: 1.0
attitude_rate: 10.0

imu_frame_id: "imu_link"
gps_frame_id: "gps_link"

imu_topic: "imu/data"
gps_topic: "gps/fix"
heading_topic: "heading"

mavsdk_system_id: 10
mavsdk_component_id: 1
mavsdk_always_send_heartbeats: false
63 changes: 63 additions & 0 deletions src/subsystems/navigation/athena_gps/launch/gps_launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition, UnlessCondition
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os


def generate_launch_description():

pkg_dir = get_package_share_directory('athena_gps')
config_file = os.path.join(pkg_dir, 'config', 'pixhawk_params.yaml')

sim_arg = DeclareLaunchArgument(
'sim',
default_value='false',
choices=['true', 'false'],
description='Use simulation bridge instead of real hardware'
)

pixhawk_node = Node(
package='athena_gps',
executable='athena_gps',
name='athena_gps',
output='screen',
parameters=[
config_file,
],
respawn=True,
respawn_delay=2.0,
condition=UnlessCondition(LaunchConfiguration('sim'))
)

imu_bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
name='imu_bridge',
output='screen',
arguments=[
'/imu@sensor_msgs/msg/Imu[gz.msgs.IMU',
],
condition=IfCondition(LaunchConfiguration('sim'))
)

gps_bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
name='gps_bridge',
output='screen',
arguments=[
'/gps/fix@sensor_msgs/msg/NavSatFix@gz.msgs.NavSat',
],
condition=IfCondition(LaunchConfiguration('sim'))
)


return LaunchDescription([
sim_arg,
pixhawk_node,
imu_bridge,
gps_bridge,
])
22 changes: 22 additions & 0 deletions src/subsystems/navigation/athena_gps/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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>athena_gps</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="mdurrani808@gmail.com">mdurrani</maintainer>
<license>TODO: License declaration</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading