Asked — Edited
Resolved Resolved by CochranRobotics!

Converting A String To Integer In Ez Scripting

I am using the plug in for the XV-11 Lidar. The output of the plug in an array in which each value is a string that represents the distance at the angle and the signal strength. To use this for control of the robot, I need numbers at these angles. The format is shown in the attached example. How do I parse and convert this in EZ Scripting into an integer?

In C there is the string.split command

https://msdn.microsoft.com/en-us/library/b873y76a(v=vs.110).aspx

and then the string to integer convert.

Is there a way to do this in the EZ scripting?

User-inserted image


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

PRO
Synthiam
#17  

When I load the plugin, it pops up an message box that reads "com3" does not exist. And it then locks up ARC, forcing me to end the task in task manager.

#18  

Interesting. Mine also tries come first and then allows me to use the config screen to then go choose the com port.

#19  

Are you sure it locks it up or is it loading/building the blank arrays? By doing 720 array elements it takes a bit.

#20  

A second message box should pop up saying that the com port wasn't initialized. I wonder if it is hidden.

#21  

I got that com 3 message too. But it continues and works once I select the correct com port. You also have to make sure you load the "tinsey" USB driver on your computer or it won't see the Lidar.

#22  

That is true. Also, I have an update written but I dont want to deploy it until I know it works. Unfortunately I cant really test it until I get another controller. This update has the ability to either enable or disable intensity settings (the array population of the intensity values). By default they are disabled. The map will still change the color of the points based on the intensity values in the config screen.

I will look at changing the error handling on the initial startup for the com port.

Thanks David

PRO
Synthiam
#23  

Not sure why mine crashes then - I will have to run it in visual studio and see if there's an exception.

Are you using this to create the initial ARC variable array? Or are you "appending" to the array 360 times?


CreateVariableArray(string variableName, object defaultValue, int size);

With that you can ...


CreateVariableArray("$lidar", 0, 360);

And it will be fast.

#24  

I'm pretty sure that is what I am doing. Will look in a bit. Definately not appending 360 times.