diff --git a/CMakeLists.txt b/CMakeLists.txt index 20daa748a2e416112836d5281ea1c938011dcbc3..b8b37e7d2a96fc85e51c213412f416d6fe72377d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,8 @@ if(COMMAND cmake_policy) endif(COMMAND cmake_policy) # The project name and the type of project -PROJECT(open-drive-format) -SET(PACKAGE_NAME open-drive-format) +PROJECT(opendrive_to_gazebo) +SET(PACKAGE_NAME opendrive-to-gazebo) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib) @@ -57,6 +57,8 @@ IF (UNIX) ADD_CUSTOM_COMMAND( COMMENT "uninstall package" COMMAND xargs ARGS rm < install_manifest.txt + COMMAND rm -rd ${CMAKE_INSTALL_PREFIX}/lib/iri/${PROJECT_NAME} + COMMAND rm -rd ${CMAKE_INSTALL_PREFIX}/include/iri/${PROJECT_NAME} TARGET uninstall ) diff --git a/Findopen_drive_format.cmake b/Findopen_drive_format.cmake deleted file mode 100644 index 07559ac974546e876999c0e8060cadf052eb5b75..0000000000000000000000000000000000000000 --- a/Findopen_drive_format.cmake +++ /dev/null @@ -1,24 +0,0 @@ -#edit the following line to add the librarie's header files -FIND_PATH(open_drive_format_INCLUDE_DIRS open_drive_format.h /usr/local/include/iri/open_drive_format /usr/include/iri/open_drive_format) - -FIND_LIBRARY(open_drive_format_LIBRARIES - NAMES open_drive_format - PATHS /usr/local/lib/iri/open_drive_format /usr/lib/iri/open_drive_format) - -SET(open_drive_format_INCLUDE_DIR ${open_drive_format_INCLUDE_DIRS}) -SET(open_drive_format_LIBRARY ${open_drive_format_LIBRARIES}) - -IF (open_drive_format_INCLUDE_DIRS AND open_drive_format_LIBRARIES) - SET(open_drive_format_FOUND TRUE) -ENDIF (open_drive_format_INCLUDE_DIRS AND open_drive_format_LIBRARIES) - -IF (open_drive_format_FOUND) - IF (NOT open_drive_format_FIND_QUIETLY) - MESSAGE(STATUS "Found open_drive_format: ${open_drive_format_LIBRARIES}") - ENDIF (NOT open_drive_format_FIND_QUIETLY) -ELSE (open_drive_format_FOUND) - IF (open_drive_format_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find open_drive_format") - ENDIF (open_drive_format_FIND_REQUIRED) -ENDIF (open_drive_format_FOUND) - diff --git a/Findopendrive_to_gazebo.cmake b/Findopendrive_to_gazebo.cmake new file mode 100644 index 0000000000000000000000000000000000000000..f382e3c9c975dc0eaa8c237d5017455a02cae0ce --- /dev/null +++ b/Findopendrive_to_gazebo.cmake @@ -0,0 +1,24 @@ +#edit the following line to add the librarie's header files +FIND_PATH(opendrive_to_gazebo_INCLUDE_DIRS opendrive_to_gazebo.h adc_circuit.h adc_geometries.h adc_road.h adc_signals.h /usr/local/include/iri/opendrive_to_gazebo /usr/include/iri/opendrive_to_gazebo) + +FIND_LIBRARY(opendrive_to_gazebo_LIBRARIES + NAMES opendrive_to_gazebo + PATHS /usr/local/lib/iri/opendrive_to_gazebo /usr/lib/iri/opendrive_to_gazebo) + +SET(opendrive_to_gazebo_INCLUDE_DIR ${opendrive_to_gazebo_INCLUDE_DIRS}) +SET(opendrive_to_gazebo_LIBRARY ${opendrive_to_gazebo_LIBRARIES}) + +IF (opendrive_to_gazebo_INCLUDE_DIRS AND opendrive_to_gazebo_LIBRARIES) + SET(opendrive_to_gazebo_FOUND TRUE) +ENDIF (opendrive_to_gazebo_INCLUDE_DIRS AND opendrive_to_gazebo_LIBRARIES) + +IF (opendrive_to_gazebo_FOUND) + IF (NOT opendrive_to_gazebo_FIND_QUIETLY) + MESSAGE(STATUS "Found opendrive_to_gazebo: ${opendrive_to_gazebo_LIBRARIES}") + ENDIF (NOT opendrive_to_gazebo_FIND_QUIETLY) +ELSE (opendrive_to_gazebo_FOUND) + IF (opendrive_to_gazebo_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find opendrive_to_gazebo") + ENDIF (opendrive_to_gazebo_FIND_REQUIRED) +ENDIF (opendrive_to_gazebo_FOUND) + diff --git a/ReadMe.md b/ReadMe.md index 860d2ece99ff4c08401bbe0c6cb6e0bb31c5ff5b..d54cde60e463abe758fe7cc7fd7fd7b2c3dc4d7f 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,17 +1,47 @@ -open_drive_format {#mainpage} +opendrive_to_gazebo {#mainpage} ============ ## Description -open_drive_format +Library to parse a OpenDrive 1.4 road file format to generate a launch file to spawn signals and objects on gazebo. + +## Installation + +* Add the labrobotica repository if it is not already added: + +Run the commands on _add repository_ and _add key_ from [labrobotica_how_to installation](https://gitlab.iri.upc.edu/labrobotica/labrobotica_how_to/-/blob/master/README.md#installation) + +* Install the package: + +```bash +sudo apt update && sudo apt install iri-opendrive-to-gazebo-dev +``` + +## Disclaimer + +Copyright (C) Institut de Robòtica i Informà tica Industrial, CSIC-UPC. +Mantainer IRI labrobotics (labrobotica@iri.upc.edu) + +This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction. + +In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see <http://www.gnu.org/licenses/> + +## For developers + +<details><summary>click here</summary> +<p> ## Dependencies This package requires of the following system libraries and packages -* [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system. -* [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation. -* stdc++ and pthread libraries. + * [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system. + * [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation. + * [XSD](http://wiki.codesynthesis.com/XSD "XSD wiki main page") to enable XML support. + * stdc++. Under linux all of these utilities are available in ready-to-use packages. @@ -19,24 +49,34 @@ Under MacOS most of the packages are available via [fink](http://www.finkproject This package also requires of the following IRI libraries: -## Compilation and installation + * [iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils "iriutils gitlab page"), a set of basic tools. -Download this repository and create a build folder inside: +## Compilation and installation from source -``` mkdir build ``` +Clone this repository and create a build folder inside: + +```bash +mkdir build +``` Inside the build folder execute the following commands: -``` cmake .. ``` +```bash +cmake .. +``` The default build mode is DEBUG. That is, objects and executables include debug information. The RELEASE build mode optimizes for speed. To build in this mode execute instead -``` cmake .. -DCMAKE_BUILD_TYPE=RELEASE ``` +```bash +cmake .. -DCMAKE_BUILD_TYPE=RELEASE +``` The release mode will be kept until next time cmake is executed. -``` make ``` +```bash +make -j $(nproc) +``` In case no errors are reported, the generated libraries (if any) will be located at the _lib_ folder and the executables (if any) will be located at the _bin_ folder. @@ -44,45 +84,52 @@ _lib_ folder and the executables (if any) will be located at the _bin_ folder. In order to be able to use the library, it it necessary to copy it into the system. To do that, execute -``` make install ``` +```bash +make install +``` -as root and the shared libraries will be copied to */usr/local/lib/iridrivers* directory -and the header files will be copied to */usr/local/include/iridrivers* dierctory. At -this point, the library may be used by any user. +as root and the shared libraries will be copied to */usr/local/lib/iri/opendrive_to_gazebo* directory +and the header files will be copied to */usr/local/include/iri/opendrive_to_gazebo* dierctory. If the +support for XML file is enabled, all the necessary files will be copied to */usr/local/include/iri/opendrive_to_gazebo/xml*. +At this point, the library may be used by any user. To remove the library from the system, exceute -``` make uninstall ``` +```bash +make uninstall +``` as root, and all the associated files will be removed from the system. To generate the documentation execute the following command: -``` make doc ``` +```bash +make doc +``` ## How to use it To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command -``` FIND_PACKAGE(open_drive_format) ``` +```cmake +FIND_PACKAGE(opendrive_to_gazebo) +``` In the case that the package is present, it is necessary to add the header files directory to the include directory path by using -``` INCLUDE_DIRECTORIES(${open_drive_format_INCLUDE_DIR}) ``` +```cmake + INCLUDE_DIRECTORIES(${opendrive_to_gazebo_INCLUDE_DIRS}) +``` and it is also necessary to link with the desired libraries by using the following command -``` TARGET_LINK_LIBRARIES(<executable name> ${open_drive_format_LIBRARY}) ``` - -## Disclaimer - -Copyright (C) 2009-2018 Institut de Robòtica i Informà tica Industrial, CSIC-UPC. -Mantainer IRI labrobotics (labrobotica@iri.upc.edu) +```cmake +TARGET_LINK_LIBRARIES(<executable name> ${opendrive_to_gazebo_LIBRARIES}) +``` -This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction. +## Examples -In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages. - -You should have received a copy of the GNU Lesser General Public License -along with this program. If not, see <http://www.gnu.org/licenses/> +There is an example to show the use of this library. +</p> +</details> diff --git a/include/open_drive_format.h b/include/opendrive_to_gazebo.h similarity index 100% rename from include/open_drive_format.h rename to include/opendrive_to_gazebo.h diff --git a/spawn_signs.launch b/spawn_signs.launch new file mode 100644 index 0000000000000000000000000000000000000000..ce105011a8e529907abaf952eda9a70990df5854 --- /dev/null +++ b/spawn_signs.launch @@ -0,0 +1,100 @@ +<?xml version="1.0"?> + +<launch> + <arg name="parent" default="map"/> + <arg name="rviz" default="false"/> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="max_1008223688"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar14"/> + <arg name="type" value="max_100"/> + <arg name="x" value="-785.318"/> + <arg name="y" value="-886.771"/> + <arg name="yaw" value="4.40075"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="max_1008225686"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar14"/> + <arg name="type" value="max_100"/> + <arg name="x" value="-806.912"/> + <arg name="y" value="-878.394"/> + <arg name="yaw" value="4.40068"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="roadworks8986806"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar12"/> + <arg name="type" value="roadworks"/> + <arg name="x" value="-837.75"/> + <arg name="y" value="-974.551"/> + <arg name="yaw" value="4.40369"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="roadworks8986841"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar12"/> + <arg name="type" value="roadworks"/> + <arg name="x" value="-817.618"/> + <arg name="y" value="-983.322"/> + <arg name="yaw" value="4.40372"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="no_overtaking8225798"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar8"/> + <arg name="type" value="no_overtaking"/> + <arg name="x" value="-688.818"/> + <arg name="y" value="-510.078"/> + <arg name="yaw" value="7.54412"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="giveway8236721"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar5"/> + <arg name="type" value="giveway"/> + <arg name="x" value="-232.499"/> + <arg name="y" value="-227.554"/> + <arg name="yaw" value="3.26183"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + + <include file="$(find sign_description)/launch/spawn.launch"> + <arg name="name" value="no_overtaking8223908"/> + <arg name="model" value="sign"/> + <arg name="tag" value="alvar8"/> + <arg name="type" value="no_overtaking"/> + <arg name="x" value="-672.01"/> + <arg name="y" value="-514.418"/> + <arg name="yaw" value="7.52419"/> + <arg name="parent" value="$(arg parent)"/> + <arg name="rviz" value="$(arg rviz)"/> + </include> + + +</launch> + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3550e5b03dcf3adabbc792bc4e8af4f8afe3a23..9631942b5e57a82b5fce9aaca7c094fc1f534d30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # driver source files -SET(sources open_drive_format.cpp adc_circuit.cpp adc_road.cpp adc_geometries.cpp adc_signals.cpp) +SET(sources opendrive_to_gazebo.cpp adc_circuit.cpp adc_road.cpp adc_geometries.cpp adc_signals.cpp) # application header files -SET(headers ../include/open_drive_format.h ../include/adc_circuit.h ../include/adc_road.h ../include/adc_geometries.h ../include/adc_signals.h) +SET(headers ../include/opendrive_to_gazebo.h ../include/adc_circuit.h ../include/adc_road.h ../include/adc_geometries.h ../include/adc_signals.h) # locate the necessary dependencies FIND_PACKAGE(iriutils REQUIRED) @@ -11,20 +11,20 @@ ADD_SUBDIRECTORY(xml) INCLUDE_DIRECTORIES(../include) INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS}) # create the shared library -ADD_LIBRARY(open_drive_format SHARED ${sources} ${XSD_SOURCES}) +ADD_LIBRARY(opendrive_to_gazebo SHARED ${sources} ${XSD_SOURCES}) # link necessary libraries -TARGET_LINK_LIBRARIES(open_drive_format ${XSD_LIBRARY}) -TARGET_LINK_LIBRARIES(open_drive_format ${iriutils_LIBRARIES}) +TARGET_LINK_LIBRARIES(opendrive_to_gazebo ${XSD_LIBRARY}) +TARGET_LINK_LIBRARIES(opendrive_to_gazebo ${iriutils_LIBRARIES}) -ADD_DEPENDENCIES(open_drive_format xsd_files_gen) +ADD_DEPENDENCIES(opendrive_to_gazebo xsd_files_gen) SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1) -INSTALL(TARGETS open_drive_format +INSTALL(TARGETS opendrive_to_gazebo RUNTIME DESTINATION bin LIBRARY DESTINATION lib/iri/${PROJECT_NAME} ARCHIVE DESTINATION lib/iri/${PROJECT_NAME}) INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME}) -INSTALL(FILES ../Findopen_drive_format.cmake DESTINATION ${CMAKE_ROOT}/Modules/) +INSTALL(FILES ../Findopendrive_to_gazebo.cmake DESTINATION ${CMAKE_ROOT}/Modules/) ADD_SUBDIRECTORY(examples) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 83a92a4bdbdf2d9ea23629947d4be830f59bab97..87968ca82999ad178f9dc47e49bc1ab70730673a 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -1,4 +1,4 @@ # create an example application -ADD_EXECUTABLE(open_drive_format_test open_drive_format_test.cpp) +ADD_EXECUTABLE(opendrive_to_gazebo_test opendrive_to_gazebo_test.cpp) # link necessary libraries -TARGET_LINK_LIBRARIES(open_drive_format_test open_drive_format) +TARGET_LINK_LIBRARIES(opendrive_to_gazebo_test opendrive_to_gazebo) diff --git a/src/examples/open_drive_format_test.cpp b/src/examples/opendrive_to_gazebo_test.cpp similarity index 89% rename from src/examples/open_drive_format_test.cpp rename to src/examples/opendrive_to_gazebo_test.cpp index 546f1756b7d9774474e20bc1b3aef1e3414780cc..c90354ed8b4215eae2a424a05e575ce43523c0f1 100644 --- a/src/examples/open_drive_format_test.cpp +++ b/src/examples/opendrive_to_gazebo_test.cpp @@ -1,4 +1,4 @@ -#include "open_drive_format.h" +#include "opendrive_to_gazebo.h" #include "exceptions.h" #include <iostream> #include <vector> @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) try { open_drive_format.load(xml_file, false); - open_drive_format.calculate_signals_pose(true); + open_drive_format.calculate_signals_pose(false); std::vector<CAdcSignals*> signals; // open_drive_format.get_signals(signals); diff --git a/src/open_drive_format.cpp b/src/opendrive_to_gazebo.cpp similarity index 98% rename from src/open_drive_format.cpp rename to src/opendrive_to_gazebo.cpp index 549bf12955023d62be96e22e11b322a102046638..1bb2c498f62b50986460d95a5de9bb2c08bdc52d 100644 --- a/src/open_drive_format.cpp +++ b/src/opendrive_to_gazebo.cpp @@ -1,4 +1,4 @@ -#include "open_drive_format.h" +#include "opendrive_to_gazebo.h" #include "exceptions.h" #include <sys/types.h>