-
Notifications
You must be signed in to change notification settings - Fork 0
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
Trislam1 #40
base: main
Are you sure you want to change the base?
Trislam1 #40
Changes from 15 commits
49e6b69
da8bdf2
5c15f5c
8c91260
9d9f653
cc6b503
d5ee693
0e11a8e
5f14de4
1ce766a
a2a9414
1ffb9c3
ea52e7c
ea66c47
563b607
59f3f91
9cb963c
b26a384
2165b0b
095ccde
15fbf7c
17d1b2c
9d7c532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tmp | ||
*.o | ||
.*.swp | ||
build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
################################################### | ||
# Copyright (c) Gaia Platform LLC | ||
# | ||
# Use of this source code is governed by the MIT | ||
# license that can be found in the LICENSE.txt file | ||
# or at https://opensource.org/licenses/MIT. | ||
################################################### | ||
|
||
cmake_minimum_required(VERSION 3.16) | ||
|
||
enable_testing() | ||
|
||
project(slam_sim) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(GAIA_COMPILE_FLAGS "-c -Wall -Wextra -ggdb") | ||
set(GAIA_LINK_FLAGS "-ggdb") | ||
|
||
# We need pthreads support. | ||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) | ||
set(THREADS_PREFER_PTHREAD_FLAG TRUE) | ||
find_package(Threads REQUIRED) | ||
|
||
include("/opt/gaia/cmake/gaia.cmake") | ||
|
||
# Default compiler/linker flags. | ||
add_compile_options(-c -Wall -Wextra -ggdb) | ||
|
||
# --- Generate Direct Access classes from DDL--- | ||
process_schema( | ||
DDL_FILE ${PROJECT_SOURCE_DIR}/gaia/slam.ddl | ||
DATABASE_NAME slam | ||
) | ||
|
||
# -- Translate ruleset into CPP -- | ||
translate_ruleset( | ||
RULESET_FILE ${PROJECT_SOURCE_DIR}/gaia/slam.ruleset | ||
DATABASE_NAME slam | ||
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. There is no |
||
CLANG_PARAMS | ||
-I ${PROJECT_SOURCE_DIR}/include | ||
) | ||
|
||
# Application | ||
|
||
add_executable(slam_sim | ||
src/analyze.cpp | ||
src/occupancy.cpp | ||
src/paths.cpp | ||
src/rule_api.cpp | ||
src/slam_sim.cpp | ||
src/utils/coord_list.cpp | ||
src/utils/line_segment.cpp | ||
) | ||
|
||
target_add_gaia_generated_sources(slam_sim) | ||
|
||
target_include_directories(slam_sim PRIVATE | ||
${GAIA_INC} | ||
${PROJECT_SOURCE_DIR}/include | ||
${PROJECT_SOURCE_DIR}/gaia/slam | ||
) | ||
|
||
target_link_directories(slam_sim PRIVATE ${GAIA_LIB_DIR}) | ||
target_link_libraries(slam_sim PRIVATE ${GAIA_LIB} rt Threads::Threads) | ||
|
||
|
||
######################################################################## | ||
# Tests | ||
|
||
################################ | ||
add_executable(test_coord_list | ||
tests/test_coord_list.cpp | ||
src/utils/coord_list.cpp | ||
) | ||
|
||
set_target_properties(test_coord_list PROPERTIES COMPILE_FLAGS "${GAIA_COMPILE_FLAGS}") | ||
set_target_properties(test_coord_list PROPERTIES LINK_FLAGS "${GAIA_LINK_FLAGS}") | ||
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. I think you can get rid of all the |
||
target_include_directories(test_coord_list PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_link_libraries(test_coord_list PRIVATE rt) | ||
|
||
add_test(NAME test_coord_list COMMAND test_coord_list) | ||
|
||
|
||
################################ | ||
add_executable(test_line_segment | ||
tests/test_line_segment.cpp | ||
src/utils/line_segment.cpp | ||
) | ||
|
||
set_target_properties(test_line_segment PROPERTIES COMPILE_FLAGS "${GAIA_COMPILE_FLAGS}") | ||
set_target_properties(test_line_segment PROPERTIES LINK_FLAGS "${GAIA_LINK_FLAGS}") | ||
target_include_directories(test_line_segment PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_link_libraries(test_line_segment PRIVATE rt) | ||
|
||
add_test(NAME test_line_segment COMMAND test_line_segment) | ||
|
||
|
||
################################ | ||
add_executable(test_analyze | ||
tests/test_analyze.cpp | ||
src/analyze.cpp | ||
src/occupancy.cpp | ||
src/paths.cpp | ||
src/rule_api.cpp | ||
src/utils/coord_list.cpp | ||
src/utils/line_segment.cpp | ||
) | ||
target_add_gaia_generated_sources(test_analyze) | ||
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. It seems like we need to split |
||
|
||
set_target_properties(test_analyze PROPERTIES COMPILE_FLAGS "${GAIA_COMPILE_FLAGS}") | ||
set_target_properties(test_analyze PROPERTIES LINK_FLAGS "${GAIA_LINK_FLAGS}") | ||
target_include_directories(test_analyze PRIVATE ${GAIA_INC}) | ||
target_include_directories(test_analyze PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_link_libraries(test_analyze PRIVATE ${GAIA_LIB} rt) | ||
|
||
add_test(NAME test_analyze COMMAND test_analyze) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
all: | ||
mkdir -p build && cd build && cmake .. && make -j 4 | ||
|
||
run: | ||
cd src && make run | ||
|
||
# At present there's no method to delete the contents of the database | ||
# from w/in the program, so add a way to do so outside. | ||
refresh_db: | ||
gaiac gaia/slam.ddl --db-name slam -g -o /tmp/slam | ||
|
||
refresh: clean all | ||
|
||
clean: | ||
rm -Rf build | ||
|
||
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. I see what you are doing here, and it makes sense to me, but AFAIK this is the only project where we do this. I know that we had a bunch of shell scripts in the AMR swarm, but the jury was out on whether they helped or caused more confusion. I prefer this to shell scripts, but I also wonder if there is a way to generalize this so that we could just drop a copy of this in with all the examples? The only project specific rule is refresh_db. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"description": "4 rooms, 3 with table", | ||
daxhaw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"width": 15.0, | ||
"height": 10.0, | ||
"world": [ | ||
{ | ||
"name": "Walls", | ||
"vertices": [ | ||
{ "x": -6.9, "y": 4.9 }, | ||
{ "x": -0.1, "y": 4.9 }, | ||
{ "x": -0.1, "y": 0.1 }, | ||
{ "x": -1.5, "y": 0.1 }, | ||
{ "x": -1.5, "y": -0.1 }, | ||
{ "x": -0.1, "y": -0.1 }, | ||
{ "x": -0.1, "y": -3.0 }, | ||
{ "x": 0.1, "y": -3.0 }, | ||
{ "x": 0.1, "y": 4.9 }, | ||
{ "x": 6.9, "y": 4.9 }, | ||
{ "x": 6.9, "y": -1.9 }, | ||
{ "x": 2.1, "y": 0.1 }, | ||
{ "x": 2.1, "y": -0.1 }, | ||
{ "x": 6.9, "y": -2.1 }, | ||
{ "x": 6.9, "y": -4.9 }, | ||
{ "x": -6.9, "y": -4.9 }, | ||
{ "x": -6.9, "y": -0.1 }, | ||
{ "x": -3.4, "y": -0.1 }, | ||
{ "x": -3.4, "y": 0.1 }, | ||
{ "x": -6.9, "y": 0.1 }, | ||
{ "x": -6.9, "y": 4.9 } | ||
] | ||
}, | ||
{ | ||
"name": "Table-1", | ||
"vertices": [ | ||
{ "x": -5.5, "y": 3.5 }, | ||
{ "x": -4.0, "y": 3.5 }, | ||
{ "x": -4.0, "y": 2.5 }, | ||
{ "x": -5.5, "y": 2.5 }, | ||
{ "x": -5.5, "y": 3.5 } | ||
] | ||
}, | ||
{ | ||
"name": "Table-2", | ||
"vertices": [ | ||
{ "x": 2.5, "y": -2.5 }, | ||
{ "x": 3.8, "y": -3.5 }, | ||
{ "x": 1.2, "y": -3.5 }, | ||
{ "x": 2.5, "y": -2.5 } | ||
] | ||
}, | ||
{ | ||
"name": "Table-3", | ||
"vertices": [ | ||
{ "x": 3.0, "y": 3.0 }, | ||
{ "x": 4.0, "y": 3.0 }, | ||
{ "x": 4.0, "y": 2.0 }, | ||
{ "x": 3.0, "y": 2.0 }, | ||
{ "x": 3.0, "y": 3.0 } | ||
] | ||
} | ||
], | ||
"landmarks": [ | ||
{ "x": -3.5, "y": 4.9, "id": 1, "name": "mark-1" }, | ||
{ "x": 3.5, "y": 4.9, "id": 2, "name": "mark-2" }, | ||
{ "x": -3.5, "y": -4.9, "id": 2, "name": "mark-3" }, | ||
{ "x": 3.5, "y": -4.9, "id": 2, "name": "mark-4" }, | ||
{ "x": 6.0, "y": -0.0, "id": 2, "name": "mark-5" } | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-4 4 | ||
daxhaw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-3 4 | ||
-2.5 3.5 | ||
-2.2 3.2 | ||
-2 2.5 | ||
-2.3 2.2 | ||
-3 2.0 | ||
-4 2 | ||
-4.5 1.5 | ||
-4.4 1 | ||
-4 1 | ||
-3 1 | ||
-2.5 0.5 | ||
-2.4 0 | ||
-2.3 -1 | ||
-2.8 -1.2 | ||
-3.5 -1.3 | ||
-4.0 -2.0 | ||
-4.0 -3.0 | ||
-3.5 -3.5 | ||
-2.5 -4.0 | ||
-1.5 -4.0 | ||
-0.5 -4 | ||
0.5 -3.9 | ||
0.8 -3.2 | ||
1.5 -2 | ||
1.9 -1.5 | ||
1.2 -0.5 | ||
1.0 0.5 | ||
1.5 1.5 | ||
1.8 2.5 | ||
2.1 3.5 | ||
3 4 | ||
4 4 | ||
5 4 | ||
5.5 3.5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1.0 1.0 | ||
1.0 2.0 | ||
-1 2.0 | ||
-5 -2.0 | ||
5 -2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
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. empty line (mayve you should put the Gaia copyright) 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. This file will be deleted. It's a shortcut to build ddl/rules w/o jumping back to cmake. |
||
RULES_CPP = slam_rules.cpp | ||
DB_NAME = slam | ||
INC = -I/opt/gaia/include/ -Islam/ -I../include/ | ||
|
||
OBJS = slam_rules.o slam/gaia_slam.o | ||
|
||
all: | ||
gaiac slam.ddl -g --db-name $(DB_NAME) -o $(DB_NAME) | ||
gaiat slam.ruleset -output $(RULES_CPP) -- -I/usr/lib/clang/10/include $(INC) | ||
|
||
refresh: clean all | ||
|
||
clean: | ||
rm -f *.o $(RULES_CPP) | ||
rm -rf $(DB_NAME) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant with
set(GAIA_COMPILE_FLAGS "-c -Wall -Wextra -ggdb")
.I'd remove the following: