1
$\begingroup$

I would bet that usually these are compiled for better performance, and of lawful reasons (make it harder for any user to save code without decompiling), though I'm not sure.

In any case, I believe performance is the major consideration (I'm very new to programming and cannot tell how data processing of robots is different, say, than that of high-end PC games or heavy PC software and if performance considerations will be usually similar or how different).

Are robot's codes usually installed when compiled from source code in an external computer or as pure source codes interpreted by some engine installed on the robots operating system?

(please example on JavaScript and Raspberry pi if possible at the moment).

$\endgroup$
8
  • $\begingroup$ Did you mean "compile or interpreted"? $\endgroup$
    – st2000
    Aug 21, 2017 at 12:09
  • $\begingroup$ I meant in the context of compiling your program code as for example, when you buy a PC game and you open its EXE file in a notepad, you see machine code and in none of the files you will find source code, usually. $\endgroup$
    – user16003
    Aug 21, 2017 at 13:03
  • $\begingroup$ Let me be clearer. Did you mean to say "interpreted" everywhere you said "decompiled (sourced)"? $\endgroup$
    – st2000
    Aug 21, 2017 at 13:07
  • $\begingroup$ I don't think so because even though I'm new in programming, I know that a source code could be either interpreted or compiled each time it is executed and just once by the human programmer. $\endgroup$
    – user16003
    Aug 22, 2017 at 7:50
  • $\begingroup$ "...compiled each time it is executed..." Code that is compiled and put into something like a robot is never compiled again. Let me try again, I think you are confusing people and may not be getting the answers you are looking for because the term "decopiled (sourced)" should be replaced with "interpreted". $\endgroup$
    – st2000
    Aug 22, 2017 at 12:23

2 Answers 2

4
$\begingroup$

Robots tend to be portable devices powered by batteries. Portable battery operated devices tend to use embedded processors with limited power and memory. Compiled code has several advantages over interpreted code in such applications:

  • Compiled code usually takes up less space. So you can have more code in the same amount of space.
  • Compiled code usually execute faster. So batteries last longer.
  • An interpreter does not need to be installed into the robot's limited memory. This frees up more space for code or data storage.
  • As compiled code usually requires less resources on the mobile platform, the mobile platform can be made with less expensive parts.

That said, it is not necessarily true that compiling code obfuscates it. If enough effort is invested, nearly any compiled code can be understood. It then becomes a matter of which is more efficient. Replicating the features or backward engineering the compiled code.

Why most people tend to use interpretive languages such a Python on a Raspberry Pi is confusing. (The Raspberry Pi is fast becoming a complete computer.) This is likely because interpretive languages tend to be less confusing to use. Where compiling code adds steps to the development process, interpretive code is simply run after specifying the interpreter.

$\endgroup$
1
$\begingroup$

Many people use Python to control robots. While it does use more computing resources to interpret the python code, it may take less time for the programmer to develop in an interpreted language.

Advantages of Python:

  1. Many programmers are familiar with Python because it is often taught as a first language in schools.
  2. It can be faster to program in Python than in c/c++ because you don't constantly have the compile/test cycles.
  3. There are even versions of python that will run on microcontrollers similar to the Arduino. The one I'm thinking of is MicroPython, but there is also WiringPi.
  4. There are often Python API's for compiled robot software. For example, ROS is usable through Python.

The main disadvantage is that you need something like a Raspberry Pi (at a minimum) to the full version of Python. Even the Raspberry Pi Zero is a powerful brain for a robot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.