roboligo
Loading...
Searching...
No Matches
RobotState.hpp
Go to the documentation of this file.
1// Copyright 2026 Juan S. Cely G.
2
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6
7// https://www.apache.org/licenses/LICENSE-2.0
8
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef ROBOLIGO_COMMON__ROBOT_HPP_
16#define ROBOLIGO_COMMON__ROBOT_HPP_
17
18#include <memory>
19#include <string>
20
21#include "rclcpp/rclcpp.hpp"
22
27
30
33
34namespace roboligo
35{
45 {
46 public:
50 RobotState() = default;
51
55 virtual ~RobotState() = default;
56
61 std::string get_name(void);
62
67 void set_name(std::string new_name);
68
73 void set_modes(std::vector<Mode> modes);
74
79 void set_triggers(std::vector<Trigger> triggers);
80
85 std::vector<Mode> get_modes(void);
86
91 std::vector<Trigger> get_triggers(void);
92
98 Trigger* get_trigger(const std::string & trigger_name);
99
105 Mode* get_mode(const std::string & mode_name);
106
111 bool is_available(void);
112
117 void set_available(bool new_state);
118
123 bool is_simulation(void);
124
129 void set_simulation(bool new_state);
130
135 bool is_stamped(void);
136
141 void set_stamp(bool new_state);
142
147 std::string show_triggers(void);
148
153 std::string show_modes(void);
154
158 void show(void);
159
160 std::shared_ptr<roboligo::Imu> imu = std::make_shared<roboligo::Imu>(
161 "imu", "imu_topic");
162
163 std::shared_ptr<roboligo::NavSat> gps = std::make_shared<roboligo::NavSat>(
164 "gps", "gps_topic");
165
166 std::shared_ptr<roboligo::Battery> battery = std::make_shared<roboligo::Battery>(
167 "battery", "battery_topic");
168
169 std::shared_ptr<roboligo::Odom> odom = std::make_shared<roboligo::Odom>(
170 "odom", "odom_topic");
171
172 std::shared_ptr<roboligo::Output> output = std::make_shared<roboligo::Output>(
173 "output", "output_topic");
174
175 std::shared_ptr<roboligo::Input> input = std::make_shared<roboligo::Input>(
176 "input", "input_topic");
177
178 std::shared_ptr<roboligo::Output> position_target = std::make_shared<roboligo::Output>(
179 "position_target", "output_topic");
180
181 private:
182
183 std::string name_{"default_robot"};
184
185 bool simulation_{false};
186
187 std::vector<Mode> modes_;
188
189 std::vector<Trigger> triggers_;
190
191 bool available_{false};
192
193 bool stamped_{false};
194
195 };
196}
197
198#endif // ROBOLIGO_COMMON__ROBOT_HPP_
Represents a configurable mode with name, value, and active status.
Definition Mode.hpp:31
std::vector< Trigger > get_triggers(void)
Gets all available triggers.
Definition RobotState.cpp:63
void set_stamp(bool new_state)
Enables or disables time stamping.
Definition RobotState.cpp:111
bool is_stamped(void)
Checks if the robot uses time stamping.
Definition RobotState.cpp:105
std::shared_ptr< roboligo::Battery > battery
Battery status monitor component.
Definition RobotState.hpp:166
Trigger * get_trigger(const std::string &trigger_name)
Retrieves a trigger by name.
Definition RobotState.cpp:70
std::shared_ptr< roboligo::Output > position_target
Position target output component.
Definition RobotState.hpp:178
bool is_available(void)
Checks if the robot is available.
Definition RobotState.cpp:81
std::string show_triggers(void)
Returns a string representation of all triggers.
Definition RobotState.cpp:117
std::vector< Mode > get_modes(void)
Gets all available modes.
Definition RobotState.cpp:39
std::shared_ptr< roboligo::Input > input
Input sensor component.
Definition RobotState.hpp:175
virtual ~RobotState()=default
Virtual destructor.
std::shared_ptr< roboligo::Odom > odom
Odometry sensor component.
Definition RobotState.hpp:169
std::shared_ptr< roboligo::Output > output
Output actuator component.
Definition RobotState.hpp:172
void set_modes(std::vector< Mode > modes)
Sets the available operational modes.
Definition RobotState.cpp:33
void set_name(std::string new_name)
Sets the robot name.
Definition RobotState.cpp:27
void set_available(bool new_state)
Sets the robot availability status.
Definition RobotState.cpp:87
std::shared_ptr< roboligo::Imu > imu
Inertial Measurement Unit sensor component.
Definition RobotState.hpp:160
RobotState()=default
Default constructor.
bool is_simulation(void)
Checks if the robot is in simulation mode.
Definition RobotState.cpp:93
std::string show_modes(void)
Returns a string representation of all modes.
Definition RobotState.cpp:128
void set_simulation(bool new_state)
Sets the simulation mode status.
Definition RobotState.cpp:99
void set_triggers(std::vector< Trigger > triggers)
Sets the available triggers.
Definition RobotState.cpp:57
std::shared_ptr< roboligo::NavSat > gps
Global Navigation Satellite System (GPS) sensor.
Definition RobotState.hpp:163
void show(void)
Displays complete robot state information.
Definition RobotState.cpp:138
Mode * get_mode(const std::string &mode_name)
Retrieves a mode by name.
Definition RobotState.cpp:46
std::string get_name(void)
Gets the robot name.
Definition RobotState.cpp:21
Represents a trigger that can transition between different modes in a state machine.
Definition Trigger.hpp:36
Definition ClassificationBase.hpp:28