Deployment within a state machine

Hi,

I am trying to achieve the following:

There is a Supervisor (LuaComponent) loading an fsm. In one of the states
of this fsm, I want to deploy stuff, currently i.e. connect some ports, and
get also a return value to check whether the deployment was successful or
not.
app_launch = state {
entry = function() depl:runScript("app_path/comp.ops") end,
doo = function() app_deployed = depl:appConnections() end,
},

Deployment within a state machine

Hi,

I am trying to achieve the following:

There is a Supervisor (LuaComponent) loading an fsm. In one of the states
of this fsm, I want to deploy stuff, currently i.e. to connect some ports,
and get also a return value to check whether the deployment was successful
or not. The state looks now like this:

app_launch = state {
entry = function() depl:runScript("app_path/comp.ops") end,
doo = function() app_deployed = depl:appConnections() end,
},

In the comp.ops file, there is:

export bool appConnections(){
#########################################
## connect lwr to the Supervisor component
var bool conn1 = false, conn2 = false
var ConnPolicy cp
conn1 =
connect("lwr.CartesianPositionCommand","Supervisor.cart_pos_cmd_out",cp)

conn2 =
connect("lwr.CartesianPosition","Supervisor.cart_pos_msr_in",cp)

if (conn1 == true & conn2 == true) then return true

return false
}

When reaching the app_launch state, the following error shows up (PROBLEM
1):

30.306 [ ERROR ][Logger] DOO doo program of state
'root.cmd_mode.app_launch' failed:
./coordination/lwr_setup_fsm_execute.lua:34: attempt to call method
'appConnections' (a nil value)

However, when I check the interface of the deployer via the Taskbrowser,
appConnections is in the list of available operations. Just like runScript
is in the list and which does work fine... But when I try to execute the
appConnections function manually via the Taskbrowser, the Taskbrowser hangs
after executing the function (PROBLEM 2)

I am using OCL version 2.5.0 under electric.

Thanks,

Bert

Deployment within a state machine

On 12/07/2012 11:12 AM, Bert Willaert wrote:
> Hi,
>
> I am trying to achieve the following:
>
> There is a Supervisor (LuaComponent) loading an fsm. In one of the states of this fsm, I want to deploy stuff, currently i.e. to connect some ports, and get also a return
> value to check whether the deployment was successful or not. The state looks now like this:
>
> app_launch = state {
> entry = function() depl:runScript("app_path/comp.ops") end,
> doo = function() app_deployed = depl:appConnections() end,
> },
>
> In the comp.ops file, there is:
>
> export bool appConnections(){
> #########################################
> ## connect lwr to the Supervisor component
> var bool conn1 = false, conn2 = false
> var ConnPolicy cp
> conn1 = connect("lwr.CartesianPositionCommand","Supervisor.cart_pos_cmd_out",cp)
> conn2 = connect("lwr.CartesianPosition","Supervisor.cart_pos_msr_in",cp)
>
> if (conn1 == true & conn2 == true) then return true
>
> return false
> }
>
> When reaching the app_launch state, the following error shows up (PROBLEM 1):
>
> 30.306 [ ERROR ][Logger] DOO doo program of state 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm_execute.lua:34: attempt to call method 'appConnections'
> (a nil value)
>
> However, when I check the interface of the deployer via the Taskbrowser, appConnections is in the list of available operations. Just like runScript is in the list and which
> does work fine... But when I try to execute the appConnections function manually via the Taskbrowser, the Taskbrowser hangs after executing the function (PROBLEM 2)

the lua deployer doesn't have a appConnections function
you can check what you can call on the deployer like this: rosrun ocl rttlua-gnulinux
> tc=rtt.getTC()
> depl=tc:getPeer("deployer")
> =depl
TaskContext: deployer
state: Stopped
isActive: true
getPeriod: 0
peers: lua
ports:
properties:
RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain/ocl/../install/lib/orocos // Locations to look for components. Use a colon
or semi-colon separated list of paths. Defaults to the environment variable with the same name.
AutoUnload (bool) = true // Stop, cleanup and unload all components loaded by the DeploymentComponent when it is destroyed.
operations:
bool addPeer(string const& From, string const& To) // Add a peer to a Component.
bool aliasPeer(string const& From, string const& To, string const& Alias) // Add a peer to a Component with an alternative name.
bool cleanupComponents() // Cleanup all the configured components (with or without AutoConf).
void clearConfiguration() // Clear all configuration settings.
bool configureComponents() // Apply a loaded configuration to the components and configure() them if AutoConf is set.
bool connect(string const& portOne, string const& portTwo, ConnPolicy policy) // Creates a connection between two ports.
bool connectPeers(string const& One, string const& Two) // Connect two Components known to this Component.
bool connectPorts(string const& One, string const& Two) // DEPRECATED. Connect the Data Ports of two Components known to this Component.
bool connectServices(string const& One, string const& Two) // Connect the matching provides/requires services of two Components known to this Component.
bool connectTwoPorts(string const& One, string const& PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect two ports of Components known to this
Component.
bool createStream(string const& component, string const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from a port.
void displayComponentTypes() // Print out a list of all component types this component can create.
strings getComponentTypes() // return a vector of all component types this component can create.
bool import(string const& Package) // Import all components, plugins and typekits from a given package or directory in the search path.
void kickOut(string const& File) // Calls stopComponents, cleanupComponents and unloadComponents in a row.
bool kickOutAll() // Calls stopComponents, cleanupComponents and unloadComponents in a row.
bool kickOutComponent(string const& comp_name) // Calls stopComponents, cleanupComponent and unloadComponent in a row.
bool kickStart(string const& File) // Calls loadComponents, configureComponents and startComponents in a row.
bool loadComponent(string const& Name, string const& Type) // Load a new component instance from a library.
bool loadComponents(string const& File) // Load components listed in an XML configuration file.
bool loadConfiguration(string const& File) // Load a new XML configuration from a file (identical to loadComponents).
bool loadConfigurationString(string const& Text) // Load a new XML configuration from a string.
bool loadLibrary(string const& Name) // Load a new library (component, plugin or typekit) into memory.
bool loadService(string const& Name, string const& Service) // Load a discovered service or plugin in an existing component.
void path(string const& Paths) // Add additional directories to the component search path without importing them.
void removePeer(string const& PeerName) // Remove a peer from this Component.
bool runScript(string const& File) // Runs a script.
bool setActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach an activity to a Component.
bool setActivityOnCPU(string const& CompName, double Period, int Priority, int SchedType, uint CPU) // Attach an activity to a Component.
bool setMasterSlaveActivity(string const& Master, string const& Slave) // Attach a slave activity with a master to a Component. The slave becomes a peer of the master
as well.
bool setPeriodicActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach a periodic activity to a Component.
bool setSequentialActivity(string const& CompName) // Attach a 'stand alone' sequential activity to a Component.
bool setSlaveActivity(string const& CompName, double Period) // Attach a 'stand alone' slave activity to a Component.
bool startComponents() // Start the components configured for AutoStart.
bool stopComponents() // Stop all the configured components (with or without AutoStart).
bool stream(string const& port, ConnPolicy policy) // Creates a stream to or from a port.
bool unloadComponent(string const& Name) // Unload a loaded component instance.
bool unloadComponents() // Unload all the previously loaded components.
bool waitForInterrupt() // This operation waits for the SIGINT signal and then returns. This allows you to wait in a script for ^C.
bool waitForSignal(int signal number) // This operation waits for the signal of the argument and then returns. This allows you to wait in a script for any signal except
SIGKILL and SIGSTOP.

>
> I am using OCL version 2.5.0 under electric.
>
> Thanks,
>
> Bert
>
>
>
>
>
>

Deployment within a state machine

To clarify a bit more my question. I am using the standard deployer first
of all, and the appConnections is an operation I added via the comp.ops
script. So for sure the standard lua deployer does not have this operation.

On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen <
dominick [dot] vanthienen [..] ...> wrote:

>
>
> On 12/07/2012 11:12 AM, Bert Willaert wrote:
> > Hi,
> >
> > I am trying to achieve the following:
> >
> > There is a Supervisor (LuaComponent) loading an fsm. In one of the
> states of this fsm, I want to deploy stuff, currently i.e. to connect some
> ports, and get also a return
> > value to check whether the deployment was successful or not. The state
> looks now like this:
> >
> > app_launch = state {
> > entry = function() depl:runScript("app_path/comp.ops") end,
> > doo = function() app_deployed = depl:appConnections() end,
> > },
> >
> > In the comp.ops file, there is:
> >
> > export bool appConnections(){
> > #########################################
> > ## connect lwr to the Supervisor component
> > var bool conn1 = false, conn2 = false
> > var ConnPolicy cp
> > conn1 =
> connect("lwr.CartesianPositionCommand","Supervisor.cart_pos_cmd_out",cp)
> > conn2 =
> connect("lwr.CartesianPosition","Supervisor.cart_pos_msr_in",cp)
> >
> > if (conn1 == true & conn2 == true) then return true
> >
> > return false
> > }
> >
> > When reaching the app_launch state, the following error shows up
> (PROBLEM 1):
> >
> > 30.306 [ ERROR ][Logger] DOO doo program of state
> 'root.cmd_mode.app_launch' failed:
> ./coordination/lwr_setup_fsm_execute.lua:34: attempt to call method
> 'appConnections'
> > (a nil value)
> >
> > However, when I check the interface of the deployer via the Taskbrowser,
> appConnections is in the list of available operations. Just like runScript
> is in the list and which
> > does work fine... But when I try to execute the appConnections function
> manually via the Taskbrowser, the Taskbrowser hangs after executing the
> function (PROBLEM 2)
>
> the lua deployer doesn't have a appConnections function
> you can check what you can call on the deployer like this: rosrun ocl
> rttlua-gnulinux
> > tc=rtt.getTC()
> > depl=tc:getPeer("deployer")
> > =depl
> TaskContext: deployer
> state: Stopped
> isActive: true
> getPeriod: 0
> peers: lua
> ports:
> properties:
> RTT_COMPONENT_PATH (string) =
> /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain/ocl/../install/lib/orocos
> // Locations to look for components. Use a colon
> or semi-colon separated list of paths. Defaults to the environment
> variable with the same name.
> AutoUnload (bool) = true // Stop, cleanup and unload all components
> loaded by the DeploymentComponent when it is destroyed.
> operations:
> bool addPeer(string const& From, string const& To) // Add a peer to a
> Component.
> bool aliasPeer(string const& From, string const& To, string const&
> Alias) // Add a peer to a Component with an alternative name.
> bool cleanupComponents() // Cleanup all the configured components
> (with or without AutoConf).
> void clearConfiguration() // Clear all configuration settings.
> bool configureComponents() // Apply a loaded configuration to the
> components and configure() them if AutoConf is set.
> bool connect(string const& portOne, string const& portTwo, ConnPolicy
> policy) // Creates a connection between two ports.
> bool connectPeers(string const& One, string const& Two) // Connect two
> Components known to this Component.
> bool connectPorts(string const& One, string const& Two) // DEPRECATED.
> Connect the Data Ports of two Components known to this Component.
> bool connectServices(string const& One, string const& Two) // Connect
> the matching provides/requires services of two Components known to this
> Component.
> bool connectTwoPorts(string const& One, string const& PortOne, string
> const& Two, string const& PortTwo) // DEPRECATED. Connect two ports of
> Components known to this
> Component.
> bool createStream(string const& component, string const& port,
> ConnPolicy policy) // DEPRECATED. Creates a stream to or from a port.
> void displayComponentTypes() // Print out a list of all component
> types this component can create.
> strings getComponentTypes() // return a vector of all component types
> this component can create.
> bool import(string const& Package) // Import all components, plugins
> and typekits from a given package or directory in the search path.
> void kickOut(string const& File) // Calls stopComponents,
> cleanupComponents and unloadComponents in a row.
> bool kickOutAll() // Calls stopComponents, cleanupComponents and
> unloadComponents in a row.
> bool kickOutComponent(string const& comp_name) // Calls
> stopComponents, cleanupComponent and unloadComponent in a row.
> bool kickStart(string const& File) // Calls loadComponents,
> configureComponents and startComponents in a row.
> bool loadComponent(string const& Name, string const& Type) // Load a
> new component instance from a library.
> bool loadComponents(string const& File) // Load components listed in
> an XML configuration file.
> bool loadConfiguration(string const& File) // Load a new XML
> configuration from a file (identical to loadComponents).
> bool loadConfigurationString(string const& Text) // Load a new XML
> configuration from a string.
> bool loadLibrary(string const& Name) // Load a new library (component,
> plugin or typekit) into memory.
> bool loadService(string const& Name, string const& Service) // Load a
> discovered service or plugin in an existing component.
> void path(string const& Paths) // Add additional directories to the
> component search path without importing them.
> void removePeer(string const& PeerName) // Remove a peer from this
> Component.
> bool runScript(string const& File) // Runs a script.
> bool setActivity(string const& CompName, double Period, int Priority,
> int SchedType) // Attach an activity to a Component.
> bool setActivityOnCPU(string const& CompName, double Period, int
> Priority, int SchedType, uint CPU) // Attach an activity to a Component.
> bool setMasterSlaveActivity(string const& Master, string const& Slave)
> // Attach a slave activity with a master to a Component. The slave becomes
> a peer of the master
> as well.
> bool setPeriodicActivity(string const& CompName, double Period, int
> Priority, int SchedType) // Attach a periodic activity to a Component.
> bool setSequentialActivity(string const& CompName) // Attach a 'stand
> alone' sequential activity to a Component.
> bool setSlaveActivity(string const& CompName, double Period) // Attach
> a 'stand alone' slave activity to a Component.
> bool startComponents() // Start the components configured for
> AutoStart.
> bool stopComponents() // Stop all the configured components (with or
> without AutoStart).
> bool stream(string const& port, ConnPolicy policy) // Creates a stream
> to or from a port.
> bool unloadComponent(string const& Name) // Unload a loaded component
> instance.
> bool unloadComponents() // Unload all the previously loaded components.
> bool waitForInterrupt() // This operation waits for the SIGINT signal
> and then returns. This allows you to wait in a script for ^C.
> bool waitForSignal(int signal number) // This operation waits for the
> signal of the argument and then returns. This allows you to wait in a
> script for any signal except
> SIGKILL and SIGSTOP.
>
>
>
>
> >
> > I am using OCL version 2.5.0 under electric.
> >
> > Thanks,
> >
> > Bert
> >
> >
> >
> >
> >
> >
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Deployment within a state machine

On 12/07/2012 12:03 PM, Bert Willaert wrote:
> To clarify a bit more my question. I am using the standard deployer first of all, and the appConnections is an operation I added via the comp.ops script. So for sure the
> standard lua deployer does not have this operation.
>

then why are you calling it on the deployer?
depl:appConnections()

> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen <dominick [dot] vanthienen [..] ... <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>
>
>
> On 12/07/2012 11:12 AM, Bert Willaert wrote:
> > Hi,
> >
> > I am trying to achieve the following:
> >
> > There is a Supervisor (LuaComponent) loading an fsm. In one of the states of this fsm, I want to deploy stuff, currently i.e. to connect some ports, and get also a
> return
> > value to check whether the deployment was successful or not. The state looks now like this:
> >
> > app_launch = state {
> > entry = function() depl:runScript("app_path/comp.ops") end,
> > doo = function() app_deployed = depl:appConnections() end,
> > },
> >
> > In the comp.ops file, there is:
> >
> > export bool appConnections(){
> > #########################################
> > ## connect lwr to the Supervisor component
> > var bool conn1 = false, conn2 = false
> > var ConnPolicy cp
> > conn1 = connect("lwr.CartesianPositionCommand","Supervisor.cart_pos_cmd_out",cp)
> > conn2 = connect("lwr.CartesianPosition","Supervisor.cart_pos_msr_in",cp)
> >
> > if (conn1 == true & conn2 == true) then return true
> >
> > return false
> > }
> >
> > When reaching the app_launch state, the following error shows up (PROBLEM 1):
> >
> > 30.306 [ ERROR ][Logger] DOO doo program of state 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm_execute.lua:34: attempt to call method
> 'appConnections'
> > (a nil value)
> >
> > However, when I check the interface of the deployer via the Taskbrowser, appConnections is in the list of available operations. Just like runScript is in the list
> and which
> > does work fine... But when I try to execute the appConnections function manually via the Taskbrowser, the Taskbrowser hangs after executing the function (PROBLEM 2)
>
> the lua deployer doesn't have a appConnections function
> you can check what you can call on the deployer like this: rosrun ocl rttlua-gnulinux
> > tc=rtt.getTC()
> > depl=tc:getPeer("deployer")
> > =depl
> TaskContext: deployer
> state: Stopped
> isActive: true
> getPeriod: 0
> peers: lua
> ports:
> properties:
> RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain/ocl/../install/lib/orocos // Locations to look for components. Use a colon
> or semi-colon separated list of paths. Defaults to the environment variable with the same name.
> AutoUnload (bool) = true // Stop, cleanup and unload all components loaded by the DeploymentComponent when it is destroyed.
> operations:
> bool addPeer(string const& From, string const& To) // Add a peer to a Component.
> bool aliasPeer(string const& From, string const& To, string const& Alias) // Add a peer to a Component with an alternative name.
> bool cleanupComponents() // Cleanup all the configured components (with or without AutoConf).
> void clearConfiguration() // Clear all configuration settings.
> bool configureComponents() // Apply a loaded configuration to the components and configure() them if AutoConf is set.
> bool connect(string const& portOne, string const& portTwo, ConnPolicy policy) // Creates a connection between two ports.
> bool connectPeers(string const& One, string const& Two) // Connect two Components known to this Component.
> bool connectPorts(string const& One, string const& Two) // DEPRECATED. Connect the Data Ports of two Components known to this Component.
> bool connectServices(string const& One, string const& Two) // Connect the matching provides/requires services of two Components known to this Component.
> bool connectTwoPorts(string const& One, string const& PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect two ports of Components known to this
> Component.
> bool createStream(string const& component, string const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from a port.
> void displayComponentTypes() // Print out a list of all component types this component can create.
> strings getComponentTypes() // return a vector of all component types this component can create.
> bool import(string const& Package) // Import all components, plugins and typekits from a given package or directory in the search path.
> void kickOut(string const& File) // Calls stopComponents, cleanupComponents and unloadComponents in a row.
> bool kickOutAll() // Calls stopComponents, cleanupComponents and unloadComponents in a row.
> bool kickOutComponent(string const& comp_name) // Calls stopComponents, cleanupComponent and unloadComponent in a row.
> bool kickStart(string const& File) // Calls loadComponents, configureComponents and startComponents in a row.
> bool loadComponent(string const& Name, string const& Type) // Load a new component instance from a library.
> bool loadComponents(string const& File) // Load components listed in an XML configuration file.
> bool loadConfiguration(string const& File) // Load a new XML configuration from a file (identical to loadComponents).
> bool loadConfigurationString(string const& Text) // Load a new XML configuration from a string.
> bool loadLibrary(string const& Name) // Load a new library (component, plugin or typekit) into memory.
> bool loadService(string const& Name, string const& Service) // Load a discovered service or plugin in an existing component.
> void path(string const& Paths) // Add additional directories to the component search path without importing them.
> void removePeer(string const& PeerName) // Remove a peer from this Component.
> bool runScript(string const& File) // Runs a script.
> bool setActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach an activity to a Component.
> bool setActivityOnCPU(string const& CompName, double Period, int Priority, int SchedType, uint CPU) // Attach an activity to a Component.
> bool setMasterSlaveActivity(string const& Master, string const& Slave) // Attach a slave activity with a master to a Component. The slave becomes a peer of the master
> as well.
> bool setPeriodicActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach a periodic activity to a Component.
> bool setSequentialActivity(string const& CompName) // Attach a 'stand alone' sequential activity to a Component.
> bool setSlaveActivity(string const& CompName, double Period) // Attach a 'stand alone' slave activity to a Component.
> bool startComponents() // Start the components configured for AutoStart.
> bool stopComponents() // Stop all the configured components (with or without AutoStart).
> bool stream(string const& port, ConnPolicy policy) // Creates a stream to or from a port.
> bool unloadComponent(string const& Name) // Unload a loaded component instance.
> bool unloadComponents() // Unload all the previously loaded components.
> bool waitForInterrupt() // This operation waits for the SIGINT signal and then returns. This allows you to wait in a script for ^C.
> bool waitForSignal(int signal number) // This operation waits for the signal of the argument and then returns. This allows you to wait in a script for any signal
> except
> SIGKILL and SIGSTOP.
>
>
>
>
> >
> > I am using OCL version 2.5.0 under electric.
> >
> > Thanks,
> >
> > Bert
> >
> >
> >
> >
> >
> >
> --
> Orocos-Users mailing list
> Orocos-Users [..] ... <mailto:Orocos-Users [..] ...>
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>

Deployment within a state machine

On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen <
dominick [dot] vanthienen [..] ...> wrote:

>
>
> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>
>> To clarify a bit more my question. I am using the standard deployer first
>> of all, and the appConnections is an operation I added via the comp.ops
>> script. So for sure the
>> standard lua deployer does not have this operation.
>>
>>
> then why are you calling it on the deployer?
> depl:appConnections()
>

Because I call the runScript("comp.ops") operation on the Deployer, so as
far as I understand the functions defined in the comp.ops file then become
operations/methods of the Deployer. This seems to be confirmed by the fact
that if I look at the interface of the Deployer in the Taskbrowser the
method 'appConnections' is in the list (after doing runScript)...

Does that make sense?

>
>
> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen <
>> dominick.vanthienen@mech.**kuleuven.be<dominick [dot] vanthienen [..] ...><mailto:
>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>
>> wrote:
>>
>>
>>
>> On 12/07/2012 11:12 AM, Bert Willaert wrote:
>> > Hi,
>> >
>> > I am trying to achieve the following:
>> >
>> > There is a Supervisor (LuaComponent) loading an fsm. In one of the
>> states of this fsm, I want to deploy stuff, currently i.e. to connect some
>> ports, and get also a
>> return
>> > value to check whether the deployment was successful or not. The
>> state looks now like this:
>> >
>> > app_launch = state {
>> > entry = function() depl:runScript("app_path/comp.**ops")
>> end,
>> > doo = function() app_deployed = depl:appConnections() end,
>> > },
>> >
>> > In the comp.ops file, there is:
>> >
>> > export bool appConnections(){
>> > ##############################**###########
>> > ## connect lwr to the Supervisor component
>> > var bool conn1 = false, conn2 = false
>> > var ConnPolicy cp
>> > conn1 = connect("lwr.**CartesianPositionCommand","**
>> Supervisor.cart_pos_cmd_out",**cp)
>> > conn2 = connect("lwr.**CartesianPosition","**
>> Supervisor.cart_pos_msr_in",**cp)
>> >
>> > if (conn1 == true & conn2 == true) then return true
>> >
>> > return false
>> > }
>> >
>> > When reaching the app_launch state, the following error shows up
>> (PROBLEM 1):
>> >
>> > 30.306 [ ERROR ][Logger] DOO doo program of state
>> 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm_**execute.lua:34:
>> attempt to call method
>> 'appConnections'
>> > (a nil value)
>> >
>> > However, when I check the interface of the deployer via the
>> Taskbrowser, appConnections is in the list of available operations. Just
>> like runScript is in the list
>> and which
>> > does work fine... But when I try to execute the appConnections
>> function manually via the Taskbrowser, the Taskbrowser hangs after
>> executing the function (PROBLEM 2)
>>
>> the lua deployer doesn't have a appConnections function
>> you can check what you can call on the deployer like this: rosrun ocl
>> rttlua-gnulinux
>> > tc=rtt.getTC()
>> > depl=tc:getPeer("deployer")
>> > =depl
>> TaskContext: deployer
>> state: Stopped
>> isActive: true
>> getPeriod: 0
>> peers: lua
>> ports:
>> properties:
>> RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/**
>> robotics-ros/packages/orocos_**toolchain/ocl/../install/lib/**orocos //
>> Locations to look for components. Use a colon
>> or semi-colon separated list of paths. Defaults to the environment
>> variable with the same name.
>> AutoUnload (bool) = true // Stop, cleanup and unload all
>> components loaded by the DeploymentComponent when it is destroyed.
>> operations:
>> bool addPeer(string const& From, string const& To) // Add a peer
>> to a Component.
>> bool aliasPeer(string const& From, string const& To, string
>> const& Alias) // Add a peer to a Component with an alternative name.
>> bool cleanupComponents() // Cleanup all the configured
>> components (with or without AutoConf).
>> void clearConfiguration() // Clear all configuration settings.
>> bool configureComponents() // Apply a loaded configuration to
>> the components and configure() them if AutoConf is set.
>> bool connect(string const& portOne, string const& portTwo,
>> ConnPolicy policy) // Creates a connection between two ports.
>> bool connectPeers(string const& One, string const& Two) //
>> Connect two Components known to this Component.
>> bool connectPorts(string const& One, string const& Two) //
>> DEPRECATED. Connect the Data Ports of two Components known to this
>> Component.
>> bool connectServices(string const& One, string const& Two) //
>> Connect the matching provides/requires services of two Components known to
>> this Component.
>> bool connectTwoPorts(string const& One, string const& PortOne,
>> string const& Two, string const& PortTwo) // DEPRECATED. Connect two ports
>> of Components known to this
>> Component.
>> bool createStream(string const& component, string const& port,
>> ConnPolicy policy) // DEPRECATED. Creates a stream to or from a port.
>> void displayComponentTypes() // Print out a list of all
>> component types this component can create.
>> strings getComponentTypes() // return a vector of all component
>> types this component can create.
>> bool import(string const& Package) // Import all components,
>> plugins and typekits from a given package or directory in the search path.
>> void kickOut(string const& File) // Calls stopComponents,
>> cleanupComponents and unloadComponents in a row.
>> bool kickOutAll() // Calls stopComponents, cleanupComponents and
>> unloadComponents in a row.
>> bool kickOutComponent(string const& comp_name) // Calls
>> stopComponents, cleanupComponent and unloadComponent in a row.
>> bool kickStart(string const& File) // Calls loadComponents,
>> configureComponents and startComponents in a row.
>> bool loadComponent(string const& Name, string const& Type) //
>> Load a new component instance from a library.
>> bool loadComponents(string const& File) // Load components
>> listed in an XML configuration file.
>> bool loadConfiguration(string const& File) // Load a new XML
>> configuration from a file (identical to loadComponents).
>> bool loadConfigurationString(string const& Text) // Load a new
>> XML configuration from a string.
>> bool loadLibrary(string const& Name) // Load a new library
>> (component, plugin or typekit) into memory.
>> bool loadService(string const& Name, string const& Service) //
>> Load a discovered service or plugin in an existing component.
>> void path(string const& Paths) // Add additional directories to
>> the component search path without importing them.
>> void removePeer(string const& PeerName) // Remove a peer from
>> this Component.
>> bool runScript(string const& File) // Runs a script.
>> bool setActivity(string const& CompName, double Period, int
>> Priority, int SchedType) // Attach an activity to a Component.
>> bool setActivityOnCPU(string const& CompName, double Period, int
>> Priority, int SchedType, uint CPU) // Attach an activity to a Component.
>> bool setMasterSlaveActivity(string const& Master, string const&
>> Slave) // Attach a slave activity with a master to a Component. The slave
>> becomes a peer of the master
>> as well.
>> bool setPeriodicActivity(string const& CompName, double Period,
>> int Priority, int SchedType) // Attach a periodic activity to a Component.
>> bool setSequentialActivity(string const& CompName) // Attach a
>> 'stand alone' sequential activity to a Component.
>> bool setSlaveActivity(string const& CompName, double Period) //
>> Attach a 'stand alone' slave activity to a Component.
>> bool startComponents() // Start the components configured for
>> AutoStart.
>> bool stopComponents() // Stop all the configured components
>> (with or without AutoStart).
>> bool stream(string const& port, ConnPolicy policy) // Creates a
>> stream to or from a port.
>> bool unloadComponent(string const& Name) // Unload a loaded
>> component instance.
>> bool unloadComponents() // Unload all the previously loaded
>> components.
>> bool waitForInterrupt() // This operation waits for the SIGINT
>> signal and then returns. This allows you to wait in a script for ^C.
>> bool waitForSignal(int signal number) // This operation waits
>> for the signal of the argument and then returns. This allows you to wait in
>> a script for any signal
>> except
>> SIGKILL and SIGSTOP.
>>
>>
>>
>>
>> >
>> > I am using OCL version 2.5.0 under electric.
>> >
>> > Thanks,
>> >
>> > Bert
>> >
>> >
>> >
>> >
>> >
>> >
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ....**kuleuven.be<Orocos-Users [..] ...><mailto:
>> Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>
>> >
>> http://lists.mech.kuleuven.be/**mailman/listinfo/orocos-users<http://lis...
>>
>>
>>

Deployment within a state machine

On 12/07/2012 12:10 PM, Bert Willaert wrote:
>
>
>
> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen <dominick [dot] vanthienen [..] ... <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>
>
>
> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>
> To clarify a bit more my question. I am using the standard deployer first of all, and the appConnections is an operation I added via the comp.ops script. So for
> sure the
> standard lua deployer does not have this operation.
>
>
> then why are you calling it on the deployer?
> depl:appConnections()
>
>
> Because I call the runScript("comp.ops") operation on the Deployer, so as far as I understand the functions defined in the comp.ops file then become operations/methods of
> the Deployer. This seems to be confirmed by the fact that if I look at the interface of the Deployer in the Taskbrowser the method 'appConnections' is in the list (after
> doing runScript)...
>
> Does that make sense?
yes,
did you try:
op = d:getOperation("appConnections")
op()
>
>
>
> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen <dominick [dot] vanthienen [..] ... <mailto:dominick [dot] vanthienen [..] ...>
> <mailto:dominick [dot] vanthienen [..] ... <mailto:dominick [dot] vanthienen [..] ...>>> wrote:
>
>
>
> On 12/07/2012 11:12 AM, Bert Willaert wrote:
> > Hi,
> >
> > I am trying to achieve the following:
> >
> > There is a Supervisor (LuaComponent) loading an fsm. In one of the states of this fsm, I want to deploy stuff, currently i.e. to connect some ports, and get
> also a
> return
> > value to check whether the deployment was successful or not. The state looks now like this:
> >
> > app_launch = state {
> > entry = function() depl:runScript("app_path/comp.__ops") end,
> > doo = function() app_deployed = depl:appConnections() end,
> > },
> >
> > In the comp.ops file, there is:
> >
> > export bool appConnections(){
> > ##############################__###########
> > ## connect lwr to the Supervisor component
> > var bool conn1 = false, conn2 = false
> > var ConnPolicy cp
> > conn1 = connect("lwr.__CartesianPositionCommand","__Supervisor.cart_pos_cmd_out",__cp)
> > conn2 = connect("lwr.__CartesianPosition","__Supervisor.cart_pos_msr_in",__cp)
> >
> > if (conn1 == true & conn2 == true) then return true
> >
> > return false
> > }
> >
> > When reaching the app_launch state, the following error shows up (PROBLEM 1):
> >
> > 30.306 [ ERROR ][Logger] DOO doo program of state 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm___execute.lua:34: attempt to call method
> 'appConnections'
> > (a nil value)
> >
> > However, when I check the interface of the deployer via the Taskbrowser, appConnections is in the list of available operations. Just like runScript is in
> the list
> and which
> > does work fine... But when I try to execute the appConnections function manually via the Taskbrowser, the Taskbrowser hangs after executing the function
> (PROBLEM 2)
>
> the lua deployer doesn't have a appConnections function
> you can check what you can call on the deployer like this: rosrun ocl rttlua-gnulinux
> > tc=rtt.getTC()
> > depl=tc:getPeer("deployer")
> > =depl
> TaskContext: deployer
> state: Stopped
> isActive: true
> getPeriod: 0
> peers: lua
> ports:
> properties:
> RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/__robotics-ros/packages/orocos___toolchain/ocl/../install/lib/__orocos // Locations to look for
> components. Use a colon
> or semi-colon separated list of paths. Defaults to the environment variable with the same name.
> AutoUnload (bool) = true // Stop, cleanup and unload all components loaded by the DeploymentComponent when it is destroyed.
> operations:
> bool addPeer(string const& From, string const& To) // Add a peer to a Component.
> bool aliasPeer(string const& From, string const& To, string const& Alias) // Add a peer to a Component with an alternative name.
> bool cleanupComponents() // Cleanup all the configured components (with or without AutoConf).
> void clearConfiguration() // Clear all configuration settings.
> bool configureComponents() // Apply a loaded configuration to the components and configure() them if AutoConf is set.
> bool connect(string const& portOne, string const& portTwo, ConnPolicy policy) // Creates a connection between two ports.
> bool connectPeers(string const& One, string const& Two) // Connect two Components known to this Component.
> bool connectPorts(string const& One, string const& Two) // DEPRECATED. Connect the Data Ports of two Components known to this Component.
> bool connectServices(string const& One, string const& Two) // Connect the matching provides/requires services of two Components known to this Component.
> bool connectTwoPorts(string const& One, string const& PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect two ports of Components
> known to this
> Component.
> bool createStream(string const& component, string const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from a port.
> void displayComponentTypes() // Print out a list of all component types this component can create.
> strings getComponentTypes() // return a vector of all component types this component can create.
> bool import(string const& Package) // Import all components, plugins and typekits from a given package or directory in the search path.
> void kickOut(string const& File) // Calls stopComponents, cleanupComponents and unloadComponents in a row.
> bool kickOutAll() // Calls stopComponents, cleanupComponents and unloadComponents in a row.
> bool kickOutComponent(string const& comp_name) // Calls stopComponents, cleanupComponent and unloadComponent in a row.
> bool kickStart(string const& File) // Calls loadComponents, configureComponents and startComponents in a row.
> bool loadComponent(string const& Name, string const& Type) // Load a new component instance from a library.
> bool loadComponents(string const& File) // Load components listed in an XML configuration file.
> bool loadConfiguration(string const& File) // Load a new XML configuration from a file (identical to loadComponents).
> bool loadConfigurationString(string const& Text) // Load a new XML configuration from a string.
> bool loadLibrary(string const& Name) // Load a new library (component, plugin or typekit) into memory.
> bool loadService(string const& Name, string const& Service) // Load a discovered service or plugin in an existing component.
> void path(string const& Paths) // Add additional directories to the component search path without importing them.
> void removePeer(string const& PeerName) // Remove a peer from this Component.
> bool runScript(string const& File) // Runs a script.
> bool setActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach an activity to a Component.
> bool setActivityOnCPU(string const& CompName, double Period, int Priority, int SchedType, uint CPU) // Attach an activity to a Component.
> bool setMasterSlaveActivity(string const& Master, string const& Slave) // Attach a slave activity with a master to a Component. The slave becomes a peer
> of the master
> as well.
> bool setPeriodicActivity(string const& CompName, double Period, int Priority, int SchedType) // Attach a periodic activity to a Component.
> bool setSequentialActivity(string const& CompName) // Attach a 'stand alone' sequential activity to a Component.
> bool setSlaveActivity(string const& CompName, double Period) // Attach a 'stand alone' slave activity to a Component.
> bool startComponents() // Start the components configured for AutoStart.
> bool stopComponents() // Stop all the configured components (with or without AutoStart).
> bool stream(string const& port, ConnPolicy policy) // Creates a stream to or from a port.
> bool unloadComponent(string const& Name) // Unload a loaded component instance.
> bool unloadComponents() // Unload all the previously loaded components.
> bool waitForInterrupt() // This operation waits for the SIGINT signal and then returns. This allows you to wait in a script for ^C.
> bool waitForSignal(int signal number) // This operation waits for the signal of the argument and then returns. This allows you to wait in a script for any
> signal
> except
> SIGKILL and SIGSTOP.
>
>
>
>
> >
> > I am using OCL version 2.5.0 under electric.
> >
> > Thanks,
> >
> > Bert
> >
> >
> >
> >
> >
> >
> --
> Orocos-Users mailing list
> Orocos-Users [..] ... <mailto:Orocos-Users [..] ...> <mailto:Orocos-Users [..] ...
> <mailto:Orocos-Users [..] ...>>
> http://lists.mech.kuleuven.be/__mailman/listinfo/orocos-users <http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users>
>
>
>

Deployment within a state machine

On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen <
dominick [dot] vanthienen [..] ...> wrote:

>
>
> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>
>
>>
>>
>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen <
>> dominick.vanthienen@mech.**kuleuven.be<dominick [dot] vanthienen [..] ...><mailto:
>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>
>> wrote:
>>
>>
>>
>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>
>> To clarify a bit more my question. I am using the standard
>> deployer first of all, and the appConnections is an operation I added via
>> the comp.ops script. So for
>> sure the
>> standard lua deployer does not have this operation.
>>
>>
>> then why are you calling it on the deployer?
>> depl:appConnections()
>>
>>
>> Because I call the runScript("comp.ops") operation on the Deployer, so as
>> far as I understand the functions defined in the comp.ops file then become
>> operations/methods of
>> the Deployer. This seems to be confirmed by the fact that if I look at
>> the interface of the Deployer in the Taskbrowser the method
>> 'appConnections' is in the list (after
>> doing runScript)...
>>
>> Does that make sense?
>>
> yes,
> did you try:
> op = d:getOperation("**appConnections")
> op()
>

We 're getting close it seems...
Now the operation is already executed, but how can I get the return value
of the function?

doo = function() op=depl:getOperation("appConnections") print(op()) end,
OR
doo = function() op=depl:getOperation("appConnections") app_deployed =
op() end,

does not work...

>
>>
>>
>> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen
>> <dominick.vanthienen@mech.__ku**leuven.be <http://kuleuven.be> <mailto:
>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>
>> >
>>
>> <mailto:dominick.vanthienen@__**mech.kuleuven.be<http://mech.kuleuven.be><mailto:
>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>>
>> wrote:
>>
>>
>>
>> On 12/07/2012 11:12 AM, Bert Willaert wrote:
>> > Hi,
>> >
>> > I am trying to achieve the following:
>> >
>> > There is a Supervisor (LuaComponent) loading an fsm. In
>> one of the states of this fsm, I want to deploy stuff, currently i.e. to
>> connect some ports, and get
>> also a
>> return
>> > value to check whether the deployment was successful or
>> not. The state looks now like this:
>> >
>> > app_launch = state {
>> > entry = function() depl:runScript("app_path/comp.*
>> *__ops") end,
>>
>> > doo = function() app_deployed =
>> depl:appConnections() end,
>> > },
>> >
>> > In the comp.ops file, there is:
>> >
>> > export bool appConnections(){
>> > ##############################**__###########
>>
>> > ## connect lwr to the Supervisor component
>> > var bool conn1 = false, conn2 = false
>> > var ConnPolicy cp
>> > conn1 = connect("lwr.__**
>> CartesianPositionCommand","__**Supervisor.cart_pos_cmd_out",_**_cp)
>> > conn2 = connect("lwr.__**CartesianPosition","__**
>> Supervisor.cart_pos_msr_in",__**cp)
>>
>> >
>> > if (conn1 == true & conn2 == true) then return true
>> >
>> > return false
>> > }
>> >
>> > When reaching the app_launch state, the following error
>> shows up (PROBLEM 1):
>> >
>> > 30.306 [ ERROR ][Logger] DOO doo program of state
>> 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm__**_execute.lua:34:
>> attempt to call method
>>
>> 'appConnections'
>> > (a nil value)
>> >
>> > However, when I check the interface of the deployer via
>> the Taskbrowser, appConnections is in the list of available operations.
>> Just like runScript is in
>> the list
>> and which
>> > does work fine... But when I try to execute the
>> appConnections function manually via the Taskbrowser, the Taskbrowser hangs
>> after executing the function
>> (PROBLEM 2)
>>
>> the lua deployer doesn't have a appConnections function
>> you can check what you can call on the deployer like this:
>> rosrun ocl rttlua-gnulinux
>> > tc=rtt.getTC()
>> > depl=tc:getPeer("deployer")
>> > =depl
>> TaskContext: deployer
>> state: Stopped
>> isActive: true
>> getPeriod: 0
>> peers: lua
>> ports:
>> properties:
>> RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/__
>> **robotics-ros/packages/orocos__**_toolchain/ocl/../install/lib/**__orocos
>> // Locations to look for
>>
>> components. Use a colon
>> or semi-colon separated list of paths. Defaults to the
>> environment variable with the same name.
>> AutoUnload (bool) = true // Stop, cleanup and unload
>> all components loaded by the DeploymentComponent when it is destroyed.
>> operations:
>> bool addPeer(string const& From, string const& To) //
>> Add a peer to a Component.
>> bool aliasPeer(string const& From, string const& To,
>> string const& Alias) // Add a peer to a Component with an alternative name.
>> bool cleanupComponents() // Cleanup all the configured
>> components (with or without AutoConf).
>> void clearConfiguration() // Clear all configuration
>> settings.
>> bool configureComponents() // Apply a loaded
>> configuration to the components and configure() them if AutoConf is set.
>> bool connect(string const& portOne, string const&
>> portTwo, ConnPolicy policy) // Creates a connection between two ports.
>> bool connectPeers(string const& One, string const& Two)
>> // Connect two Components known to this Component.
>> bool connectPorts(string const& One, string const& Two)
>> // DEPRECATED. Connect the Data Ports of two Components known to this
>> Component.
>> bool connectServices(string const& One, string const&
>> Two) // Connect the matching provides/requires services of two Components
>> known to this Component.
>> bool connectTwoPorts(string const& One, string const&
>> PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect
>> two ports of Components
>> known to this
>> Component.
>> bool createStream(string const& component, string
>> const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from
>> a port.
>> void displayComponentTypes() // Print out a list of all
>> component types this component can create.
>> strings getComponentTypes() // return a vector of all
>> component types this component can create.
>> bool import(string const& Package) // Import all
>> components, plugins and typekits from a given package or directory in the
>> search path.
>> void kickOut(string const& File) // Calls
>> stopComponents, cleanupComponents and unloadComponents in a row.
>> bool kickOutAll() // Calls stopComponents,
>> cleanupComponents and unloadComponents in a row.
>> bool kickOutComponent(string const& comp_name) // Calls
>> stopComponents, cleanupComponent and unloadComponent in a row.
>> bool kickStart(string const& File) // Calls
>> loadComponents, configureComponents and startComponents in a row.
>> bool loadComponent(string const& Name, string const&
>> Type) // Load a new component instance from a library.
>> bool loadComponents(string const& File) // Load
>> components listed in an XML configuration file.
>> bool loadConfiguration(string const& File) // Load a
>> new XML configuration from a file (identical to loadComponents).
>> bool loadConfigurationString(string const& Text) //
>> Load a new XML configuration from a string.
>> bool loadLibrary(string const& Name) // Load a new
>> library (component, plugin or typekit) into memory.
>> bool loadService(string const& Name, string const&
>> Service) // Load a discovered service or plugin in an existing component.
>> void path(string const& Paths) // Add additional
>> directories to the component search path without importing them.
>> void removePeer(string const& PeerName) // Remove a
>> peer from this Component.
>> bool runScript(string const& File) // Runs a script.
>> bool setActivity(string const& CompName, double Period,
>> int Priority, int SchedType) // Attach an activity to a Component.
>> bool setActivityOnCPU(string const& CompName, double
>> Period, int Priority, int SchedType, uint CPU) // Attach an activity to a
>> Component.
>> bool setMasterSlaveActivity(string const& Master,
>> string const& Slave) // Attach a slave activity with a master to a
>> Component. The slave becomes a peer
>> of the master
>> as well.
>> bool setPeriodicActivity(string const& CompName, double
>> Period, int Priority, int SchedType) // Attach a periodic activity to a
>> Component.
>> bool setSequentialActivity(string const& CompName) //
>> Attach a 'stand alone' sequential activity to a Component.
>> bool setSlaveActivity(string const& CompName, double
>> Period) // Attach a 'stand alone' slave activity to a Component.
>> bool startComponents() // Start the components
>> configured for AutoStart.
>> bool stopComponents() // Stop all the configured
>> components (with or without AutoStart).
>> bool stream(string const& port, ConnPolicy policy) //
>> Creates a stream to or from a port.
>> bool unloadComponent(string const& Name) // Unload a
>> loaded component instance.
>> bool unloadComponents() // Unload all the previously
>> loaded components.
>> bool waitForInterrupt() // This operation waits for the
>> SIGINT signal and then returns. This allows you to wait in a script for ^C.
>> bool waitForSignal(int signal number) // This operation
>> waits for the signal of the argument and then returns. This allows you to
>> wait in a script for any
>> signal
>> except
>> SIGKILL and SIGSTOP.
>>
>>
>>
>>
>> >
>> > I am using OCL version 2.5.0 under electric.
>> >
>> > Thanks,
>> >
>> > Bert
>> >
>> >
>> >
>> >
>> >
>> >
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ....__kule**uven.be <http://kuleuven.be><mailto:
>> Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>>
>> <mailto:Orocos-Users@lists.__m**ech.kuleuven.be <http://mech.kuleuven.be>
>> <mailto:Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>
>> >>
>> http://lists.mech.kuleuven.be/**__mailman/listinfo/orocos-**users<http:/...
>> http://lists.mech.kuleuven.**be/mailman/listinfo/orocos-**users<http://l...
>> >
>>
>>
>>
>>

Deployment within a state machine

On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert <
bert [dot] willaert [..] ...> wrote:

>
> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen <
> dominick [dot] vanthienen [..] ...> wrote:
>
>>
>>
>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>
>>
>>>
>>>
>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen <
>>> dominick.vanthienen@mech.**kuleuven.be<dominick [dot] vanthienen [..] ...><mailto:
>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>
>>> wrote:
>>>
>>>
>>>
>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>
>>> To clarify a bit more my question. I am using the standard
>>> deployer first of all, and the appConnections is an operation I added via
>>> the comp.ops script. So for
>>> sure the
>>> standard lua deployer does not have this operation.
>>>
>>>
>>> then why are you calling it on the deployer?
>>> depl:appConnections()
>>>
>>>
>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>> as far as I understand the functions defined in the comp.ops file then
>>> become operations/methods of
>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>> the interface of the Deployer in the Taskbrowser the method
>>> 'appConnections' is in the list (after
>>> doing runScript)...
>>>
>>> Does that make sense?
>>>
>> yes,
>> did you try:
>> op = d:getOperation("**appConnections")
>> op()
>>
>
> We 're getting close it seems...
> Now the operation is already executed, but how can I get the return value
> of the function?
>
> doo = function() op=depl:getOperation("appConnections") print(op()) end,
> OR
> doo = function() op=depl:getOperation("appConnections") app_deployed =
> op() end,
>
> does not work...
>

To be more specific:
I can see that the operation is executed, but the print call added in the
line below is not... So it seems that after execution of the operation,
control is not returned to the doo function...
doo = function() op=depl:getOperation("appConnections") app_deployed = op()
print("Result: ",app_deployed) end,

>
>>>
>>>
>>> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen
>>> <dominick.vanthienen@mech.__ku**leuven.be <http://kuleuven.be> <mailto:
>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>
>>> >
>>>
>>> <mailto:dominick.vanthienen@__**mech.kuleuven.be<http://mech.kuleuven.be><mailto:
>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>>
>>> wrote:
>>>
>>>
>>>
>>> On 12/07/2012 11:12 AM, Bert Willaert wrote:
>>> > Hi,
>>> >
>>> > I am trying to achieve the following:
>>> >
>>> > There is a Supervisor (LuaComponent) loading an fsm. In
>>> one of the states of this fsm, I want to deploy stuff, currently i.e. to
>>> connect some ports, and get
>>> also a
>>> return
>>> > value to check whether the deployment was successful or
>>> not. The state looks now like this:
>>> >
>>> > app_launch = state {
>>> > entry = function() depl:runScript("app_path/comp.
>>> **__ops") end,
>>>
>>> > doo = function() app_deployed =
>>> depl:appConnections() end,
>>> > },
>>> >
>>> > In the comp.ops file, there is:
>>> >
>>> > export bool appConnections(){
>>> > ##############################**__###########
>>>
>>> > ## connect lwr to the Supervisor component
>>> > var bool conn1 = false, conn2 = false
>>> > var ConnPolicy cp
>>> > conn1 = connect("lwr.__**
>>> CartesianPositionCommand","__**Supervisor.cart_pos_cmd_out",_**_cp)
>>> > conn2 = connect("lwr.__**CartesianPosition","__**
>>> Supervisor.cart_pos_msr_in",__**cp)
>>>
>>> >
>>> > if (conn1 == true & conn2 == true) then return true
>>> >
>>> > return false
>>> > }
>>> >
>>> > When reaching the app_launch state, the following error
>>> shows up (PROBLEM 1):
>>> >
>>> > 30.306 [ ERROR ][Logger] DOO doo program of state
>>> 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm__**_execute.lua:34:
>>> attempt to call method
>>>
>>> 'appConnections'
>>> > (a nil value)
>>> >
>>> > However, when I check the interface of the deployer via
>>> the Taskbrowser, appConnections is in the list of available operations.
>>> Just like runScript is in
>>> the list
>>> and which
>>> > does work fine... But when I try to execute the
>>> appConnections function manually via the Taskbrowser, the Taskbrowser hangs
>>> after executing the function
>>> (PROBLEM 2)
>>>
>>> the lua deployer doesn't have a appConnections function
>>> you can check what you can call on the deployer like this:
>>> rosrun ocl rttlua-gnulinux
>>> > tc=rtt.getTC()
>>> > depl=tc:getPeer("deployer")
>>> > =depl
>>> TaskContext: deployer
>>> state: Stopped
>>> isActive: true
>>> getPeriod: 0
>>> peers: lua
>>> ports:
>>> properties:
>>> RTT_COMPONENT_PATH (string) = /home/u0065688/src/svn/__
>>> **robotics-ros/packages/orocos__**_toolchain/ocl/../install/lib/**__orocos
>>> // Locations to look for
>>>
>>> components. Use a colon
>>> or semi-colon separated list of paths. Defaults to the
>>> environment variable with the same name.
>>> AutoUnload (bool) = true // Stop, cleanup and unload
>>> all components loaded by the DeploymentComponent when it is destroyed.
>>> operations:
>>> bool addPeer(string const& From, string const& To) //
>>> Add a peer to a Component.
>>> bool aliasPeer(string const& From, string const& To,
>>> string const& Alias) // Add a peer to a Component with an alternative name.
>>> bool cleanupComponents() // Cleanup all the configured
>>> components (with or without AutoConf).
>>> void clearConfiguration() // Clear all configuration
>>> settings.
>>> bool configureComponents() // Apply a loaded
>>> configuration to the components and configure() them if AutoConf is set.
>>> bool connect(string const& portOne, string const&
>>> portTwo, ConnPolicy policy) // Creates a connection between two ports.
>>> bool connectPeers(string const& One, string const&
>>> Two) // Connect two Components known to this Component.
>>> bool connectPorts(string const& One, string const&
>>> Two) // DEPRECATED. Connect the Data Ports of two Components known to this
>>> Component.
>>> bool connectServices(string const& One, string const&
>>> Two) // Connect the matching provides/requires services of two Components
>>> known to this Component.
>>> bool connectTwoPorts(string const& One, string const&
>>> PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect
>>> two ports of Components
>>> known to this
>>> Component.
>>> bool createStream(string const& component, string
>>> const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from
>>> a port.
>>> void displayComponentTypes() // Print out a list of
>>> all component types this component can create.
>>> strings getComponentTypes() // return a vector of all
>>> component types this component can create.
>>> bool import(string const& Package) // Import all
>>> components, plugins and typekits from a given package or directory in the
>>> search path.
>>> void kickOut(string const& File) // Calls
>>> stopComponents, cleanupComponents and unloadComponents in a row.
>>> bool kickOutAll() // Calls stopComponents,
>>> cleanupComponents and unloadComponents in a row.
>>> bool kickOutComponent(string const& comp_name) //
>>> Calls stopComponents, cleanupComponent and unloadComponent in a row.
>>> bool kickStart(string const& File) // Calls
>>> loadComponents, configureComponents and startComponents in a row.
>>> bool loadComponent(string const& Name, string const&
>>> Type) // Load a new component instance from a library.
>>> bool loadComponents(string const& File) // Load
>>> components listed in an XML configuration file.
>>> bool loadConfiguration(string const& File) // Load a
>>> new XML configuration from a file (identical to loadComponents).
>>> bool loadConfigurationString(string const& Text) //
>>> Load a new XML configuration from a string.
>>> bool loadLibrary(string const& Name) // Load a new
>>> library (component, plugin or typekit) into memory.
>>> bool loadService(string const& Name, string const&
>>> Service) // Load a discovered service or plugin in an existing component.
>>> void path(string const& Paths) // Add additional
>>> directories to the component search path without importing them.
>>> void removePeer(string const& PeerName) // Remove a
>>> peer from this Component.
>>> bool runScript(string const& File) // Runs a script.
>>> bool setActivity(string const& CompName, double
>>> Period, int Priority, int SchedType) // Attach an activity to a Component.
>>> bool setActivityOnCPU(string const& CompName, double
>>> Period, int Priority, int SchedType, uint CPU) // Attach an activity to a
>>> Component.
>>> bool setMasterSlaveActivity(string const& Master,
>>> string const& Slave) // Attach a slave activity with a master to a
>>> Component. The slave becomes a peer
>>> of the master
>>> as well.
>>> bool setPeriodicActivity(string const& CompName,
>>> double Period, int Priority, int SchedType) // Attach a periodic activity
>>> to a Component.
>>> bool setSequentialActivity(string const& CompName) //
>>> Attach a 'stand alone' sequential activity to a Component.
>>> bool setSlaveActivity(string const& CompName, double
>>> Period) // Attach a 'stand alone' slave activity to a Component.
>>> bool startComponents() // Start the components
>>> configured for AutoStart.
>>> bool stopComponents() // Stop all the configured
>>> components (with or without AutoStart).
>>> bool stream(string const& port, ConnPolicy policy) //
>>> Creates a stream to or from a port.
>>> bool unloadComponent(string const& Name) // Unload a
>>> loaded component instance.
>>> bool unloadComponents() // Unload all the previously
>>> loaded components.
>>> bool waitForInterrupt() // This operation waits for
>>> the SIGINT signal and then returns. This allows you to wait in a script for
>>> ^C.
>>> bool waitForSignal(int signal number) // This
>>> operation waits for the signal of the argument and then returns. This
>>> allows you to wait in a script for any
>>> signal
>>> except
>>> SIGKILL and SIGSTOP.
>>>
>>>
>>>
>>>
>>> >
>>> > I am using OCL version 2.5.0 under electric.
>>> >
>>> > Thanks,
>>> >
>>> > Bert
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> --
>>> Orocos-Users mailing list
>>> Orocos-Users [..] ....__kule**uven.be <http://kuleuven.be><mailto:
>>> Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>>
>>> <mailto:Orocos-Users@lists.__m**ech.kuleuven.be<http://mech.kuleuven.be>
>>> <mailto:Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>
>>> >>
>>> http://lists.mech.kuleuven.be/**__mailman/listinfo/orocos-**
>>> users <http://lists.mech.kuleuven.be/__mailman/listinfo/orocos-users> <
>>> http://lists.mech.kuleuven.**be/mailman/listinfo/orocos-**users<http://l...
>>> >
>>>
>>>
>>>
>>>
>

Deployment within a state machine

On Fri, Dec 7, 2012 at 12:58 PM, Bert Willaert
<bert [dot] willaert [..] ...> wrote:
>
>
>
> On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert
> <bert [dot] willaert [..] ...> wrote:
>>
>>
>> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen
>> <dominick [dot] vanthienen [..] ...> wrote:
>>>
>>>
>>>
>>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>>
>>>>
>>>>
>>>>
>>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen
>>>> <dominick [dot] vanthienen [..] ...
>>>> <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>>>>
>>>>
>>>>
>>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>>
>>>> To clarify a bit more my question. I am using the standard
>>>> deployer first of all, and the appConnections is an operation I added via
>>>> the comp.ops script. So for
>>>> sure the
>>>> standard lua deployer does not have this operation.
>>>>
>>>>
>>>> then why are you calling it on the deployer?
>>>> depl:appConnections()
>>>>
>>>>
>>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>>> as far as I understand the functions defined in the comp.ops file then
>>>> become operations/methods of
>>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>>> the interface of the Deployer in the Taskbrowser the method 'appConnections'
>>>> is in the list (after
>>>> doing runScript)...
>>>>
>>>> Does that make sense?
>>>
>>> yes,
>>> did you try:
>>> op = d:getOperation("appConnections")
>>> op()
>>
>>
>> We 're getting close it seems...
>> Now the operation is already executed, but how can I get the return value
>> of the function?
>>
>> doo = function() op=depl:getOperation("appConnections") print(op()) end,
>> OR
>> doo = function() op=depl:getOperation("appConnections") app_deployed =
>> op() end,
>>
>> does not work...
>
>
> To be more specific:
> I can see that the operation is executed, but the print call added in the
> line below is not... So it seems that after execution of the operation,
> control is not returned to the doo function...
> doo = function() op=depl:getOperation("appConnections") app_deployed = op()
> print("Result: ",app_deployed) end,
>

Interesting thread. For starters, what Bert is trying to do should be
completely legitimate/working. The only issue is that, as the RTT
says, you can't send() exported scripting functions.

Lua can't see the difference between an exported scripting function
and a regular C++ function, so both should work equally well.

Also I'm surprised that op() "works" but depl:op() doesn't.

Unfortunately for Bert, I'll first have to ask to check this behavior
with 2.6.0 :-) We could also take a look at the Lua + OperationC +
scripting code for this use case. (especially why depl:op() fails).
However, calling exported rtt-script functions is unit tested in the
RTT test suite, so there is something fishy.

The good news is that the hanging is reproducible with the
TaskBrowser, which means that if we fix it for that case, it will
probably also be fixed for rttlua.

Peter

Deployment within a state machine

On Fri, Dec 7, 2012 at 9:21 PM, Peter Soetens <peter [..] ...> wrote:
> On Fri, Dec 7, 2012 at 12:58 PM, Bert Willaert
> <bert [dot] willaert [..] ...> wrote:
>>
>>
>>
>> On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert
>> <bert [dot] willaert [..] ...> wrote:
>>>
>>>
>>> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen
>>> <dominick [dot] vanthienen [..] ...> wrote:
>>>>
>>>>
>>>>
>>>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen
>>>>> <dominick [dot] vanthienen [..] ...
>>>>> <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>>>
>>>>> To clarify a bit more my question. I am using the standard
>>>>> deployer first of all, and the appConnections is an operation I added via
>>>>> the comp.ops script. So for
>>>>> sure the
>>>>> standard lua deployer does not have this operation.
>>>>>
>>>>>
>>>>> then why are you calling it on the deployer?
>>>>> depl:appConnections()
>>>>>
>>>>>
>>>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>>>> as far as I understand the functions defined in the comp.ops file then
>>>>> become operations/methods of
>>>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>>>> the interface of the Deployer in the Taskbrowser the method 'appConnections'
>>>>> is in the list (after
>>>>> doing runScript)...
>>>>>
>>>>> Does that make sense?
>>>>
>>>> yes,
>>>> did you try:
>>>> op = d:getOperation("appConnections")
>>>> op()
>>>
>>>
>>> We 're getting close it seems...
>>> Now the operation is already executed, but how can I get the return value
>>> of the function?
>>>
>>> doo = function() op=depl:getOperation("appConnections") print(op()) end,
>>> OR
>>> doo = function() op=depl:getOperation("appConnections") app_deployed =
>>> op() end,
>>>
>>> does not work...
>>
>>
>> To be more specific:
>> I can see that the operation is executed, but the print call added in the
>> line below is not... So it seems that after execution of the operation,
>> control is not returned to the doo function...
>> doo = function() op=depl:getOperation("appConnections") app_deployed = op()
>> print("Result: ",app_deployed) end,
>>
>
> Interesting thread. For starters, what Bert is trying to do should be
> completely legitimate/working. The only issue is that, as the RTT
> says, you can't send() exported scripting functions.
>
> Lua can't see the difference between an exported scripting function
> and a regular C++ function, so both should work equally well.
>
> Also I'm surprised that op() "works" but depl:op() doesn't.
>
> Unfortunately for Bert, I'll first have to ask to check this behavior
> with 2.6.0 :-)

It's present in 2.6.0 too:

$ cat test.ops
require("print")

export function foo()
{
print.ln("ok")
}

$ rosrun ocl deployer-gnulinux -s test.ops
Real-time memory: 517904 bytes free of 524288 allocated.
Switched to : Deployer

This console reader allows you to browse and manipulate
TaskContexts.
You can type in an operation, expression, create or change
variables.
(type 'help' for instructions and 'ls' for context info)

TAB completion and HISTORY is available ('bash' like)

Use 'Ctrl-D' or type 'quit' to exit this program.

Deployer [S]> foo()
ok

^C

Peter

Deployment within a state machine

On Fri, Dec 7, 2012 at 9:24 PM, Peter Soetens <peter [..] ...> wrote:
> On Fri, Dec 7, 2012 at 9:21 PM, Peter Soetens <peter [..] ...> wrote:
>> On Fri, Dec 7, 2012 at 12:58 PM, Bert Willaert
>> <bert [dot] willaert [..] ...> wrote:
>>>
>>>
>>>
>>> On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert
>>> <bert [dot] willaert [..] ...> wrote:
>>>>
>>>>
>>>> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen
>>>> <dominick [dot] vanthienen [..] ...> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen
>>>>>> <dominick [dot] vanthienen [..] ...
>>>>>> <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>>>>
>>>>>> To clarify a bit more my question. I am using the standard
>>>>>> deployer first of all, and the appConnections is an operation I added via
>>>>>> the comp.ops script. So for
>>>>>> sure the
>>>>>> standard lua deployer does not have this operation.
>>>>>>
>>>>>>
>>>>>> then why are you calling it on the deployer?
>>>>>> depl:appConnections()
>>>>>>
>>>>>>
>>>>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>>>>> as far as I understand the functions defined in the comp.ops file then
>>>>>> become operations/methods of
>>>>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>>>>> the interface of the Deployer in the Taskbrowser the method 'appConnections'
>>>>>> is in the list (after
>>>>>> doing runScript)...
>>>>>>
>>>>>> Does that make sense?
>>>>>
>>>>> yes,
>>>>> did you try:
>>>>> op = d:getOperation("appConnections")
>>>>> op()
>>>>
>>>>
>>>> We 're getting close it seems...
>>>> Now the operation is already executed, but how can I get the return value
>>>> of the function?
>>>>
>>>> doo = function() op=depl:getOperation("appConnections") print(op()) end,
>>>> OR
>>>> doo = function() op=depl:getOperation("appConnections") app_deployed =
>>>> op() end,
>>>>
>>>> does not work...
>>>
>>>
>>> To be more specific:
>>> I can see that the operation is executed, but the print call added in the
>>> line below is not... So it seems that after execution of the operation,
>>> control is not returned to the doo function...
>>> doo = function() op=depl:getOperation("appConnections") app_deployed = op()
>>> print("Result: ",app_deployed) end,
>>>
>>
>> Interesting thread. For starters, what Bert is trying to do should be
>> completely legitimate/working. The only issue is that, as the RTT
>> says, you can't send() exported scripting functions.
>>
>> Lua can't see the difference between an exported scripting function
>> and a regular C++ function, so both should work equally well.
>>
>> Also I'm surprised that op() "works" but depl:op() doesn't.
>>
>> Unfortunately for Bert, I'll first have to ask to check this behavior
>> with 2.6.0 :-)
>
> It's present in 2.6.0 too:
>
> $ cat test.ops
> require("print")
>
> export function foo()
> {
> print.ln("ok")
> }
>
> $ rosrun ocl deployer-gnulinux -s test.ops
> Real-time memory: 517904 bytes free of 524288 allocated.
> Switched to : Deployer
>
> This console reader allows you to browse and manipulate
> TaskContexts.
> You can type in an operation, expression, create or change
> variables.
> (type 'help' for instructions and 'ls' for context info)
>
> TAB completion and HISTORY is available ('bash' like)
>
> Use 'Ctrl-D' or type 'quit' to exit this program.
>
> Deployer [S]> foo()
> ok
>
> ^C

The bug disappears when you start the *TaskBrowser* component (don't
ask how I figured that out :-).

You'd probably have the same solution if you would start the LuaComponent.

This is probably related to the faulty behavior described in this long
thread: http://www.orocos.org/forum/rtt/rtt-dev/changing-behaviour-updatehook

I'll check if there is another workaround which won't influence
nominal behavior but I can't promise anything. The reason the unit
tests passed was because the caller was in the running state
(start()'ed), but I'm not sure if this was intentional.

Peter

Deployment within a state machine

On Fri, Dec 7, 2012 at 9:45 PM, Peter Soetens <peter [..] ...> wrote:
> On Fri, Dec 7, 2012 at 9:24 PM, Peter Soetens <peter [..] ...> wrote:
>> On Fri, Dec 7, 2012 at 9:21 PM, Peter Soetens <peter [..] ...> wrote:
>>> On Fri, Dec 7, 2012 at 12:58 PM, Bert Willaert
>>> <bert [dot] willaert [..] ...> wrote:
>>>>
>>>>
>>>>
>>>> On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert
>>>> <bert [dot] willaert [..] ...> wrote:
>>>>>
>>>>>
>>>>> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen
>>>>> <dominick [dot] vanthienen [..] ...> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen
>>>>>>> <dominick [dot] vanthienen [..] ...
>>>>>>> <mailto:dominick [dot] vanthienen [..] ...>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>>>>>
>>>>>>> To clarify a bit more my question. I am using the standard
>>>>>>> deployer first of all, and the appConnections is an operation I added via
>>>>>>> the comp.ops script. So for
>>>>>>> sure the
>>>>>>> standard lua deployer does not have this operation.
>>>>>>>
>>>>>>>
>>>>>>> then why are you calling it on the deployer?
>>>>>>> depl:appConnections()
>>>>>>>
>>>>>>>
>>>>>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>>>>>> as far as I understand the functions defined in the comp.ops file then
>>>>>>> become operations/methods of
>>>>>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>>>>>> the interface of the Deployer in the Taskbrowser the method 'appConnections'
>>>>>>> is in the list (after
>>>>>>> doing runScript)...
>>>>>>>
>>>>>>> Does that make sense?
>>>>>>
>>>>>> yes,
>>>>>> did you try:
>>>>>> op = d:getOperation("appConnections")
>>>>>> op()
>>>>>
>>>>>
>>>>> We 're getting close it seems...
>>>>> Now the operation is already executed, but how can I get the return value
>>>>> of the function?
>>>>>
>>>>> doo = function() op=depl:getOperation("appConnections") print(op()) end,
>>>>> OR
>>>>> doo = function() op=depl:getOperation("appConnections") app_deployed =
>>>>> op() end,
>>>>>
>>>>> does not work...
>>>>
>>>>
>>>> To be more specific:
>>>> I can see that the operation is executed, but the print call added in the
>>>> line below is not... So it seems that after execution of the operation,
>>>> control is not returned to the doo function...
>>>> doo = function() op=depl:getOperation("appConnections") app_deployed = op()
>>>> print("Result: ",app_deployed) end,
>>>>
>>>
>>> Interesting thread. For starters, what Bert is trying to do should be
>>> completely legitimate/working. The only issue is that, as the RTT
>>> says, you can't send() exported scripting functions.
>>>
>>> Lua can't see the difference between an exported scripting function
>>> and a regular C++ function, so both should work equally well.
>>>
>>> Also I'm surprised that op() "works" but depl:op() doesn't.
>>>
>>> Unfortunately for Bert, I'll first have to ask to check this behavior
>>> with 2.6.0 :-)
>>
>> It's present in 2.6.0 too:
>>
>> $ cat test.ops
>> require("print")
>>
>> export function foo()
>> {
>> print.ln("ok")
>> }
>>
>> $ rosrun ocl deployer-gnulinux -s test.ops
>> Real-time memory: 517904 bytes free of 524288 allocated.
>> Switched to : Deployer
>>
>> This console reader allows you to browse and manipulate
>> TaskContexts.
>> You can type in an operation, expression, create or change
>> variables.
>> (type 'help' for instructions and 'ls' for context info)
>>
>> TAB completion and HISTORY is available ('bash' like)
>>
>> Use 'Ctrl-D' or type 'quit' to exit this program.
>>
>> Deployer [S]> foo()
>> ok
>>
>> ^C
>
> The bug disappears when you start the *TaskBrowser* component (don't
> ask how I figured that out :-).
>
> You'd probably have the same solution if you would start the LuaComponent.
>
> This is probably related to the faulty behavior described in this long
> thread: http://www.orocos.org/forum/rtt/rtt-dev/changing-behaviour-updatehook
>
> I'll check if there is another workaround which won't influence
> nominal behavior but I can't promise anything. The reason the unit
> tests passed was because the caller was in the running state
> (start()'ed), but I'm not sure if this was intentional.

I boiled it down to a bug in FunctionGraph.cpp, which executes parsed
script functions and pushed a fix to toolchain-2.5 and 2.6.

All should be fine now (if you're using git). Be aware that if your
exported script function contains a yield statement, you'll need to
make the executing component periodic, or have some external trigger,
as usual with scripts.

What remains now is checking why the lua syntax bailed out...

Peter

Running exported ops script functions from Lua (formerly: Deploy

On Fri, Dec 07, 2012 at 10:27:27PM +0100, Peter Soetens wrote:
...
> What remains now is checking why the lua syntax bailed out...

I get something else... Using your example:

$ cat test.ops
require("print")
export function foo()
{
print.ln("ok")
}

$ cat test3.lua
tc=rtt.getTC()
depl=tc:getPeer("deployer")
depl:loadService("deployer", "scripting")
assert(depl:start)

print("running script")
depl:runScript("test.ops")

print("calling foo")
depl:foo()

Running this hangs forever in runScript, with your latest patch
applied and regardless of whether the deployer is started or not.

$ rttlua-gnulinux test3.lua
Real-time memory: 517904 bytes free of 524288 allocated.
running script

Any ideas?
Markus

Deployment within a state machine

On Fri, Dec 07, 2012 at 10:27:27PM +0100, Peter Soetens wrote:
...
> I boiled it down to a bug in FunctionGraph.cpp, which executes parsed
> script functions and pushed a fix to toolchain-2.5 and 2.6.
>
> All should be fine now (if you're using git). Be aware that if your
> exported script function contains a yield statement, you'll need to
> make the executing component periodic, or have some external trigger,
> as usual with scripts.
>
> What remains now is checking why the lua syntax bailed out...

Let's move this to to orocos-dev.
Markus

Deployment within a state machine

On Fri, Dec 7, 2012 at 12:58 PM, Bert Willaert <
bert [dot] willaert [..] ...> wrote:

>
>
>
> On Fri, Dec 7, 2012 at 12:39 PM, Bert Willaert <
> bert [dot] willaert [..] ...> wrote:
>
>>
>> On Fri, Dec 7, 2012 at 12:14 PM, Dominick Vanthienen <
>> dominick [dot] vanthienen [..] ...> wrote:
>>
>>>
>>>
>>> On 12/07/2012 12:10 PM, Bert Willaert wrote:
>>>
>>>
>>>>
>>>>
>>>> On Fri, Dec 7, 2012 at 12:04 PM, Dominick Vanthienen <
>>>> dominick.vanthienen@mech.**kuleuven.be<dominick [dot] vanthienen [..] ...><mailto:
>>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>
>>>> wrote:
>>>>
>>>>
>>>>
>>>> On 12/07/2012 12:03 PM, Bert Willaert wrote:
>>>>
>>>> To clarify a bit more my question. I am using the standard
>>>> deployer first of all, and the appConnections is an operation I added via
>>>> the comp.ops script. So for
>>>> sure the
>>>> standard lua deployer does not have this operation.
>>>>
>>>>
>>>> then why are you calling it on the deployer?
>>>> depl:appConnections()
>>>>
>>>>
>>>> Because I call the runScript("comp.ops") operation on the Deployer, so
>>>> as far as I understand the functions defined in the comp.ops file then
>>>> become operations/methods of
>>>> the Deployer. This seems to be confirmed by the fact that if I look at
>>>> the interface of the Deployer in the Taskbrowser the method
>>>> 'appConnections' is in the list (after
>>>> doing runScript)...
>>>>
>>>> Does that make sense?
>>>>
>>> yes,
>>> did you try:
>>> op = d:getOperation("**appConnections")
>>> op()
>>>
>>
>> We 're getting close it seems...
>> Now the operation is already executed, but how can I get the return value
>> of the function?
>>
>> doo = function() op=depl:getOperation("appConnections") print(op()) end,
>> OR
>> doo = function() op=depl:getOperation("appConnections") app_deployed =
>> op() end,
>>
>> does not work...
>>
>
> To be more specific:
> I can see that the operation is executed, but the print call added in the
> line below is not... So it seems that after execution of the operation,
> control is not returned to the doo function...
> doo = function() op=depl:getOperation("appConnections") app_deployed =
> op() print("Result: ",app_deployed) end,
>

This seems also relevant: when I did app_deployed = op:send(), I got the
following error:

29.284 [ ERROR ][Logger] OperationCallerC::send(): Can not send the
'appConnections' operation:Send not yet implemented for scripting functions.
Result: userdata: 0x7f68ac0faf98

Apparently, scripting functions are not fully supported yet?

Sorry for the multiple messages!

>
>
>
>>
>>>>
>>>>
>>>> On Fri, Dec 7, 2012 at 11:53 AM, Dominick Vanthienen
>>>> <dominick.vanthienen@mech.__ku**leuven.be <http://kuleuven.be> <mailto:
>>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>
>>>> >
>>>>
>>>> <mailto:dominick.vanthienen@__**mech.kuleuven.be<http://mech.kuleuven.be><mailto:
>>>> dominick.vanthienen@**mech.kuleuven.be<dominick [dot] vanthienen [..] ...>>>>
>>>> wrote:
>>>>
>>>>
>>>>
>>>> On 12/07/2012 11:12 AM, Bert Willaert wrote:
>>>> > Hi,
>>>> >
>>>> > I am trying to achieve the following:
>>>> >
>>>> > There is a Supervisor (LuaComponent) loading an fsm. In
>>>> one of the states of this fsm, I want to deploy stuff, currently i.e. to
>>>> connect some ports, and get
>>>> also a
>>>> return
>>>> > value to check whether the deployment was successful or
>>>> not. The state looks now like this:
>>>> >
>>>> > app_launch = state {
>>>> > entry = function() depl:runScript("app_path/comp.
>>>> **__ops") end,
>>>>
>>>> > doo = function() app_deployed =
>>>> depl:appConnections() end,
>>>> > },
>>>> >
>>>> > In the comp.ops file, there is:
>>>> >
>>>> > export bool appConnections(){
>>>> > ##############################**__###########
>>>>
>>>> > ## connect lwr to the Supervisor component
>>>> > var bool conn1 = false, conn2 = false
>>>> > var ConnPolicy cp
>>>> > conn1 = connect("lwr.__**
>>>> CartesianPositionCommand","__**Supervisor.cart_pos_cmd_out",_**_cp)
>>>> > conn2 = connect("lwr.__**CartesianPosition","__**
>>>> Supervisor.cart_pos_msr_in",__**cp)
>>>>
>>>> >
>>>> > if (conn1 == true & conn2 == true) then return true
>>>> >
>>>> > return false
>>>> > }
>>>> >
>>>> > When reaching the app_launch state, the following error
>>>> shows up (PROBLEM 1):
>>>> >
>>>> > 30.306 [ ERROR ][Logger] DOO doo program of state
>>>> 'root.cmd_mode.app_launch' failed: ./coordination/lwr_setup_fsm__**_execute.lua:34:
>>>> attempt to call method
>>>>
>>>> 'appConnections'
>>>> > (a nil value)
>>>> >
>>>> > However, when I check the interface of the deployer via
>>>> the Taskbrowser, appConnections is in the list of available operations.
>>>> Just like runScript is in
>>>> the list
>>>> and which
>>>> > does work fine... But when I try to execute the
>>>> appConnections function manually via the Taskbrowser, the Taskbrowser hangs
>>>> after executing the function
>>>> (PROBLEM 2)
>>>>
>>>> the lua deployer doesn't have a appConnections function
>>>> you can check what you can call on the deployer like this:
>>>> rosrun ocl rttlua-gnulinux
>>>> > tc=rtt.getTC()
>>>> > depl=tc:getPeer("deployer")
>>>> > =depl
>>>> TaskContext: deployer
>>>> state: Stopped
>>>> isActive: true
>>>> getPeriod: 0
>>>> peers: lua
>>>> ports:
>>>> properties:
>>>> RTT_COMPONENT_PATH (string) =
>>>> /home/u0065688/src/svn/__**robotics-ros/packages/orocos__**
>>>> _toolchain/ocl/../install/lib/**__orocos // Locations to look for
>>>>
>>>> components. Use a colon
>>>> or semi-colon separated list of paths. Defaults to the
>>>> environment variable with the same name.
>>>> AutoUnload (bool) = true // Stop, cleanup and unload
>>>> all components loaded by the DeploymentComponent when it is destroyed.
>>>> operations:
>>>> bool addPeer(string const& From, string const& To) //
>>>> Add a peer to a Component.
>>>> bool aliasPeer(string const& From, string const& To,
>>>> string const& Alias) // Add a peer to a Component with an alternative name.
>>>> bool cleanupComponents() // Cleanup all the
>>>> configured components (with or without AutoConf).
>>>> void clearConfiguration() // Clear all configuration
>>>> settings.
>>>> bool configureComponents() // Apply a loaded
>>>> configuration to the components and configure() them if AutoConf is set.
>>>> bool connect(string const& portOne, string const&
>>>> portTwo, ConnPolicy policy) // Creates a connection between two ports.
>>>> bool connectPeers(string const& One, string const&
>>>> Two) // Connect two Components known to this Component.
>>>> bool connectPorts(string const& One, string const&
>>>> Two) // DEPRECATED. Connect the Data Ports of two Components known to this
>>>> Component.
>>>> bool connectServices(string const& One, string const&
>>>> Two) // Connect the matching provides/requires services of two Components
>>>> known to this Component.
>>>> bool connectTwoPorts(string const& One, string const&
>>>> PortOne, string const& Two, string const& PortTwo) // DEPRECATED. Connect
>>>> two ports of Components
>>>> known to this
>>>> Component.
>>>> bool createStream(string const& component, string
>>>> const& port, ConnPolicy policy) // DEPRECATED. Creates a stream to or from
>>>> a port.
>>>> void displayComponentTypes() // Print out a list of
>>>> all component types this component can create.
>>>> strings getComponentTypes() // return a vector of all
>>>> component types this component can create.
>>>> bool import(string const& Package) // Import all
>>>> components, plugins and typekits from a given package or directory in the
>>>> search path.
>>>> void kickOut(string const& File) // Calls
>>>> stopComponents, cleanupComponents and unloadComponents in a row.
>>>> bool kickOutAll() // Calls stopComponents,
>>>> cleanupComponents and unloadComponents in a row.
>>>> bool kickOutComponent(string const& comp_name) //
>>>> Calls stopComponents, cleanupComponent and unloadComponent in a row.
>>>> bool kickStart(string const& File) // Calls
>>>> loadComponents, configureComponents and startComponents in a row.
>>>> bool loadComponent(string const& Name, string const&
>>>> Type) // Load a new component instance from a library.
>>>> bool loadComponents(string const& File) // Load
>>>> components listed in an XML configuration file.
>>>> bool loadConfiguration(string const& File) // Load a
>>>> new XML configuration from a file (identical to loadComponents).
>>>> bool loadConfigurationString(string const& Text) //
>>>> Load a new XML configuration from a string.
>>>> bool loadLibrary(string const& Name) // Load a new
>>>> library (component, plugin or typekit) into memory.
>>>> bool loadService(string const& Name, string const&
>>>> Service) // Load a discovered service or plugin in an existing component.
>>>> void path(string const& Paths) // Add additional
>>>> directories to the component search path without importing them.
>>>> void removePeer(string const& PeerName) // Remove a
>>>> peer from this Component.
>>>> bool runScript(string const& File) // Runs a script.
>>>> bool setActivity(string const& CompName, double
>>>> Period, int Priority, int SchedType) // Attach an activity to a Component.
>>>> bool setActivityOnCPU(string const& CompName, double
>>>> Period, int Priority, int SchedType, uint CPU) // Attach an activity to a
>>>> Component.
>>>> bool setMasterSlaveActivity(string const& Master,
>>>> string const& Slave) // Attach a slave activity with a master to a
>>>> Component. The slave becomes a peer
>>>> of the master
>>>> as well.
>>>> bool setPeriodicActivity(string const& CompName,
>>>> double Period, int Priority, int SchedType) // Attach a periodic activity
>>>> to a Component.
>>>> bool setSequentialActivity(string const& CompName) //
>>>> Attach a 'stand alone' sequential activity to a Component.
>>>> bool setSlaveActivity(string const& CompName, double
>>>> Period) // Attach a 'stand alone' slave activity to a Component.
>>>> bool startComponents() // Start the components
>>>> configured for AutoStart.
>>>> bool stopComponents() // Stop all the configured
>>>> components (with or without AutoStart).
>>>> bool stream(string const& port, ConnPolicy policy) //
>>>> Creates a stream to or from a port.
>>>> bool unloadComponent(string const& Name) // Unload a
>>>> loaded component instance.
>>>> bool unloadComponents() // Unload all the previously
>>>> loaded components.
>>>> bool waitForInterrupt() // This operation waits for
>>>> the SIGINT signal and then returns. This allows you to wait in a script for
>>>> ^C.
>>>> bool waitForSignal(int signal number) // This
>>>> operation waits for the signal of the argument and then returns. This
>>>> allows you to wait in a script for any
>>>> signal
>>>> except
>>>> SIGKILL and SIGSTOP.
>>>>
>>>>
>>>>
>>>>
>>>> >
>>>> > I am using OCL version 2.5.0 under electric.
>>>> >
>>>> > Thanks,
>>>> >
>>>> > Bert
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> --
>>>> Orocos-Users mailing list
>>>> Orocos-Users [..] ....__kule**uven.be <http://kuleuven.be><mailto:
>>>> Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>>
>>>> <mailto:Orocos-Users@lists.__m**ech.kuleuven.be<http://mech.kuleuven.be>
>>>> <mailto:Orocos-Users@lists.**mech.kuleuven.be<Orocos-Users [..] ...>
>>>> >>
>>>> http://lists.mech.kuleuven.be/**__mailman/listinfo/orocos-**
>>>> users <http://lists.mech.kuleuven.be/__mailman/listinfo/orocos-users> <
>>>> http://lists.mech.kuleuven.**be/mailman/listinfo/orocos-**users<http://l...
>>>> >
>>>>
>>>>
>>>>
>>>>
>>
>