Skip to content

Commit

Permalink
found PlotJuggler, a software that plots data from rosbag. Has multip…
Browse files Browse the repository at this point in the history
…anelling, but I changed some things for autoscaling.
  • Loading branch information
MisterPNP committed Mar 25, 2018
1 parent 6b159d1 commit 9d7b541
Show file tree
Hide file tree
Showing 36 changed files with 5,557 additions and 2 deletions.
1 change: 1 addition & 0 deletions ros_type_introspection/.gitattributes
@@ -0,0 +1 @@
*.h linguist-language=C++
33 changes: 33 additions & 0 deletions ros_type_introspection/.gitignore
@@ -0,0 +1,33 @@
/CMakeLists.txt.user
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app


build*
132 changes: 132 additions & 0 deletions ros_type_introspection/CHANGELOG.rst
@@ -0,0 +1,132 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package ros_type_introspection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.1.0 (2018-03-22)
------------------
* critical bug fix
* fixed compilation of test
* remove potential problem in other projects
* Contributors: Davide Faconti

1.0.2 (2018-02-08)
------------------
* fixing issue with blobs (detected when parsing sensor_msgs::Image)
* added test for sensor image
* Contributors: Davide Faconti

1.0.1 (2017-11-14)
------------------
* added return value to deserializeIntoFlatContainer
* bug fix
* fix compilation issue
* fix potential issue with static variables
* Contributors: Davide Faconti

1.0.0 (2017-10-12)
------------------
* Complete refactoring
* Contributors: Davide Faconti, Kartik Mohta, Ian Taylor, Mehdi Tlili

0.8.0 (2017-08-30)
------------------
* fixing a serious issue with vectors which are too large
* Contributors: Davide Faconti

0.7.1 (2017-08-29)
------------------
* ros Time and Duration fixed
* tests fixed
* important API Change
* might fix issue reported in `#5 <https://github.com/facontidavide/ros_type_introspection/issues/5>`_. print_number made public
* adding inline to fix compilation error `#4 <https://github.com/facontidavide/ros_type_introspection/issues/4>`_
* maintain nanosecond precision for time/duration
* Contributors: Davide Faconti, Ian Taylor

0.6.3 (2017-06-26)
------------------
* speed up
* yet another bug fixed
* considerable speed improvement
* Contributors: Davide Faconti

0.6.2 (2017-06-23)
------------------
* bug fix. types where missing in conversion
* Contributors: Davide Faconti

0.6.1 (2017-06-22)
------------------
* fixed a bug in resize
* potential compilation problem fixed
* Contributors: Davide Faconti

0.6.0 (2017-06-20)
------------------
* moved the deserializing code
* new API
* fixing issue in resize (to be tested)
* fixed osx compilation failure due to implicit_instantiation of std::array
* Fix formating and typos
* Contributors: Bo Li, Davide Faconti, Sam Pfeiffer

0.5.1 (2017-04-02)
------------------
* fix the test
* fix tests?
* compilation fix
* typo fix
* test fixed
* Contributors: Davide Faconti

0.5.0 (2017-03-25)
------------------
* toStr changed
* Contributors: Davide Faconti

0.4.3 (2017-02-13)
------------------
* FIX: bug found in cache. reverting the recent change
* Contributors: davide

0.4.1 (2017-02-09)
------------------
* COSMETIC: more consistent code
* considerable speed improvement in applyNameTransform
* Contributors: Davide Faconti

0.4.0 (2017-02-06)
------------------
* critical bug fixed
* remove compilation warnings
* Update README.md
* Contributors: Davide Faconti

0.3.3 (2016-11-04)
------------------
* removed serious bug that might cause double free
* Contributors: davide

0.3.2 (2016-10-26)
------------------
* fixing tests (EXPECTED_EQ is more informative)
* changed the type of ROSType::baseName() and added SString::toStdString()

0.3.1 (2016-10-20)
------------------
* added BSD license
* added an alternative implementation of ShapeShifter

0.3.0 (2016-10-17)
-----------

* Doxygen added
* Moved to gtests instead of Catch.
* Final API (?)

0.2.0 (2016-10-17)
-----------

* All unit tests pass, but coverage is not very high.
* By default is uses the custom string implementation.
* Stable (?) API
136 changes: 136 additions & 0 deletions ros_type_introspection/CMakeLists.txt
@@ -0,0 +1,136 @@
cmake_minimum_required(VERSION 2.8.3)
project(ros_type_introspection)

find_package(Boost REQUIRED COMPONENTS regex)


find_package(catkin REQUIRED COMPONENTS
roscpp
rostime
topic_tools
rosbag
rosbag_storage
roscpp_serialization
sensor_msgs
geometry_msgs
abseil_cpp
)

# Build flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES ros_type_introspection
CATKIN_DEPENDS
roscpp
rostime
topic_tools
rosbag
rosbag_storage
roscpp_serialization
abseil_cpp
DEPENDS
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations

include_directories(
include
${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
add_library(ros_type_introspection

src/ros_type.cpp
src/ros_field.cpp
src/stringtree_leaf.cpp
src/ros_message.cpp
src/substitution_rule.cpp

src/ros_introspection.cpp
)

target_link_libraries(ros_type_introspection ${catkin_LIBRARIES})


find_package(benchmark CONFIG)
if (benchmark_FOUND)

add_executable(ros_introspection_benchmark src/tests/benchmark.cpp)
add_dependencies(ros_introspection_benchmark
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS})

target_link_libraries(ros_introspection_benchmark
${catkin_LIBRARIES}
ros_type_introspection
benchmark
)

endif(benchmark_FOUND)

add_executable(rosbag_example example/rosbag_example.cpp)
target_link_libraries(rosbag_example ${catkin_LIBRARIES} ros_type_introspection)

add_executable(subscribe_example example/subscribe_example.cpp)
target_link_libraries(subscribe_example ${catkin_LIBRARIES} ros_type_introspection
)


#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html


## Mark executables and/or libraries for installation
install(TARGETS ros_type_introspection
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)


## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".git" EXCLUDE
)


#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING)

catkin_add_gtest(ros_introspection_test
src/tests/parser_test.cpp
src/tests/deserializer_test.cpp
src/tests/renamer_test.cpp
)

target_link_libraries(ros_introspection_test
${catkin_LIBRARIES} boost_regex
ros_type_introspection
)

endif()
21 changes: 21 additions & 0 deletions ros_type_introspection/LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 facontidavide

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
65 changes: 65 additions & 0 deletions ros_type_introspection/README.md
@@ -0,0 +1,65 @@
# Ros Message Introspection
### "If you don't know why you need this library, probably you don't need it".

This simple library extracts information from a ROS Message, even when its
type is unknown at compilation time.

Have you ever wanted to build an app that can subscribe to __any__
`topic` and extract its content, or can read data from __any__ `rosbag`?
What if the topic and/or the bag contains user defined ROS types ignored
at compilation time?

The common solution in the ROS ecosystem is to use Python, that provides
the needed introspection. Tools, for instance, like __rqt_plot__ and __rqt_bag__
took this approach. This library implements a __C++ alternative__.

This library is particularly useful to extract data from two type-erasing classes
provided by ROS itself:

1. [topic_tools::ShapeShifter](http://docs.ros.org/diamondback/api/topic_tools/html/classtopic__tools_1_1ShapeShifter.html):
a type used to subscribe to any topic, regardless of the original type.

2. [rosbag::MessageInstance](http://docs.ros.org/diamondback/api/rosbag/html/c++/classrosbag_1_1MessageInstance.html):
the generic type commonly used to read data from a ROS bag.

# About version 1.X

Version 1.X has a completely new API; on the other hand, this implementatation is __3 times faster__ and much more flexible.
To convert old applications should be straighforward, though. Please take a look to the [examples](example)
and the unit tests to see how to update your code.


# Some background
The ROS Message Types can be described as
a [Interface Description Language](https://en.wikipedia.org/wiki/Interface_description_language).
This approach is very well known and commonly used on the web and in distributed systems in general.

A [rosmsg](http://wiki.ros.org/rosmsg) is defined by the user; an "IDL compiler", i.e.
[gencpp](http://wiki.ros.org/gencpp),
reads this schema and generates a header file that contains the source code that the user
shall include in his/her applications.
The inclusion of this header file is needed on both the publisher *and* the subscriber sides.

This approach provides strong and type-safe contracts between the producer and the consumer
of the message and, additionally, is needed to implements a fast
serialization / deserialization mechanism.

The only "problem" is that in very few use cases (for instance if you want to build
a plugin to [load ROS bags in MATLAB](https://github.com/bcharrow/matlab_rosbag))
you don't know in advance which ROS Messages you will need to read.
Therefore, you won't be able to include the necessary header files.

# Acknowledgements
This library is inspired by these other libraries
[matlab_rosbag](https://github.com/bcharrow/matlab_rosbag) and
[cpp_introspection](https://github.com/tu-darmstadt-ros-pkg/cpp_introspection).










0 comments on commit 9d7b541

Please sign in to comment.