Skip to content

Commit 0368426

Browse files
committed
Version bump to 0.2.3
* Version bump, linting, changelog Signed-off-by: Arne Nordmann <arne.nordmann@de.bosch.com>
1 parent 9fe4406 commit 0368426

6 files changed

Lines changed: 51 additions & 24 deletions

File tree

system_modes/changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
Changelog for package system_modes
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
0.2.3 (2020-02-13)
6+
-----------
7+
* improved StateAndMode struct
8+
* testing
9+
10+
0.2.2 (2020-07-13)
11+
-----------
12+
* introduced StateAndMode struct to bundle lifecycle state and system mode
13+
514
0.2.0 (2020-02-13)
615
-----------
716
* integration with ROS 2 launch

system_modes/include/system_modes/mode_impl.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,18 @@ struct StateAndMode
6161
return true;
6262
}
6363

64-
return (cmp.mode.compare(mode) == 0 || // same mode
64+
return cmp.mode.compare(mode) == 0 || // same mode
6565
(cmp.mode.compare(DEFAULT_MODE) == 0 && mode.empty()) || // we consider empty and
66-
(mode.compare(DEFAULT_MODE) == 0 && cmp.mode.empty())); // DEFAULT_MODE the same
66+
(mode.compare(DEFAULT_MODE) == 0 && cmp.mode.empty()); // DEFAULT_MODE the same
6767
}
6868

6969
bool operator!=(const StateAndMode & cmp) const
7070
{
7171
return !(*this == cmp);
7272
}
7373

74-
void from_string(const std::string & sam) {
74+
void from_string(const std::string & sam)
75+
{
7576
auto dot = sam.find(".");
7677
if (dot != std::string::npos) {
7778
state = state_id_(sam.substr(0, dot));
@@ -82,7 +83,8 @@ struct StateAndMode
8283
}
8384
}
8485

85-
std::string as_string() const {
86+
std::string as_string() const
87+
{
8688
if (state != State::PRIMARY_STATE_ACTIVE || mode.empty()) {
8789
return state_label_(state);
8890
}

system_modes/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>system_modes</name>
5-
<version>0.2.1</version>
5+
<version>0.2.3</version>
66
<description>Model-based distributed configuration handling.</description>
77
<maintainer email="arne.nordmann@bosch.com">Arne Nordmann</maintainer>
88
<license>Apache License 2.0</license>

system_modes/src/system_modes/mode_impl.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// limitations under the License.
1515
#include "system_modes/mode_impl.hpp"
1616

17+
#include <map>
1718
#include <string>
1819
#include <vector>
1920
#include <utility>
@@ -22,6 +23,7 @@
2223
#include <lifecycle_msgs/msg/state.hpp>
2324
#include <lifecycle_msgs/msg/transition.hpp>
2425

26+
using std::map;
2527
using std::pair;
2628
using std::mutex;
2729
using std::string;
@@ -117,9 +119,9 @@ ModeImpl::add_parameters(const vector<Parameter> & parameters)
117119
void
118120
ModeImpl::set_parameter(const Parameter & parameter)
119121
{
120-
std::string param_name = parameter.get_name();
122+
string param_name = parameter.get_name();
121123
std::size_t foundr = parameter.get_name().rfind("ros__parameters");
122-
if (foundr != std::string::npos) {
124+
if (foundr != string::npos) {
123125
param_name = parameter.get_name().substr(foundr + strlen("ros__parameters") + 1);
124126
}
125127

@@ -142,15 +144,15 @@ ModeImpl::set_parameters(const vector<Parameter> & parameters)
142144

143145
void
144146
ModeImpl::add_part_mode(
145-
const std::string & part,
147+
const string & part,
146148
const StateAndMode stateAndMode)
147149
{
148150
this->part_modes_[part] = StateAndMode(stateAndMode.state, stateAndMode.mode);
149151
}
150152

151153
void
152154
ModeImpl::set_part_mode(
153-
const std::string & part,
155+
const string & part,
154156
const StateAndMode stateAndMode)
155157
{
156158
if (this->part_modes_.find(part) == this->part_modes_.end()) {
@@ -162,7 +164,7 @@ ModeImpl::set_part_mode(
162164
this->add_part_mode(part, stateAndMode);
163165
}
164166

165-
const std::vector<std::string>
167+
const vector<string>
166168
ModeImpl::get_parts() const
167169
{
168170
vector<string> results;
@@ -173,19 +175,19 @@ ModeImpl::get_parts() const
173175
}
174176

175177
const StateAndMode
176-
ModeImpl::get_part_mode(const std::string & part) const
178+
ModeImpl::get_part_mode(const string & part) const
177179
{
178180
if (this->part_modes_.count(part)) {
179181
return this->part_modes_.at(part);
180182
} else {
181-
throw std::out_of_range(
183+
throw out_of_range(
182184
"Can't receive modes for part '" + part +
183185
"', part not specified.");
184186
}
185187
}
186188

187189
// TODO(anordman): Can we get this from the rcl default state machine?
188-
static const std::map<unsigned int, string> STATES_ = {
190+
static const map<unsigned int, string> STATES_ = {
189191
{State::PRIMARY_STATE_UNKNOWN, "unknown"},
190192
{State::PRIMARY_STATE_UNCONFIGURED, "unconfigured"},
191193
{State::PRIMARY_STATE_INACTIVE, "inactive"},
@@ -199,7 +201,7 @@ static const std::map<unsigned int, string> STATES_ = {
199201
{State::TRANSITION_STATE_ERRORPROCESSING, "errorprocessing"}
200202
};
201203

202-
static const std::map<unsigned int, string> TRANSITIONS_ = {
204+
static const map<unsigned int, string> TRANSITIONS_ = {
203205
{Transition::TRANSITION_CREATE, "create"},
204206
{Transition::TRANSITION_CONFIGURE, "configure"},
205207
{Transition::TRANSITION_CLEANUP, "cleanup"},
@@ -210,7 +212,7 @@ static const std::map<unsigned int, string> TRANSITIONS_ = {
210212
{Transition::TRANSITION_DESTROY, "destroy"}
211213
};
212214

213-
static const std::map<unsigned int, unsigned int> GOAL_STATES_ = {
215+
static const map<unsigned int, unsigned int> GOAL_STATES_ = {
214216
{Transition::TRANSITION_CREATE, State::PRIMARY_STATE_UNCONFIGURED},
215217
{Transition::TRANSITION_CONFIGURE, State::PRIMARY_STATE_INACTIVE},
216218
{Transition::TRANSITION_CLEANUP, State::PRIMARY_STATE_UNCONFIGURED},
@@ -220,7 +222,7 @@ static const std::map<unsigned int, unsigned int> GOAL_STATES_ = {
220222
{Transition::TRANSITION_ACTIVE_SHUTDOWN, State::PRIMARY_STATE_FINALIZED}
221223
};
222224

223-
const std::string
225+
const string
224226
state_label_(unsigned int state_id)
225227
{
226228
try {
@@ -231,7 +233,7 @@ state_label_(unsigned int state_id)
231233
}
232234

233235
unsigned int
234-
state_id_(const std::string & state_label)
236+
state_id_(const string & state_label)
235237
{
236238
for (auto id : STATES_) {
237239
if (id.second.compare(state_label) == 0) {
@@ -241,7 +243,7 @@ state_id_(const std::string & state_label)
241243
return 0;
242244
}
243245

244-
const std::string
246+
const string
245247
transition_label_(unsigned int transition_id)
246248
{
247249
try {
@@ -252,7 +254,7 @@ transition_label_(unsigned int transition_id)
252254
}
253255

254256
unsigned int
255-
transition_id_(const std::string & transition_label)
257+
transition_id_(const string & transition_label)
256258
{
257259
for (auto id : TRANSITIONS_) {
258260
if (id.second.compare(transition_label) == 0) {
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2-
Changelog for package system_modes_examples
3-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2+
Changelog for package system_modes
3+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
5+
0.2.3 (2020-02-13)
6+
-----------
7+
* improved StateAndMode struct
8+
* testing
9+
10+
0.2.2 (2020-07-13)
11+
-----------
12+
* introduced StateAndMode struct to bundle lifecycle state and system mode
413

514
0.2.0 (2020-02-13)
615
-----------
716
* integration with ROS 2 launch
17+
* updated docs
18+
19+
0.1.6 (2019-10-31)
20+
-------------------
21+
* fixed QoS configuration for parameter event subscribers
822

923
0.1.5 (2019-10-21)
1024
-------------------
@@ -16,4 +30,4 @@ Changelog for package system_modes_examples
1630

1731
0.1.1 (2019-03-08)
1832
-------------------
19-
* first public release for ROS 2 system modes examples
33+
* first public release for ROS 2 system modes

system_modes_examples/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>system_modes_examples</name>
5-
<version>0.2.1</version>
5+
<version>0.2.3</version>
66
<description>Simple example system for system_modes package.</description>
77
<maintainer email="arne.nordmann@bosch.com">Arne Nordmann</maintainer>
88
<license>Apache License 2.0</license>

0 commit comments

Comments
 (0)