-
Notifications
You must be signed in to change notification settings - Fork 7
Create UWRT utils package #184
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
Open
keyonjerome
wants to merge
13
commits into
uwrt-mars-rover-arm-dev
Choose a base branch
from
uwrt-utils-dev
base: uwrt-mars-rover-arm-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
db6aee2
Created utilities package.
keyonjerome 9dc2d63
CMake tests for utils package.
keyonjerome 0141e49
Fix attempts for linking files.
keyonjerome 07c6b75
Fix utils imports and exports.
keyonjerome f38a43e
Add incl guard and replace duplicate code w utils.
keyonjerome 8657670
Remove old-style ament-cmake
keyonjerome 390a310
Make utils package header-only.
keyonjerome 5da4c6b
Switch include guard to $pragma.
keyonjerome 3568cac
Update license declaration.
keyonjerome 76ae9cf
Add CMake testing.
keyonjerome 35c1289
Add test dependencies.
keyonjerome 77c7b3f
clang format
keyonjerome 5bfec4a
remove compile_commands from git
keyonjerome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
1 change: 0 additions & 1 deletion
1
uwrt_mars_rover_arm/uwrt_mars_rover_arm_hw/compile_commands.json
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,79 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(uwrt_mars_rover_utils) | ||
|
||
# set C/C++ standard | ||
if(NOT CMAKE_C_STANDARD) | ||
set(CMAKE_C_STANDARD 99) | ||
endif() | ||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 14) | ||
endif() | ||
|
||
|
||
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) | ||
|
||
add_library(${PROJECT_NAME} INTERFACE) | ||
target_include_directories( | ||
${PROJECT_NAME} | ||
INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wmmc88 I'm not sure what the Modern CMake replacement is for this |
||
|
||
|
||
install( | ||
DIRECTORY include/ | ||
DESTINATION include | ||
) | ||
install( | ||
TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}Targets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
INCLUDES DESTINATION include | ||
) | ||
|
||
|
||
|
||
|
||
if(BUILD_TESTING) | ||
# Force generation of compile_commands.json for clang-tidy | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") | ||
|
||
# clang-format | ||
find_package(ament_cmake_clang_format REQUIRED) | ||
ament_clang_format( | ||
CONFIG_FILE ${CMAKE_SOURCE_DIR}/../../.clang-format | ||
) | ||
|
||
# clang-tidy | ||
find_package(ament_cmake_clang_tidy REQUIRED) | ||
ament_clang_tidy( | ||
${CMAKE_BINARY_DIR} | ||
CONFIG_FILE ${CMAKE_SOURCE_DIR}/../../.clang-tidy | ||
) | ||
|
||
# cppcheck | ||
find_package(ament_cmake_cppcheck REQUIRED) | ||
ament_cppcheck() | ||
|
||
# flake8 | ||
find_package(ament_cmake_flake8 REQUIRED) | ||
ament_flake8( | ||
CONFIG_FILE ${CMAKE_SOURCE_DIR}/../../.flake8 | ||
) | ||
|
||
# xmllint | ||
find_package(ament_cmake_xmllint REQUIRED) | ||
ament_xmllint() | ||
endif() | ||
|
||
ament_package() |
34 changes: 34 additions & 0 deletions
34
uwrt_mars_rover_utils/include/uwrt_mars_rover_utils/data_utils.hpp
This file contains hidden or 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,34 @@ | ||
#pragma once | ||
|
||
namespace DifferentialTransmissionData { | ||
|
||
namespace ActuatorData { | ||
|
||
struct CommandData { | ||
double velocity{}; // TODO: change this so that it can work with any interface type... add enum class that will hold | ||
// the different command types | ||
}; | ||
|
||
struct StateData { | ||
double velocity{}; | ||
double position{}; | ||
double iq_current{}; // not used for differential transmission | ||
}; | ||
|
||
} // namespace ActuatorData | ||
|
||
// keeping this separate from ActuatorData despite the overlap for extensibility reasons | ||
namespace JointData { | ||
|
||
struct CommandData { | ||
double velocity{}; | ||
}; | ||
|
||
struct StateData { | ||
double velocity{}; | ||
double position{}; | ||
}; | ||
|
||
} // namespace JointData | ||
|
||
} // namespace DifferentialTransmissionData |
This file contains hidden or 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,23 @@ | ||
<?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>uwrt_mars_rover_utils</name> | ||
<version>0.0.0</version> | ||
<description>UWRT Mars Rover utilities package for avoiding duplicate code.</description> | ||
<maintainer email="[email protected]">keyonjerome</maintainer> | ||
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
keyonjerome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<test_depend>ament_cmake_clang_format</test_depend> | ||
<test_depend>ament_cmake_clang_tidy</test_depend> | ||
<test_depend>ament_cmake_cppcheck</test_depend> | ||
<test_depend>ament_cmake_flake8</test_depend> | ||
<test_depend>ament_cmake_xmllint</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.