8#ifndef VisionRobots_DEFINED
9#define VisionRobots_DEFINED
11#include <SimpleShapes.h>
62 size_t n =
static_cast<size_t>(-5);
63 std::string command =
"ROBOT";
64 std::transform(s.begin(), s.end(), s.begin(), ::toupper);
65 while(n!=std::string::npos) {
66 n = s.find(command, n+5);
67 if (n!=std::string::npos) {
68 std::string t = s.substr(n+command.length()+1);
71 if(s.substr(n-3, 3).find(
"TOP") != std::string::npos)
76 std::vector<std::string> com = components_of_string_separated(t,
'(');
77 GUPoint<int16_t> _topLeft(com.at(2).c_str());
78 GUPoint<int16_t> _bottomRight(com.at(3).c_str());
80 robotInfo.set_topLeft_X(_topLeft.x);
81 robotInfo.set_topLeft_Y(_topLeft.y);
83 robotInfo.set_bottomRight_X(_bottomRight.x);
84 robotInfo.set_bottomRight_Y(_bottomRight.y);
97 topRobots[topCntr] = robotInfo;
98 topRobots[topCntr++].set_visible(
true);
101 bottomRobots[bottomCntr] = robotInfo;
102 bottomRobots[bottomCntr++].set_visible(
true);
117 return topRobots[idx];
122 return bottomRobots[idx];
137 return topRobots[idx];
142 return bottomRobots[idx];
150 topCntr = bottomCntr = 0;
153 topRobots[i].set_visible(
false);
157 bottomRobots[i].set_visible(
false);
182 std::stringstream result;
184 for (uint32_t i = 0; i < topCntr; i++) {
185 result <<
"TopRobot:("
186 << topRobots[i].topLeft_X() <<
"," << topRobots[i].topLeft_Y() <<
")("
187 << topRobots[i].bottomRight_X() <<
"," << topRobots[i].bottomRight_Y() <<
") ";
189 for (uint32_t i = 0; i < bottomCntr; i++) {
190 result <<
"BottomRobot:("
191 << bottomRobots[i].topLeft_X() <<
"," << bottomRobots[i].topLeft_Y() <<
")("
192 << bottomRobots[i].bottomRight_X() <<
"," << bottomRobots[i].bottomRight_Y() <<
") ";
Class to post information about Robot posts detected from vision This class contains information the ...
VisionRobots()
Default Constructor.
void setRobot(wb_robot robotInfo, VisionCamera camera)
Add a the Robot to this VisionRobot message.
VisionRobots(std::string s)
String Constructor Converts a serialized string to a VisionRobot object.
void setFrameNumber(size_t fn)
Sets the frame number this information in this message was observed.
void Reset()
Reset the visible flag for all four different posts to false.
void from_string(std::string &s)
wb_robot & robots(VisionCamera camera, int idx)
Get the current Robots for this message.
std::string description()
Converts this message into a serialized string.
const wb_robot & robots(VisionCamera camera, int idx) const
Get the current Robots for this message.
size_t frameNumber() const
Get the frame number the information in this message was observed.
Whiteboard structure for robot coordinates X and Y coordinates are posted as seen in the image X rang...
VisionCamera
Enum of available camera's that can be used by vision.
@ Bottom
Bottom Camera on the nao.
@ Top
Top Camera on the nao.