0
$\begingroup$

im currently programming a robot with 2 wheels and i got the task to let it drive alone for a few minutes in a maze. I just managed to programm a controller that controls the distance to each wall right and left. But now i dont know how to drive to the right and left. I tried but its pretty random if the robot hits one of the walls or drives a perfect curve. I can use the wheel encoder sensors, the infrared sensors and the IMU to navigate the robot. Does anyone of you have an idea how i should program this? Thanks for your help

$\endgroup$
0
$\begingroup$

im currently programming a robot with 2 wheels and i got the task to let it drive alone for a few minutes in a maze.

Some more information would be nice. reasonable options are (1) a differential drive type with castor/casters, or (2) a Segway type balancing robot. I am assuming option (1). This is however still an issue. what kind of wheels? grippy rubber, holomonic, swerve drive? I shall assume grippy rubber wheels. C'mon man.

I just managed to programm a controller that controls the distance to each wall right > and left.

I don't understand you. A controller as in hardware, or as in software? I am assuming you mean that you have written code that is aware of the walls, and their proximity to the device measuring the distance. You have these values available. OK. I am assuming the values are that of distance (ex: float or int types).

But now i dont know how to drive to the right and left.

You need to write a program to control the motors. Since the question is a few days old, and I am sure you know this.

I tried but its pretty random if the robot hits one of the walls or drives a perfect curve.

Good job. Motion is better than no motion. Now you have to debug your code to make it usable. If the code is not repeatable and predictable, then your robot is going to be not as impressive as it could be. My advice when writing code (passed to me from a textbook) is don't write the code as cleverly as you can. Why? Because debugging is twice as hard as writing code in the first place. So if you write as cleverly as you can you are not qualified to debug your code. Make your code very easy to read.

I can use the wheel encoder sensors, the infrared sensors and the IMU to navigate the robot.

That sounds like a reasonably capable unit. How much time are you going to invest into this project? I ask because if you are going to spend a lot of time on this unit I recommend implementing some sort of robotic middleware (ex: ROS). If you just want to do the least amount of work, and just hack out a crappy solution, then implement only the hardware you NEED, and use that to achieve your maze navigation objective. The two approaches will generate a significantly different robot even though the hardware is the same. One robot will be stupid ann simply will not hit walls. The other with some minor additions can start to do mapping, localization, path planning, obstacle avoidance and other very cool stuff.

Does anyone of you have an idea how i should program this? Thanks for your help

hmmmmm. I don't know how to answer your question. It's a bit vague. So here's a vague answer: assess your robotic objective. Then figure out what data you need from sensors. Then figure out how to control the outputs based on the sensor data you collect. Spend time planning out your project. This will save you tons of time later on. First I would implement the motors; make sure they move, and make sure the robot can handle motion in the environment. This validates all your hardware. Then implement the sensors, lastly build your finite state machine.

Good luck.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.