Moving foot-bot towards a patch in ARGoS using LUA

Requests regarding how to set up experiments in ARGoS.
Waqar731
Posts: 60
Joined: Thu Oct 23, 2014 12:33 pm
Location: Pakistan
Contact:

Moving foot-bot towards a patch in ARGoS using LUA

Postby Waqar731 » Tue May 19, 2020 3:55 am

Hi
I m trying to move a foot bot towards a specific patch in LUA lets say from position (1,1) to a position (4,4) without using light source. I have obtained the current coordinates x and y of foot-bot using GPS sensor and stored them in a vector. Also stored target coordinates values in a spearate vector.

Code: Select all

local pos = { a=robot.positioning.position.x, b=robot.positioning.position.y } local target = { a=4, b=4 }
I have subtracted the current coordinates vector from the target coordinates vector using this.

Code: Select all

local newvector = {a = target.a - pos.a, b = target.b - pos.b }
Also obtained the orientation angle of foot-bot using GPS sensor.

Code: Select all

robot.positioning.orientation.angle
I have rotated the new vector and tried to move the foot-bot but it is not moving.

Code: Select all

newvector.rotate (-orientation) robot.wheels.set_velocity(newvector)
Even this rotating new vector doesn't work and I am confused about setting the coordinates towards new desired location. How can I set orientation towards new coordinates if I have the current x, y and orientation using GPS sensor.

Thanks and best regards
Waqar Hussain

pincy
Site Admin
Posts: 442
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Moving foot-bot towards a patch in ARGoS using LUA

Postby pincy » Tue Jun 02, 2020 7:56 pm

The method "set_velocity" does not accept a vector as input, but the wheel speeds.
I made ARGoS.

Waqar731
Posts: 60
Joined: Thu Oct 23, 2014 12:33 pm
Location: Pakistan
Contact:

Re: Moving foot-bot towards a patch in ARGoS using LUA

Postby Waqar731 » Wed Jun 03, 2020 4:29 am

thanks for the reply, Can u please exactly tell where I have mistake in the code?
Waqar Hussain

pincy
Site Admin
Posts: 442
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Moving foot-bot towards a patch in ARGoS using LUA

Postby pincy » Wed Jun 03, 2020 4:36 am

robot.wheels.set_velocity(10,5) sets the left wheel to 10 cm/s and the right to 5 cm/s
I made ARGoS.

Waqar731
Posts: 60
Joined: Thu Oct 23, 2014 12:33 pm
Location: Pakistan
Contact:

Re: Moving foot-bot towards a patch in ARGoS using LUA

Postby Waqar731 » Wed Jun 03, 2020 5:18 am

I know how to move normally with velocity. But this question was asked in a sense that how to set direction/orientation of foot-bot towards the specific patch. But this question is still unsolved. Please tell me the can I move robot towards a specific patch.
Waqar Hussain

Waqar731
Posts: 60
Joined: Thu Oct 23, 2014 12:33 pm
Location: Pakistan
Contact:

Re: Moving foot-bot towards a patch in ARGoS using LUA

Postby Waqar731 » Thu Jun 04, 2020 6:00 am

Hi,
Currently robot has been placed on coordinates (-2,-2) as can be seen in attached screenshot.
Screenshot from 2020-06-04 10-54-53.png
Screenshot from 2020-06-04 10-54-53.png (77.35 KiB) Viewed 18 times
Now I want to move it to (0,0) coordinates without using any light source or omni-directional camera. I have tried the following lines of code, but it is not even moving the robot. The code I am using is given below:

Code: Select all

pos_x=robot.positioning.position.x pos_y=robot.positioning.position.y local target = { a=0, b=0 } local newvector = {a = target.a - pos_x, b = target.b - pos_y } local orientation=robot.positioning.orientation.angle newvector.rotate(-orientation) robot.wheels.set_velocity(10,10)
Please help me to solve this issue. Thanks
Waqar Hussain


Return to “How to... ?”



cron