|
From: <rob...@us...> - 2008-09-04 23:29:59
|
Revision: 3962
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=3962&view=rev
Author: rob_wheeler
Date: 2008-09-04 23:30:10 +0000 (Thu, 04 Sep 2008)
Log Message:
-----------
Add zero offset for actuators
Modified Paths:
--------------
pkg/trunk/drivers/motor/ethercat_hardware/src/wg05.cpp
pkg/trunk/mechanism/hardware_interface/include/hardware_interface/hardware_interface.h
Modified: pkg/trunk/drivers/motor/ethercat_hardware/src/wg05.cpp
===================================================================
--- pkg/trunk/drivers/motor/ethercat_hardware/src/wg05.cpp 2008-09-04 23:22:38 UTC (rev 3961)
+++ pkg/trunk/drivers/motor/ethercat_hardware/src/wg05.cpp 2008-09-04 23:30:10 UTC (rev 3962)
@@ -194,7 +194,7 @@
state.timestamp_ = current_status.timestamp_ / 1e+6;
state.encoder_count_ = current_status.encoder_count_;
- state.position_ = double(current_status.encoder_count_) / pulses_per_revolution * 2 * M_PI;
+ state.position_ = double(current_status.encoder_count_ - state.zero_offset_) / pulses_per_revolution * 2 * M_PI;
state.encoder_velocity_ = double(int(current_status.encoder_count_ - last_status.encoder_count_))
/ (current_status.timestamp_ - last_status.timestamp_) * 1e+6;
state.velocity_ = state.encoder_velocity_ / pulses_per_revolution * 2 * M_PI;
Modified: pkg/trunk/mechanism/hardware_interface/include/hardware_interface/hardware_interface.h
===================================================================
--- pkg/trunk/mechanism/hardware_interface/include/hardware_interface/hardware_interface.h 2008-09-04 23:22:38 UTC (rev 3961)
+++ pkg/trunk/mechanism/hardware_interface/include/hardware_interface/hardware_interface.h 2008-09-04 23:30:10 UTC (rev 3962)
@@ -49,7 +49,8 @@
last_requested_effort_(0),
last_commanded_effort_(0),
last_measured_effort_(0),
- num_encoder_errors_(0)
+ num_encoder_errors_(0),
+ zero_offset_(0)
{}
double timestamp_;
@@ -73,6 +74,8 @@
int num_encoder_errors_;
int num_communication_errors_;
+
+ int zero_offset_; // In encoder counts
};
class ActuatorCommand
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|