Skip to content

Commit

Permalink
Merge pull request #164 from KumarRobotics/devel/humble_pranav
Browse files Browse the repository at this point in the history
rqt_mav_manager and kr_crazyflie_interface migrated to ROS2 humble
  • Loading branch information
fcladera authored Mar 27, 2024
2 parents d2e61c8 + 39ae768 commit 2b84510
Show file tree
Hide file tree
Showing 17 changed files with 661 additions and 557 deletions.
63 changes: 25 additions & 38 deletions interfaces/kr_crazyflie_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
cmake_minimum_required(VERSION 3.10)
project(kr_crazyflie_interface)

# set default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall)

find_package(
catkin REQUIRED
COMPONENTS roscpp
nav_msgs
geometry_msgs
kr_mav_msgs
nodelet)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(kr_mav_msgs REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR})

catkin_package(
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
roscpp
nav_msgs
geometry_msgs
kr_mav_msgs
nodelet
DEPENDS
EIGEN3)
add_library(${PROJECT_NAME} SHARED src/so3cmd_to_crazyflie_component.cpp)
ament_target_dependencies(${PROJECT_NAME} rclcpp rclcpp_components kr_mav_msgs nav_msgs geometry_msgs)
target_link_libraries(${PROJECT_NAME} Eigen3::Eigen)
rclcpp_components_register_nodes(${PROJECT_NAME} "SO3CmdToCrazyflie")

add_library(${PROJECT_NAME} src/so3cmd_to_crazyflie_nodelet.cpp)
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
install(DIRECTORY
launch
config
DESTINATION share/${PROJECT_NAME}
)

install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(TARGETS
${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(FILES nodelet_plugin.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
ament_package()
16 changes: 9 additions & 7 deletions interfaces/kr_crazyflie_interface/config/crazyflie.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
kp_yaw_rate: 0.1
c1: -0.6709
c2: 0.1932
c3: 13.0652
so3_cmd_timeout: 0.1
thrust_pwm_max: 60000
thrust_pwm_min: 20000
so3cmd_to_crazyflie:
ros__parameters:
kp_yaw_rate: 0.1
c1: -0.6709
c2: 0.1932
c3: 13.0652
so3_cmd_timeout: 0.1
thrust_pwm_max: 60000
thrust_pwm_min: 20000
18 changes: 0 additions & 18 deletions interfaces/kr_crazyflie_interface/launch/test.launch

This file was deleted.

54 changes: 54 additions & 0 deletions interfaces/kr_crazyflie_interface/launch/test.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.substitutions import FindPackageShare
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode

def generate_launch_description():

robot_ns = LaunchConfiguration('robot')
odom_topic = LaunchConfiguration('odom')
so3_cmd_topic = LaunchConfiguration('so3_cmd')

robot_arg = DeclareLaunchArgument(
'robot', default_value=''
)
odom_arg = DeclareLaunchArgument(
'odom', default_value='odom'
)
so3_cmd_arg = DeclareLaunchArgument(
'so3_cmd', default_value='so3_cmd'
)

# Path to the configuration file
config_file = FindPackageShare('kr_crazyflie_interface').find('kr_crazyflie_interface') + '/config/crazyflie.yaml'

# Component configuration
so3cmd_to_crazyflie_component = ComposableNodeContainer(
name="so3_container",
namespace=LaunchConfiguration('robot'),
package="rclcpp_components",
executable="component_container",
composable_node_descriptions=[
ComposableNode(
package="kr_crazyflie_interface",
plugin="SO3CmdToCrazyflie",
name="so3cmd_to_crazyflie",
parameters=[config_file],
remappings=[
("~/odom", odom_topic),
("~/so3_cmd", so3_cmd_topic)
]
)
],
output='screen'
)

return LaunchDescription([
robot_arg,
odom_arg,
so3_cmd_arg,
so3cmd_to_crazyflie_component
])
7 changes: 0 additions & 7 deletions interfaces/kr_crazyflie_interface/nodelet_plugin.xml

This file was deleted.

15 changes: 8 additions & 7 deletions interfaces/kr_crazyflie_interface/package.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<package format="2">
<?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>kr_crazyflie_interface</name>
<version>1.0.0</version>
<description>kr_crazyflie_interface</description>
<maintainer email="[email protected]">Justin Thomas</maintainer>
<maintainer email="[email protected]">Aaron Weinstein</maintainer>
<maintainer email="[email protected]">Pranav Shah</maintainer>

<license>BSD</license>

<!-- Dependencies which this package needs to build itself. -->
<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>

<!-- Dependencies needed to compile and run this package. -->
<depend>roscpp</depend>
<depend>rclcpp</depend>
<depend>nav_msgs</depend>
<depend>geometry_msgs</depend>
<depend>kr_mav_msgs</depend>
<depend>nodelet</depend>
<depend>rclcpp_components</depend>

<export>
<nodelet plugin="${prefix}/nodelet_plugin.xml"/>
<build_type>ament_cmake</build_type>
</export>

</package>
Loading

0 comments on commit 2b84510

Please sign in to comment.