rttlua:部署
https://www.orocos.org/wiki/orocos/toolchain/luacookbook
https://github.com/guihomework/orocos_tutorials/wiki#spoiler1(重点推荐)
https://github.com/jhu-lcsr/rtt_ros_examples(需要改写)
其中example.launch
<launch>
<arg name="LUA" default="true"/>
<include if="$(arg LUA)" file="$(find rtt_ros)/launch/rttlua.launch">
<arg name="RTTLUA_ARGS" value="$(find rtt_ros_integration_example)/example.lua"/>
</include>
<include unless="$(arg LUA)" file="$(find rtt_ros)/launch/deployer.launch">
<arg name="DEPLOYER_ARGS" value="-s $(find rtt_ros_integration_example)/example.ops"/>
<arg name="LOG_LEVEL" value="debug"/>
<arg name="DEBUG" value="false"/>
</include>
<node name="update_monitor" pkg="rtt_ros_integration_example" type="update_monitor.py" output="screen"/>
</launch>
其中example.lua改写如下:
--[ Set log-level ]--
require "rttlib"
require "rttros"
rtt.setLogLevel("Warning")
--[ get convenience objects ]--
gs = gs or rtt.provides()
tc = tc or rtt.getTC()
depl = depl or tc:getPeer("Deployer")
depl:import("rtt_rosnode")
depl:import("rtt_roscomm")
--[ required imports ]--
depl:import("rtt_ros")
depl:import("rtt_ros")
ros = gs:provides("ros")
ros:import("rtt_ros_integration_example")
--[ Load a HelloRobot component ]--
depl:loadComponent("hello_robot","HelloRobot")
hr = depl:getPeer("hello_robot")
--[ Give it a periodic activity ]--
depl:setActivity(
hr:getName(),
0.0,
depl:getAttribute("LowestPriority"):get(),
rtt.globals.ORO_SCHED_OTHER)
--[ Create connections to some ros topics ]--
depl:stream(hr:getName()..".float_out", ros:topic("float_out"))
depl:stream(hr:getName()..".float_in", ros:topic("float_in"))
depl:stream(hr:getName()..".string_out", ros:topic("string_out"))
depl:stream(hr:getName()..".string_in", ros:topic("string_in"))
--[ Connect the component to some ros topics ]--
hr:loadService("rosservice")
hr:provides("rosservice"):connect("increment", "/increment", "std_srvs/Empty")
hr:provides("rosservice"):connect( "updated", "/updated", "std_srvs/Empty")
--[ Configure and start the component ]--
hr:configure()
hr:start()