strands-project / trajectory_behaviours

Apply qualitative spatial temporal relationships between detected trajectories and static objects, per ROI.
2 stars 8 forks source link

robot_view_cone incorrect calculation #19

Open ferdianjovan opened 8 years ago

ferdianjovan commented 8 years ago

Hi,

I believe this calculation is slightly wrong,

Lx = Px + d * (math.cos((yaw-alpha)/2))
Ly = Py + d * (math.cos((yaw-alpha)/2))
Rx = Px + d * (math.cos((yaw+alpha)/2))
Ry = Py + d * (math.cos((yaw+alpha)/2))

in https://github.com/strands-project/trajectory_behaviours/blob/master/relational_learner/src/relational_learner/learningArea.py#L358

It should be

lyaw = (yaw - (0.5 * alpha)) % (2 * math.pi)
ryaw = (yaw + (0.5 * alpha)) % (2 * math.pi)

Lx = Px + d * math.cos(lyaw)
Ly = Py + d * math.sin(lyaw)
Rx = Px + d * math.cos(ryaw)
Ry = Py + d * math.sin(ryaw)

It has been tested and works fine in https://github.com/strands-project/trajectory_behaviours/pull/18