lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


*  Which is better for robot control, Lua or Python?
* What aspects should be considered when making such a choice?

Let me start off with that I've been doing some kind of robot programming since the 70's.

I've used:ASM, BASIC, C, C++, Fortran, Lisp, Logo, Lua, Processing (now called Arduino) and Python. So almost any language can be used. But I'll stick to the 2 you asked about.

Your choices can be driven by two factors:
1) How well does your target robot support your language. Are their libraries to support the drive base, sensors, remote control, etc. ? Trying to port interfaces to a different language is not a fun task. You should also look at the eco-system around the robot. Things like the use of Robot Operating System - ROS will dictate your language choices. Because C is supported by most robots, you can do a Python or Lua wrapper in C and go from there. It's a lot of work
to create those wrappers.

For example the FIRST Robotics Competition officially only supports a few languages: C, Java and Mathlab. A team spent a long time to build Python wrappers. They released
them and about half a dozen teams use them.

2) How well do you know your language. Trying to learn the robot part AND a new language at the same time is a huge pain. I've taught robotics classes across the years and I get roboteers to write simple remote control routines first (move a joystick, read that value and
send it to the motor), since that's a simple follow along.

Once you get to sensors you need to think of them as events. Limit switch is pushed, sonar sensor sending values, etc. You need to be constantly looking at them in a loop and making decisions based on their values. Both Lua and Python support the programming you need to do, do you have the programming skills to be able to handle multiple things
happening at the same time?

While roboteers get excited about "We can now do tasks or co-routines" the reality is that you can code pretty decent robot actions without them. That lets you duck the fun world
of deadlocks across tasks.

Good luck!