|
From: <rob...@us...> - 2008-07-25 06:44:25
|
Revision: 2124
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=2124&view=rev
Author: rob_wheeler
Date: 2008-07-25 06:44:34 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Add current time to HardwareInterface
Modified Paths:
--------------
pkg/trunk/mechanism/hw_interface/include/hw_interface/hardware_interface.h
pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp
Modified: pkg/trunk/mechanism/hw_interface/include/hw_interface/hardware_interface.h
===================================================================
--- pkg/trunk/mechanism/hw_interface/include/hw_interface/hardware_interface.h 2008-07-25 03:55:16 UTC (rev 2123)
+++ pkg/trunk/mechanism/hw_interface/include/hw_interface/hardware_interface.h 2008-07-25 06:44:34 UTC (rev 2124)
@@ -84,6 +84,7 @@
}
Actuator *actuator;
int numActuators;
+ double current_time_;
};
#endif
Modified: pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp
===================================================================
--- pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp 2008-07-25 03:55:16 UTC (rev 2123)
+++ pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp 2008-07-25 06:44:34 UTC (rev 2124)
@@ -55,7 +55,7 @@
// Switch to hard real-time
int period = 1000000;
- struct timespec tick;
+ struct timespec tick, now;
#if defined(__XENO__)
pthread_set_mode_np(0, PTHREAD_PRIMARY|PTHREAD_WARNSW);
#endif
@@ -64,6 +64,8 @@
while (!quit)
{
ec.update();
+ clock_gettime(CLOCK_REALTIME, &now);
+ ec.hw->current_time_ = now.tv_nsec / NSEC_PER_SEC + now.tv_sec;
mc.update();
tick.tv_nsec += period;
while (tick.tv_nsec >= NSEC_PER_SEC)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|