30#define M_PI 3.14159265358979323846
33#define RAD2DEG 180/M_PI
34#define DEG2RAD M_PI/180
55 for (
int i = 0; i < 10; i++)
57 yarp::dev::Map2DLocation newloc=loc;
59 std::default_random_engine generator(seed);
60 std::uniform_real_distribution<double> dist(-1, 1);
61 std::uniform_real_distribution<double> dist_t(-180, 180);
62 double numberx = dist(generator);
63 double numbery = dist(generator);
64 double numbert = dist_t(generator);
67 newloc.theta += numbert;
68 poses.push_back(newloc);
131 std::lock_guard<std::mutex> lock(
m_mutex);
160 yCWarning(FAKELOCALIZER) <<
"No localization data received for more than 0.1s!";
166 yCInfo(FAKELOCALIZER) <<
"Localization init request: (" << loc.
map_id <<
")";
167 std::lock_guard<std::mutex> lock(
m_mutex);
190 std::lock_guard<std::mutex> lock(
m_mutex);
197 std::lock_guard<std::mutex> lock(
m_mutex);
define control board standard interfaces
contains the definition of a Vector type
virtual void run() override
Loop function.
yarp::dev::Nav2D::Map2DLocation m_current_loc
virtual bool threadInit() override
Initialization method.
yarp::dev::Nav2D::Map2DLocation m_current_odom
bool getCurrentLoc(yarp::dev::Nav2D::Map2DLocation &loc)
yarp::dev::Nav2D::Map2DLocation m_initial_loc
virtual void threadRelease() override
Release method.
double m_last_statistics_printed
fakeLocalizerThread(double _period, yarp::os::Searchable &_cfg)
bool initializeLocalization(const yarp::dev::Nav2D::Map2DLocation &loc)
yarp::dev::Nav2D::Map2DLocation m_initial_odom
double m_last_locdata_received
virtual bool startLocalizationService() override
Starts the localization service.
virtual bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the current position of the robot w.r.t world reference frame.
bool setInitialPose(const yarp::dev::Nav2D::Map2DLocation &loc) override
Sets the initial pose for the localization algorithm which estimates the current position of the robo...
virtual bool getEstimatedOdometry(yarp::dev::OdometryData &odom) override
Gets the estimated odometry the robot, including its velocity expressed in the world and in the local...
virtual bool close() override
Close the DeviceDriver.
virtual bool stopLocalizationService() override
Stops the localization service.
bool getEstimatedPoses(std::vector< yarp::dev::Nav2D::Map2DLocation > &poses) override
Gets a set of pose estimates computed by the localization algorithm.
bool getLocalizationStatus(yarp::dev::Nav2D::LocalizationStatusEnum &status) override
Gets the current status of the localization task.
fakeLocalizerThread * locThread
std::string map_id
name of the map
double theta
orientation [deg] in the map reference frame
double y
y position of the location [m], expressed in the map reference frame
double x
x position of the location [m], expressed in the map reference frame
double odom_x
position of the robot [m], expressed in the world reference frame
double odom_y
position of the robot [m], expressed in the world reference frame
double odom_theta
orientation the robot [deg], expressed in the world reference frame
An abstraction for a periodic thread.
bool start()
Call this to start the thread.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
const Matrix & eye()
Build an identity matrix, don't resize.
T * data()
Return a pointer to the first element of the vector.
#define yCInfo(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
@ localization_status_localized_ok
For streams capable of holding different kinds of content, check what they actually have.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
An interface to the operating system, including Port based communication.