#include <speed_observer.h>
|
static double | speedFromTwoPoses (const tf2::Vector3 &a, const tf2::Vector3 &b, const double &t) |
| Calculate the minimal speed that a trajectory between two poses had if the motion was performed within a given time. More...
|
|
Definition at line 37 of file speed_observer.h.
prbt_hardware_support::SpeedObserver::SpeedObserver |
( |
ros::NodeHandle & |
nh, |
|
|
std::string & |
reference_frame, |
|
|
std::vector< std::string > & |
frames_to_observe |
|
) |
| |
Create an observer to observe the speed of a list of frames in reference to a reference frame.
- Parameters
-
nh | NodeHandle to handle node |
reference_frame | Reference frame for all transformations |
frames_to_observe | List of frames to observer |
Definition at line 33 of file speed_observer.cpp.
FrameSpeeds prbt_hardware_support::SpeedObserver::createFrameSpeedsMessage |
( |
const std::map< std::string, double > & |
speeds | ) |
const |
|
private |
Creates a message to be sent to the 'frame_speeds' topic.
- Parameters
-
speeds | Vector containing one speed per observed frame |
- Returns
- The message
Definition at line 162 of file speed_observer.cpp.
std::pair< tf2::Vector3, ros::Time > prbt_hardware_support::SpeedObserver::getLatestPose |
( |
const std::string & |
frame | ) |
const |
|
private |
Using tf to get the latest Pose of a frame as tf::Vector3
.
- Note
- Reference frame is always
reference_frame_
- Parameters
-
frame | Which frame should be transformed |
- Returns
- The pose as Vector and the time stamp
Definition at line 68 of file speed_observer.cpp.
bool prbt_hardware_support::SpeedObserver::isWithinLimit |
( |
const double & |
speed | ) |
const |
|
inlineprivate |
Check if a speed value is within the currently set limit.
- Note
- Needed for unittest
- Parameters
-
- Returns
- True iff speed is within limit
Definition at line 161 of file speed_observer.h.
bool prbt_hardware_support::SpeedObserver::setSpeedLimitCb |
( |
SetSpeedLimit::Request & |
req, |
|
|
SetSpeedLimit::Response & |
res |
|
) |
| |
Callback for service to set the currently active speed limit.
- Parameters
-
req | Service request |
res | Service response |
- Returns
- True if the limit was set succesfully
Definition at line 193 of file speed_observer.cpp.
double prbt_hardware_support::SpeedObserver::speedFromTwoPoses |
( |
const tf2::Vector3 & |
a, |
|
|
const tf2::Vector3 & |
b, |
|
|
const double & |
t |
|
) |
| |
|
inlinestaticprivate |
Calculate the minimal speed that a trajectory between two poses had if the motion was performed within a given time.
- Parameters
-
a | Pose at the beginning of the trajectory |
b | Pose at the end of the trajectory |
t | The time the motion took |
- Returns
- The minimal speed for the trajectory
Definition at line 154 of file speed_observer.h.
Starts the observation cycle. The function blocks until ros shuts down.
- Parameters
-
frequency | [Hz] Will check all frame once per cycle |
allowed_missed_calculations | Number of iterations that can have outdated tf data before a Stop1 is triggered. |
Definition at line 79 of file speed_observer.cpp.
void prbt_hardware_support::SpeedObserver::terminateNow |
( |
| ) |
|
|
inline |
void prbt_hardware_support::SpeedObserver::triggerStop1 |
( |
| ) |
|
|
private |
Used to trigger stop of the robot when speed limit is exceeded.
Definition at line 177 of file speed_observer.cpp.
void prbt_hardware_support::SpeedObserver::waitUntillCanTransform |
( |
const std::string & |
frame, |
|
|
const ros::Time & |
time, |
|
|
const unsigned short int |
max_num_retries = 10 |
|
) |
| const |
|
private |
Helper method waiting until TF transformation is available.
- Note
- Refernce frame is always
reference_frame_
- Parameters
-
frame | Which fram should be transformed |
time | At what time is the transfomration needed |
max_num_retries | How many times should the method wait for WAITING_TIME_FOR_TRANSFORM_S seconds |
Definition at line 42 of file speed_observer.cpp.
constexpr uint32_t prbt_hardware_support::SpeedObserver::DEFAULT_QUEUE_SIZE { 10 } |
|
staticprivate |
constexpr double prbt_hardware_support::SpeedObserver::DEFAULT_SPEED_LIMIT { .25 } |
|
staticprivate |
ros::Publisher prbt_hardware_support::SpeedObserver::frame_speeds_pub_ |
|
private |
const std::vector<std::string> prbt_hardware_support::SpeedObserver::frames_to_observe_ |
|
private |
std::map<std::string, unsigned int> prbt_hardware_support::SpeedObserver::missed_calculations_ |
|
private |
Map to store the number of successive missed frame transform calculations.
Definition at line 139 of file speed_observer.h.
const std::string prbt_hardware_support::SpeedObserver::reference_frame_ |
|
private |
std::atomic_bool prbt_hardware_support::SpeedObserver::terminate_ { false } |
|
private |
constexpr double prbt_hardware_support::SpeedObserver::TIME_INTERVAL_EPSILON_S { 1e-9 } |
|
staticprivate |
Epsilon prevents computation of speed for small time intervals.
Definition at line 149 of file speed_observer.h.
constexpr double prbt_hardware_support::SpeedObserver::WAITING_TIME_FOR_TRANSFORM_S { 0.1 } |
|
staticprivate |
The documentation for this class was generated from the following files: