Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how does gotop(ls,as) really work? #4

Closed
alacalcasis opened this issue Dec 30, 2020 · 5 comments
Closed

how does gotop(ls,as) really work? #4

alacalcasis opened this issue Dec 30, 2020 · 5 comments

Comments

@alacalcasis
Copy link

Acording to "gotop(ls,as) sets the speed of the center of mass of the robot. The speed is expressed as a vector in polar coordinates, where ls is the linear speed (i.e., the forward speed, in cm/sec) and as is the angular speed (i.e., in rad/sec)." I am expecting that: gotop(0.0, 3.1415926535/4.0) would make the Khepera IV on Argos3 rotate 45 degrees per step. Thus it needs 7 steps to be at 305 degree orientation, but it doesn't rotates at all, at the end of 7 steps (1 step = 1 second) the Khepera IV never rotated and it is still pointing to 0 degree, its initial orientation. How should I interpret this? Thank you in advance,

Alan

@vivek-shankar
Copy link
Collaborator

Hi Alan,
gotop(l,a) takes a vector in a polar coordinate system and computes a control input that will drive the robot to this desired vector. It is more like a set point that you give the robot and it applies a control input depending on this setpoint. The velocity of the robot is determined by two things: 1. Max velocity that you specify in your argos file (https://github.com/ilpincy/argos3-kheperaiv/blob/master/src/testing/testbuzzexperiment.argos#L38) and 2. the length of the vector that you pass in as the set point. The velocity of the robot increases with the length of the vector that you give the goto function and the velocity is clamped to the max velocity of the robot (meaning, the vectors that requiring the robot to move over the max velocity will cause the robot to move at max velocity). In your case, you are giving the gotop function a vector of magnitude zero and hence the robot should never move, you can notice the robot moving with increasing velocity as you increase the length of this vector.

Furthermore, I noticed that you are referring to 1 step as 1 second, this totally depends on the number of ticks that you have in your .argos file. Ideally, we use the ticks per second to be 10 (https://github.com/ilpincy/argos3-kheperaiv/blob/master/src/testing/testbuzzexperiment.argos#L10), which means that each step is 100ms and you will have 10 ticks per second. if you set this to be 1 then you will have 1 step = 1 second.

I hope this clarifies your doubt.
If you have further questions, feel free to contact me.

-Vivek

@alacalcasis
Copy link
Author

alacalcasis commented Dec 30, 2020

Thank you Vivek, I was just trying to rotate the robot, not moving it to any other position. And I did change seconds per tick to 1 because I wanted to know how exactly gotop works.

And I think I understand that first argument of gotop is linear-speed which is limited by a max velocity that I assumed is 20 cm/s. The reason I used 0.0 as linear-speed was to make the robot rotate in the same position. Or is there something I'm still not getting about linear-speed? Maybe the robot won't rotate with zero linear-speed, or would do it erratically.

I still don't understand why the robot didn't rotate as expected, and that was just one of other similar test cases I used that didn't adjust to expected rotation of the khepera-iv.

@vivek-shankar
Copy link
Collaborator

The way the implementation works is that you provide a vector and this vector is used to compute the wheel actuator commands. A vector with magnitude 0 is a null vector and will obviously result in no movement according to the implementation.
You will have to provide a non-zero value to the first argument to apply your angular speed.

@alacalcasis
Copy link
Author

Thank you Vivek, my problem seems to be that I always think of these robots as agents in NetLogo and they can turn left or right without moving, just rotating, that is why I find this api non-intuitive. But I'll have to learn! Thank you for your patience.

@vivek-shankar
Copy link
Collaborator

You are right, actual robots have limitations, and the more limitations you include in your simulations, the more close it will be to a real setting. The robots that you use in argos do not include all the limitations of a real robot but it is fairly close to reality, if you have something working here, it will most likely work in a real setting.
One more thing, if you feel you are not comfortable with using this goto function, you can always implement your own function that takes in velocities and sets the wheel actuation. You can set the wheel speed using set_wheels(lws,rws).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants