Search found 39 matches

by DavideIng
01 Mar 2018, 11:01
Forum: General questions
Topic: Get and save position data of an object using Graph
Replies: 6
Views: 399

Re: Get and save position data of an object using Graph

I need to write position data (X and Y coordinates) in and excel file until the simulation time is 30 seconds. The code that I am using is the following: k=1 t1 = simGetSimulationTime() if (t1 < 30) then tableX={} tableY={} q=simGetObjectPosition(ePuck1,-1) tableX[k]=q[1] tableY[k]=q[2] else misureX...
by DavideIng
27 Feb 2018, 18:53
Forum: General questions
Topic: Get and save position data of an object using Graph
Replies: 6
Views: 399

Re: Get and save position data of an object using Graph

Because doing this the file "misure" in the Vrep folder is empty.

Cheers
by DavideIng
27 Feb 2018, 17:52
Forum: General questions
Topic: Get and save position data of an object using Graph
Replies: 6
Views: 399

Re: Get and save position data of an object using Graph

Is it correct to do this when the simulation is still running and the table is still updating:

Code: Select all

data="misure.xlsx"
file=io.open(data,"w")
file=write(Table)
file:close()
by DavideIng
27 Feb 2018, 17:34
Forum: General questions
Topic: Get and save position data of an object using Graph
Replies: 6
Views: 399

Re: Get and save position data of an object using Graph

I am trying to add the position data to a table in the following way: ePuck = simGetObjectHandle('ePuck') Table={} Table=simGetObjectPosition(ePuck,-1) I am not sure that is the correct way to do this but, assuming that is, I don't understand how to write the table data in an excel file. Any suggest...
by DavideIng
26 Feb 2018, 18:39
Forum: General questions
Topic: Get and save position data of an object using Graph
Replies: 6
Views: 399

Get and save position data of an object using Graph

Hello, I need to get and save the X-Y data relative to the position on the scene of an ePuck robot. After that I have to export it in excel an plot it. I already add to the scene the Graph object and I selected: [file -> Export -> selected graphs as CSV], what I have to do now? Do I have to add to t...
by DavideIng
09 Dec 2017, 15:18
Forum: General questions
Topic: Show a target point in the scene
Replies: 1
Views: 312

Show a target point in the scene

Hello,
Is there some way to show a ''way point'' in the the scene?
I set a scene where an ePuck has to reach a point that change every three simulation's seconds and I would like to show this point in some way?
Anyone could help me?

Many thanks
Davide
by DavideIng
30 Nov 2017, 16:40
Forum: General questions
Topic: Issue with ObjectHandle returned by simReadProximitySensor
Replies: 1
Views: 534

Issue with ObjectHandle returned by simReadProximitySensor

Hello, My purpose is get the Image (Rgb_table) from the vision sensor of ePuck1 or ePuck2 or ePuck3 or ePuck4 if detected by one of the ePuck proximity sensor. To do that I am using the statements below: res1,dist1,dP1,detectedObjectHandle1=simReadProximitySensor(ProxSensor1) res2,dist2,dP2,detected...
by DavideIng
24 Nov 2017, 13:50
Forum: General questions
Topic: Get the argument (orientation) of a 2D vector
Replies: 1
Views: 228

Get the argument (orientation) of a 2D vector

Hello,
I am trying to implement the Particle-Swarm algorithm using a swarm of ePucks, to do that I need to get the absolute orientation (absolute argument) of a vector.
I don't know how to do that from a Threaded child script, can someone help me?

Many thanks in advance
Davide
by DavideIng
22 Nov 2017, 18:22
Forum: General questions
Topic: Set random direction to avoid other ePucks on the scene
Replies: 1
Views: 346

Re: Set random direction to avoid other ePucks on the scene

Fix it.

Code: Select all

rand1 = math.random(-1,1)
rand2 = math.random(-1,1)

        if ((rand1 > 0) and (rand2 > 0)) or ((rand1 < 0) and (rand2 < 0)) then
        rand1 = -rand1
        end
by DavideIng
21 Nov 2017, 17:44
Forum: General questions
Topic: Set random direction to avoid other ePucks on the scene
Replies: 1
Views: 346

Set random direction to avoid other ePucks on the scene

Hello, I am coding a scene with two ePucks (the next step is going to have more ePucks) and the main purpose is the following: When the ePucks are going to be closer than a certain distance (threshold has been fixed before) they have to change direction: in my alghoritm they turn of 90 degrees and t...