statgrab_health.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2005-2006
4  * Raphael Sznitman, Brad Kratochvil
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 #include <stdint.h>
24 #include <libplayercore/playercore.h>
25 
26 extern "C"
27 {
28 #include <statgrab.h>
29 }
30 
32 // The class for the driver
34 {
35  public:
36 
37  StatGrabDriver(ConfigFile* cf, int section);
38 
39  private:
40  // Main function for device thread.
41  virtual void Main();
42  int MainSetup();
43  void RefreshData();
44 
45  // Structure for specific process data
46 
47  // Structure holding Swap data
48  sg_swap_stats *swap_stats;
49 
50  // Structure holding CPU data
51  sg_cpu_percents *cpu_percent;
52 
53  // Structure holding memory stat
54  sg_mem_stats *mem_data;
55  double mem_percent;
56 
57  // Health Interface
58  player_devaddr_t mHealthId;
59  player_health_data_t mHealth;
60 
61  // For status checking priviledge
62  int status;
63  int32_t mSleep;
64 
65 };
Request to get an integer property.
Definition: player.h:457
#define PLAYER_DIO_CMD_VALUES
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1987
#define PLAYER_WARN1(msg, a)
Error message macros.
Definition: error.h:89
Data: recognized string.
Definition: player_interfaces.h:3395
#define PLAYER_SPEECH_RECOGNITION_DATA_STRING
Data subtype: recognized string.
Definition: player_interfaces.h:3388
#define PLAYER_MSG1(level, msg, a)
Error message macros.
Definition: error.h:105
#define PLAYER_MSG3(level, msg, a, b, c)
Error message macros.
Definition: error.h:107
virtual void Publish(player_devaddr_t addr, QueuePointer &queue, uint8_t type, uint8_t subtype, void *src=NULL, size_t deprecated=0, double *timestamp=NULL, bool copy=true)
Publish a message via one of this driver's interfaces.
double py
Y [m].
Definition: player.h:198
player_health_memory_t mem
The memory stats
Definition: player_interfaces.h:4650
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:158
char * text
Recognized text.
Definition: player_interfaces.h:3400
#define PLAYER_POINTCLOUD3D_DATA_STATE
Data subtype: state.
Definition: player_interfaces.h:4854
#define PLAYER_HEALTH_DATA_STATE
Structure describing the cpu.
Definition: player_interfaces.h:4619
uint8_t blue
Blue color channel.
Definition: player_interfaces.h:5297
#define PLAYER_PTZ_DATA_STATE
Data subtype: state.
Definition: player_interfaces.h:1208
int AddInterface(player_devaddr_t addr)
Add an interface.
int64_t used
Used memory
Definition: player_interfaces.h:4639
virtual void Main()
Main method for driver thread.
Definition: statgrab_health.cpp:158
Definition: nxtdc.hh:102
Generic message header.
Definition: player.h:160
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:657
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:663
float py
Y [m].
Definition: player_interfaces.h:5289
Data: state (PLAYER_PTZ_DATA_STATE)
Definition: player_interfaces.h:1228
int MainSetup()
Sets up the resources needed by the driver thread.
Definition: statgrab_health.cpp:141
float tilt
Desired tilt angle [rad].
Definition: player_interfaces.h:1253
Command: state (PLAYER_PTZ_CMD_STATE)
Definition: player_interfaces.h:1248
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:73
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
Data: Get cloud (PLAYER_POINTCLOUD3D_DATA_STATE) The basic 3dcloudpoint data packet.
Definition: player_interfaces.h:4879
virtual void Main(void)=0
Main method for driver thread.
uint8_t blue
Blue color channel.
Definition: player.h:328
uint8_t red
Red color channel.
Definition: player_interfaces.h:5293
const char * ReadFilename(int section, const char *name, const char *value)
Read a filename.
int ReadInt(int section, const char *name, int value)
Read an integer value.
void ProcessMessages(void)
Process pending messages.
float px
X [m].
Definition: player_interfaces.h:5287
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:94
uint8_t red
Red color channel.
Definition: player.h:324
#define PLAYER_CAMERA_FORMAT_MONO16
Image format : 16-bit monochrome (network byte order).
Definition: player_interfaces.h:2938
uint32_t digout
output bitfield
Definition: player_interfaces.h:2011
int32_t value
The property value.
Definition: player.h:464
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:111
double px
X [m].
Definition: player.h:196
#define PLAYER_CAMERA_DATA_STATE
Data subtype: state.
Definition: player_interfaces.h:2922
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
static bool MatchDeviceAddress(player_devaddr_t addr1, player_devaddr_t addr2)
Compare two addresses.
Definition: device.h:200
float idle
The idle cpu load
Definition: player_interfaces.h:4626
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:105
Data: state (PLAYER_STEREO_DATA_STATE)
Definition: player_interfaces.h:5301
#define PLAYER_MSGTYPE_RESP_NACK
A negative response message.
Definition: player.h:124
Integer property class.
Definition: property.h:113
Definition: nxtdc.hh:116
Command: output values (PLAYER_DIO_CMD_VALUES)
Definition: player_interfaces.h:2006
#define PLAYER_GET_INTPROP_REQ
Integer property get request subtype.
Definition: player.h:429
int64_t free
Free memory
Definition: player_interfaces.h:4641
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Data: state (PLAYER_CAMERA_DATA_STATE)
Definition: player_interfaces.h:2950
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1994
float pan
Desired pan angle [rad].
Definition: player_interfaces.h:1251
Definition: nxtdc.hh:131
Class for loading configuration file information.
Definition: configfile.h:195
virtual int Setup()
Initialize the driver.
Definition: driver.h:385
double pz
Z [m].
Definition: player.h:200
float pz
Z [m].
Definition: player_interfaces.h:5291
A device address.
Definition: player.h:144
Structure describing the HEALTH's data packet.
Definition: player_interfaces.h:4645
An autopointer for the message queue.
Definition: message.h:72
uint32_t bits
bitfield of samples
Definition: player_interfaces.h:1999
void SetError(int code)
Set/reset error code.
Definition: driver.h:144
position2d data
Definition: player_interfaces.h:606
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:81
float user
The user's cpu load
Definition: player_interfaces.h:4630
#define PLAYER_STEREO_DATA_STATE
Data: state (PLAYER_STEREO_DATA_STATE)
Definition: player_interfaces.h:5281
uint32_t count
the command
Definition: player_interfaces.h:2009
virtual bool RegisterProperty(const char *key, Property *property, ConfigFile *cf, int section)
Property registration.
#define PLAYER_CAMERA_COMPRESS_RAW
Compression method: raw.
Definition: player_interfaces.h:2945
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:80
Definition: v4l2_dyna_ctrls.h:77
player_devaddr_t device_addr
Default device address (single-interface drivers)
Definition: driver.h:268
Base class for drivers which oeprate with a thread.
Definition: driver.h:551
float system
The system cpu load
Definition: player_interfaces.h:4628
Messages between wsn and a robot.
Definition: er.h:86
#define PLAYER_PTZ_CMD_STATE
Command subtype: state.
Definition: player_interfaces.h:1214
player_health_memory_t swap
The swap stats
Definition: player_interfaces.h:4652
#define PLAYER_POSITION2D_DATA_STATE
Data: state (PLAYER_POSITION2D_DATA_STATE)
Definition: player_interfaces.h:568
uint32_t text_count
Length of text.
Definition: player_interfaces.h:3398
char * key
The property key.
Definition: player.h:462
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:88
3D Pointcloud element structure An element as stored in a 3D pointcloud, containing a 3D position plu...
Definition: player_interfaces.h:4861
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:98
uint32_t count
number of samples
Definition: player_interfaces.h:1997
virtual int Shutdown()
Finalize the driver.
Definition: driver.h:392
int64_t total
Total memory
Definition: player_interfaces.h:4637
uint8_t alpha
Alpha (transparency) channel.
Definition: player.h:322
#define PLAYER_DIO_DATA_VALUES
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1984
Base class for all drivers.
Definition: driver.h:107
player_health_cpu_t cpu_usage
The current cpu usage
Definition: player_interfaces.h:4648
#define PLAYER_MSG0(level, msg)
General messages.
Definition: error.h:104
Definition: player_interfaces.h:5284
Definition: v4l2_dyna_ctrls.h:86
Definition: statgrab_health.h:33
uint8_t stall
Are the motors stalled?
Definition: player_interfaces.h:613
uint8_t green
Green color channel.
Definition: player_interfaces.h:5295
#define PLAYER_SET_INTPROP_REQ
Integer property set request subtype.
Definition: player.h:431
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:75
uint8_t green
Green color channel.
Definition: player.h:326