reed-adept / aria-matlab

OUTDATED Matlab and Simulink Interfaces for ARIA -- most up to date code can now be found with the ARIA library package -- see website
http://robots.mobilerobots.com/wiki/ARIA
Other
4 stars 7 forks source link

allow connections to multiple robots (with different connection parameters, e.g. TCP port) [was: "aria_init"] #5

Open magedmikhail opened 10 years ago

magedmikhail commented 10 years ago

How I connect more than one robot through aria_init I tried aria_init -rrtp 8101;arrobot_connect ; arrobot setvel(200) it works fine then aria_init -rrtp 8102;arrobot connect, it did not connect to the second one thanks so much for your help

reed-adept commented 10 years ago

Currently the aria-matlab interface assumes that you are only connecting to one robot at a time. This makes it simpler and easy to use in this case. You should be able to use –rrtp to choose a TCP port, but must run two instance of Matlab (if possible). If you call aria_init multiple times in the same script or session, the subsequent ones will be ignored since aria is already initialized.

The libariac wrapper C library contains in it only one ArRobot object. To be able to connect to multiple robots from the same Matlab instance/session would require changes to the aria matlab Mex interfaces and to the libariac wrapper to store and select between different robot and connection objects. I can give more detailed thoughts on this if you would like to try adding that ability.

Reed

From: magedmikhail [mailto:notifications@github.com] Sent: Monday, February 24, 2014 1:48 PM To: reed-adept/aria-matlab Subject: [aria-matlab] aria_init (#5)

How I connect more than one robot through aria_init I tried aria_init -rrtp 8101;arrobot_connect ; arrobot setvel(200) it works fine then aria_init -rrtp 8102;arrobot connect, it did not connect to the second one thanks so much for your help

— Reply to this email directly or view it on GitHubhttps://github.com/reed-adept/aria-matlab/issues/5.

magedmikhail commented 10 years ago

Is there a way to view the code behind the MATLAB commands to ARIA?

A grid does not appear when checking “Grid” in MobileSim. Is that what this option should control?

Is there a built in tolerance for “robot_move(x)”? For example, when commanding to move the robot 5000mm to the right, it stopped after 4950mm.

What is the velocity when using the command “robot_move(x)”?

Is there an easy way to erase tracks in MobileSim? If “Tracks” had been turned on in MobileSim, I have been turning “Tracks” off and then back on if I do not want the previous simulation’s tracks to be visible for the next simulation.

Is there a command that translates the robot at a set velocity (mm/s) instead of rotating the wheels at a set velocity (degrees/s) as when using “robot_setvel(x)”?

Are x and y the same scale in MobileSim? For example, when commanding the robot to move a distance in the +x-direction and then the same distance in the +y-direction, the x and y distances look different on the screen.

What is the rotational velocity when using the command “robot_setdeltaheading(x)”?

Is there a variable for a time vector?

reed-adept commented 10 years ago

I'll respond to your other questions in a separate message. For general questions about ARIA, MobileSim and other software the best place to discuss is the aria-users mailing list (http://robots.mobilerobots.com/wiki/aria-users)

All the code for aria-matlab is provided in mex-src and ariac.cpp. The source code for ARIA itself is also included with ARIA.

There are two ways that I can think of to support multiple robots in aria-matlab. The first is that for every function, add a variant that includes an integer robot index argument. For example in addition to arrobot_setvel(x), we would also add arrobot_setvel(i, x) which sets the velocity of robot i. arrobot_setvel(x) would be changed to be an alias for arrobot_setvel(0, x). This makes writing single-robot software -- the common case -- still easy.

The downside of that approach is that it creates lots of new functions.

The second way would be to use an arrobot_choose(i) function to select a global "currently selected" robot. This avoids the need to add a lot of new functions to the API, but it introduced hidden state to the API which could be a bad source of confusion and bugs (and prevents possible concurrent use of the API, though I don't know if that's actually practical in Matlab). This is not, however, an uncommon pattern in Matlab it seems, and it might make interactive use of the functions in the Matlab command console slightly easier.

I would lean towards the first approach, but the second would be less work if you are trying to get it usable as soon as possible.

In both approaches, you would need to maintain withinin libariac lists of ArRobot and ArRobotConnector and other objects (e.g. use std::vector) instead of just one of each as we currently have in libariac.

If you want to take a try at adding this functionality, fork the github repository and when when ready we can look at patches or just send pull (merge) request. I am away from the office right now but when I get back next week I can make sure the github repository is up to date with my most recent code.

reed-adept commented 10 years ago

Send me an email at reed.hedges@adept.com and I can answer your other questions.