6#define _USE_MATH_DEFINES
35#define DEFAULT_THREAD_PERIOD 0.01
51 std::lock_guard<std::mutex> lock(
m_mutex);
94 std::lock_guard<std::mutex> lock(
m_mutex);
122 {
yCWarning(
LOCALIZATION2D_NWS_YARP) <<
"retrieve_position_periodically is true, but data is not published because publish_odometry is false. This configuration is strange";}
124 {
yCWarning(
LOCALIZATION2D_NWS_YARP) <<
"retrieve_position_periodically is true, but data is not published because publish_location is false. This configuration is strange";}
194 if (!
m_RPC) {
return false;}
196 std::lock_guard<std::mutex> lock(
m_mutex);
212 std::lock_guard<std::mutex> lock(
m_mutex);
222 if (!
m_RPC) {
return;}
263 publish_odometry_on_yarp_port();
266 publish_2DLocation_on_yarp_port();
270void Localization2D_nws_yarp::publish_odometry_on_yarp_port()
285void Localization2D_nws_yarp::publish_2DLocation_on_yarp_port()
define control board standard interfaces
#define DEFAULT_THREAD_PERIOD
contains the definition of a Vector type
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::OdometryData m_current_odometry
yarp::os::Stamp m_odom_stamp
yarp::dev::Nav2D::LocalizationStatusEnum m_current_status
yarp::os::Stamp m_loc_stamp
bool m_getdata_using_periodic_thread
yarp::dev::Nav2D::Map2DLocation m_current_position
bool m_GENERAL_publish_odometry
bool m_GENERAL_retrieve_position_periodically
bool m_GENERAL_publish_location
std::string m_GENERAL_name
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
void run() override
Loop function.
yarp::os::BufferedPort< yarp::dev::OdometryData > m_odometryPort
std::string m_rpcPortName
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
std::string m_2DLocationPortName
yarp::dev::Nav2D::ILocalization2D * iLoc
std::string m_odometryPortName
bool m_getdata_using_periodic_thread
bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
bool attach(yarp::dev::PolyDriver *driver) override
Attach to another object.
bool close() override
Close the DeviceDriver.
bool threadInit() override
Initialization method.
Localization2D_nws_yarp()
void threadRelease() override
Release method.
bool detach() override
Detach the object (you must have first called attach).
ILocalization2DRPCd * m_RPC
yarp::os::BufferedPort< yarp::dev::Nav2D::Map2DLocation > m_2DLocationPort
bool view(T *&x)
Get an interface to the device driver.
virtual yarp::dev::ReturnValue getLocalizationStatus(LocalizationStatusEnum &status)=0
Gets the current status of the localization task.
virtual yarp::dev::ReturnValue getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc)=0
Gets the current position of the robot w.r.t world reference frame.
virtual yarp::dev::ReturnValue getEstimatedOdometry(yarp::dev::OdometryData &odom)=0
Gets the estimated odometry the robot, including its velocity expressed in the world and in the local...
A container for a device driver.
bool isValid() const
Check if device is valid.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
int getOutputCount() override
Determine how many output connections this port has.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An interface for reading from a network connection.
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
void setReader(PortReader &reader) override
Set an external reader for port data.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A base class for nested structures that can be searched.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
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.
void delay(double seconds)
Wait for a certain number of seconds.
An interface to the operating system, including Port based communication.