Let's Make Robots!

arduino sumo

I'm trying to makd a arduino sumo robot code, I have been looking all over the web for the last month ripping my hair out trying to find a arduino sumo code that I can mod and I cant find anything can someone pleas help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

i know that this may come in a little late , but im building a sumobot too and i learned a bit in programming for sumos so i think i cana help and we could co-op

 

I'm in college now and I have an custom order electrics store so I don't know how much time I will have, but I'm up for it if you are. Let's make some robots! 

Look, I'll try this again.

Let's look at just one tiny aspect of this code project. 

On your sumo robot, you have probably 2 sensors. One is downward facing to "see" the ring and one is forward facing to detect the opponent. For now, we will look at the downward facing sensor. We have a IR LED shining down and a IR photo transistor looking for that reflected light. The amount of light that the sensor detects will be read by an ADC input. Basically, we read the sensor and get a number. Now, a very low number might tell us we are looking at white. Maybe a high number shows black. Somewhere in between is our "threshold". This threshold is a number we decide on that says, "over this amount, it is black and under this amount it is white". This threshold is going to be wildly different from bot to bot. The code used for another robot may have its threshold at 300 while yours may work out to 600. In the end, there is no way around the fact that you are going to have to sit down and write a sketch that reads the sensor and shows you its value on the serial monitor. You can't skip this no matter what code you have found to modify. Code from scratch, code inspired from other code or modified code, you are going to have to find this value manually. 

We move on to wheels. What series of highs and lows makes it go forward, backward and turn? What PWM values are in a range that will work? Even if you modify other code, there is no way around the fact that you are going to have to sit down and write a simple sketch to drive your motors forward, back and turn.

Opponent finding:  You may have a distance sensor on the front of your bot. What value do you get when something is say, 4" away? Well, there is no way around the fact that you are going to have to write a small, simple sketch to read this sensor and put its readings on the serial monitor. If you code from scratch or modify, you will go nowhere without isolating and testing the output of this sensor. Gotta be done.

I could go on and on and on here. Every "sub-section" of your robot will need to be isolated and tested individually. --Even if you modify code.

 

--Oh, and don't ask the same question twice when you don't get the answer you want.

You are probably not going to find any "universal sumo code" that is going to work. No two robots (unless they are mass-produced) will be constructed the same or wired the same. There is very little chance you can take any "off-the-shelf" code from anywhere, stick it in and have it work. Instead, you can, and should, look at examples of code from folks that have done similar stuff to what you want to do and see if you can use portions of their code and/or get ideas and inspiration from it. In the end, you can't get away from the fact that you are going to have to write some code here.

I would suggest breaking everything into much smaller steps. First off, write a small sketch that simply runs your motors. Get them to go forward and back and turn. Get that working and solid.

Next, write a small sketch to simply check your sensors. You can use the serial monitor to keep an eye on your tests and simply be sure they are A) working and B) spitting out the data you expect.

Next is to try to code a very simple, small part of the sumo routine. If I understand correctly, there is a white or black ring that the bot needs to stay inside. I would write a sketch that drives around (anywhere) and simply avoids this ring. --Just a simple code to "stay in the circle".

Next would be to forget about the "stay in the circle" thing and instead work on a sketch to "find the other guy". Play with this one a while.

When you have all of the above working, you can start to try to put them all together. Its the only way to do it, my friend.

in my opinion your best bet is to find sample code for the sensors and motor driver you intend on using and get all those parts working together, sumo's are a combination of line follower and object ovoid-er but the opposite line ovoid-er and object follower there are some code examples of these out there.

get your hardware up and running first then work on your line and opponent detection 

sumo is competitive and i don't think there going to give away there awesome code 

good luck 

 

I felt like was not geting any wear

Why create a new post when you have already asked this?