[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Which is better for robot control, Lua or Python?What aspects,should be considered when making such a choice?
- From: 孙世龙 sunshilong <sunshilong369@...>
- Date: Fri, 29 Jan 2021 14:30:01 +0800
Thank you for your detailed explanation.
>How well does your target robot support your language. Are their
>libraries to support the drive base, sensors, remote control, etc.
The drivers are all written in C.
Neither Lua nor Python directly controls the peripheral devices.
>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.
I googled and found that there are ROS clients for both Lua and
Python (for details, see http://wiki.ros.org/Client%20Libraries).
I can't agree more, the eco-system is a key factor indeed.
And it seems that there are more libraries (developed by the third
party) for Python.
>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?
It seems that both Lua and Python are not friendly to multithreaded
programming.
Thank you for your attention to my question.
Best regards
sunshilong
On Thu, Jan 28, 2021 at 10:14 PM Foster Schucker <Foster@schucker.org> wrote:
>
> * 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!