LCAS / iliad

L-CAS specific works on ILIAD project
6 stars 5 forks source link

Error processing qsr_prob_rep service call #7

Closed MFernandezCarmona closed 6 years ago

MFernandezCarmona commented 6 years ago

Hello, I'm modifying strands human aware navigation stack to be used in multiple robots, and it's mostly working. I did minor modifications in several packages to support renaming topics, services, nodes and namespaces mostly. Currently I'm working with a gazebo simulation where a human walks towards the forklift. It's in package hri_simulation, iliad_sim_hri.launch.

But I'm get this error every time gazebo actor is detected as a tracked human. @cdondrup, Do you have any idea what may I be doing wrong? Thanks!

[ERROR] [1523455301.184029, 589.096000]: Error processing request: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
['Traceback (most recent call last):
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 625, in _handle_request
    response = convert_return_to_response(self.handler(request), self.response_class)
', '  File "/opt/ros/kinetic/lib/qsr_prob_rep/qsr_prob_rep_ros_server.py", line 30, in <lambda>
    self.services[service] = rospy.Service("~"+namespace+"/"+service, QSRProbRep, (lambda a,b: lambda x: self.callback(x, a, b))(namespace,service))
', '  File "/opt/ros/kinetic/lib/qsr_prob_rep/qsr_prob_rep_ros_server.py", line 34, in callback
    return QSRProbRepResponse(data=self._lib.request(r).get())
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_lib/rep_lib.py", line 57, in request
    return request_message.call_function(self.modules[namespace], func_name)
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_lib/rep_io.py", line 39, in call_function
    return getattr(c, f)(**self.kwargs)
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_lib/rep_io.py", line 71, in wrapper
    return func(self, *args, **kwargs)
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_lib/rep_pf.py", line 51, in update
    res = self.pf.update(**z)
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_pf/filter.py", line 63, in update
    kwargs["filter"].bayes(np.array([kwargs["states"].index(obs), np.nan]))
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_pf/particle_filter_base.py", line 82, in bayes
    self.emp.weights = np.multiply(self.emp.weights, np.exp(self.p_yt_xt.eval_multiple(yt, self.emp.particles)))
', '  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qsrrep_pf/probability_density_functions.py", line 116, in eval_multiple
    o = np.array(self.models[self.models.keys()[m]][self.key])[p.astype(int),x[0]]
', 'IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
']
[ERROR] [1523455301.184486, 589.096000]: service [/robot1/prob_rep_ros_server/pf/update] responded with an error: error processing request: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
MFernandezCarmona commented 6 years ago

I think I got the problem: I was using both "with_qsr_lib" and "with_qsr_prob_rep" as true. Using "with_qsr_lib"=true only, I get another error:

[ERROR] [1523467370.151489, 443.876000]: timeout exceeded while waiting for service /robot1/prob_rep_ros_server/pf/update

Seems that only "working" config is "with_qsr_prob_rep" as true. Thoughts?

cdondrup commented 6 years ago

The second error looks like it is trying to contact the particle filter but can't because it isn't running. So yeah, it needs with_qsr_prob_rep:=true. Can you send me a rosbag with system output that breaks the particle filter? I'll try to recreate the error here and have a look.

cdondrup commented 6 years ago

And the models you are using as well, please.

MFernandezCarmona commented 6 years ago

Models are the default ones. Also, as it's a simulation, I think it's easier if you just clone https://github.com/LCAS/iliad.git and launch my simulation roslaunch hri_simulation iliad_sim_hri.launch gazeboGui:=false Everything is remapped at /robot1 and usually that's the source of my problems. It's a testbench repo, probably there will be many dirty things. Apologises in advance!

MFernandezCarmona commented 6 years ago

Ok, I think I found the problem. In file qsrrep_pf/probability_density_functions.py At line 116 o = np.array(self.models[self.models.keys()[m]][self.key])[p.astype(int),x[0]] That x[0] index is not casted into an int. I changed to: o = np.array(self.models[self.models.keys()[m]][self.key])[p.astype(int),int(x[0]]) And now I don't have the error...

Did you try any of these in kinetic/Ubuntu 16.04?

cdondrup commented 6 years ago

Sorry I didn't have time to look at it yet. Glad you found the error.

I never tried this in Kinetic, no.