diff --git a/README.md b/README.md index 0483802..997d46f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # RAE ROS -This repository contains rae [ROS](https://www.ros.org/) integration files. +This repository contains rae [ROS](https://www.ros.org/) integration files. +**Note** The RAE project is under active development so you can expect changes in the API and improvements in the performance in near future. Please report problems on Github issues as it's important for the development efforts. ### Setting up procedure diff --git a/rae_description/launch/rsp.launch.py b/rae_description/launch/rsp.launch.py index 844e205..64586c1 100644 --- a/rae_description/launch/rsp.launch.py +++ b/rae_description/launch/rsp.launch.py @@ -4,40 +4,26 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction from launch.substitutions import Command, LaunchConfiguration -from launch_ros.actions import LoadComposableNodes, ComposableNodeContainer +from launch_ros.actions import Node from launch_ros.descriptions import ComposableNode from launch.conditions import IfCondition def launch_setup(context, *args, **kwargs): - name = LaunchConfiguration('name').perform(context) use_sim_time = LaunchConfiguration('use_sim_time') - run_container = LaunchConfiguration('run_container') pkg_path = os.path.join(get_package_share_directory('rae_description')) xacro_path = os.path.join(pkg_path, 'urdf', 'rae.urdf.xacro') return [ - ComposableNodeContainer( - condition=IfCondition(run_container), - name=name+"_container", - namespace="", - package="rclcpp_components", - executable="component_container", - composable_node_descriptions=[], - output="both", - ), - LoadComposableNodes( - target_container=name+"_container", - composable_node_descriptions=[ - ComposableNode( - package='robot_state_publisher', - plugin='robot_state_publisher::RobotStatePublisher', - name=name+'_state_publisher', - parameters=[{ - 'robot_description': Command(['xacro ', xacro_path, ' sim_mode:=', use_sim_time]), - 'use_sim_time': use_sim_time - }] - )]) + Node( + package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + parameters=[{ + 'robot_description': Command(['xacro ', xacro_path, ' sim_mode:=', use_sim_time]), + 'use_sim_time': use_sim_time + }] + ) ] diff --git a/rae_hw/CMakeLists.txt b/rae_hw/CMakeLists.txt index 0b080fa..f9a596d 100644 --- a/rae_hw/CMakeLists.txt +++ b/rae_hw/CMakeLists.txt @@ -58,6 +58,13 @@ install( LIBRARY DESTINATION lib ) +add_executable(mic_node src/mic_node.cpp) +ament_target_dependencies(mic_node rclcpp audio_msgs) +target_link_libraries(mic_node ${PROJECT_NAME}) + +add_executable(speakers_node src/speakers_node.cpp) +ament_target_dependencies(speakers_node rclcpp audio_msgs) +target_link_libraries(speakers_node ${PROJECT_NAME}) add_executable(test_motors test/test_motors.cpp src/rae_motors.cpp) target_link_libraries(test_motors ${GPIOD_LIBRARY}) @@ -76,7 +83,7 @@ ament_target_dependencies(test_speed rclcpp geometry_msgs) install(TARGETS - test_motors test_encoders test_max_speed test_speed + test_motors test_encoders test_max_speed test_speed mic_node speakers_node DESTINATION lib/${PROJECT_NAME}) diff --git a/rae_hw/launch/peripherals.launch.py b/rae_hw/launch/peripherals.launch.py index ab71c35..a0b9bee 100644 --- a/rae_hw/launch/peripherals.launch.py +++ b/rae_hw/launch/peripherals.launch.py @@ -39,19 +39,16 @@ def launch_setup(context, *args, **kwargs): name='led_node', package='rae_hw', plugin='rae_hw::LEDNode', - ), - ComposableNode( - name='mic_node', - package='rae_hw', - plugin='rae_hw::MicNode', - ), - ComposableNode( - name='motors_node', - package='rae_hw', - plugin='rae_hw::SpeakersNode', - ), + ) ]), - + Node( + package='rae_hw', + executable='mic_node' + ), + Node( + package='rae_hw', + executable='speakers_node' + ), Node( package='rae_bringup', executable='battery_status.py', diff --git a/rae_hw/src/mic_node.cpp b/rae_hw/src/mic_node.cpp new file mode 100644 index 0000000..3b37663 --- /dev/null +++ b/rae_hw/src/mic_node.cpp @@ -0,0 +1,16 @@ +#include "rclcpp/rclcpp.hpp" +#include "rae_hw/peripherals/mic.hpp" + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + + auto node = std::make_shared(rclcpp::NodeOptions()); + rclcpp::executors::StaticSingleThreadedExecutor executor; + executor.add_node(node); + executor.spin(); + + rclcpp::shutdown(); + + return 0; +} \ No newline at end of file diff --git a/rae_hw/src/speakers_node.cpp b/rae_hw/src/speakers_node.cpp new file mode 100644 index 0000000..1279f30 --- /dev/null +++ b/rae_hw/src/speakers_node.cpp @@ -0,0 +1,16 @@ +#include "rclcpp/rclcpp.hpp" +#include "rae_hw/peripherals/speakers.hpp" + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + + auto node = std::make_shared(rclcpp::NodeOptions()); + rclcpp::executors::StaticSingleThreadedExecutor executor; + executor.add_node(node); + executor.spin(); + + rclcpp::shutdown(); + + return 0; +} \ No newline at end of file