rosin-project / metacontrol_sim

2 stars 4 forks source link

added a fake laserscanner #56

Open hsd-dev opened 3 years ago

hsd-dev commented 3 years ago

Related to https://github.com/rosin-project/metacontrol_sim/issues/52

By default publishes the laser scan from /scan topic as it is:

roslaunch metacontrol_sim fake_laserscanner_bringup.launch

The data can be "corrupted" by adding a transformation function:

roslaunch metacontrol_sim fake_laserscanner_bringup.launch range_transformer:='[0 for x in m.ranges]'
hsd-dev commented 3 years ago

@chcorbato

hsd-dev commented 3 years ago

One disadvantage I see with this method is that the scans cannot be changed to corrupted at runtime.

marioney commented 3 years ago

One disadvantage I see with this method is that the scans cannot be changed to corrupted at runtime.

This can be problematic. isn't it possible to add a service to change this?

hsd-dev commented 3 years ago

isn't it possible to add a service to change this?

Working on it. Will add another commit.

hsd-dev commented 3 years ago

Original code from here. Unfortunately, it not a python module. So copy-pasted with due credits

https://github.com/rosin-project/metacontrol_sim/blob/392ecede1ca923e5e170df6ca34205d45080a5d4/scripts/fake_laserscanner.py#L18-L24

The inherited class now exposes a service which can be used to "corrupt" the data:

rosservice call /transform_range "data: true"

The transformation function can be set as an arg in the launch file: https://github.com/rosin-project/metacontrol_sim/blob/392ecede1ca923e5e170df6ca34205d45080a5d4/launch/fake_laserscanner_bringup.launch#L4

Currently the range values are simply set to 0s.

chcorbato commented 3 years ago

@marioney can you review this?