Hello,
Can anyone tell me what do i have to do if i want to calculate the distance between a moving robot for example the pioneer p3dx and any obstacle around it for example a wall. Also how can i see the value on the simulation ?
I am guessing i need to use proximity sensors or already built in sensors in the robots for example pioneer p3dx has 16 ultrasonic sensors i think. Also what do i need to add in the code ? Please help.
Kind regards
Maruf
Calculating distance and printing it
Re: Calculating distance and printing it
Hello Maruf,
to compute the minimum distance between your robot and the environment, use the distance calculation module. Once you have registered a distance object, you can access it, read it and print the distance from a child script with:
Of course you can do something similar with proximity sensors.
Cheers
to compute the minimum distance between your robot and the environment, use the distance calculation module. Once you have registered a distance object, you can access it, read it and print the distance from a child script with:
Code: Select all
handle=simGetDistanceHandle('myDistanceObjectName')
result,distance=simReadDistance(handle)
print(distance) -- prints the distance to the console
Cheers
Re: Calculating distance and printing it
hello,
so i am trying to obtain similar data and i tried using the above steps as specified. But I am receiving error at the below statement (correct me if i am wrong):
DistHandle = simGetDistanceHandle('FrontLeg') --statement executed during initialization
What I think, the error is due to the use of wrong distanceobject name: 'FrontLeg'
In such a scenario, how to know which is the correct name and whether the name used is a legal name?
so i am trying to obtain similar data and i tried using the above steps as specified. But I am receiving error at the below statement (correct me if i am wrong):
DistHandle = simGetDistanceHandle('FrontLeg') --statement executed during initialization
What I think, the error is due to the use of wrong distanceobject name: 'FrontLeg'
In such a scenario, how to know which is the correct name and whether the name used is a legal name?
Re: Calculating distance and printing it
Hello,
I see two potential problems:
I see two potential problems:
- either you have misspelled the object name (it is case sensitive)
- either you have not understood how object handles are retrieved. Make sure to read this page
-
- Posts: 1
- Joined: 18 Feb 2018, 15:00
Re: Calculating distance and printing it
Hey, How do I calculate the distance that my bot has moved and display the distance so that I can use this data for future applications? I'm unable to get it done using simxGetDistanceHandle.
Re: Calculating distance and printing it
You need to give us more information. Where are you trying to get and display the distance? In V-REP or in an external application?
Cheers
Cheers