tud-cor / FS19_modROS

(partial) ROS1 integration for FarmSim19
Apache License 2.0
49 stars 12 forks source link

Review the `collisionMask` passed to `rayCastClosest(..)` #35

Open gavanderhoorn opened 3 years ago

gavanderhoorn commented 3 years ago

The current collision mask is set to:

https://github.com/tud-cor/FS19_modROS/blob/5e8d48482b79c9608f7fdbe42f88f7e7ef0bc568/modROS.lua#L92-L98

IIRC, we've not been able to really find any documentation for those bit positions, except in this article/tutorial: How to Set Correct Collisions in Your Farming Simulator Mod:

Bit Feature
1 non_pushable1
2 non_pushable2
3 static_world1
4 static_world2
6 tractors
7 combines
8 trailers
12 dynamic_objects
13 dynamic_objects_machines
20 trigger_player
21 trigger_tractors
22 trigger_combines
23 trigger_fillables
24 trigger_dynamic_objects
25 trigger_trafficVehicles
26 trigger_cutters
30 kinematic_objects_without_collision

I suspect these are documented somewhere, I just haven't searched for it.

Whether the current value of the collisionMask is the optimal value for our purposes would be something to discuss.


Edit: from the same page: some example collision masks for various objects/vehicles:

Collision Type Bits Hex Value Decimal Value
Tractor 1, 6, 13, 21 0x202042 2105410
Combine 1, 7, 13, 22 0x402082 4202626
Fillable 1, 8, 13, 23 0x802102 8397058
Cutter 1, 12, 13, 24, 26 0x5003002 83898370
Tools 1, 13 0x2002 8194
gavanderhoorn commented 3 years ago

@Sagexs: it would be very helpful if you could experiment a bit and see whether any of these bits (or perhaps some of the undocumented ones) make raycastClosest(..) also detect vegetation.

I do expect there to be a rather large performance penalty if it would be possible, but at least then we'd know.

@tckarenchiang: perhaps we could see whether we'd want to make the collisionMask configurable, so users who have a need could tweak it for their specific use-case.

gavanderhoorn commented 3 years ago

Oh, and AFAIU: if collsionMask is not set, it will default to hitting everything.

tckarenchiang commented 3 years ago

Oh, and AFAIU: if collsionMask is not set, it will default to hitting everything.

I've tested: if collisionMask is not set, crops still can't be detected (with laser scanner pointing down)

gavanderhoorn commented 3 years ago

And just to make sure: if you set all bits of the collisionMask, does that change anything? So set it to 0xFFFFFFFF.

I'm not sure where I read that not providing collisionMask equates to a fully enabled collisionMask.

tckarenchiang commented 3 years ago

And just to make sure: if you set all bits of the collisionMask, does that change anything? So set it to 0xFFFFFFFF.

It doesn't seem to change anything.

gavanderhoorn commented 3 years ago

Ok, then it seems we can close #10 for now with the unfortunate conclusion that raycastClosest(..) cannot be used for detection crops/vegetation.


Edit: perhaps if we make some progress with #22, depthimage_to_laserscan could work for that instead.