EDIT: THIS PROJECT HAS BEEN ADDED TO EZ-AI*****
This has been updated to include the latest information about this tool.
EZ-DB is a utility that will allow ARC to store and retrieve data from a database. The current databases that are supported are MySQL and MSSQL. EZ-DB can be downloaded from this site.
The location that you place the folder doesn't matter, as long as you can connect to your ARC application. Unzip the contents of the zip file (the EZ-DB folder) to any location that you would like to have as the applications home. I haven't tested yet to see if this can run on a different computer by using the ARCIP setting in the config file.
CONFIGURING THE APPLICATION
The EZ-DB.exe.config file contains the configuration settings for this application. I have stored a copy of this file in the Backup folder for you, if you make a mistake and need to recover a working version.
This is the contents of this file. As you can see, you should be running .net 4.5. Going down the list under the <appSettings> section you will see the following
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="Server" value="localhost"/>
<add key="UserName" value="Robot"/>
<add key="Password" value="3Z-R0b0t"/>
<add key="Database" value="robot"/>
<add key="DBServerType" value="MSSQL"/>
<!--add key="DBServerType" value="MySQL"/-->
<add key="TableName" value="Variables"/>
<add key ="EZBuilderPort" value="6666"/>
<add key ="EZBuilderIP" value="127.0.0.1"/>
</appSettings>
</configuration>
Server - Name of the machine housing your database (localhost works if it is on the same computer)
UserName - The user name specified within your database server that has permissions to insert/update and read from the database. If you are going to use stored procedures, they will also need rights to execute the stored procs. Many people will just give this user DBO permissions over this database.
Password - The password for the specified user within your database server.
Database - The database that you will be storing to and querying data from.
DBServerType - There is one for MSSQL and one that is initially commented out for MySQL. Uncomment one and comment out the other. This is done by including the !-- before and -- after the xml element, but within the element starting and ending brackets. Example... <!--ALL OF THIS WILL BE COMMENTED OUT-->
TableName - This is the name of the table that you want to store your data in. Retrieval can be from anywhere on the database server, or using linked servers or replication could come from multiple servers.
EZBuilderPort - The port that the robot you are wanting to have communicate with the database is running on. This is not 23 or 24, but the port TCP port setting. See image below. If multiple robots are running, one of these will handle the database traffic for all robots for one machine.
EZBuilderIP - The IP address of the computer that ARC is running on.
After updating the EZ-DB.exe.Config file, save it and you will be ready to go from the application side.
USING WITH ARC
Some parameters have to be setup for this communication to work.
I add this to my initialization script to set these
#Starting variables for EZ-DB
$SqlReturn = ""
$SqlCommand = ""
To call the app and store data in the database, you would use a script component like this
Exec("C:\EZ-DB\EZ-DB.exe","$tempC Out Wall-E")
This will call the EZ-DB.exe application and pass some parameters to it.
The first parameter is the parameter that you want to store the value of. In this example, I am storing the $tempC variable from the ARC application into my database.
The second parameter must be In or Out. Notice the first letter is capitalized. Right now, it must be capitalized so it literally must be either In or Out. This is from the perspective of ARC. Are you passing something In to ARC or passing something Out of ARC? In this case, I am passing the variable Out to be stored in the database.
The third variable is the name of your robot. This will also be stored so that if you have multiple robots storing data in the same table, you will be able to identify which one sent the data.
To call the app to retrieve data from the database, you will need to first store your query in the $SqlCommand variable and then call the application, passing in three parameters.
$SqlCommand = "SELECT AVG{CONVERT{INT,VariableValue}} FROM Variables WHERE VariableName = '$tempC' and RobotName = 'Wall-E' and DateEntered > CONVERT{VARCHAR{10},GETDATE{},101}"
EXEC("C:\EZ-DB\EZ-DB.exe", "$SqlCommand In Wall-E")
If you are familiar with any SQL language, you will realize that all of the ( have been replaced with { and all of the ) has been replaced with }. This is because you're variable in ARC would not be able to be set because of issues with having ( or ) inside of a variable value. EZ-DB converts { to ( and } to ) before the query is executed.
The result of the query will be passed back to the $SqlReturn variable in ARC. This can then be used to do whatever you want to do with it in ARC.
I have included a EZB project called EZ-DBExample.ezb in this folder. It might be helpful.
My email address is [email protected]. If you have any questions, please let me know.
I will be adding more output data data to display information about what is going on with the app in the ARC panel. Messages like "connecting to database", "Getting Data", "Returning data to ARC" and stuff like that. I will probably make a configuration setting to enable or disable these messages.
I would appreciate more ideas or features that you might have.
works. dont know what I was doing wrong before. removed it and re-added it and it works.
@d.cochran, This all looks very impressive exciting. I love the idea of people like you making something like EZ Robot even better and useful for more people. Thanks for all your hard work!
I have one question though; What will this do and how can someone like me use it for?
Basically, you would be able to store information from variables into a database.
say for example you wanted to make 10 robots work together all over the world. If each could connect to a database via the internet, they could communicate with each other and do things based on what other robots are doing.
another example might be Jarvis by Rich. Jarvis can control parts of Rich's home. It could get the outside temp and humidity from an RSS feed. He then could see what temp the thermostat has been set to in the past when the temp and humidity were similar to what it currently is.
another example would be to log moves in a game and be able to see what the next move normally is based on the move that was just made and the move you are about to make.
there are so many possibilities. I work with databases daily for a large bank. It is in my blood I guess. I really don't know yet exactly what I will do, but the thought of many robots being able to communicate with each other and make decisions based on what the other ones are doing (robotic vacuums or lawn mowers working together) interests me a lot.
Thanks for the explanations! That totally awesome. You just may be the creator and father of the Borg civilization. eek
Just to point out though, the GetVar() and PushVar() commands will do the same thing once the cloud is set up for data storage/retrieval.
The beauty of a database is not just shared storage and retrieval of variables, but the ability to do complex queries for the variable retrieval.
Answering from my phone, so don't want to get too deep, but I'll try to come up with some example ideas later to demonstrate.
Right. Passing any getting variables is one thing, but being able to dig through a lot of data for the answer to a question in a second or two is where the power is.
say you store the points in a path that was taken, and the time it took to take that path. The next 30 days you took other random path and recorded the paths. You would then be able to query the database for the shortest or quickest path or create a different path based off of all of the gathered data.
decisions made off of data gathered is where this becomes powerful.
You are right, which is why Jarvis logs everything.
For instance heating, hot water and external temperature
Aside from a cool chart it also helps when work out when to turn on the heating to make sure it's warm when I get home. Knowing the information has saved me so much in energy bills.
But I digress...