Skip to content

Commit

Permalink
Adds workspace content
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpinelli-bdai committed Jun 26, 2024
1 parent 24b6eba commit 3cb5831
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM osrf/ros:humble-desktop-full


ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y git make graphviz python3-pip

RUN cd /tmp \
&& git clone --recursive https://github.com/ros2/ros2_documentation \
&& pip install --requirement ros2_documentation/requirements.txt \
&& rm -rf ros2_documentation

RUN cd /tmp \
&& git clone --recursive https://github.com/ros-infrastructure/rosdoc2 \
&& pip install --upgrade ./rosdoc2 \
&& rm -rf rosdoc2

# Add vscode user with same UID and GID as your host system
# (copied from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Switch from root to user
USER $USERNAME

# Add user to video group to allow access to webcam
RUN sudo usermod --append --groups video $USERNAME

# Update all packages
RUN sudo apt update && sudo apt upgrade -y

# Install Git
RUN sudo apt install -y git

# Rosdep update
RUN rosdep update

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

# Remove apt lists
RUN sudo apt-get autoremove -y && sudo apt-get clean -y && rm -rf /var/lib/lists/*
10 changes: 10 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "humble desktop-full",
"dockerFile": "Dockerfile",
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/${localWorkspaceFolderBasename}"
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
devel/
logs/
install/
log/
build/
bin/
lib/
docs_build
msg_gen/
srv_gen/
msg/*Action.msg
Expand Down Expand Up @@ -48,4 +51,4 @@ qtcreator-*
.#*

# Catkin custom files
CATKIN_IGNORE
CATKIN_IGNORE
59 changes: 59 additions & 0 deletions src/example_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.8)
project(example_package)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_ros REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

add_library(example_package src/example_package.cpp)
target_compile_features(example_package PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
target_include_directories(example_package PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(example_package PRIVATE "EXAMPLE_PACKAGE_BUILDING_LIBRARY")

install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS example_package
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

ament_export_include_directories(
include
)
ament_export_libraries(
example_package
)
ament_export_targets(
export_${PROJECT_NAME}
)

ament_package()
19 changes: 19 additions & 0 deletions src/example_package/include/example_package/example_package.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef EXAMPLE_PACKAGE__EXAMPLE_PACKAGE_HPP_
#define EXAMPLE_PACKAGE__EXAMPLE_PACKAGE_HPP_

#include "example_package/visibility_control.h"

namespace example_package
{

class ExamplePackage
{
public:
ExamplePackage();

virtual ~ExamplePackage();
};

} // namespace example_package

#endif // EXAMPLE_PACKAGE__EXAMPLE_PACKAGE_HPP_
35 changes: 35 additions & 0 deletions src/example_package/include/example_package/visibility_control.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef EXAMPLE_PACKAGE__VISIBILITY_CONTROL_H_
#define EXAMPLE_PACKAGE__VISIBILITY_CONTROL_H_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define EXAMPLE_PACKAGE_EXPORT __attribute__ ((dllexport))
#define EXAMPLE_PACKAGE_IMPORT __attribute__ ((dllimport))
#else
#define EXAMPLE_PACKAGE_EXPORT __declspec(dllexport)
#define EXAMPLE_PACKAGE_IMPORT __declspec(dllimport)
#endif
#ifdef EXAMPLE_PACKAGE_BUILDING_LIBRARY
#define EXAMPLE_PACKAGE_PUBLIC EXAMPLE_PACKAGE_EXPORT
#else
#define EXAMPLE_PACKAGE_PUBLIC EXAMPLE_PACKAGE_IMPORT
#endif
#define EXAMPLE_PACKAGE_PUBLIC_TYPE EXAMPLE_PACKAGE_PUBLIC
#define EXAMPLE_PACKAGE_LOCAL
#else
#define EXAMPLE_PACKAGE_EXPORT __attribute__ ((visibility("default")))
#define EXAMPLE_PACKAGE_IMPORT
#if __GNUC__ >= 4
#define EXAMPLE_PACKAGE_PUBLIC __attribute__ ((visibility("default")))
#define EXAMPLE_PACKAGE_LOCAL __attribute__ ((visibility("hidden")))
#else
#define EXAMPLE_PACKAGE_PUBLIC
#define EXAMPLE_PACKAGE_LOCAL
#endif
#define EXAMPLE_PACKAGE_PUBLIC_TYPE
#endif

#endif // EXAMPLE_PACKAGE__VISIBILITY_CONTROL_H_
18 changes: 18 additions & 0 deletions src/example_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>example_package</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="[email protected]">vscode</maintainer>
<license>TODO: License declaration</license>

<buildtool_depend>ament_cmake_ros</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>
14 changes: 14 additions & 0 deletions src/example_package/src/example_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "example_package/example_package.hpp"

namespace example_package
{

ExamplePackage::ExamplePackage()
{
}

ExamplePackage::~ExamplePackage()
{
}

} // namespace example_package

0 comments on commit 3cb5831

Please sign in to comment.