|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
43 currentTexture(nullptr),
44 currentStatus(BatteryStatusMissing),
90 bool TextureBattery::initBatteryClient()
97 std::string robot_name =
"foo";
98 std::string localPort =
"/oculus/battery:i";
99 std::string remotePort =
"/" + robot_name +
"/battery:o";
102 options.
put(
"robot", robot_name.c_str());
103 options.
put(
"device",
"BatteryClient");
104 options.
put(
"local", localPort.c_str());
105 options.
put(
"remote", remotePort.c_str());
107 options.
put(
"quiet",
true);
111 if (!drv || !(drv->
isValid())) {
140 if (!initBatteryClient()) {
166 }
else if (charge > 80.0) {
172 }
else if (charge > 60.0) {
178 }
else if (charge > 40.0) {
184 }
else if (charge > 20.0) {
const TextureStatic::Image battery_missing
const TextureStatic::Image battery_060
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
virtual bool getBatteryStatus(Battery_status &status)=0
get the battery status
#define yCWarning(component,...)
const TextureStatic::Image battery_caution
bool isValid() const
Check if device is valid.
@ BatteryStatusCharging060
@ BatteryStatusCharging040
const yarp::os::LogComponent & OVRHEADSET()
double getPeriod() const
Return the current period of the thread.
bool view(T *&x)
Get an interface to the device driver.
const TextureStatic::Image battery_charging_low
const TextureStatic::Image battery_080
const TextureStatic::Image battery_charging_060
TextureStatic * currentTexture
const TextureStatic::Image battery_040
virtual void run()
Loop function.
@ BatteryStatusChargingLow
const TextureStatic::Image battery_charging_caution
bool start()
Call this to start the thread.
A container for a device driver.
bool close() override
Close the DeviceDriver.
TextureBattery(ovrSession session, bool enabled)
void suspend()
Suspend the thread, the thread keeps running by doLoop is never executed.
const TextureStatic::Image battery_charging_040
#define yCAssert(component, x)
const TextureStatic::Image battery_charging
#define yCError(component,...)
const TextureStatic::Image battery_charging_080
const TextureStatic::Image battery_100
The main, catch-all namespace for YARP.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
const TextureStatic::Image battery_low
@ BatteryStatusChargingCaution
@ BatteryStatusCharging080
A class for storing options and configuration information.
virtual bool getBatteryCharge(double &charge)=0
get the battery status of charge