5 #include <FTSensorNode.h> 7 #include <Rcs_typedef.h> 8 #include <Rcs_macros.h> 26 FTSensorNode::frameCallback();
41 Rcs::Viewer(), gDes(NULL), gCurr(NULL), hud(NULL)
43 pthread_mutex_init(&this->
graphMtx, NULL);
45 if (desired != NULL) {
46 this->gDes = RcsGraph_clone(desired);
48 this->gnDes =
new Rcs::GraphNode(this->gDes);
49 gnDes->setGhostMode(
true,
"RED");
53 if (current != NULL) {
54 this->gCurr = RcsGraph_clone(current);
55 this->gnCurr =
new Rcs::GraphNode(this->gCurr);
58 RCSGRAPH_TRAVERSE_SENSORS(this->gCurr) {
59 if (SENSOR->type == RCSSENSOR_LOAD_CELL) {
66 this->hud =
new Rcs::HUD();
73 RcsGraph_destroy(this->gDes);
74 RcsGraph_destroy(this->gCurr);
76 pthread_mutex_destroy(&this->
graphMtx);
82 if (isInitialized() ==
false) {
88 if (this->gDes != NULL) {
89 RcsGraph_setState(this->gDes, NULL, NULL);
92 if (this->gCurr != NULL) {
93 RcsGraph_setState(this->gCurr, NULL, NULL);
96 pthread_mutex_unlock(&this->
graphMtx);
98 double dtFrame = Timer_getSystemTime();
102 for (
size_t i = 0; i < userEventStack.size(); ++i) {
103 getOsgViewer()->getEventQueue()->userEvent(userEventStack[i].
get());
105 userEventStack.clear();
106 userEventMtx.unlock();
112 dtFrame = Timer_getSystemTime() - dtFrame;
113 this->fps = 0.9*this->fps + 0.1*(1.0/dtFrame);
137 bool syncWithEventLoop_) :
138 Rcs::SensorComponent(), desiredGraph(NULL), currentGraph(graphCurr),
139 viewer(NULL), kc(NULL), syncWithEventLoop(syncWithEventLoop_)
148 RcsGraph* graphDes, RcsGraph* graphCurr,
149 bool syncWithEventLoop_) :
198 while (src != NULL) {
199 if (src->type == RCSSENSOR_LOAD_CELL) {
200 MatNd_copy(dst->rawData, src->rawData);
220 return "ViewerComponent";
228 return 1.0/
viewer->updateFrequency();
244 if (this->
kc == NULL) {
245 this->
kc =
new Rcs::KeyCatcher();
osg::ref_ptr< Rcs::GraphNode > gnDes
const RcsGraph * desiredGraph
const char * getName() const
BodyNode * getBodyNodePtrFromDesiredGraph(const char *name)
KeyCatcher * getKeyCatcher()
LockedFTS(const RcsSensor *fts, pthread_mutex_t *mtx)
const RcsGraph * currentGraph
ViewerComponent(RcsGraph *currentGraph, bool syncWithEventLoop=false)
void setText(const std::string &text)
osg::ref_ptr< Rcs::GraphNode > gnCurr
pthread_mutex_t * graphMtx
void updateGraph(RcsGraph *graph)
double getCallbackUpdatePeriod() const
void setText(const std::string &text)
ComponentViewer(const RcsGraph *desired, const RcsGraph *current)
BodyNode * getBodyNodePtrFromCurrentGraph(const char *name)
virtual ~ViewerComponent()