Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ros2 cpp package #26

Open
wants to merge 3 commits into
base: ros-2
Choose a base branch
from
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
21 changes: 8 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@

# Swarm Robot v4
Platform IO Based Firmware Repository for Swarm Robots

### Build Instructions ###
First need install ATOM IDE or VS Code first.
Then need to install Platform IO with Espressif 32 Platform.

[A tutorial on how to install Espressif 32 Platform on VSCode](https://www.instructables.com/id/Develop-ESP32-With-PlatformIO-IDE/)

### Online Documantation ###

Will Be updated soon.
---
permalink: "/"
forward_url: "https://pera-swarm.ce.pdn.ac.lk/docs/robots/main/v4/"
---

<meta http-equiv = "refresh" content = "0; url = {{ page.forward_url}}" />
<p>Redirecting...<br><br>Please click <a href="{{ page.forward_url }}">here</a> if the browser is not automatically redirected.</p>

23 changes: 23 additions & 0 deletions ros2-workspace/src/my_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.5)
project(my_package)

# Set the C++ standard for your package
set(CMAKE_CXX_STANDARD 17)

# Find necessary dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)

# Add your C++ source files
add_executable(my_node src/my_node.cpp)

# Link your C++ node with the required dependencies
ament_target_dependencies(my_node rclcpp)

# Install your executable
install(TARGETS
my_node
DESTINATION lib/${PROJECT_NAME}
)

ament_package()
18 changes: 18 additions & 0 deletions ros2-workspace/src/my_package/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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>my_package</name>
<version>0.0.0</version>
<description>ROS2 Package for PeraSwarm Simulation Testing</description>
<maintainer email="[email protected]">kalindu</maintainer>
<license>TODO: License declaration</license>

<buildtool_depend>ament_cmake</buildtool_depend>

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

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
12 changes: 12 additions & 0 deletions ros2-workspace/src/my_package/src/my_node.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "rclcpp/rclcpp.hpp"

int main(int argc, char *argv[]) {
rclcpp::init(argc, argv);
auto node = rclcpp::Node::make_shared("my_node");

RCLCPP_INFO(node->get_logger(), "Hello, ROS 2!");

rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}