Orocos Script vs Lua Script

Hi Developers & Users,

Somebody can show me about the differences between Orocos Scripting and Lua Scripting? because my first impression is that with both we can configurate the same things and have more or less the same powerfull, but the Orocos Script shows as more clean than Lua. What's the differences for choose them?

Thanks in advance, Toni

Orocos Script vs Lua Script

On Mon, 26 Sep 2011, antonio [dot] castellon [..] ... wrote:

> Somebody can show me about the differences between Orocos Scripting and
> Lua Scripting? because my first impression is that with both we can
> configurate the same things and have more or less the same powerfull, but
> the Orocos Script shows as more clean than Lua. What's the differences
> for choose them?

The differences are the traditional differences between a scripting
language and a compiled language. Basically the trade-off between
efficiency of the code versus efficiency of the coding. For example,
Lua scripts will never be as hard realtime as compiled C++ code; but
changing some parameters in a program while developing an application will
always be faster with a scripting language then when one has to recompile
or to edit and reload an XML file.

> Thanks in advance,
> Toni

Herman

enkulator's picture

Orocos Script vs Lua Script

Thanks Herman, sorry for my english ... I asking about the differences
between: Lua and Orocos. both are scripting. What is the difference between
them?

Thanks in advance,
Toni

On Mon, Sep 26, 2011 at 13:46, Herman Bruyninckx <
Herman [dot] Bruyninckx [..] ...> wrote:

> On Mon, 26 Sep 2011, antonio [dot] castellon [..] ... wrote:
>
> Somebody can show me about the differences between Orocos Scripting and
>> Lua Scripting? because my first impression is that with both we can
>> configurate the same things and have more or less the same powerfull, but
>> the Orocos Script shows as more clean than Lua. What's the differences
>> for choose them?
>>
>
> The differences are the traditional differences between a scripting
> language and a compiled language. Basically the trade-off between
> efficiency of the code versus efficiency of the coding. For example,
> Lua scripts will never be as hard realtime as compiled C++ code; but
> changing some parameters in a program while developing an application will
> always be faster with a scripting language then when one has to recompile
> or to edit and reload an XML file.
>
> Thanks in advance,
>> Toni
>>
>
> Herman
>

Orocos Script vs Lua Script

On Sep 26, 2011, at 07:51 , Antonio Castellon wrote:

> Thanks Herman, sorry for my english ... I asking about the differences between: Lua and Orocos. both are scripting. What is the difference between them?

Herman actually did answer that question. I understand the english-as-a-second-language difficulties ... :-)

He is simply comparing the traditional Orocos scripts (which are turned into compiled C++ code), with Lua scripts. Yes, both are scripts, but Lua is a full language. The Orocos scripts are not, the tradeoff being that Orocos scripts are hard-realtime and they are more higher performance.

HTH
S

> Thanks in advance,
> Toni
>
> On Mon, Sep 26, 2011 at 13:46, Herman Bruyninckx <Herman [dot] Bruyninckx [..] ...> wrote:
> On Mon, 26 Sep 2011, antonio [dot] castellon [..] ... wrote:
>
> Somebody can show me about the differences between Orocos Scripting and
> Lua Scripting? because my first impression is that with both we can
> configurate the same things and have more or less the same powerfull, but
> the Orocos Script shows as more clean than Lua. What's the differences
> for choose them?
>
> The differences are the traditional differences between a scripting
> language and a compiled language. Basically the trade-off between
> efficiency of the code versus efficiency of the coding. For example,
> Lua scripts will never be as hard realtime as compiled C++ code; but
> changing some parameters in a program while developing an application will
> always be faster with a scripting language then when one has to recompile
> or to edit and reload an XML file.
>
> Thanks in advance,
> Toni
>
> Herman

Orocos Script vs Lua Script

On Mon, Sep 26, 2011 at 02:04:17PM +0200, S Roderick wrote:
> On Sep 26, 2011, at 07:51 , Antonio Castellon wrote:
>
>
> Thanks Herman, sorry for my english ... I asking about the differences
> between: Lua and Orocos. both are scripting. What is the difference
> between them?
>
>
> Herman actually did answer that question. I understand the
> english-as-a-second-language difficulties ... :-)
>
> He is simply comparing the traditional Orocos scripts (which are turned into
> compiled C++ code), with Lua scripts. Yes, both are scripts, but Lua is a full
> language. The Orocos scripts are not, the tradeoff being that Orocos scripts
> are hard-realtime and they are more higher performance.

Have you actually done some benchmarking? Otherwise you should not
make such statements. I ran some simple benchmarks that suggested Lua
scripts run at least ~2x faster (not going through the current type
system).

It is true, however, that it is still easier to be hard real-time safe
in Orocos scripting than with Lua. Although it is possible with both.

Markus

Orocos Script vs Lua Script

On Sep 26, 2011, at 17:14 , Markus Klotzbuecher wrote:

> On Mon, Sep 26, 2011 at 02:04:17PM +0200, S Roderick wrote:
>> On Sep 26, 2011, at 07:51 , Antonio Castellon wrote:
>>
>>
>> Thanks Herman, sorry for my english ... I asking about the differences
>> between: Lua and Orocos. both are scripting. What is the difference
>> between them?
>>
>>
>> Herman actually did answer that question. I understand the
>> english-as-a-second-language difficulties ... :-)
>>
>> He is simply comparing the traditional Orocos scripts (which are turned into
>> compiled C++ code), with Lua scripts. Yes, both are scripts, but Lua is a full
>> language. The Orocos scripts are not, the tradeoff being that Orocos scripts
>> are hard-realtime and they are more higher performance.
>
> Have you actually done some benchmarking? Otherwise you should not
> make such statements. I ran some simple benchmarks that suggested Lua
> scripts run at least ~2x faster (not going through the current type
> system).

No, I have not. It would be great if you could publish such benchmarks?!

> It is true, however, that it is still easier to be hard real-time safe
> in Orocos scripting than with Lua. Although it is possible with both.

+1

enkulator's picture

Orocos Script vs Lua Script

Thanks Roderick

But I use the Oropcos Script outside of the components, it's a correct way
to use it? I'm using "deploy-gnulinux -start myScript.ops" and my components
don0t have any reference to Orocos Script.

Toni.

On Mon, Sep 26, 2011 at 14:04, S Roderick <kiwi [dot] net [..] ...> wrote:

> On Sep 26, 2011, at 07:51 , Antonio Castellon wrote:
>
> Thanks Herman, sorry for my english ... I asking about the differences
> between: Lua and Orocos. both are scripting. What is the difference between
> them?
>
>
> Herman actually did answer that question. I understand the
> english-as-a-second-language difficulties ... :-)
>
> He is simply comparing the traditional Orocos scripts (which are turned
> into compiled C++ code), with Lua scripts. Yes, both are scripts, but Lua is
> a full language. The Orocos scripts are not, the tradeoff being that Orocos
> scripts are hard-realtime and they are more higher performance.
>
> HTH
> S
>
> Thanks in advance,
> Toni
>
> On Mon, Sep 26, 2011 at 13:46, Herman Bruyninckx <
> Herman [dot] Bruyninckx [..] ...> wrote:
>
>> On Mon, 26 Sep 2011, antonio [dot] castellon [..] ... wrote:
>>
>> Somebody can show me about the differences between Orocos Scripting and
>>> Lua Scripting? because my first impression is that with both we can
>>> configurate the same things and have more or less the same powerfull, but
>>> the Orocos Script shows as more clean than Lua. What's the differences
>>> for choose them?
>>>
>>
>> The differences are the traditional differences between a scripting
>> language and a compiled language. Basically the trade-off between
>> efficiency of the code versus efficiency of the coding. For example,
>> Lua scripts will never be as hard realtime as compiled C++ code; but
>> changing some parameters in a program while developing an application will
>> always be faster with a scripting language then when one has to recompile
>> or to edit and reload an XML file.
>>
>> Thanks in advance,
>>> Toni
>>>
>>
>> Herman
>>
>
>

Orocos Script vs Lua Script

On Sep 26, 2011, at 08:16 , Antonio Castellon wrote:

> Thanks Roderick
>
> But I use the Oropcos Script outside of the components, it's a correct way to use it? I'm using "deploy-gnulinux -start myScript.ops" and my components don0t have any reference to Orocos Script.

"myScript.ops" is an Orocos script.
S

enkulator's picture

Orocos Script vs Lua Script

Yes it is,
I try to execute the next test script to understand Orocos-Script
("deploy-gnulinux
-start myScript.ops"):

import("orocos/ocl");
require("print");
loadComponent("myDriver","::SensorDriver"); // producer
Driver21.setPeriod(0.5);

StateMachine TestDriver
{
initial state SETUP
{
var bool isCfgOk = false

entry
{
isCfgOk = ( myDriver.configure() == false )
print.ln(".......................... SETUP")
}

exit
{
print.ln(".......................... <exit>");
}

transitions {
if (isCfgOk==false) then select FAILURE
if (isCfgOk==true) then select RUNNING
}
}

state RUNNING
{
entry
{
print.ln(".......................... RUNNING")
myDriver.start()
}
}

state FAILURE
{
entry
{
print.ln("........................... Configuration Components failure.
¡¡¡¡")
}

transition if (true) then select SHUTDOWN
}

final state SHUTDOWN
{
entry
{
print.ln(".......................... SHUTDOWN")
myDriver21.stop()
}
}
}

RootMachine TestDriver the_statemachine
the_statemachine.activate();
the_statemachine.start();

And the Component is loaded correctly, but the statemachine stopped in
STATUS state and nothing more is executed.
the myDriver has not reference to the StateMachine, I try that the state
machine execute the workflow states and execute the methods of thge
components, perhaps I understand incorrectly the mode to be used and is
necessary that the Component have a reference on startHook and stopHook to
of the stateMachine in order to control the flow.... then, I have included a
new component that use ScriptingService on it (start/stop|hook) like:

...
scripting::ScriptingService::shared_ptr sa =
boost::dynamic_pointer_cast<scripting::ScriptingService>(provides()->getService("scripting"));
scripting::StateMachinePtr sm =
sa->getStateMachine("the_statemachine");
if (!sm) {
log(Error) << "State Machine the_statemachine not loaded in
ModeSwitch."<< endlog();
return false;
}
return sm->activate() && sm->start();

...

but when I run the component appear the next error:

deployer-gnulinux: /usr/local/include/boost/smart_ptr/shared_ptr.hpp:414: T*
boost::shared_ptr<T>::operator->() const [with T =
RTT::scripting::ScriptingService]: Assertion `px != 0' failed.

Any idea¿?
Thanks in advance for your time and sorry for the masters, but I'm a newbie
on Orocos.
Toni

On Mon, Sep 26, 2011 at 14:20, Stephen Roderick <kiwi [dot] net [..] ...> wrote:

> On Sep 26, 2011, at 08:16 , Antonio Castellon wrote:
>
> > Thanks Roderick
> >
> > But I use the Oropcos Script outside of the components, it's a correct
> way to use it? I'm using "deploy-gnulinux -start myScript.ops" and my
> components don0t have any reference to Orocos Script.
>
> "myScript.ops" is an Orocos script.
> S
>
>

enkulator's picture

Orocos Script vs Lua Script

Sorry, Forget my questions I just understand how it works.

On Mon, Sep 26, 2011 at 14:38, Antonio Castellon <
antonio [dot] castellon [..] ...> wrote:

>
> Yes it is,
> I try to execute the next test script to understand Orocos-Script ("deploy-gnulinux
> -start myScript.ops"):
>
> import("orocos/ocl");
> require("print");
> loadComponent("myDriver","::SensorDriver"); // producer
> Driver21.setPeriod(0.5);
>
> StateMachine TestDriver
> {
> initial state SETUP
> {
> var bool isCfgOk = false
>
> entry
> {
> isCfgOk = ( myDriver.configure() == false )
> print.ln(".......................... SETUP")
> }
>
> exit
> {
> print.ln(".......................... <exit>");
> }
>
> transitions {
> if (isCfgOk==false) then select FAILURE
> if (isCfgOk==true) then select RUNNING
> }
> }
>
> state RUNNING
> {
> entry
> {
> print.ln(".......................... RUNNING")
> myDriver.start()
> }
> }
>
> state FAILURE
> {
> entry
> {
> print.ln("........................... Configuration Components failure.
> ¡¡¡¡")
> }
>
> transition if (true) then select SHUTDOWN
> }
>
> final state SHUTDOWN
> {
> entry
> {
> print.ln(".......................... SHUTDOWN")
> myDriver21.stop()
> }
> }
> }
>
> RootMachine TestDriver the_statemachine
> the_statemachine.activate();
> the_statemachine.start();
>
>
> And the Component is loaded correctly, but the statemachine stopped in
> STATUS state and nothing more is executed.
> the myDriver has not reference to the StateMachine, I try that the state
> machine execute the workflow states and execute the methods of thge
> components, perhaps I understand incorrectly the mode to be used and is
> necessary that the Component have a reference on startHook and stopHook to
> of the stateMachine in order to control the flow.... then, I have included a
> new component that use ScriptingService on it (start/stop|hook) like:
>
> ...
> scripting::ScriptingService::shared_ptr sa =
> boost::dynamic_pointer_cast<scripting::ScriptingService>(provides()->getService("scripting"));
> scripting::StateMachinePtr sm =
> sa->getStateMachine("the_statemachine");
> if (!sm) {
> log(Error) << "State Machine the_statemachine not loaded in
> ModeSwitch."<< endlog();
> return false;
> }
> return sm->activate() && sm->start();
>
> ...
>
>
> but when I run the component appear the next error:
>
> deployer-gnulinux: /usr/local/include/boost/smart_ptr/shared_ptr.hpp:414:
> T* boost::shared_ptr<T>::operator->() const [with T =
> RTT::scripting::ScriptingService]: Assertion `px != 0' failed.
>
> Any idea¿?
> Thanks in advance for your time and sorry for the masters, but I'm a newbie
> on Orocos.
> Toni
>
> On Mon, Sep 26, 2011 at 14:20, Stephen Roderick <kiwi [dot] net [..] ...> wrote:
>
>> On Sep 26, 2011, at 08:16 , Antonio Castellon wrote:
>>
>> > Thanks Roderick
>> >
>> > But I use the Oropcos Script outside of the components, it's a correct
>> way to use it? I'm using "deploy-gnulinux -start myScript.ops" and my
>> components don0t have any reference to Orocos Script.
>>
>> "myScript.ops" is an Orocos script.
>> S
>>
>>
>