Society of Robots - Robot Forum

General Misc => Misc => Topic started by: xilc on February 06, 2013, 06:54:37 PM

Title: Considering Mechanical Engineering, advice on robotics please?
Post by: xilc on February 06, 2013, 06:54:37 PM
Hi there, I find making robots very interesting, and in fact, I am considering going to college for mechanical engineering with a focus of robotics. However, I did have a few questions first...

[li]How difficult is it to create a really, really good robot? Like, say for example I want a robot that can drive around in all directions, and has an arm attached to it to pick up something? How hard is it to make a robot of such caliber?
[/li][/list]
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: jwatte on February 06, 2013, 07:23:00 PM
People will come in and mention various approaches to microcontroller and robot programming that don't *require* C knowledge. BASIC stamp, Netduino, LEGO Mindstorms graphical GUIs, and the like.
People who do this may mean well, but they give bad advice for the purposes of career development. For all real intents and purposes, you need to learn C (and, likely, C++) if you want to get into embedded microcontrollers. It's the closest you can get to a "universal language" for computer programming in general, and especially for low-level devices. There exists devices where C won't work, but those are few, far between, and usually in the margins.

A robot that can drive in all directions, and has an arm? You can buy components off the shelf, screw them together, and get it up and running in a week.
A robot that can actually fulfill specific requirements robustly? That's probably much harder, because anything from power cords and table legs, to bad ligthing and poorly oriented target objects, will challenge the "simple" approaches to robot behavior.
You may start out with a simple robot that can run around without bumping into walls, but to solve all the "real world" problems you end up solving problems ranging across steroscopic cameras, fuzzy object detection/image recognition, SLAM (simultaneous locating and mapping), path planning, safety interlocks, battery runtime, mechanical system inaccuracies, and a dozen other real-world challenges I'm forgetting about or haven't even learned about yet.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Gertlex on February 06, 2013, 11:04:13 PM
On the programming note, I will echo JWatte in saying that avoiding C is pointless.  But rest assured, you don't need to be an expert to get started... though that never hurts when debugging code.

My recommendation is that every engineer should understand programming logic.  In particular, I've found C and Python to be a good pair of skills to have.  Python is more of a scripting language, and ends up being well suited for computer-side interfacing with robots (e.g. logging data).

Check out the $50 robot tutorial on this website, if you haven't already.  It won't be a 'really good bot', but it will definitely get you hooked.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Admin on February 07, 2013, 02:34:55 PM
I studied mechanical engineering in college.

For my electives, I took classes such as electronics and three semesters of C++ programming. C++ is very similar to C, so I managed to learn C on my own after that.

Higher level languages, such as java, have fewer similarities with C so if your goal is robot programming, don't go that route.

C is used to program 99% of all robots. Period. :P
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: jkerns on February 08, 2013, 10:23:50 AM
What kind of job do you want for making robots?

If you end up at an industrial robotics company there are lots of jobs that don't involve software. Designing work stations for an assembly line, designing new end effectors, etc.

But, having an understanding of software is a good thing and would improve your marketability if you want to have a robotics related job. You will at least need to know how your device interacts with the software. And, likely you will be involved with testing your mechanical device which will involve instrumentation / interfacing / data collection. And the ability to write up some test code to drive the device for testing may  be essential.

Learn C.

Learn math (you automatically get that as part of your Mechanical Engineering Degree)

Learn at least some electronics.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: xilc on February 08, 2013, 02:45:14 PM
What kind of job do you want for making robots?

If you end up at an industrial robotics company there are lots of jobs that don't involve software. Designing work stations for an assembly line, designing new end effectors, etc.


Learn C.

Learn at least some electronics.

My dream job would be working at NASA, or working in Aerospace/Astrospace Engineering, quite honestly. Making a new mars rover robot would be pretty awesome. I have high hopes like that.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Admin on February 08, 2013, 03:27:38 PM
The #1 way of getting a robotics job is to make a few really impressive robots on your own free time. ;D
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: xilc on February 08, 2013, 05:44:44 PM
The #1 way of getting a robotics job is to make a few really impressive robots on your own free time. ;D

I'm just confused on the programming languages used to program the bots... Is it C, or C++? And I'm just amazed at the way it's written. I'll take Stampy's code, for example... I downloaded Stampy's source code.

Code: [Select]
else if (scan_angle < 50)//if target is too far on left
{
servoLeft();//turn towards target
set_led(YELLOW, 1);
set_led(GREEN, 0);
scan_angle+=1;//scanner turns right while robot turns left
}
else //centered on target
{
servoForward();//drive straight
set_led(YELLOW, 1);
set_led(GREEN, 1);
}
}

That's just amazing, like, how simple it is...
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Gertlex on February 08, 2013, 05:59:15 PM
In all the robot coding I've ever dealt with, there are libraries of code (written by others) behind the code you write.  The compiler then takes C/C++ etc., and creates the lower level code that gets put on the robot. Generally, this lower level language is 'Assembly,' and Assembly differs between different microcontrollers.

The code you quoted is valid C and valid C++.  The languages are very similar, and for much of the more basic stuff, identical.  It's also a simple example :)

The complexity in coding often comes in the algorithms, and in tying the algorithms together.  The example  you quote isn't complex enough to merit the term 'algorithm.'  Tying code together can be particularly complex.  You can have dozens of small, simple functions, but the way they interact together can get very, painfully complex.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: xilc on February 11, 2013, 09:54:42 PM
In all the robot coding I've ever dealt with, there are libraries of code (written by others) behind the code you write.  The compiler then takes C/C++ etc., and creates the lower level code that gets put on the robot. Generally, this lower level language is 'Assembly,' and Assembly differs between different microcontrollers.

The code you quoted is valid C and valid C++.  The languages are very similar, and for much of the more basic stuff, identical.  It's also a simple example :)

The complexity in coding often comes in the algorithms, and in tying the algorithms together.  The example  you quote isn't complex enough to merit the term 'algorithm.'  Tying code together can be particularly complex.  You can have dozens of small, simple functions, but the way they interact together can get very, painfully complex.

So basically what you're telling me is that stampy's code references a library someone else wrote, right? Because I'm just confused by the coding I'm seeing.

"servoLeft()"

If I studied regular c/c++, I wouldn't see the function servoLeft, so I assume there are different robotics-specific libraries that are used to program a microcontroller?
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Gertlex on February 11, 2013, 11:55:35 PM
The answer to both questions there is 'yes'.
Title: Re: Considering Mechanical Engineering, advice on robotics please?
Post by: Admin on February 12, 2013, 12:05:07 PM
Stampy used an old library written by Botrics (but their site no longer works). At the time I'd argue it was the best out there.

For the original Axon I wrote a library to imitate the Botrics library, but since then WebbotLib (written by Webbot) has taken my rough code (and concepts) to the next level.