Skip to content
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Release Versions
- [6.3.0](#630)
- [6.2.0](#620)

## Upcoming changes

- fix: raise exception when accessing an empty parameter value in python (#260)

## 9.3.1

Version 9.3.1 is a patch that introduces a reference frame compatibility check in the inverse kinematics functions of
Expand Down
3 changes: 3 additions & 0 deletions python/source/common/parameter_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <state_representation/exceptions/InvalidCastException.hpp>
#include <state_representation/exceptions/InvalidParameterException.hpp>
#include <state_representation/exceptions/EmptyStateException.hpp>
#include <state_representation/space/cartesian/CartesianState.hpp>
#include <state_representation/space/cartesian/CartesianPose.hpp>
#include <state_representation/space/joint/JointState.hpp>
Expand Down Expand Up @@ -116,6 +117,8 @@ void ParameterContainer::set_value(py::object value) {
}

py::object ParameterContainer::get_value() const {
this->assert_not_empty();

try {
switch (this->get_parameter_type()) {
case ParameterType::INT:
Expand Down
4 changes: 4 additions & 0 deletions python/test/state_representation/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def test_parameter_construction(name, value, parameter_type, state_type, test_fu
assert param.get_parameter_state_type() == state_type
assert param.is_empty()
assert not param
with pytest.raises(sr.exceptions.EmptyStateError):
param.get_value()

new_param = sr.Parameter(param)
assert new_param.is_empty()
Expand All @@ -69,6 +71,8 @@ def test_parameter_construction(name, value, parameter_type, state_type, test_fu

param.reset()
assert param.is_empty()
with pytest.raises(sr.exceptions.EmptyStateError):
param.get_value()


def param_map_equal(param_dict, param_map):
Expand Down