[ros-users] [PATCH] Odometry calibration of the Pioneer Robot, ETHZ

刘明 liu.ming.prc at gmail.com
Mon Dec 13 18:04:10 UTC 2010


Hi,

Considering the calibration of the odometry for Pioneer robot using the
p2os_driver, we believe the
REVCOUNT, DRIFTFACTOR, TICKSMM are missing in both the header files and the
source files.

The following patch will add interfaces to adjust these three parameters to
the p2os_driver package.
This patch has been tested on PioneerAT and DX. (use parameter -p1)


diff -Naur old/include/p2os_driver/p2os.h new/include/p2os_driver/p2os.h
--- old/include/p2os_driver/p2os.h    2010-12-13 18:53:09.000000000 +0100
+++ new/include/p2os_driver/p2os.h    2010-12-13 18:52:40.000000000 +0100
@@ -143,6 +143,11 @@
     int direct_wheel_vel_control;
     int radio_modemp;

+
+    int revcount ; //#ticks per 180 degree, resolution of the robot
+    int ticksmm ; //encoder ticks per millimeter tire motion
+    int driftfactor; //working drift, to correct rotational offset
+
     int motor_max_speed;
     int motor_max_turnspeed;
     short motor_max_trans_accel, motor_max_trans_decel;
diff -Naur old/include/p2os_driver/robot_params.h
new/include/p2os_driver/robot_params.h
--- old/include/p2os_driver/robot_params.h    2010-12-13 18:53:09.000000000
+0100
+++ new/include/p2os_driver/robot_params.h    2010-12-13 18:52:40.000000000
+0100
@@ -164,6 +164,14 @@
   TRANSKP = 85,      // Added in P2OS1.M
   TRANSKV = 86,      // Added in P2OS1.M
   TRANSKI = 87,      // Added in P2OS1.M
+
+
+  //ETHZ added
+  REVCOUNT = 88,
+  DRIFTFACTOR = 89,
+  TICKSMM = 93,
+
+
   SOUND = 90,
   PLAYLIST = 91,
   SOUNDTOG = 92, ///< int, AmigoBot (old H8 model) specific, enable(1) or
@@ -222,7 +230,7 @@
 #define CMUCAM_MESSAGE_LEN  10

 /* conection stuff */
-#define DEFAULT_P2OS_PORT "/dev/ttyS0"
+#define DEFAULT_P2OS_PORT "/dev/ttyUSB0"
 #define DEFAULT_P2OS_TCP_REMOTE_HOST "localhost"
 #define DEFAULT_P2OS_TCP_REMOTE_PORT 8101

diff -Naur old/src/p2os.cc new/src/p2os.cc
--- old/src/p2os.cc    2010-12-13 18:53:01.000000000 +0100
+++ new/src/p2os.cc    2010-12-13 18:52:30.000000000 +0100
@@ -92,6 +92,18 @@
   n_private.param( "max_yawdecel", spd, 0.0);
   motor_max_rot_decel = (short)rint(RTOD(spd));

+  //odom calibration: revcount
+  int odomparam;
+  //essential:
+  n_private.param( "revcount", odomparam, 38000);
+  revcount = odomparam; //#ticks per 180 degree, resolution of the robot
+  //these two parameters are not set by default:
+  n_private.param( "ticksmm", odomparam, -1);
+  ticksmm = odomparam; //encoder ticks per millimeter tire motion
+  n_private.param( "revcount", odomparam, -1);
+  driftfactor = odomparam; //working drift, to correct rotational offset
+
+
   desired_freq = 10;

   // advertise services
@@ -560,6 +572,37 @@
     this->SendReceive(&accel_packet,false);
   }

+  ///////////////////Odometry/////////////////////////////////
+  //ETHZ Dec 8 2010
+  P2OSPacket odom_packet;
+  unsigned char odom_command[4];
+  if(this->revcount > 0)
+  {
+    odom_command[0] = REVCOUNT;
+    odom_command[1] = ARGINT;
+    odom_command[2] = this->revcount & 0x00FF;
+    odom_command[3] = (this->revcount & 0xFF00) >> 8;
+    odom_packet.Build(odom_command, 4);
+    this->SendReceive(&odom_packet);
+  }
+  if(this->ticksmm > 0)
+  {
+    odom_command[0] = TICKSMM;
+    odom_command[1] = ARGINT;
+    odom_command[2] = this->ticksmm & 0x00FF;
+    odom_command[3] = (this->ticksmm & 0xFF00) >> 8;
+    odom_packet.Build(odom_command, 4);
+    this->SendReceive(&odom_packet);
+  }
+  if(this->driftfactor > 0)
+  {
+    odom_command[0] = DRIFTFACTOR;
+    odom_command[1] = ARGINT;
+    odom_command[2] = this->driftfactor & 0x00FF;
+    odom_command[3] = (this->driftfactor & 0xFF00) >> 8;
+    odom_packet.Build(odom_command, 4);
+    this->SendReceive(&odom_packet);
+  }

   // if requested, change PID settings
   P2OSPacket pid_packet;


For further information, please refer to the software manual, e.g.
http://www.ist.tugraz.at/_attach/Publish/Kmr06/pioneer-robot.pdf#page=56

Good luck!

Best regards,
Ming Liu

-- 
___________________________________
Ming Liu
Autonomous Systems Laboratory
ETH Zurich, CLA E 26
Tannenstrasse 3
8092, Zurich, Switzerland
Phone: +41 44 632 92 96
Mobile: +41 76 729 50 85
Fax:   +41 44 632 11 81
Liu.Ming.PRC at gmail.com
ming.liu at mavt.ethz.ch
___________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20101213/80ffc406/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odom_calibration.patch
Type: text/x-patch
Size: 3391 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20101213/80ffc406/attachment-0004.bin>


More information about the ros-users mailing list