Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: All
SortIncludes: false
SpaceBeforeParens: ControlStatements

Macros:
- MRS_LIB_INTERNAL_INLINE_API_V1=inline
- MRS_LIB_INTERNAL_INLINE_API_V2=inline
...
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ target_sources(mrs_lib_mrs_lib
"include/mrs_lib/impl/ukf.hpp"
# include/mrs_lib/internal
"include/mrs_lib/internal/coroutine_callback_helpers.hpp"
"include/mrs_lib/internal/version_macros.hpp"
# include/mrs_lib/safety_zone
"include/mrs_lib/safety_zone/line_operations.h"
"include/mrs_lib/safety_zone/polygon.h"
Expand Down Expand Up @@ -211,7 +212,7 @@ target_link_libraries(mrs_lib_mrs_lib
# Dynamic param manager tests

add_executable(dynparam_tests
src/dynparam_mgr/dynparam_tests.cpp
examples/dynparam_mgr/dynparam_tests.cpp
)

target_link_libraries(dynparam_tests
Expand All @@ -224,7 +225,7 @@ target_link_libraries(dynparam_tests

# TODO why is it built from all these different files?
add_executable(subscribe_handler_example
src/subscriber_handler/example.cpp
examples/subscriber_handler/example.cpp
src/timeout_manager/timeout_manager.cpp
src/timer_handler/timer_handler.cpp
)
Expand Down
8 changes: 5 additions & 3 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2330,15 +2330,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2371,7 +2371,9 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = \
"MRS_LIB_INTERNAL_INLINE_API_V1=" \
"MRS_LIB_INTERNAL_INLINE_API_V2="

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 7 additions & 6 deletions include/mrs_lib/attitude_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>

#include <mrs_lib/geometry/misc.h>
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

// type of the object we are grasping
Expand Down Expand Up @@ -507,28 +508,28 @@ namespace mrs_lib
}
}

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

template <>
struct std::tuple_size<mrs_lib::AttitudeConverter>
struct std::tuple_size<mrs_lib::v1::AttitudeConverter>
{
static constexpr int value = 3;
};

template <>
struct std::tuple_element<0, mrs_lib::AttitudeConverter>
struct std::tuple_element<0, mrs_lib::v1::AttitudeConverter>
{
using type = double;
};

template <>
struct std::tuple_element<1, mrs_lib::AttitudeConverter>
struct std::tuple_element<1, mrs_lib::v1::AttitudeConverter>
{
using type = double;
};

template <>
struct std::tuple_element<2, mrs_lib::AttitudeConverter>
struct std::tuple_element<2, mrs_lib::v1::AttitudeConverter>
{
using type = double;
};
Expand Down
5 changes: 3 additions & 2 deletions include/mrs_lib/batch_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#include <mrs_msgs/msg/trajectory_reference.hpp>
#include <mrs_lib/visual_object.h>
#include <set>
#include <mrs_lib/internal/version_macros.hpp>

#define DEFAULT_ELLIPSE_POINTS 64

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

/**
Expand Down Expand Up @@ -263,6 +264,6 @@ namespace mrs_lib
unsigned long uuid = 0; // create unique ID for items in object buffer
};

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

#include <coroutine>

namespace mrs_lib::internal
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V2 v2::internal
{

// This is a workaround to GCC generated code overflowing stack when using symmetric transfer
Expand Down Expand Up @@ -39,7 +41,14 @@ namespace mrs_lib::internal
}
};

} // namespace mrs_lib::internal
} // namespace mrs_lib::inline v2::internal

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1::internal
{

// Backport resume_coroutine to v1 interfaces
using ::mrs_lib::v2::internal::resume_coroutine;

} // namespace mrs_lib::inline v1::internal

#endif // MRS_LIB_CORO_INTERNAL_THREAD_LOCAL_CONTINUATION_SCHEDULER_HPP_
14 changes: 12 additions & 2 deletions include/mrs_lib/coro/runners.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#include <mrs_lib/coro/internal/thread_local_continuation_scheduler.hpp>
#include <mrs_lib/coro/task.hpp>
#include <mrs_lib/internal/version_macros.hpp>


namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V2 v2
{

namespace internal
Expand Down Expand Up @@ -87,6 +88,15 @@ namespace mrs_lib

} // namespace internal

} // namespace mrs_lib
} // namespace mrs_lib::inline v2

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1::internal
{

// Backport start_task to v1 interfaces
using ::mrs_lib::v2::internal::start_task;

} // namespace mrs_lib::inline v1::internal


#endif // MRS_LIB_CORO_RUNNERS_HPP_
13 changes: 11 additions & 2 deletions include/mrs_lib/coro/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <utility>

#include <mrs_lib/coro/internal/attributes.hpp>
#include <mrs_lib/internal/version_macros.hpp>

// Note on ownership semantics:
// Since we want to support cancellation at any point in the coroutine stacks,
Expand All @@ -18,7 +19,7 @@
// either suspend and become continuation of some other task thus transferring
// ownership or destruct itself once completed.

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V2 v2
{

template <typename T = void>
Expand Down Expand Up @@ -335,7 +336,15 @@ namespace mrs_lib
friend class internal::PromiseType<T>;
};

} // namespace mrs_lib
} // namespace mrs_lib::inline v2

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

// Backport Task to v1 interfaces
using ::mrs_lib::v2::Task;

} // namespace mrs_lib::inline v1

#ifndef MRS_LIB_CORO_TASK_IMPL_HPP_
#include <mrs_lib/coro/task.impl.hpp> // IWYU pragma: export
Expand Down
5 changes: 3 additions & 2 deletions include/mrs_lib/coro/task.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

#include <mrs_lib/coro/internal/thread_local_continuation_scheduler.hpp>
#include <mrs_lib/coro/task.hpp>
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V2 v2
{
namespace internal
{
Expand Down Expand Up @@ -79,7 +80,7 @@ namespace mrs_lib
}

} // namespace internal
} // namespace mrs_lib
} // namespace mrs_lib::inline v2


#endif // MRS_LIB_CORO_TASK_IMPL_HPP_
5 changes: 3 additions & 2 deletions include/mrs_lib/dkf.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

#include <mrs_lib/lkf.h>
#include <mrs_lib/geometry/misc.h>
#include <mrs_lib/internal/version_macros.hpp>
#include <iostream>

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

/* class DKF //{ */
Expand Down Expand Up @@ -156,6 +157,6 @@ namespace mrs_lib
};
//}

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif // DKF_H
5 changes: 3 additions & 2 deletions include/mrs_lib/dynparam_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

#include <rclcpp/rclcpp.hpp>
#include <mrs_lib/param_provider.h>
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

/**
Expand Down Expand Up @@ -168,6 +169,6 @@ namespace mrs_lib
std::vector<registered_param_t> m_registered_params;
};

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#include <mrs_lib/impl/dynparam_mgr.hpp>
5 changes: 3 additions & 2 deletions include/mrs_lib/geometry/conversions_eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
#include <geometry_msgs/msg/vector3.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/vector3.h>
#include <mrs_lib/internal/version_macros.hpp>

#include <Eigen/Dense>
#include <Eigen/Geometry>

namespace mrs_lib
namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{
namespace geometry
{
Expand All @@ -33,6 +34,6 @@ namespace mrs_lib
//}

} // namespace geometry
} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif // GEOMETRY_CONVERSIONS_EIGEN_H
6 changes: 4 additions & 2 deletions include/mrs_lib/geometry/cyclic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <cmath>
#include <ostream>

namespace mrs_lib
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{
namespace geometry
{
Expand Down Expand Up @@ -523,6 +525,6 @@ namespace mrs_lib
static constexpr double supremum = 180;
};
} // namespace geometry
} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif // CYCLIC_H
6 changes: 4 additions & 2 deletions include/mrs_lib/geometry/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include <geometry_msgs/msg/point.h>
#include <geometry_msgs/msg/quaternion.h>

namespace mrs_lib
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{
namespace geometry
{
Expand Down Expand Up @@ -319,6 +321,6 @@ namespace mrs_lib
//}

} // namespace geometry
} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif
6 changes: 4 additions & 2 deletions include/mrs_lib/geometry/shapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

#include <Eigen/Dense>

namespace mrs_lib
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{
namespace geometry
{
Expand Down Expand Up @@ -654,6 +656,6 @@ namespace mrs_lib
};
//}
} // namespace geometry
} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif // SHAPES_H
6 changes: 4 additions & 2 deletions include/mrs_lib/gps_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <cstdlib>
#include <string>

namespace mrs_lib
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

const double RADIANS_PER_DEGREE = M_PI / 180.0;
Expand Down Expand Up @@ -313,6 +315,6 @@ namespace mrs_lib
UTMtoLL(UTMNorthing, UTMEasting, UTMZone.c_str(), Lat, Long);
}

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif // _UTM_H
6 changes: 4 additions & 2 deletions include/mrs_lib/iir_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include <vector>

namespace mrs_lib
#include <mrs_lib/internal/version_macros.hpp>

namespace mrs_lib::MRS_LIB_INTERNAL_INLINE_API_V1 v1
{

class IirFilter
Expand Down Expand Up @@ -34,6 +36,6 @@ namespace mrs_lib
std::vector<double> buffer_;
};

} // namespace mrs_lib
} // namespace mrs_lib::inline v1

#endif
Loading
Loading