44 #define M_PI 3.14159265358979323846
47 #define RAD2DEG 180/M_PI
48 #define DEG2RAD M_PI/180
64 locThread->getCurrentLoc(loc);
69 for (
int i = 0; i < 10; i++)
71 yarp::dev::Map2DLocation newloc=loc;
73 std::default_random_engine generator(seed);
74 std::uniform_real_distribution<double> dist(-1, 1);
75 std::uniform_real_distribution<double> dist_t(-180, 180);
76 double numberx = dist(generator);
77 double numbery = dist(generator);
78 double numbert = dist_t(generator);
81 newloc.theta += numbert;
82 poses.push_back(newloc);
90 locThread->getCurrentLoc(loc);
96 locThread->initializeLocalization(loc);
102 locThread->getCurrentLoc(loc);
108 locThread->initializeLocalization(loc);
115 locThread->getCurrentLoc(loc);
145 std::lock_guard<std::mutex> lock(
m_mutex);
171 yCWarning(FAKELOCALIZER) <<
"No localization data received for more than 0.1s!";
177 yCInfo(FAKELOCALIZER) <<
"Localization init request: (" << loc.
map_id <<
")";
178 std::lock_guard<std::mutex> lock(
m_mutex);
201 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
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.
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
An interface for the device drivers.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
An interface to the operating system, including Port based communication.