Well, I decided to do some work on bluetooth messaging so that I when it comes time to real swarm algorithms and such, I won't have to keep referencing guides and stuff for how to send and receive messages. So, I designed this little program that, on the master:
- Opens a bluetooth connection with the slave.
- Runs a designated shape path (triangle, square, decagon, etc);
- Sends the total degrees turned by the right wheel (total encoder reading)
- Quits the program.
Meanwhile, the slave:
- Receives the encoder rotations
- Runs through a loop that does the number of turns and straight runs = to the number of turns encountered by the master which is sent to the slave
- Disconnects from the master
- Quits
Here's a little video:
Note: I realize the shapes aren't perfectly normal, and that the slave ends up in a different orientation than the master. I realized what was going on after I taped this, and I didn't feel like doing it again, but I will explain why. After each turn/straight, I had the master and the slave wait for 50 milliseconds, but I forgot to state motors A & B should be = 0, so there was a minor rotation error. Because the slave had a battery on max charge, it rotated more through those 50 milliseconds than the slave did, which had a mere 6.2 volts of battery. And there you have. An explanation for the discrepancy.
Here are some pics, in case you want to see how the robots are built:
Later on, I'll make a post on my Projects tab for this project. Until next time, then.
No comments:
Post a Comment