Asked — Edited

Script To Select Camera

Hi,

Something is terribly annoying : ARC resets its default camera so if you are using a different camera than the ezb camera, any script that is supposed to boot your cam and then start it in the camera settings will not activate the one you want.

Is there a way to select a camera in the list as default and lock it so it stops bugging me like trying to force me to buy the low res ezb camera ?

thank you.

PS : ezb v4 is full of bugs. I can't count how many I meet. It is VERY unstable. Please, provide us with a firmware at some point. It is really very annoying. few examples :

-ezb disconnects -ezb has flawed digital ports : servos and motors won't respond ezb needs to be disconnected then connected again -ezb v4 used in conjunction with ezb V3 will screw all servos mixing up the old 100 position values and the new 180 positions. ARC has a very slow response rate - often due to a wifi board that is too slow, apparently, or a flawed buffer in the software, Idk. -digital ports will all lock to ON position and turn the robot totally nut and crazy -ARC will crash, very often, as soon as more than 3 scripts run at once. -i2C port is far too unstable. and so on... can't remember all the bugs I've encountered but it is really a lot.


ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

#17  

Thanks a lot for this very extensive analysis on my scripts! Wow!

Regarding the camera, no, I don't use an ip, at least not directly. I use a directshow filter so the one in the list that you should see if you were locally connected to my network and had the proper directshow installed, is named "rover" and fortunately the password that you saw is no longer in use!;)

The camera list switching to EZB default's camera is still a problem and it'd be great to solve it. I also use the EZB's camera but not as a main camera, more for the robot's arm so I can see closely what I'm grabbing and eventually even have things recognized and grabed automatically (like my cat's tale... but my wife doesn't agree with that part... fortunately I was able to get rid of most glyphs I was using for self docking since I can use now a compass thanks to Jeremie's genius).

regarding ARC version I'm not sure to understand. It is true that this file was created a while ago, but I'm definitely working on the latest version of the software so maybe it doesn't impact the original file and therefore that's a problem to solve : how do I get to benefit from updates without having to re-create the file itself (even though I could simply merge) ?

Regarding CPU usage I lately added many more sleep() in my loops. Still have to work on the redundancies. Some redundancies, though, are necessary for the rover to reconnect itself at any time while I'm away and it's running.

For the rest I'm going to look at all what you wrote carefully as of now and do the necessary modifications.

many thanks, Elfege

#18  

I see that in the corrected code that you wrote (thank you, btw), you use both boolean and C logical connectors (&&). Can you use others such as != and == ?

I really didn't know how to add 3 conditions like you do it beside by accumulating if's, which is a inconvenient in many ways.

Another thing : how do you get the system to remember variables? Each time I use variables declared at the beguining of a script, after any new ":reference" it acts as if it had lost them and won't read the associated sensor anymore. I noticed that issue in C programming too, after closing } I do have to re-declare certain variables but not all and I never got what caused this.

Thanks, Elfège.

PRO
Synthiam
#19  
  1. How are you using 2 different cameras if there is only 1 camera control? There is a camera added to the mobile interface, but that has the strange url ip assigned (it's on the second virtual desktop)

  2. what do you mean that a variable disappears after it is referenced? When you reload a project the variables will be cleared but not when the project is running - unless you call the clear variables function or press clear variables in the variable viewer.

  3. Yes you can use != and == etc

  4. regarding the project version, it's good to hear that you're running the most recent. I just wanted to ensure that you were. Thanks for confirming, because the latest version has so many stability improvements in scripting and threading - it's highly noticable.

#20  
  1. Discard the one in the mobile interface. That's old stuff from when I was hopping I could have a video feed from my night vision ip cam to my mobile app and, also, when I was dreaming of port forwarding the whole thing and control the robot from the internet instead of local network only. It is actually really weird that I couldn't figure it out but I seem to remember that before giving up on that I had read that it was actually not possible due to a limited amount of ports available. However I really wonder why I could not do a simple http://mypublicIP:port where the port would be any port forwarded to port 80 pointing to the EZB V4 internal http port. I tried telnet ports too but the mobile app won't accept a connection this way either. So far I only use telnet to launch scripts but no mobile interface yet. That'd be a great feature to add and basically it only needs, I think, that the mobile app allows it instead of systematically blocking the use of a public IP... but if you can show me where I'm wrong and how this is in fact perfectly achievable, I not only will feel a little shame for not being able to do this with EZB while I have so many port forwardings that I have to add several routers so I don't exceed ther limitations (being busy with video surveillance when I'm away for instance), I'll also consider sending you a bottle of a good Champagne (at least in the form of a picture...).

  2. About variables I have no clear all variable script running except for clearlastglyph, which is not the same I suppose. It really behaves sometimes like the variable is simply forgotten. If I write this, for instance :

:start $variable = getadc()

repeatwhile($variable = value) actions sleep() Endrepeatwhile

instead of this :

:start

repeatwhile($variable < value) $variable = getadc() actions sleep() Endrepeatwhile

then the loop won't end even though variable has gone beyond the value.

Maybe it's due to the excess of processes and maybe I'm basing this on only a couple of times I experienced something that looked like it. I'll test it further if you can't reproduce it. Just do it in a long script where a lot of other lines are written between the declaration of the variable and the request inserted in a repeat loop.

Not sure if I'm totally clear... kinda reaching the limit of what I can explain in what remains my second language!:)

#21  

Oops... this message had to be deleted...

#22  

Oops... message deleted by the author (like the previous one).

#23  

BTw I didn't answer a question :

So one main camera for all operations, a pan tilt foscam night vision, very convenient, through direct show so it shows in the list of cams in EZB.

Another cam for the arm, this one doesn't need night vision, been using EZB for a while but recently switched with a cam coming from a wowwee toy for I need ezb cam for another purpose at work.

Now, it would really be awesome if swithcing cams in the list could be scripted.

Thanks

PRO
Synthiam
#24  

This is correct regarding the variable example. I'll post both here with a title so they can be referenced in the description below

Version 1


:start

$variable = getadc()

repeatwhile($variable = value)

  actions

  sleep()

Endrepeatwhile

Version 2


:start

repeatwhile($variable &lt; value)

  $variable = getadc()
  actions
  sleep()

Endrepeatwhile

So what's happening in Version 1 is that the GetADC value is applied to the variable only one time, before the RepeatWhile begins. Version 2 gets the ADC value each time the loop occurs.

What happens when you assign a variable is it holds a value. For example, when you put..


$variable = GetADC(0)

The $variable will hold the value that the ADC Port #0 had for ever, until it's told otherwise. If you assign a variable a value, it will never change unless you tell it to. A variable is like a pocket in your pants. If you put a used tissue in your pocket, no matter how long you wait, it will always be there. If you wish for the tissue to not be there, you have to remove it. If you wish for something else to be in the pocket instead of the tissue, you remove the tissue and replace it with something else.

Here is how variables work...


# make $x hold the value of 1
$x = 1

# print the value of $x, which will be 1
print($x)

# now put the value of 2 in the variable
$x = 2

# print the value of $x, which will now be 2
print($x)

The same applies when you assign the value to a result of a function..


# make $x hold the value of ADC(0)
$x = GetADC(0)

# print the value of $x, which was the value when the GetADC() happened
print($x)

# now get the latest value of ADC(0)
$x = GetADC(0)

# print the value of $x, which will now be the last time we got the ADC value
print($x)