Pose.hpp
Go to the documentation of this file.
1 // Copyright (C) 2021 COGIP Robotics association <cogip35@gmail.com>
2 // This file is subject to the terms and conditions of the GNU Lesser
3 // General Public License v2.1. See the file LICENSE in the top level
4 // directory for more details.
5 
11 
12 #pragma once
13 
14 #include "cogip_defs/Pose.hpp"
15 #include "utils.hpp"
16 
17 #include "PB_PathPose.hpp"
18 
19 namespace cogip {
20 
21 namespace path {
22 
24 class Pose : public cogip_defs::Pose {
25 public:
27  Pose(
28  double x=0.0,
29  double y=0.0,
30  double O=0.0,
31  double max_speed_ratio_linear=0.0,
32  double max_speed_ratio_angular=0.0,
33  bool allow_reverse=true,
34  bool bypass_antiblocking=false,
35  uint32_t timeout_ms=0,
36  bool bypass_final_orientation=false
37  );
38 
40  virtual ~Pose() {};
41 
43  virtual double max_speed_ratio_linear() const { return max_speed_ratio_linear_; };
44 
46  virtual double max_speed_ratio_angular() const { return max_speed_ratio_angular_; };
47 
49  virtual bool allow_reverse() const { return allow_reverse_; };
50 
52  virtual void set_allow_reverse(
53  bool enable
54  ) { allow_reverse_ = enable; };
55 
57  virtual bool bypass_anti_blocking() const { return bypass_anti_blocking_; }
58 
60  virtual uint32_t timeout_ms() const { return timeout_ms_; }
61 
63  virtual bool bypass_final_orientation() const { return bypass_final_orientation_; }
64 
66  void pb_read(
67  const PB_PathPose &path_pose
68  );
69 
71  void pb_copy(
72  PB_PathPose &path_pose
73  ) const;
74 
76  bool operator==(const Pose& other) {
77  return (
78  areDoublesEqual(x(), other.x()) &&
79  areDoublesEqual(y(), other.y()) &&
80  areDoublesEqual(O(), other.O()) &&
81  areDoublesEqual(max_speed_ratio_linear(), other.max_speed_ratio_linear()) &&
82  areDoublesEqual(max_speed_ratio_angular(), other.max_speed_ratio_angular()) &&
83  allow_reverse() == other.allow_reverse() &&
85  timeout_ms() == other.timeout_ms() &&
87  );
88  };
89 
90 private:
91  double max_speed_ratio_linear_;
92  double max_speed_ratio_angular_;
93  bool allow_reverse_;
94  bool bypass_anti_blocking_;
95  uint32_t timeout_ms_;
96  bool bypass_final_orientation_;
97 };
98 
99 } // namespace path
100 
101 } // namespace cogip
102 
cogip::path::Pose::~Pose
virtual ~Pose()
Destructor.
Definition: Pose.hpp:40
cogip::cogip_defs::Coords::y
double y(void) const
Return Y coordinate.
Definition: Coords.hpp:36
cogip::path::Pose::max_speed_ratio_angular
virtual double max_speed_ratio_angular() const
Return max speed angular.
Definition: Pose.hpp:46
cogip::path::Pose::timeout_ms
virtual uint32_t timeout_ms() const
Return timeout to reach the pose, 0 if timeout should be disabled.
Definition: Pose.hpp:60
cogip::path::Pose::set_allow_reverse
virtual void set_allow_reverse(bool enable)
Enable or disable reverse mode.
Definition: Pose.hpp:52
cogip::path::Pose
Position class as used in Path.
Definition: Pose.hpp:24
cogip::path::Pose::operator==
bool operator==(const Pose &other)
Override operator ==.
Definition: Pose.hpp:76
cogip
Differential drive controller.
Definition: Coords.hpp:16
cogip::path::Pose::allow_reverse
virtual bool allow_reverse() const
Is reverse mode allowed or not.
Definition: Pose.hpp:49
cogip::cogip_defs::Pose
A robot position.
Definition: Pose.hpp:24
cogip::path::Pose::pb_read
void pb_read(const PB_PathPose &path_pose)
Initialize the object from a Protobuf message.
cogip::path::Pose::bypass_anti_blocking
virtual bool bypass_anti_blocking() const
Return true if anti blocking should be bypassed.
Definition: Pose.hpp:57
cogip::path::Pose::pb_copy
void pb_copy(PB_PathPose &path_pose) const
Copy object to a Probobuf message.
cogip::path::Pose::bypass_final_orientation
virtual bool bypass_final_orientation() const
Return true if final orientation should be bypassed.
Definition: Pose.hpp:63
cogip::cogip_defs::Pose::O
double O(void) const
Return 0-orientation.
Definition: Pose.hpp:45
cogip::path::Pose::max_speed_ratio_linear
virtual double max_speed_ratio_linear() const
Return max speed linear.
Definition: Pose.hpp:43
cogip::path::Pose::Pose
Pose(double x=0.0, double y=0.0, double O=0.0, double max_speed_ratio_linear=0.0, double max_speed_ratio_angular=0.0, bool allow_reverse=true, bool bypass_antiblocking=false, uint32_t timeout_ms=0, bool bypass_final_orientation=false)
Constuctor.
cogip::cogip_defs::Coords::x
double x(void) const
Return X coordinate.
Definition: Coords.hpp:33
Pose.hpp
Pose class declaration.