Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked — Edited

Script To Select Camera

Hi,

Something is terribly annoying : ez builder 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.
ezbuilder 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
-ezbuilder 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.

#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
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

Code:


:start

$variable = getadc()

repeatwhile($variable = value)

actions

sleep()

Endrepeatwhile


Version 2

Code:


:start

repeatwhile($variable < 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..

Code:


$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...

Code:


# 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..

Code:


# 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)
Synthiam
#25  
Lastly, the question regarding starting the camera with a specific device. That already exists.

There is a feature when editing scripts called Cheat Sheet. This is a tab which displays all available commands of any control added to ARC.

The option you are looking for is listed in the Cheat Sheet under the camera control. Here is exactly how to use it..

[feature]
ControlCommand("Camera", CameraStart, [Camera URL:PORT])
[/feature]

and an example code would be

Code:


ControlCommand("Camera", CameraStart, "Rover")
#26  
Damn! I definitely have a problem with the Cheat Sheet each time I'm looking for a new / never used before feature I just can't find it. I'm sorry about this, this is so stupid... Thanks anyway.
Synthiam
#27  
If it's helping, it isn't stupid :D. I'm also sure a huge number of people are watching this thread and also learning:)

ARC is MASSIVE and it's funny - because some people say "document more", but we do, it's just that the documentation is also massive! Haha, such as the cheat sheet. The Cheat Sheet is the world's best documentation for "what you can do". The problem is that there's a lot you can do!

I always forget what commands are even possible. When you asked about the camera, i had to look to see if it was even there!
#28  
Hi,

I'm coming back to this forum because I'm still struggling with cameras. I can't get the script supposed to start the camera to actually start it because each time I used a camera, well I need to refresh the list for the camera to work again. Otherwise the start button is stuck to "stop" (as if camera was running, but it's not) and I get error messages each time I try to actually stop it.

So, in clear : most of the time I can't stop a camera to restart it while there's no more picture. It's frozen on run mode. The only way is to restart ARC.

here is the error message :

Error Initializing Camera: System.Runtime.InteropServices.COMException (0x800401E4): Invalid syntax (Exception from HRESULT: 0x800401E4 (MK_E_SYNTAX))
at System.Runtime.InteropServices.UCOMIMoniker.ParseDisplayName(UCOMIBindCtx pbc, UCOMIMoniker pmkToLeft, String pszDisplayName, Int32& pchEaten, UCOMIMoniker& ppmkOut)
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA.scapxQaT9t(String )
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA..ctor(String )
at EZ_B.Camera.StartCamera(ValuePair videoCaptureDevice, Control processedPreviewControl, Control realtimePreviewControl, Int32 captureWidth, Int32 captureHeight). Resolution: 320x240
Error Initializing Camera: System.Runtime.InteropServices.COMException (0x800401E4): Invalid syntax (Exception from HRESULT: 0x800401E4 (MK_E_SYNTAX))
at System.Runtime.InteropServices.UCOMIMoniker.ParseDisplayName(UCOMIBindCtx pbc, UCOMIMoniker pmkToLeft, String pszDisplayName, Int32& pchEaten, UCOMIMoniker& ppmkOut)
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA.scapxQaT9t(String )
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA..ctor(String )
at EZ_B.Camera.StartCamera(ValuePair videoCaptureDevice, Control processedPreviewControl, Control realtimePreviewControl, Int32 captureWidth, Int32 captureHeight). Resolution: 640x480

Let me know if there's anything you can suggest me from there.

Thanks.
#29  
also, is there a script command to refresh the list ? That'd be useful and, I swear, this time I looked extensively into the cheat sheet!:)
Synthiam
#30  
Haha there isn't a refresh ControlCommand for the camera. That's a strange error - it's a hardware error. I can add a refresh for you. I'm wondering what that hardware error is about... Maybe the camera takes a little longer than usual to initialize? Or is the resolution unsupported?

What settings do you change to get the camera to start working? Hardware errors are nearly impossible to debug when we didn't make the hardware.
#31  
I too have this refresh necessity. If I don't refresh the list, the camera may not appear in the list, or I just can't start it without refreshing. A refresh script command would be nice, or perhaps a "refresh on load" feature could be made. I don't get an error though.
#33  
To get it working I need to restart ezb and beside that I don't specify any new setting beside the usual Res that I've been using for months with this same Foscam. If by chancebincan get the camera control to stop running then I need a refresh and it works again. This either with alas.info filter or with URL directly.

I'll see what I can do on the hardware side when I'm back home.

Thanks.
Synthiam
#34  
Here's some insight to explain the issue, it's incredibly clear in the error which you shared.

Quote:


Error Initializing Camera: System.Runtime.InteropServices.COMException (0x800401E4): Invalid syntax (Exception from HRESULT: 0x800401E4 (MK_E_SYNTAX))
at System.Runtime.InteropServices.UCOMIMoniker.ParseDisplayName(UCOMIBindCtx pbc, UCOMIMoniker pmkToLeft, String pszDisplayName, Int32& pchEaten, UCOMIMoniker& ppmkOut)
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA.scapxQaT9t(String )
at Rp33miUMIGbqXYpali.lvF6UlmL50Nw9ZUXPA..ctor(String )
at EZ_B.Camera.StartCamera(ValuePair videoCaptureDevice, Control processedPreviewControl, Control realtimePreviewControl, Int32 captureWidth, Int32 captureHeight). Resolution: 320x240


The driver is not returning successfully and the name of the camera cannot be parsed yet. What is happening is one of two things...

1) Another program is attempting to use the camera device

2) The camera device driver is not fully loaded yet. Meaning, the USB cable was plugged in, but the driver hasn't completed loading. Most likely not providing enough time between connecting the cable and loading the camera control

3) The usb port or cable is damaged and the camera is not making a reliable connection

4) The camera driver is not 100% compatible with your OS version

5) The camera hardware is buggy

6) The camera device driver is buggy

Which ever the reason - there is little that ez-robot can do if the Windows Operating System is not providing the driver information.


In your post, you mention

Quote:


to get it working i need to restart ezb


Do you mean ARC or the EZ-B? Because the EZ-B has no relationship with the 3rd party camera being used. Please clarify
#35  
No, I mean ARC. I don't know what can be driver-related when I'm using the URL of an IP cam. I'll have to look into it further. Thanks again DJ.
Synthiam
#36  
If you're using the URL of an ip cam, then the issue can be network related. The ip cam may not be connected to the network at the time.

If you are always using the URL of the IP cam, the error of parsing the device name would never occur.

From what i read in the responses, sometimes you use IP URL and sometimes you specify a driver. Is this correct?

I require clarification to understand where the error resides. If you are stating that you always 100% using the IP URL and absolutely never ever use a physical device, let me know. That will be useful.
#37  
I think there's a mess to Clean up again in my project... I literally interconnected dozens of scripts using variables as triggers so I don't have them running all at once ... But there's still some cleaning to be made. I'm trying to achieve impossible goals here anyway, wanting my robot to go out in the apt. Check on some spots and come back charging... I think I'm gonna have to start drawing down my algorithms and try to achieve something much simpler and efficient. The thing is that I want to count for all possible bugs, stuck positions and all. There's also all the dead angles of my square rover which would benefit a lot from having a surrounding bumper... I have the sensors, just need to conceive the number and rethink the entire structure of it, again...

Anyway, regarding the camera yes both ip or alax.info driver. having also all sorts of trouble with ezboard constantly disconnecting but there are many possible causes that I can find in my network infrastructure and all these scripts not perfectly synchronized.

I'll work on all this and I'll come back if it doesn't change.
#38  
Question : is there a way to search for text over all the scripts at once? That would be hugely useful for checking on redundancies.

Another super super hugely needed feature : being able to see a script running without losing the hand on all other features. When I need to see how two or three scripts interact... Well it's almost impossible to do so without just guessing sometimes.

A separate window specific to script errors only another one for prints only, would also be useful.

Also, why I can't get the color coded display of the scripts? I have it on my laptop but on my desktop computer, even after reinstalling it doesn't activate.

Also can I export the variables ' list?

That's all!

:D:D:D *blush*
#39  
Oh and FYI Ezb v3 should not be discontinued. It's really a great redundancy / alternative when It became imperative to reboot everything. I have two redundant ezb v3's on top of my main controller which sonic course a v4. They both allowed me to try out new scripts and have all these bugs while sitting at 130 miles from the robot...

Having the Bluetooth as a backup mean of connection, mainly for power management, is really great.

Maybe coming up with a mini Bluetooth ezb dedicated to remote rovers power redundancies and reboot possibilities?

The top of the ton would be a ezb with two separate chips and power connectivity automatically switching in case of failure. Two everything : 2 wifi, two processors but the same d and adc and etc ports... Just meditating lost in the middle of the Catskills --- it looks like Canada here.;)
#40  
ok, got the hardware issue fixed so I don't get the error message any longer.

Now, however, I can't get to access my camera, as I lately used to do, using the script command :

Code:

 ControlCommand("Camera", CameraStart, [Camera URL:PORT]) 


Here is how it looks :

Code:

 ControlCommand("Camera", CameraStart, $Rover) 


and the variable $Rover prints out this address :

http://192.168.10.179:80/video.cgi?rate=0&user=XXXX&pwd=XXXXXXX

if I don't use the variable but type the url directly, same issue.

It's frustrating because I had finally got to access my camera without using Alax.info filter and now, for some reason, it doesn't work any longer.

I get the JPGStream Read Error.

Same camera, nothing changed. Maybe I'm forgetting something regarding the url, but no idea... probably this little thing that I'm not thinking about... of course. But I'm sure of one thing, I had been using the url access to the camera for weeks before I had this bug.

@Dj, I know this is only a temporary fix, but have you implemented yet a "refresh" command in an upcoming new version of ARC ? This is the only thing that allows me to script a reboot of the camera. This is another issue than the one I was just talking about. I still need to press refresh before I can see the camera feed again, using Alax.info filter.

Thanks a lot everybody.
#41  
@Dj

Ok, now I see a little bit more clearly in this.

I just did a test : If I run the camera (using alax.info driver) using the command :

Code:

 ControlCommand("Camera", CameraStart, "Rover") 


I get the same error message as before, the one that you said was hardware related.

But if I manually select the camera in the list and run press the start button or run the following command :

Code:

 ControlCommand("Camera", CameraStart) 


that is to say, without specifying the driver or any item whatsoever, then it works.

Any idea on what can make that happen ? Can it still be just hardware related ?

Thanks.