Phidgets Motor Encoder Low Level
From wikidb
Pre Req
- Phidgets Motor Encoder See High Level
Investigate
rostopic info phidgets/encoder/351673 Type: phidgets/encoder_params Publishers: None Subscribers: * /odometry (http://hood:41705/)
rostopic echo phidgets/encoder/351673 header: seq: 1 stamp: secs: 0 nsecs: 0 frame_id: base_link index: 0 count: -60 count_change: -60 time: 5 ---
Test Script
Just run the odometry without running the encoder publishers. The encoder publishing will be with the encode_test.sh below.
cat test/odometry_test.launch <launch> <node pkg="phidgets" type="odometry" name="odometry" respawn="true" output="screen"> <param name="serialleft" value="351547" /> <param name="serialright" value="351673" /> <param name="wheelbase" value="283" /> <param name="countspermmleft" value="6" /> <param name="countspermmright" value="6" /> <param name="verbose" value="true" /> </node> </launch>
See echo encoder fields above. Format is yaml. This will publish one encoder message for each encoder. At 6 counts per mm the 60 count message below should make the while move roughly 1 cm.
cat test/encoder_test.sh #!/bin/bash # left rostopic pub -1 /phidgets/encoder/351547 phidgets/encoder_params '{header: {seq: 1, stamp: {secs: 0, nsecs: 0}, frame_id: "base_link"}, index: 0, count: 60, count_change: 60, time: 5} ' # right rostopic pub -1 /phidgets/encoder/351673 phidgets/encoder_params '{header: {seq: 1, stamp: {secs: 0, nsecs: 0}, frame_id: "base_link"}, index: 0, count: -60, count_change: -60, time: 5} '
Test
Terminal 1
roscore
terminal 2
roslaunch floor_hugger odometry_test.launch
terminal 3
rostopic echo odom
terminal 4
. encoder_test.sh
echo result
pose: pose: position: x: -0.00999791911171 almost 1 cm y: -0.000176660062442 almost 0 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 ----
Sanity Check on Wheel Rotation
Terminal 1
roscore
Terminal 2
roslaunch floor_hugger odometry.launch
Terminal 3
rosbag record -a
Rotated right wheel about one revolution. Results will be approximate.
Terminal 2 and 3
^C
Terminal 4
rostopic echo phidgets/encoder/351673 > ~/tmp/en73.txt
Terminal 3
rosbag play 2016-04-21-11-27-20.bag
Wait to complete
Terminal 4
^C emacs ~/tmp/en73.txt&
Results
- see Calibrate_Phidgets_Odometry
- circumference is 330 mm
- right encoder count is 1897
- 1897 / 330 => 5.75 counts / mm
- close to that measured value in calibaration page. Wheel rotation was approximate.