-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Toy example package and the skeleton of a simple example.
- Loading branch information
Showing
9 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Simple Build | ||
on: | ||
push: | ||
# Will trigger on MERGES (or pushes) to main branch. | ||
branches: | ||
- 'main' | ||
pull_request: | ||
# Will ALSO trigger any time a PR is opened merging to main. | ||
# Specify '*' here to merge on PRs being opened against ANY branch. | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
# The name of the job is "build". All jobs run in SEPARATE containers, so | ||
# they may run on separate machines and have the workspace wiped inbetween. | ||
build: | ||
# Run on a github-hosted runner. To specify our own, select: | ||
# [self-hosted, linux] instead. | ||
runs-on: ubuntu-latest | ||
# This is the docker container that the image will run in. This is 20.04 | ||
# with ros-noetic-desktop meta-package. | ||
container: osrf/ros:noetic-desktop | ||
steps: | ||
# Name is optional, uses: specify which ACTION is used (basically github | ||
# macros). You can write your own! Use with: to specify extra parameters. | ||
- name: Check out depository | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: ${HOME}/catkin_ws/src/toy_example_package | ||
submodules: recursive | ||
#- name: Install catkin-tools on Noetic | ||
# run: | | ||
# apt update && apt install -y python3-pip | ||
# pip3 install osrf-pycommon | ||
# apt update && apt install -y python3-wstool python3-catkin-tools | ||
- name: Build test | ||
run: | | ||
cd ${HOME}/catkin_ws | ||
catkin init | ||
catkin config --extend "/opt/ros/noetic" | ||
catkin config --merge-devel | ||
rosdep update | ||
rosdep install --from-paths src --ignore-src -y --rosdistro noetic | ||
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release | ||
catkin build --continue toy_example_package | ||
# shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# asl-actions | ||
Github Actions for ASL | ||
Github Actions and documentation for ASL. | ||
|
||
## Getting Started | ||
First, you can start with the quick-start docs from GitHub: https://docs.github.com/en/actions/quickstart | ||
|
||
Then you can follow along with a few simple tutorial workflows. | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build and Test Catkin Package | ||
on: | ||
push: | ||
# Will trigger on MERGES (or pushes) to main branch. | ||
branches: | ||
- 'main' | ||
pull_request: | ||
# Will ALSO trigger any time a PR is opened merging to main. | ||
# Specify '*' here to merge on PRs being opened against ANY branch. | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
# The name of the job is "build". All jobs run in SEPARATE containers, so | ||
# they may run on separate machines and have the workspace wiped inbetween. | ||
build: | ||
# Run on a github-hosted runner. To specify our own, select: | ||
# [self-hosted, linux] instead. | ||
runs-on: ubuntu-latest | ||
# This is the docker container that the image will run in. This is 20.04 | ||
# with ros-noetic-desktop meta-package. | ||
container: osrf/ros:noetic-desktop | ||
steps: | ||
# Name is optional, uses: specify which ACTION is used (basically github | ||
# macros). You can write your own! Use with: to specify extra parameters. | ||
- name: Check out depository | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: ${HOME}/catkin_ws/src/my_package_name | ||
submodules: recursive | ||
- name: Install catkin-tools on Noetic | ||
run: | | ||
apt update && apt install -y python3-pip | ||
pip3 install osrf-pycommon | ||
apt update && apt install -y python3-wstool python3-catkin-tools | ||
- name: Install Dependencies | ||
run: | | ||
$GITHUB_WORKSPACE/install/prepare-jenkins-slave.sh | ||
shell: bash | ||
- name: Build test | ||
working-directory: | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
apt update | ||
apt install -y autoconf libtool git qt5-default | ||
mkdir -p ${HOME}/catkin_ws/src; | ||
cd ${HOME}/catkin_ws | ||
catkin init | ||
catkin config --extend "/opt/ros/${{matrix.config.rosdistro}}" | ||
catkin config --merge-devel | ||
cd ${HOME}/catkin_ws | ||
rosdep update | ||
rosdep install --from-paths src --ignore-src -y --rosdistro noetic | ||
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release | ||
catkin build --continue my_package_name | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.0.2) | ||
project(toy_example_package) | ||
|
||
add_compile_options(-std=c++11) | ||
|
||
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs) | ||
catkin_package( | ||
CATKIN_DEPENDS std_msgs roscpp | ||
) | ||
|
||
include_directories(include ${catkin_INCLUDE_DIRS}) | ||
|
||
add_executable(publisher_node src/publisher.cpp) | ||
add_dependencies(publisher_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) | ||
target_link_libraries(publisher_node | ||
${catkin_LIBRARIES} | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>toy_example_package</name> | ||
<version>0.0.0</version> | ||
<description>Toy example package for Github Actions workflows.</description> | ||
|
||
<maintainer email="[email protected]">Helen Oleynikova</maintainer> | ||
|
||
<license>BSD</license> | ||
|
||
<depend>roscpp</depend> | ||
<depend>std_msgs</depend> | ||
<buildtool_depend>catkin</buildtool_depend> | ||
|
||
<export> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <ros/ros.h> | ||
#include <std_msgs/String.h> | ||
|
||
#include <sstream> | ||
|
||
// All this code is from the publisher tutorial: | ||
// https://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 | ||
int main(int argc, char **argv) { | ||
ros::init(argc, argv, "toy_example_publisher"); | ||
|
||
ros::NodeHandle nh, nh_private("~"); | ||
|
||
ros::Publisher pub = nh_private.advertise<std_msgs::String>("hello", 1); | ||
|
||
ros::Rate loop_rate(10); // Hz | ||
|
||
int count = 0; | ||
while (ros::ok()) { | ||
std_msgs::String msg; | ||
|
||
std::stringstream ss; | ||
ss << "hello world " << count; | ||
msg.data = ss.str(); | ||
|
||
ROS_INFO("%s", msg.data.c_str()); | ||
|
||
pub.publish(msg); | ||
|
||
ros::spinOnce(); | ||
|
||
loop_rate.sleep(); | ||
++count; | ||
} | ||
|
||
return 0; | ||
} |