Activity Bot with Tank Treads Addition
panama23445
Posts: 9
in Propeller 1
Hey, so I am trying to get this tank tread code to conform to the Activity Bot and i'm not having any luck. It has been a while since I played around with the thing, or even coded. I can't understand the instructions that came with the treads. Any chance someone can give me an example to start coding with?
Thanks!
Thanks!
Comments
-Phil
here is a link to the product: https://www.parallax.com/product/28106
and here is a link of the manual that came with it: https://www.parallax.com/sites/default/files/downloads/28106-Tank-Treads-Kit-Product-Guide.v3.0.pdf
The instructions say that you can still use the same code as you use for the stock encoders and wheels that come with the Activity Bot with these treads and this I just don't understand how to use the same code.
-Panama
Note that the Tank Treads are not compatible with the Boe-Bot or ActivityBot encoders, since the encoders rely on the robots' original spoked wheels. See the Tank Tread Product Guide for details and programming tips, plus notes about using the Tank Treads with other Robot Accessories.
You won't be able to use the encoders for feedback, but the servo driving code should be the same.
Without encoder feedback, the motors' speed will likely fluctuate based on the state of charge. As you can read in the above linked thread, I had a heck of a time trying to get my robot to perforum a figure 8 on unregulated power. It wasn't until I added a voltage regulator that the robot performed well.
Just inside the main function, add the following code to turn off encoder feedback:
This tells your ActivityBot not to expect any encoder feedback while performing navigation maneuvers. Commands such as drive_goto(); that rely on precise distances will not work properly with treads. Try experimenting with drive_speed(); and pause(); functions in your program instead to achieve the desired outcome.
#include "abdrive.h" // Include abdrive header
#include "ping.h" // Include ping header
int distance, setPoint, errorVal, kp, speed; // Navigation variables
int main() // main function
{
drive_feedback(0); //<-- "Turns Off" encoders
setPoint = 32; // Desired cm distance
kp = -10; // Proportional control
drive_speed(6, 6); // 7 ticks/sec / 20 ms
while(1) // main loop
{
distance = ping_cm(6); // Measure distance
errorVal = setPoint - distance; // Calculate error
speed = kp * errorVal; // Calculate correction speed
if(speed > 128) speed = 128; // Limit top speed
if(speed < -128) speed = -128;
drive_rampStep(speed, speed); // Use result for following
}
}
ok, I have tried some experimentation and it's still not working. My code is attached, what am I missing?
The goal is to use the drive gear teeth as an encoder wheel.
Actual modifications are as follows:
1. Rotate the drive servos so the drive shafts are on the forward side of the ActivityBot chassis
2. Drill two 7/64 holes on the servo mounting plates, mount encoder with one spacer
3. Mount encoder assembly upside down with cables facing forward with two spacers
Parts list:
• 2- encoders
• 2- encoder mounting plates
• 2-encoder cables
• 6- nylon spacers (these are the only additional parts needed)
Steps:
1. Rotate the drive servos so the drive shafts are on the forward side of the ActivityBot chassis
2. Join the two mounting plates by using the encoder screw
3. Offset the mounting plates so the encoder locating pin hole is half covered
4. Drill a 7/64 hole through the bottom plate
5. Align the mounting plates so they are no longer offset
6. Using the bottom plate as a guide, drill a 7/64 hole on the other mounting plate
7. Separate the mounting plates
8. Using two nylon spacers between the mounting screws and the encoders, install the encoders onto the mounting plates using the new holes for the encoder locating pins
9. Using the remaining four nylon spacers between the mounting plate and the servo, mount the encoders upside down below the drive servos with the cables facing forward
10. Connect the encoder cables to pins P14 and P15 as usual
11. Run the Test Encoder Connections program. You may have to move the encoder mounting plates as far down as possible before tightening the mounting screws
12. You may have to adjust the tank tread drive wheel to minimize out-of-round or wobble
13. If they encoders test okay, run the ActivityBot Calibrate program without the rubber treads
14. When done calibrating, install the rubber treads and load a navigation program to test your new encoder-enabled ActivityBot with Tank Treads!
Note: To try to compensate for the encoder loss, I had made some manual adjustments to the drive servos via the adjustment pot, so I had to do some minor fine-tuning to reverse my manual adjustments. Since the servos are now forward on the chassis the adjustment pot screws are easily accessible.
How well does the encoder setup work for you? The theory looks right, but how does it work in the real world?
Will it do the F8 challenge? Video would be awesome..
Thanks for sharing.
I can't find a Parallax stock number for the Drill Bit attachment, but that should probably have its own Post.
-Tommy
Thank you for your feedback, the F8 3/10/16 video is available here:
MC
Ecro should be amazed!
If you posted that video into the "ercos figure eight challenge" thread, it would for sure take first place for neat and tidy,
You would, of course, be showered with rewards of great praise and honorable mentions..
Keep up the good fun.
-Tommy
This is our very first posting on Parallax's forum, and our purpose as a high school robotics and engineering class, is to share what we have learned using the ActivityBot within our abilities and resources.
Our hope is that the encoder modification instructions and pictures contribute to robotics students around the world.
Special thanks to Ttailspin for suggesting an F8 Challenge video, proof of concept is essential after all.
mcarter