Skip to content

Commit

Permalink
cpplint as the code formatter (#10)
Browse files Browse the repository at this point in the history
delete ros1 action managers as well
  • Loading branch information
skpawar1305 authored Dec 8, 2023
1 parent 6ead1a4 commit 4eaa1f8
Show file tree
Hide file tree
Showing 31 changed files with 1,004 additions and 1,559 deletions.
32 changes: 32 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- yaml -*-

# This file determines clang-format's style settings; for details, refer to
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html

# See https://google.github.io/styleguide/cppguide.html for more info
BasedOnStyle: Google

Language: Cpp

# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#columnlimit
# Maximum line with is 120 characters (default: 80)
ColumnLimit : 120

# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#pointeralignment
# Align pointer to the left:
# int* a;
DerivePointerAlignment: false
PointerAlignment: Left

# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortfunctionsonasingleline
# Compress functions onto a single line (when they fit) iff they are defined
# inline (inside a of class) or are empty.
AllowShortFunctionsOnASingleLine: Inline

# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortlambdasonasingleline
# Compress lambdas onto a single line iff they are empty.
AllowShortLambdasOnASingleLine: Empty

# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includeblocks
# Alphabetically sort each block of includes separately, and do not re-group.
IncludeBlocks: Preserve
10 changes: 10 additions & 0 deletions .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: cpplint
on: [push, pull_request]
jobs:
cpplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- run: pip install cpplint
- run: cpplint --recursive .
63 changes: 34 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,64 +33,69 @@ pkg_check_modules(readylogpp REQUIRED readylog++)
pkg_check_modules(parsegologpp REQUIRED parsegolog++)

set(gologpp_action_pkgs
turtlesim
gpp_action_examples_interface
nav2_msgs
webots_spot_msgs
spot_msgs
turtlesim
gpp_action_examples_interface
nav2_msgs
webots_spot_msgs
spot_msgs
)

set(found_action_pkgs)
foreach(pkg ${gologpp_action_pkgs})
find_package(${pkg})
if ("${${pkg}_FOUND}")
list(APPEND found_action_pkgs ${pkg})
endif()
find_package(${pkg})
if ("${${pkg}_FOUND}")
list(APPEND found_action_pkgs ${pkg})
endif()
endforeach()

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-placement-new")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-placement-new")
endif()

set(BUILD_TESTS OFF CACHE BOOL "Enable gologpp tests" FORCE)

link_directories(${readylogpp_LIBRARY_DIRS} ${parsegologpp_LIBRARY_DIRS} ${ECLIPSE_LIBRARY_DIRS})

add_executable(gologpp_agent
src/agent_node.cpp
src/ros_backend.cpp
src/action_manager.cpp
src/exog_manager.cpp
src/agent_node.cpp
src/ros_backend.cpp
src/action_manager.cpp
src/exog_manager.cpp
)
ament_target_dependencies(gologpp_agent rclcpp rclcpp_action rclcpp_components builtin_interfaces tf2 tf2_ros std_msgs std_srvs geometry_msgs ${found_action_pkgs})
target_link_libraries(gologpp_agent ${ECLIPSE_LIBRARIES})
target_include_directories(gologpp_agent PUBLIC
src/
${readylogpp_INCLUDE_DIRS}
${parsegologpp_INCLUDE_DIRS}
${ECLIPSE_INCLUDE_DIRS}
src/
${readylogpp_INCLUDE_DIRS}
${parsegologpp_INCLUDE_DIRS}
${ECLIPSE_INCLUDE_DIRS}
)

install(
TARGETS gologpp_agent
DESTINATION lib/${PROJECT_NAME}
TARGETS gologpp_agent
DESTINATION lib/${PROJECT_NAME}
)

foreach(pkg ${found_action_pkgs})
target_sources(gologpp_agent PRIVATE "src/actions/gpp_${pkg}.cpp")
target_compile_definitions(gologpp_agent PUBLIC "-D${pkg}_FOUND")
target_sources(gologpp_agent PRIVATE "src/actions/gpp_${pkg}.cpp")
target_compile_definitions(gologpp_agent PUBLIC "-D${pkg}_FOUND")
endforeach()

target_link_libraries(
gologpp_agent
${readylogpp_LIBRARIES}
${parsegologpp_LIBRARIES}
gologpp_agent
${readylogpp_LIBRARIES}
${parsegologpp_LIBRARIES}
)
target_include_directories(
gologpp_agent
PRIVATE
include
)

target_compile_features(
gologpp_agent
PUBLIC
c_std_99
cxx_std_17
gologpp_agent
PUBLIC
c_std_99
cxx_std_17
)
ament_package()
28 changes: 28 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Stop searching for additional config files.
set noparent

# Disable a warning about C++ features that were not in the original
# C++11 specification (and so might not be well-supported). Our supported
# minimum platforms should be new enough that this warning is irrelevant.
filter=-build/c++11

# We do not care about the whitespace details of a TODO comment. It is not
# relevant for easy grepping, and the GSG does not specify any particular
# whitespace style. (We *do* care what the "TODO(username)" itself looks like
# because GSG forces a particular style there, but that formatting is covered
# by the readability/todo rule, which we leave enabled.)
filter=-whitespace/todo

# Don't require a copyright in each file
filter=-legal/copyright

# Must match clang-format
linelength=120

# Use `#pragma once`, not the `#ifndef FOO_H` guard.
# https://drake.mit.edu/styleguide/cppguide.html#The__pragma_once_Guard
filter=-build/header_guard
filter=+build/pragma_once

# Trust clang-format to enforce the correct include order.
filter=-build/include_order
8 changes: 4 additions & 4 deletions agents/spot.gpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
action navigateTo(string target_frame, number x, number y, number yaw) {
mapping:
"/trajectory" {
frame_id = target_frame,
"/trajectory" {
frame_id = target_frame,
posX = x,
posY = y,
yaw = yaw
}
}
}

procedure main(){
navigateTo("test_frame", 0.0, 0.0, 0.0);
navigateTo("test_frame", 0.0, 0.0, 0.0);
}
96 changes: 48 additions & 48 deletions agents/test_BAT.gpp
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
action navigateToFrame(string target_frame) {
mapping:
"trajectoryToFrame" {
frame_id = target_frame
}
"trajectoryToFrame" {
frame_id = target_frame
}
}

action playSound(string audio) {
mapping:
"play_audio" {
audio_file = audio
}
"play_audio" {
audio_file = audio
}
}

// action clear_behavior_fault(bool data) {
// mapping:
// "/clear_behavior_fault" {
// "/clear_behavior_fault" {
// data = data
// }
// }
// }

action stop(number data) {
mapping:
"/stop" {data = data}
"/stop" {data = data}
}

action increaseHeight() {
mapping:
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = 0.2,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = 0.2,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
}
action reduceHeight() {
mapping:
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = -0.2,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = -0.2,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
}
action normalPose() {
mapping:
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = 0.0,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
"body_pose_service" {
px = 0.0,
py = 0.0,
pz = 0.0,
ox = 0.0,
oy = 0.0,
oz = 0.0,
ow = 1.0
}
}

// action power_on() {
// mapping:
// "/power_on" {}
// "/power_on" {}
// }

// action claim() {
// mapping:
// "/claim" {}
// "/claim" {}
// }

// action sit() {
// mapping:
// "/sit" {}
// "/sit" {}
// }

// action stand() {
// mapping:
// "/stand" {}
// "/stand" {}
// }


procedure main(){
start(playSound("Rickroll"));
navigateToFrame("frame1");
increaseHeight();
navigateToFrame("frame2");
reduceHeight();
navigateToFrame("frame3");
normalPose();
navigateToFrame("frame4");
start(playSound("Rickroll"));
navigateToFrame("frame1");
increaseHeight();
navigateToFrame("frame2");
reduceHeight();
navigateToFrame("frame3");
normalPose();
navigateToFrame("frame4");
}
Loading

0 comments on commit 4eaa1f8

Please sign in to comment.