lua deployment script

hi
I'm trying to convert my old deployment.xml script to a lua deployment script
I've some questions/problems:
*how can I load property files: I tried this
-- load property files
depl:loadService("Scene","marshalling")
Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf") => here is still problem:
/home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:35: function arguments expected near '.' , I
tried ':' instead but still no solution...

*is it possible to still load old fashionned ops and osd scripts?
something like:
depl:loadService("SuperVisor","scripting")
SuperVisor:RunScript("../scripts/statesPrioCart.osd")
SuperVisor:RunScript("../scripts/init.ops")
=> this gives:
/home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:64: function arguments expected near '.'

Here's the script itself:

--deploy script in lua
require "rttlib"

tc = rtt.getTC()
depl = tc:getPeer("deployer")

-- import components, requires correctly setup RTT_COMPONENT_PATH or ROS_PACKAGE_PATH
depl:import("ocl")
depl:import("iTaSC")
depl:import("kdl_typekit")
depl:import("lissajous_lwr")
depl:import("trajectory_generators")

-- create component 'Scene'
-- Scene creates all ports that are iTaSC related, only extra ports have to be connected
depl:loadComponent("Scene", "iTaSC::ScenePriorities")
depl:loadComponent("SuperVisor","RTT::TaskContext")
depl:loadComponent("KukaLWR","iTaSC::KukaLWR")
depl:loadComponent("FixedObject","iTaSC::FixedObject")
depl:loadComponent("CartesianMotion","iTaSC::CartesianMotion")

-- get reference to components (peers of deployer)
Scene = depl:getPeer("Scene")
SuperVisor = depl:getPeer("SuperVisor")
KukaLWR = depl:getPeer("KukaLWR")
FixedObject = depl:getPeer("FixedObject")
CartesianMotion = depl:getPeer("CartesianMotion")

-- connect peers
-- depl:connectPeers("Scene","KukaLWR")
-- depl:connectPeers("Scene","CartesianMotion")
-- depl:connectPeers("Scene","FixedObject")
-- depl:connectPeers("Scene","Solver")
-- depl:connectPeers("Scene","Reporter")
-- depl:connectPeers("SuperVisor","Robot")
depl:connectPeers("SuperVisor","Scene")
-- depl:connectPeers("SuperVisor","KukaLWR")
-- depl:connectPeers("SuperVisor","CartesianMotion")
-- depl:connectPeers("SuperVisor","CartesianTrajectoryGenerator")
-- depl:connectPeers("SuperVisor","Reporter")
-- depl:connectPeers("SuperVisor","Solver")
-- depl:connectPeers("SuperVisor","FixedObject")

-- connectionPolicies

-- connect ports
-- depl:connect("KukaLWR.KukaLWRJointPosition", "Robot.nAxesSensorPosition", rtt.Variable('ConnPolicy'))
-- depl:connect("KukaLWR.KukaLWRJointVelocity", "Robot.nAxesOutputVelocity", rtt.Variable('ConnPolicy'))
-- depl:connect("CartesianMotion.DesiredPose", "CartesianTrajectoryGenerator.CartesianPoseDes", rtt.Variable('ConnPolicy'))
-- depl:connect("CartesianMotion.DesiredTwist", "CartesianTrajectoryGenerator.CartesianTwistDes", rtt.Variable('ConnPolicy'))
-- depl:connect("CartesianMotion.Pose", "CartesianTrajectoryGenerator.CartesianPoseMsr", rtt.Variable('ConnPolicy'))

-- load property files
depl:loadService("Scene","marshalling")
depl:loadService("FixedObject","marshalling")
depl:loadService("CartesianMotion","marshalling")

Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf")
FixedObject:marshalling.updateProperties("../cpf/FixedObject.cpf")
CartesianMotion:marshalling.updateProperties(../cpf/CartesianMotion.cpf")
=> here is still problem:
/home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:35: function arguments expected near '.' , I
tried : instead but still no solution...

-- load scripts
depl:loadService("SuperVisor","scripting")
SuperVisor:scripting.RunScript("../scripts/statesPrioCart.osd")
SuperVisor:scripting.RunScript("../scripts/init.ops")
=> this didn't work either

-- create activity for producer: period=0.01, priority=0, schedtype=ORO_SCHED_OTHER (1), ORO_SCHED_RT=0.
depl:setActivity("Scene", 0.01, 1, 0)
depl:setActivity("SuperVisor", 0.01, 0, 0)
depl:setActivity("KukaLWR", 0.01, 1, 0)
depl:setActivity("FixedObject", 0.01, 1, 0)
depl:setActivity("CartesianMotion", 0.01, 1, 0)

-- raise loglevel
rtt.setLogLevel("Debug")

-- configure/start components
SuperVisor:configure()
SuperVisor:start()
KukaLWR:configure()
KukaLWR:start()
FixedObject:configure()
FixedObject:start()
CartesianMotion:configure()

-- uncomment to print interface printing (for debugging)
-- print(consumer)
-- print(producer)

-- log that the deployment is complete
rtt.logl('Info', "Deployment complete!")

thanx!

nick

lua deployment script

Hi Nick,

On Wed, May 25, 2011 at 09:02:19AM +0200, Dominick Vanthienen wrote:

> I'm trying to convert my old deployment.xml script to a lua deployment script
> I've some questions/problems:
> *how can I load property files: I tried this
> -- load property files
> depl:loadService("Scene","marshalling")
> Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf") => here is still problem:

This won't work. You can access operations of Services as follows:

loadProps=Scene:provides("marshalling"):getOperation("loadProperties")

and simply call it:

loadProps("test.cpf")

or as a one liner

Scene:provides("marshalling"):getOperation("loadProperties")("test.cpf")

See also
http://people.mech.kuleuven.be/~orocos/pub/devel/documentation/ocl/maste...

> *is it possible to still load old fashionned ops and osd scripts?
> something like:
> depl:loadService("SuperVisor","scripting")
> SuperVisor:RunScript("../scripts/statesPrioCart.osd")
> SuperVisor:RunScript("../scripts/init.ops")
> => this gives:
> /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:64: function arguments expected near '.'

Same here:

depl:loadService("SuperVisor","scripting")
runScript=SuperVisor:provides("scripting"):getOperation("runScript")
runScript("script.ops")

BTW, if your are in the rttlua shell, you can print the loaded
Services by typing

=SuperVisor:provides()
Service: SuperVisor
Subservices: marshalling, scripting
Operations: activate, cleanup, configure, error, exec_file,
exec_str, getPeriod, inFatalError, inRunTimeError, isActive,
isConfigured, isRunning, setPeriod, start, stop, trigger, update
Ports:
Service: marshalling
Subservices:
Operations: loadProperties, readProperties, readProperty,
storeProperties, updateFile, updateProperties, writeProperties,
writeProperty
Ports:
Service: scripting
Subservices:
Operations: activateStateMachine, deactivateStateMachine,
eval, execute, getProgramLine, getProgramList,
getProgramStatus, getProgramStatusStr, getProgramText,
getStateMachineLine, getStateMachineList, getStateMachineState,
getStateMachineStatus, getStateMachineStatusStr,
getStateMachineText, hasProgram, hasStateMachine,
inProgramError, inStateMachineError, inStateMachineState,
isProgramPaused, isProgramRunning, isStateMachineActive,
isStateMachinePaused, isStateMachineRunning, loadProgramText,
loadPrograms, loadStateMachineText, loadStateMachines,
pauseProgram, pauseStateMachine, requestStateMachineState,
resetStateMachine, runScript, startProgram, startStateMachine,
stepProgram, stopProgram, stopStateMachine, unloadProgram,
unloadStateMachine
Ports:

>
> Here's the script itself:
>
> --deploy script in lua
> require "rttlib"
>
> tc = rtt.getTC()
> depl = tc:getPeer("deployer")
>
> -- import components, requires correctly setup RTT_COMPONENT_PATH or ROS_PACKAGE_PATH
> depl:import("ocl")
> depl:import("iTaSC")
> depl:import("kdl_typekit")
> depl:import("lissajous_lwr")
> depl:import("trajectory_generators")
>
> -- create component 'Scene'
> -- Scene creates all ports that are iTaSC related, only extra ports have to be connected
> depl:loadComponent("Scene", "iTaSC::ScenePriorities")
> depl:loadComponent("SuperVisor","RTT::TaskContext")
> depl:loadComponent("KukaLWR","iTaSC::KukaLWR")
> depl:loadComponent("FixedObject","iTaSC::FixedObject")
> depl:loadComponent("CartesianMotion","iTaSC::CartesianMotion")
>
> -- get reference to components (peers of deployer)
> Scene = depl:getPeer("Scene")
> SuperVisor = depl:getPeer("SuperVisor")
> KukaLWR = depl:getPeer("KukaLWR")
> FixedObject = depl:getPeer("FixedObject")
> CartesianMotion = depl:getPeer("CartesianMotion")
>
> -- connect peers
> -- depl:connectPeers("Scene","KukaLWR")
> -- depl:connectPeers("Scene","CartesianMotion")
> -- depl:connectPeers("Scene","FixedObject")
> -- depl:connectPeers("Scene","Solver")
> -- depl:connectPeers("Scene","Reporter")
> -- depl:connectPeers("SuperVisor","Robot")
> depl:connectPeers("SuperVisor","Scene")
> -- depl:connectPeers("SuperVisor","KukaLWR")
> -- depl:connectPeers("SuperVisor","CartesianMotion")
> -- depl:connectPeers("SuperVisor","CartesianTrajectoryGenerator")
> -- depl:connectPeers("SuperVisor","Reporter")
> -- depl:connectPeers("SuperVisor","Solver")
> -- depl:connectPeers("SuperVisor","FixedObject")
>
> -- connectionPolicies
>
> -- connect ports
> -- depl:connect("KukaLWR.KukaLWRJointPosition", "Robot.nAxesSensorPosition", rtt.Variable('ConnPolicy'))
> -- depl:connect("KukaLWR.KukaLWRJointVelocity", "Robot.nAxesOutputVelocity", rtt.Variable('ConnPolicy'))
> -- depl:connect("CartesianMotion.DesiredPose", "CartesianTrajectoryGenerator.CartesianPoseDes", rtt.Variable('ConnPolicy'))
> -- depl:connect("CartesianMotion.DesiredTwist", "CartesianTrajectoryGenerator.CartesianTwistDes", rtt.Variable('ConnPolicy'))
> -- depl:connect("CartesianMotion.Pose", "CartesianTrajectoryGenerator.CartesianPoseMsr", rtt.Variable('ConnPolicy'))
>
> -- load property files
> depl:loadService("Scene","marshalling")
> depl:loadService("FixedObject","marshalling")
> depl:loadService("CartesianMotion","marshalling")
>
> Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf")
> FixedObject:marshalling.updateProperties("../cpf/FixedObject.cpf")
> CartesianMotion:marshalling.updateProperties(../cpf/CartesianMotion.cpf")
> => here is still problem:
> /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:35: function arguments expected near '.' , I
> tried : instead but still no solution...
>
> -- load scripts
> depl:loadService("SuperVisor","scripting")
> SuperVisor:scripting.RunScript("../scripts/statesPrioCart.osd")
> SuperVisor:scripting.RunScript("../scripts/init.ops")
> => this didn't work either
>
> -- create activity for producer: period=0.01, priority=0, schedtype=ORO_SCHED_OTHER (1), ORO_SCHED_RT=0.

ORO_SCHED_OTHER is 0 and ORO_SCHED_RT is 1 if I am not
mistaken.

> depl:setActivity("Scene", 0.01, 1, 0)
> depl:setActivity("SuperVisor", 0.01, 0, 0)
> depl:setActivity("KukaLWR", 0.01, 1, 0)
> depl:setActivity("FixedObject", 0.01, 1, 0)
> depl:setActivity("CartesianMotion", 0.01, 1, 0)
>
> -- raise loglevel
> rtt.setLogLevel("Debug")
>
> -- configure/start components
> SuperVisor:configure()
> SuperVisor:start()
> KukaLWR:configure()
> KukaLWR:start()
> FixedObject:configure()
> FixedObject:start()
> CartesianMotion:configure()
>
> -- uncomment to print interface printing (for debugging)
> -- print(consumer)
> -- print(producer)
>
> -- log that the deployment is complete
> rtt.logl('Info', "Deployment complete!")

Best regards
Markus

lua deployment script

On 05/25/2011 10:21 AM, Markus Klotzbuecher wrote:
> Hi Nick,
>
> On Wed, May 25, 2011 at 09:02:19AM +0200, Dominick Vanthienen wrote:
>
>> I'm trying to convert my old deployment.xml script to a lua deployment script
>> I've some questions/problems:
>> *how can I load property files: I tried this
>> -- load property files
>> depl:loadService("Scene","marshalling")
>> Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf") => here is still problem:
> This won't work. You can access operations of Services as follows:
>
> loadProps=Scene:provides("marshalling"):getOperation("loadProperties")
>
> and simply call it:
>
> loadProps("test.cpf")
>
> or as a one liner
>
> Scene:provides("marshalling"):getOperation("loadProperties")("test.cpf")
>
> See also
> http://people.mech.kuleuven.be/~orocos/pub/devel/documentation/ocl/maste...
>
>> *is it possible to still load old fashionned ops and osd scripts?
>> something like:
>> depl:loadService("SuperVisor","scripting")
>> SuperVisor:RunScript("../scripts/statesPrioCart.osd")
>> SuperVisor:RunScript("../scripts/init.ops")
>> => this gives:
>> /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:64: function arguments expected near '.'
> Same here:
>
> depl:loadService("SuperVisor","scripting")
> runScript=SuperVisor:provides("scripting"):getOperation("runScript")
> runScript("script.ops")
>
> BTW, if your are in the rttlua shell, you can print the loaded
> Services by typing
>
> =SuperVisor:provides()
> Service: SuperVisor
> Subservices: marshalling, scripting
> Operations: activate, cleanup, configure, error, exec_file,
> exec_str, getPeriod, inFatalError, inRunTimeError, isActive,
> isConfigured, isRunning, setPeriod, start, stop, trigger, update
> Ports:
> Service: marshalling
> Subservices:
> Operations: loadProperties, readProperties, readProperty,
> storeProperties, updateFile, updateProperties, writeProperties,
> writeProperty
> Ports:
> Service: scripting
> Subservices:
> Operations: activateStateMachine, deactivateStateMachine,
> eval, execute, getProgramLine, getProgramList,
> getProgramStatus, getProgramStatusStr, getProgramText,
> getStateMachineLine, getStateMachineList, getStateMachineState,
> getStateMachineStatus, getStateMachineStatusStr,
> getStateMachineText, hasProgram, hasStateMachine,
> inProgramError, inStateMachineError, inStateMachineState,
> isProgramPaused, isProgramRunning, isStateMachineActive,
> isStateMachinePaused, isStateMachineRunning, loadProgramText,
> loadPrograms, loadStateMachineText, loadStateMachines,
> pauseProgram, pauseStateMachine, requestStateMachineState,
> resetStateMachine, runScript, startProgram, startStateMachine,
> stepProgram, stopProgram, stopStateMachine, unloadProgram,
> unloadStateMachine
> Ports:
>
>> Here's the script itself:
>>
>> --deploy script in lua
>> require "rttlib"
>>
>> tc = rtt.getTC()
>> depl = tc:getPeer("deployer")
>>
>> -- import components, requires correctly setup RTT_COMPONENT_PATH or ROS_PACKAGE_PATH
>> depl:import("ocl")
>> depl:import("iTaSC")
>> depl:import("kdl_typekit")
>> depl:import("lissajous_lwr")
>> depl:import("trajectory_generators")
>>
>> -- create component 'Scene'
>> -- Scene creates all ports that are iTaSC related, only extra ports have to be connected
>> depl:loadComponent("Scene", "iTaSC::ScenePriorities")
>> depl:loadComponent("SuperVisor","RTT::TaskContext")
>> depl:loadComponent("KukaLWR","iTaSC::KukaLWR")
>> depl:loadComponent("FixedObject","iTaSC::FixedObject")
>> depl:loadComponent("CartesianMotion","iTaSC::CartesianMotion")
>>
>> -- get reference to components (peers of deployer)
>> Scene = depl:getPeer("Scene")
>> SuperVisor = depl:getPeer("SuperVisor")
>> KukaLWR = depl:getPeer("KukaLWR")
>> FixedObject = depl:getPeer("FixedObject")
>> CartesianMotion = depl:getPeer("CartesianMotion")
>>
>> -- connect peers
>> -- depl:connectPeers("Scene","KukaLWR")
>> -- depl:connectPeers("Scene","CartesianMotion")
>> -- depl:connectPeers("Scene","FixedObject")
>> -- depl:connectPeers("Scene","Solver")
>> -- depl:connectPeers("Scene","Reporter")
>> -- depl:connectPeers("SuperVisor","Robot")
>> depl:connectPeers("SuperVisor","Scene")
>> -- depl:connectPeers("SuperVisor","KukaLWR")
>> -- depl:connectPeers("SuperVisor","CartesianMotion")
>> -- depl:connectPeers("SuperVisor","CartesianTrajectoryGenerator")
>> -- depl:connectPeers("SuperVisor","Reporter")
>> -- depl:connectPeers("SuperVisor","Solver")
>> -- depl:connectPeers("SuperVisor","FixedObject")
>>
>> -- connectionPolicies
>>
>> -- connect ports
>> -- depl:connect("KukaLWR.KukaLWRJointPosition", "Robot.nAxesSensorPosition", rtt.Variable('ConnPolicy'))
>> -- depl:connect("KukaLWR.KukaLWRJointVelocity", "Robot.nAxesOutputVelocity", rtt.Variable('ConnPolicy'))
>> -- depl:connect("CartesianMotion.DesiredPose", "CartesianTrajectoryGenerator.CartesianPoseDes", rtt.Variable('ConnPolicy'))
>> -- depl:connect("CartesianMotion.DesiredTwist", "CartesianTrajectoryGenerator.CartesianTwistDes", rtt.Variable('ConnPolicy'))
>> -- depl:connect("CartesianMotion.Pose", "CartesianTrajectoryGenerator.CartesianPoseMsr", rtt.Variable('ConnPolicy'))
>>
>> -- load property files
>> depl:loadService("Scene","marshalling")
>> depl:loadService("FixedObject","marshalling")
>> depl:loadService("CartesianMotion","marshalling")
>>
>> Scene:marshalling.loadProperties("../cpf/ScenePrioCart.cpf")
>> FixedObject:marshalling.updateProperties("../cpf/FixedObject.cpf")
>> CartesianMotion:marshalling.updateProperties(../cpf/CartesianMotion.cpf")
>> => here is still problem:
>> /home/u0065688/src/svn/robotics-ros/packages/orocos_toolchain_ros/ocl/install/bin/rttlua-gnulinux: cartesian_vel_lua_prio.lua:35: function arguments expected near '.' , I
>> tried : instead but still no solution...
>>
>> -- load scripts
>> depl:loadService("SuperVisor","scripting")
>> SuperVisor:scripting.RunScript("../scripts/statesPrioCart.osd")
>> SuperVisor:scripting.RunScript("../scripts/init.ops")
>> => this didn't work either
>>
>> -- create activity for producer: period=0.01, priority=0, schedtype=ORO_SCHED_OTHER (1), ORO_SCHED_RT=0.
> ORO_SCHED_OTHER is 0 and ORO_SCHED_RT is 1 if I am not
> mistaken.
nope inverse, see:
http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v2.0...
>> depl:setActivity("Scene", 0.01, 1, 0)
>> depl:setActivity("SuperVisor", 0.01, 0, 0)
>> depl:setActivity("KukaLWR", 0.01, 1, 0)
>> depl:setActivity("FixedObject", 0.01, 1, 0)
>> depl:setActivity("CartesianMotion", 0.01, 1, 0)
>>
>> -- raise loglevel
>> rtt.setLogLevel("Debug")
>>
>> -- configure/start components
>> SuperVisor:configure()
>> SuperVisor:start()
>> KukaLWR:configure()
>> KukaLWR:start()
>> FixedObject:configure()
>> FixedObject:start()
>> CartesianMotion:configure()
>>
>> -- uncomment to print interface printing (for debugging)
>> -- print(consumer)
>> -- print(producer)
>>
>> -- log that the deployment is complete
>> rtt.logl('Info', "Deployment complete!")
> Best regards
> Markus

lua deployment script

On Wed, May 25, 2011 at 03:20:14PM +0200, Dominick Vanthienen wrote:
...

> >>
> >> -- create activity for producer: period=0.01, priority=0, schedtype=ORO_SCHED_OTHER (1), ORO_SCHED_RT=0.
> > ORO_SCHED_OTHER is 0 and ORO_SCHED_RT is 1 if I am not
> > mistaken.
> nope inverse, see:
> http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v2.0...

And what makes you think that file is the one being included?

In rtt/os/gnulinux/fosi.h there is

#define ORO_SCHED_RT SCHED_FIFO /**_ Linux FIFO scheduler */
#define ORO_SCHED_OTHER SCHED_OTHER /** Linux normal scheduler */

... and if you grep in /usr/include/bits/sched.h for those you will
get:

#define SCHED_OTHER 0
#define SCHED_FIFO 1

:-)

Anyway, I need to add these constants, I'm just havn't found a
satisfyingly clean way to do so yet.

Best regards
Markus

lua deployment script

On Wed, May 25, 2011 at 9:48 PM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> On Wed, May 25, 2011 at 03:20:14PM +0200, Dominick Vanthienen wrote:
> ...
>
>> >>
>> >> -- create activity for producer: period=0.01, priority=0, schedtype=ORO_SCHED_OTHER (1), ORO_SCHED_RT=0.
>> > ORO_SCHED_OTHER is 0 and ORO_SCHED_RT is 1 if I am not
>> > mistaken.
>> nope inverse, see:
>> http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v2.0...
>
> And what makes you think that file is the one being included?
>
> In rtt/os/gnulinux/fosi.h there is
>
> #define ORO_SCHED_RT    SCHED_FIFO /**_ Linux FIFO scheduler */
> #define ORO_SCHED_OTHER SCHED_OTHER /** Linux normal scheduler */
>
> ... and if you grep in /usr/include/bits/sched.h for those you will
> get:
>
> #define SCHED_OTHER     0
> #define SCHED_FIFO      1
>
> :-)
>
> Anyway, I need to add these constants, I'm just havn't found a
> satisfyingly clean way to do so yet.

There is a RTT::types::GlobalsRepository built into RTT, where you can
store and retrieve globals/constants. Some RTT plugins/services add
constants in there too... The Doxygen documentation is screwed up for
this class. This will be fixed in 2.4.

Peter
--
Orocos-Users mailing list
Orocos-Users [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users