rosInterfacePublishService bug

Report crashes, strange behaviour, or apparent bugs
TobiasW
Posts: 10
Joined: 21 Jul 2016, 15:33

rosInterfacePublishService bug

Postby TobiasW » 18 Nov 2016, 15:43

Hey,

I am not 100% sure if its a bug, but it seems strange to me.

What have I done?

I create a service publisher:

Code: Select all

 serviceData = simExtRosInterface_advertiseService('/vrep/simulationData', 'vrep_common/simulationGetData', 'image_callback')
    simExtRosInterface_serviceServerTreatUInt8ArrayAsString(serviceData)


with the callback:

Code: Select all

function image_callback()
    local data,w,h=simGetVisionSensorCharImage(colorCam)
    d={}
    d['header']={seq=1,stamp=0,frame_id="a"}
    d['height']=h
    d['width']=w
    d['encoding']='rgb8'
    d['is_bigendian']=1
    d['step']=w*3
    d['data']=data

    res = {}
    res['image']=d
    res['data']={0.1, 0.2}
    return res
end


results in the error;

Code: Select all

Error: [string -unknown location]:?: ros_srv_callback__vrep_common__simulationGetData: read__vrep_common__simulationGetDataResponse: malformed table (bad key type) (image_callback)


My service message looks like this:

Code: Select all

---
sensor_msgs/Image image
float32[] data


Everything works fine if I only setting one field in res without setting the other field (i.e. res['image']=d xor res['data']={0.1, 0.2} )

If I'm doing something wrong, please let me know

coppelia
Site Admin
Posts: 5957
Joined: 14 Dec 2012, 00:25

Re: rosInterfacePublishService bug

Postby coppelia » 23 Nov 2016, 09:03

Hello Tobias,

we need to look into this..

cheers

fferri
Posts: 87
Joined: 09 Sep 2013, 19:28

Re: rosInterfacePublishService bug

Postby fferri » 24 Nov 2016, 20:30

Hello Tobias,

is your problem reproducible also with following code?

Code: Select all

function cb(req)
    local data='blablablabla'
    local w=2
    local h=2
    d={}
    d['header']={seq=1,stamp=0,frame_id="a"}
    d['height']=h
    d['width']=w
    d['encoding']='rgb8'
    d['is_bigendian']=1
    d['step']=w*3
    d['data']=data

    res = {}
    res['image']=d
    res['data']={0.1, 0.2}
    return res
end

if (sim_call_type==sim_childscriptcall_initialization) then
    srv=simExtRosInterface_advertiseService('/foo','vrep_common/simulationGetData','cb')
    simExtRosInterface_serviceServerTreatUInt8ArrayAsString(srv)
end

fferri
Posts: 87
Joined: 09 Sep 2013, 19:28

Re: rosInterfacePublishService bug

Postby fferri » 24 Nov 2016, 20:36

For the record, the meaning of "malformed table (bad key type)" is that a string key was expected when reading a Lua table (the ROS message), but something else was found (e.g. a float).

For example, a table such as {10,20} or {1=10,2=20} would raise such exception, while {a=10,b=20} would not.

Your code looks legit however. The cause of your issue might be something else.


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 2 guests