|
From: <mm...@us...> - 2008-05-06 00:15:31
|
Revision: 315
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=315&view=rev
Author: mmwise
Date: 2008-05-05 17:15:38 -0700 (Mon, 05 May 2008)
Log Message:
-----------
added README for docs
Modified Paths:
--------------
pkg/trunk/util/control/auto_calibration/src/AutoCal.cpp
pkg/trunk/util/control/auto_calibration/test/test_AutoCal.cpp
Added Paths:
-----------
pkg/trunk/README
Added: pkg/trunk/README
===================================================================
--- pkg/trunk/README (rev 0)
+++ pkg/trunk/README 2008-05-06 00:15:38 UTC (rev 315)
@@ -0,0 +1 @@
+To make the documentation go into documentation and make.
Modified: pkg/trunk/util/control/auto_calibration/src/AutoCal.cpp
===================================================================
--- pkg/trunk/util/control/auto_calibration/src/AutoCal.cpp 2008-05-05 23:48:01 UTC (rev 314)
+++ pkg/trunk/util/control/auto_calibration/src/AutoCal.cpp 2008-05-06 00:15:38 UTC (rev 315)
@@ -22,7 +22,7 @@
// Info for arm stage
- Info shoulder = {0, 180.0, 0.0, 0.0, -90.0, 90.0, 0, 0, 1000};
+ Info shoulder = {0, 180.0, 0.0, 0.0, -90.0, 90.0, 0, 1, 1000};
XmlRpcValue arm;
shoulder.toXmlRpcValue(arm["shoulder"]);
@@ -40,7 +40,7 @@
void AutoCal::RunAutoCal(string objectName)
{
- int speed = 125;
+ int speed = 70;
int flag = 1;
int count = 0;
@@ -50,13 +50,20 @@
cout << "Now auto calibrating " << object.size() <<" motors." << endl;
- e.motors_on();
- e.set_control_mode(0);
+ if (e.set_control_mode(0))
+ cout << "Control mode set to 0" << endl;
+ if (e.motors_on())
+ cout << "Motors turned on" << endl;
for (XmlRpcValue::iterator it2 = object.begin(); it2 != object.end(); ++it2)
{
+ //cout << "XmlRpcValue size: " << (*it2).second.size() << endl;
if (info.fromXmlRpcValue(it2)) {
+
+ //cout<<"here"<<endl;
e.set_drv(info.motorNum, speed);
+ e.tick();
+ cout<<e.get_cur(info.motorNum)<<endl;
}
}
@@ -74,42 +81,43 @@
{
if (info.fromXmlRpcValue(it2))
{
- if(e.get_cur(info.motorNum)>425 && info.count>999)
- {
- e.set_drv(info.motorNum, 0);
-
- if(info.flag == 1)
- {
- info.maxEncoder = e.get_enc(info.motorNum);
- info.flag = 0;
- info.count = 0;
- }
- else if(info.flag == -1)
- {
- info.minEncoder = e.get_enc(info.motorNum);
- info.flag = -2;
- }
- }
- else if(info.flag==0)
- {
- e.set_drv(info.motorNum, -speed);
- info.flag = -1;
- }
- else if(info.flag == -2)
- {
- count = count+1;
- info.flag = -3;
-
- }
- if(count==object.size())
- {
- flag=0;
- e.motors_off();
- cout << "Done calibrating " << object.size() <<" motors." << endl;
-
- }
- info.count = info.count +1;
- info.toXmlRpcValue(it2);
+
+ if(e.get_cur(info.motorNum)>400 && info.count>50)
+ {
+ e.set_drv(info.motorNum, 0);
+
+ if(info.flag == 1)
+ {
+ info.maxEncoder = e.get_enc(info.motorNum);
+ info.flag = 0;
+ info.count = 0;
+ }
+ else if(info.flag == -1)
+ {
+ info.minEncoder = e.get_enc(info.motorNum);
+ info.flag = -2;
+ }
+ }
+ else if(info.flag==0 && info.count>50)
+ {
+ e.set_drv(info.motorNum, -speed);
+ info.flag = -1;
+ info.count=0;
+ }
+ else if(info.flag == -2)
+ {
+ count = count+1;
+ info.flag = -3;
+
+ }
+ if(count==object.size())
+ {
+ flag=0;
+ e.motors_off();
+ cout << "Done calibrating " << object.size() <<" motors." << endl;
+ }
+ info.count = info.count +1;
+ info.toXmlRpcValue(it2);
}
usleep(300);
}
@@ -117,7 +125,8 @@
for (XmlRpcValue::iterator it2 = object.begin(); it2 != object.end(); ++it2)
{
- if (info.fromXmlRpcValue(it2)) {
+ if (info.fromXmlRpcValue(it2))
+ {
cout << "Min Encoder : " << info.minEncoder << " Max Encoder : "<< info.maxEncoder << endl;
}
}
Modified: pkg/trunk/util/control/auto_calibration/test/test_AutoCal.cpp
===================================================================
--- pkg/trunk/util/control/auto_calibration/test/test_AutoCal.cpp 2008-05-05 23:48:01 UTC (rev 314)
+++ pkg/trunk/util/control/auto_calibration/test/test_AutoCal.cpp 2008-05-06 00:15:38 UTC (rev 315)
@@ -28,9 +28,11 @@
int main(int argc, char **argv)
{
ros::init(argc, argv);
+
Test_Autocal T;
T.run();
return 1;
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|