From a8454b014e7901524f9060f5eb7c67b1b774262e Mon Sep 17 00:00:00 2001
From: Felix Agner <felix.agner@control.lth.se>
Date: Tue, 3 Jan 2023 16:01:39 +0100
Subject: [PATCH] changed to not always have the same port

---
 README.md             | 12 +++++++-----
 src/connectomnibot.jl |  8 ++++----
 test/testclient.jl    |  3 ++-
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index a1f0f03..37d4c79 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 723e2fe..120aa09 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 9ff852e..34ab8e5 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]))
-- 
GitLab