orocos / rtt_ros_integration

Orocos-ROS integration libraries and tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no roshandle and ros::init present in rtt_ros pkgs?

roboticsai opened this issue · comments

When ever i ty to rttlua-gnulinux -i deployment/youbot.lua below error comes:

[FATAL] [1521766153.873659483]: You must call ros::init() before creating the first NodeHandle
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
[ERROR] [1521766153.896688903]: [registerPublisher] Failed to contact master at [:0]. Retrying...
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []

even after i modified the cpp files same error si comming.
the youbot.lua file is:

-- In order to run this script, use:
-- rttlua-gnulinux -i deployment/youbot.lua

-- See also http://www.orocos.org/wiki/orocos/toolchain/LuaCookbook
-- in order to set your LUA_PATH correctly, or errors will occur.

require("rttlib")
rttlib.color = true -- Since we're running this script with -i

-- Get our Lua TC
tc = rtt.getTC()

-- Get the deployer
depl = tc:getPeer("Deployer")

-- Start deploying and connecting
-- We need rtt_tf to get the current 2D position for us
depl:import("rtt_tf")
depl:loadComponent("tf","rtt_tf::RTT_TF")
tf = depl:getPeer("tf")
tf:configure() -- error in this line
tf:start()

--depl:import("rtt_dot_service")
--depl:loadService("deployer","dot")
depl:loadComponent("updater","OCL::LuaComponent")
depl:addPeer("updater", "deployer")
updater = depl:getPeer("updater")
updater:exec_file("deployment/updater.lua")
updater:configure()
updater:start()

-- Import our own components
depl:import("controller-youbot")

depl:loadComponent("localisation","Localisation")
depl:addPeer("localisation", "tf") -- for lookupTransform
localisation= depl:getPeer("localisation")
localisation:setPeriod(0.01)
localisation:configure()
localisation:start()

depl:loadComponent("controller","Controller")
depl:loadComponent("areadetection","Areadetection")
depl:loadComponent("teleop","Teleop")

-- Deployment Exercise: Add a supervisor Lua component
depl:loadComponent("supervisor","OCL::LuaComponent")
depl:addPeer("supervisor", "teleop")
depl:addPeer("supervisor", "controller")
depl:addPeer("supervisor", "areadetection")
sup = depl:getPeer("supervisor")
sup:exec_file("components/supervisor/supervisor.lua")
sup:configure()

-- Data Flow connections
cp=rtt.Variable("ConnPolicy")
cp.transport=3 -- 3 is ROS -- NOTE: set transport back to zero for local connections !

cp.name_id="/cmd_vel" -- topic name
depl:stream("controller.cmdvel", cp )
depl:stream("teleop.cmdvel", cp )

cp.name_id="/joy"
depl:stream("teleop.joystick",cp)

cp.transport = 0
cp.name_id=""
depl:connect("localisation.pose","controller.curlocation", cp)
depl:connect("localisation.pose","areadetection.curlocation", cp)

-- Data Flow Exercise:
-- Connect the events of areadetection to the supervisor
-- Connect the localisation's ports to the controller and areadetection
-- Check if all components and ports match periodicity or have an event-port
depl:connect("areadetection.events","supervisor.events", cp)

-- Only start in case no youbot is present:
depl:loadComponent("youbot","Nobot")
cp.transport = 0
depl:connect("youbot.cmdvel","controller.cmdvel", cp);
depl:connect("youbot.cmdvel","teleop.cmdvel", cp);
depl:connect("youbot.curpos","controller.curlocation", cp);

-- Deployment Exercise:
-- Configure or start the necessary components:
-- areadetection, nobot (if applicable), supervisor
-- Remember that the supervisor has the authority to
-- control (start/stop) most components.
sup:start()

-- Deployment Exercise:
-- Visualise the current setup with the rtt_dot_service
-- Use rosrun xdot xdot.y orograph.dot to visualize
-- call generate again to update the graph

-- user/test commands:

cmd = rttlib.port_clone_conn(sup:getPort("events"))
cmd:write("e_circle")
cmd:write("e_manual")
So what is the problem?