diff --git a/README.md b/README.md index a1f0f03484b66d9dc15a8b542fa7bc24191520d9..37d4c7903bccbf606a19ebfd93438b592580b83c 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,9 @@ Use `connectomnibot` to create a TCP-connection. Whenever your script is done or ``` using Omnibot -ip = ... -bot = connectomnibot(ip) +host = ... +port = ... +bot = connectomnibot(host, port) for i = 1:100 setspeeds(bot,[100,100,100]) @@ -36,8 +37,9 @@ close(bot) ``` using Omnibot -ip = ... -bot = connectomnibot(ip) +host = ... +port = ... +bot = connectomnibot(host, port) println(getmaxspeed(bot)) @@ -45,7 +47,7 @@ close(bot) ``` ### Network -At the department of automatic control, you should be connected to the omnibots via the same router. Currently this has been done with the router with name *robotlab*, where the IP naming conventions for the robots are `192.168.0.10X` for robot with name `omniX`, i.e. omnibot `omni6` has IP `192.168.0.106`. +At the department of automatic control, you should be connected to the omnibots via the same router. Currently this has been done with the router with name *robotlab*. IP and port conventions: Robot with name *omniX* has IP `192.168.0.10X` and port `900X` e.g.. omnibot `omni10` has IP `192.168.0.110`and port `9006`. ## Support diff --git a/src/connectomnibot.jl b/src/connectomnibot.jl index 723e2fe4984f301f103ff945c187a40212492ed9..120aa09a8dc20cd29ccfde57670718d00068e13b 100644 --- a/src/connectomnibot.jl +++ b/src/connectomnibot.jl @@ -1,17 +1,17 @@ """ - connectomnibot(ip::String;port::Int=9998) + connectomnibot(ip::String, port::Int) Connect to the omnibot with `ip` and `port`. Return a `TCPSocket` with open connection. """ -function connectomnibot(ip::String;port::Int=9998) +function connectomnibot(ip::String, port::Int) return connect(ip,port) end """ - connectomnibot(ip::IPv4;port::Int=9998) + connectomnibot(ip::IPv4;port::Int) Also callable with an IPv4 type argument """ -function connectomnibot(ip::IPv4;port::Int=9998) +function connectomnibot(ip::IPv4, port::Int) return connect(ip,port) end diff --git a/test/testclient.jl b/test/testclient.jl index 9ff852e066140c9bf8bac8171b8b5299e9ff72b8..34ab8e587d0d2eefbb42825183b9415ae42feffe 100644 --- a/test/testclient.jl +++ b/test/testclient.jl @@ -2,7 +2,8 @@ using Omnibot using Sockets ip = getipaddr() -bot = connectomnibot(ip,port=9998) +port = 9998 +bot = connectomnibot(ip,port) for i = 1:100 println(setspeed(bot,[100,100,100]))