Skip to content

Commit 6b10841

Browse files
sloretzwjwwood
authored andcommitted
Read only parameters (#495)
* in progress broken test_time_source Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * style Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * test undeclared params Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * Only get parameter if it is set Signed-off-by: Shane Loretz <sloretz@osrfoundation.org> * doc fixup Signed-off-by: William Woodall <william@osrfoundation.org> * use override rather than virtual in places Signed-off-by: William Woodall <william@osrfoundation.org> * rename ParameterInfo_t to ParameterInfo and just use struct, no typedef Signed-off-by: William Woodall <william@osrfoundation.org> * add method to access ParameterValue within a Parameter Signed-off-by: William Woodall <william@osrfoundation.org> * enable get<Parameter> and get<ParameterValue> on Parameter class Signed-off-by: William Woodall <william@osrfoundation.org> * avoid const pass by value Signed-off-by: William Woodall <william@osrfoundation.org> * match type of enum in C++ to type used in message definition Signed-off-by: William Woodall <william@osrfoundation.org> * fixup after rebase Signed-off-by: William Woodall <william@osrfoundation.org> * more fixup after rebase Signed-off-by: William Woodall <william@osrfoundation.org> * replace create_parameter with declare_parameter Signed-off-by: William Woodall <william@osrfoundation.org> * provide implementation for templated declare_parameter method Signed-off-by: William Woodall <william@osrfoundation.org> * style Signed-off-by: William Woodall <william@osrfoundation.org> * do not use const reference when it's a primitive (like bool) Signed-off-by: William Woodall <william@osrfoundation.org> * typo Signed-off-by: William Woodall <william@osrfoundation.org> * follow to bool change that wasn't staged Signed-off-by: William Woodall <william@osrfoundation.org> * fixup tests Signed-off-by: William Woodall <william@osrfoundation.org> * added lots of docs, alternative API signatures, and some of the tests Signed-off-by: William Woodall <william@osrfoundation.org> * more tests and associated fixes Signed-off-by: William Woodall <william@osrfoundation.org> * address documentation feedback Signed-off-by: William Woodall <william@osrfoundation.org> * fixup previously added tests Signed-off-by: William Woodall <william@osrfoundation.org> * add tests and fixes for describe_parameter(s) and get_parameter_types Signed-off-by: William Woodall <william@osrfoundation.org> * remove old parameter tests Signed-off-by: William Woodall <william@osrfoundation.org> * use const reference where possible Signed-off-by: William Woodall <william@osrfoundation.org> * address comments Signed-off-by: William Woodall <william@osrfoundation.org> * fix tests for deprecated methods Signed-off-by: William Woodall <william@osrfoundation.org> * address feedback Signed-off-by: William Woodall <william@osrfoundation.org> * significantly improve the reliability of the time_source tests Signed-off-by: William Woodall <william@osrfoundation.org> * uncrustify, cpplint, and cppcheck fixes Signed-off-by: William Woodall <william@osrfoundation.org> * Revert "significantly improve the reliability of the time_source tests" This reverts commit 3ef385d. Signed-off-by: William Woodall <william@osrfoundation.org> * only declare use_sim_time parameter if not already declared Signed-off-by: William Woodall <william@osrfoundation.org> * fixup rclcpp_lifecycle Signed-off-by: William Woodall <william@osrfoundation.org> * fixup tests Signed-off-by: William Woodall <william@osrfoundation.org> * add missing namespace scope which fails on Windows Signed-off-by: William Woodall <william@osrfoundation.org> * extend deprecation warning suppression to support Windows too Signed-off-by: William Woodall <william@osrfoundation.org> * fix compiler warnings and missing visibility macro Signed-off-by: William Woodall <william@osrfoundation.org> * remove commented left over tests Signed-off-by: William Woodall <william@osrfoundation.org> * fix compiler warning on Windows Signed-off-by: William Woodall <william@osrfoundation.org> * suppress deprecation warning on include of file in Windows Signed-off-by: William Woodall <william@osrfoundation.org> * avoid potential loss of data warning converting int64_t to int Signed-off-by: William Woodall <william@osrfoundation.org> * trying to fix more loss of data warnings Signed-off-by: William Woodall <william@osrfoundation.org> * fix test_node Signed-off-by: William Woodall <william@osrfoundation.org> * add option to automatically declare parameters from initial parameters (yaml file) Signed-off-by: William Woodall <william@osrfoundation.org> * remove redundant conditional Signed-off-by: William Woodall <william@osrfoundation.org>
1 parent 97ed34a commit 6b10841

22 files changed

+3064
-365
lines changed

rclcpp/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ if(BUILD_TESTING)
210210
)
211211
target_link_libraries(test_node_global_args ${PROJECT_NAME})
212212
endif()
213-
ament_add_gtest(test_node_initial_parameters test/test_node_initial_parameters.cpp)
214-
if(TARGET test_node_initial_parameters)
215-
target_link_libraries(test_node_initial_parameters ${PROJECT_NAME})
216-
endif()
217213
ament_add_gtest(test_parameter_events_filter test/test_parameter_events_filter.cpp)
218214
if(TARGET test_parameter_events_filter)
219215
ament_target_dependencies(test_parameter_events_filter

rclcpp/include/rclcpp/exceptions.hpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,35 @@ class EventNotRegisteredError : public std::runtime_error
185185
class InvalidParametersException : public std::runtime_error
186186
{
187187
public:
188-
// Inherit constructors from runtime_error;
188+
// Inherit constructors from runtime_error.
189189
using std::runtime_error::runtime_error;
190190
};
191191

192-
/// Throwing if passed parameter value is invalid.
192+
/// Thrown if passed parameter value is invalid.
193193
class InvalidParameterValueException : public std::runtime_error
194194
{
195-
// Inherit constructors from runtime_error;
195+
// Inherit constructors from runtime_error.
196+
using std::runtime_error::runtime_error;
197+
};
198+
199+
/// Thrown if parameter is already declared.
200+
class ParameterAlreadyDeclaredException : public std::runtime_error
201+
{
202+
// Inherit constructors from runtime_error.
203+
using std::runtime_error::runtime_error;
204+
};
205+
206+
/// Thrown if parameter is not declared, e.g. either set or get was called without first declaring.
207+
class ParameterNotDeclaredException : public std::runtime_error
208+
{
209+
// Inherit constructors from runtime_error.
210+
using std::runtime_error::runtime_error;
211+
};
212+
213+
/// Thrown if parameter is immutable and therefore cannot be undeclared.
214+
class ParameterImmutableException : public std::runtime_error
215+
{
216+
// Inherit constructors from runtime_error.
196217
using std::runtime_error::runtime_error;
197218
};
198219

0 commit comments

Comments
 (0)