45 yCError(NAVIGATION2D_NWS_YARP,
"Subdevice passed to attach method is invalid (it does not implement all the required interfaces)");
51 yCWarning(NAVIGATION2D_NWS_YARP,
"The attached subdevice does not implement INavigation2DVelocityActions interface");
57 return PeriodicThread::start();
62 if (PeriodicThread::isRunning())
64 PeriodicThread::stop();
73 yCDebug(NAVIGATION2D_NWS_YARP) <<
"Configuration: \n" << config.
toString().c_str();
75 if (config.
check(
"GENERAL") ==
false)
77 yCWarning(NAVIGATION2D_NWS_YARP) <<
"Missing GENERAL group, assuming default options";
81 if (!general_group.
check(
"period"))
83 yCInfo(NAVIGATION2D_NWS_YARP) <<
"Missing 'period' parameter. Using default value: 0.010";
91 if (!general_group.
check(
"name"))
93 yCInfo(NAVIGATION2D_NWS_YARP) <<
"Missing 'name' parameter. Using default value: " <<
m_local_name;
98 if (
m_local_name.c_str()[0] !=
'/') {
yCError(NAVIGATION2D_NWS_YARP) <<
"Missing '/' in name parameter";
return false; }
103 if (config.
check(
"subdevice"))
111 yCError(NAVIGATION2D_NWS_YARP) <<
"Failed to open subdevice.. check params";
117 yCError(NAVIGATION2D_NWS_YARP) <<
"Failed to attach subdevice.. check params";
123 yCInfo(NAVIGATION2D_NWS_YARP) <<
"Waiting for device to attach";
128 yCError(NAVIGATION2D_NWS_YARP) <<
"Error initializing YARP ports";
148 yCTrace(NAVIGATION2D_NWS_YARP,
"Close");
149 if (PeriodicThread::isRunning())
151 PeriodicThread::stop();
167 yCDebug(NAVIGATION2D_NWS_YARP) <<
"read() Command failed";
181 yCError(NAVIGATION2D_NWS_YARP,
"Unable to get Navigation Status!\n");
194 return std::string(
"navigation_status_idle");
196 return std::string(
"navigation_status_moving");
198 return std::string(
"navigation_status_waiting_obstacle");
200 return std::string(
"navigation_status_goal_reached");
202 return std::string(
"navigation_status_aborted");
204 return std::string(
"navigation_status_failing");
206 return std::string(
"navigation_status_paused");
208 return std::string(
"navigation_status_preparing_before_move");
210 return std::string(
"navigation_status_thinking");
212 return std::string(
"navigation_status_error");
214 return std::string(
"navigation_status_error");
define control board standard interfaces
contains the definition of a map type
constexpr double DEFAULT_THREAD_PERIOD
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void setInterfaces(yarp::dev::Nav2D::INavigation2DTargetActions *iNav_target, yarp::dev::Nav2D::INavigation2DControlActions *iNav_ctrl, yarp::dev::Nav2D::INavigation2DVelocityActions *iNav_vel)
yarp::dev::Nav2D::INavigation2DControlActions * iNav_ctrl
virtual void run() override
Loop function.
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
yarp::dev::Nav2D::NavigationStatusEnum m_navigation_status
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual bool detach() override
Detach the object (you must have first called attach).
virtual bool attach(yarp::dev::PolyDriver *drv) override
Attach to another object.
navigation2D_nws_yarp()
Default module constructor.
yarp::dev::Nav2D::INavigation2DTargetActions * iNav_target
virtual bool close() override
Close the DeviceDriver.
std::string m_rpcPortName
yarp::dev::Nav2D::INavigation2DVelocityActions * iNav_vel
bool initialize_YARP(yarp::os::Searchable &config)
yarp::dev::PolyDriver pNav
bool view(T *&x)
Get an interface to the device driver.
virtual bool getNavigationStatus(NavigationStatusEnum &status)=0
Gets the current status of the navigation task.
A container for a device driver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
bool detachAll() final
Detach the object (you must have first called attach).
A simple collection of objects that can be described and transmitted in a portable way.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
An interface for reading from a network connection.
An abstraction for a periodic thread.
void setReader(PortReader &reader) override
Set an external reader for port data.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::string asString() const
Get string value.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
@ navigation_status_error
@ navigation_status_preparing_before_move
@ navigation_status_aborted
@ navigation_status_failing
@ navigation_status_goal_reached
@ navigation_status_thinking
@ navigation_status_moving
@ navigation_status_paused
@ navigation_status_waiting_obstacle
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.