Typically: "How do I... ", "How can I... " questions
IRIIWU
Posts: 9
Joined: 11 Jul 2017, 21:53

Hey,
I have imported a road into vrep and now i want define boundaries so that I can tell a car that it is meant to remain on the road . What would be the best approach for this?

coppelia
Posts: 7445
Joined: 14 Dec 2012, 00:25

Hello,

you could mount various type of sensors to your car (e.g. vision or proximity). Another option would be build a 2D map of the scene, which indicates where the boundaries are. But in order to build that map, you would also need some sort of sensor.

Have a look at this example scene for instance.

Cheers

IRIIWU
Posts: 9
Joined: 11 Jul 2017, 21:53

Hey Coppelia,
thanks for the suggestion but i was looking for something where I could just define the road as a valid region and everything else as and invalid region. any suggestions and directions as to how to go about it?

Thanks

coppelia
Posts: 7445
Joined: 14 Dec 2012, 00:25

That was my suggestion by using a map (the map will tell you what region is valid, and what region is invalid). But someone needs to create that map. Once you have the map, your vehicle can check its position relative to that map and try to avoid forbidden regions.

Cheers

IRIIWU
Posts: 9
Joined: 11 Jul 2017, 21:53

Hey Coppelia,
Thanks for the clarification. How would we get the map data and then how do we use the map data to differentiate.

IRIIWU
Posts: 9
Joined: 11 Jul 2017, 21:53

since the vision sensor gives us an image would the solution to basically indicate based on the colors in the map? ie black and white

coppelia
Posts: 7445
Joined: 14 Dec 2012, 00:25

Yes. The solution is basically the example file I mentioned in my previous post.

Cheers

IRIIWU
Posts: 9
Joined: 11 Jul 2017, 21:53

Hey , Coppelia I wanted to know how you were able to get the object position wrt to the image generated by the vision sensor

coppelia
Posts: 7445
Joined: 14 Dec 2012, 00:25

local absolutePosition={1,1,1}
local relativePosition=simMultiplyVector(mi,absolutePosition)