@@ -18,28 +18,29 @@ Use `connectomnibot` to create a TCP-connection. Whenever your script is done or
...
@@ -18,28 +18,29 @@ Use `connectomnibot` to create a TCP-connection. Whenever your script is done or
```
```
using Omnibot
using Omnibot
host = ...
HOST = "xxx.xxx.xxx.xxx"
port = ...
PORT = yyyy
bot = connectomnibot(host, port)
bot = connectomnibot(HOST, PORT)
for i = 1:100
for i = 1:100
setspeed(bot, [100, 100, 100])
setspeed(bot, [100, 100, 100])
println("x: @(getx(bot))")
println("x: $(getx(bot))")
println("y: @(gety(bot))")
println("y: $(gety(bot))")
println("z: @(getz(bot))")
println("z: $(getz(bot))")
println("theta: @(gettheta(bot))")
println("theta: $(gettheta(bot))")
sleep(0.1)
sleep(0.1)
end
end
close(bot)
close(bot)
```
```
#### Example: Read the maximum set-point for servo speed
#### Example: Read the maximum set-point for servo speed
```
```
using Omnibot
using Omnibot
host = ...
HOST = "xxx.xxx.xxx.xxx"
port = ...
PORT = yyyy
bot = connectomnibot(host, port)
println(getmaxspeed(bot))
println(getmaxspeed(bot))
...
@@ -47,21 +48,21 @@ close(bot)
...
@@ -47,21 +48,21 @@ close(bot)
```
```
### Example: `do x` syntax
### Example: `do x` syntax
The following example does practically the same as the first example.
The following example does practically the same as the first example, but is perhaps a bit safer as it automatically closes the bot-connection when exiting the `do x` block.
```
```
using Omnibot
using Omnibot
host = ...
HOST = "xxx.xxx.xxx.xxx"
port = ...
PORT = yyyy
connectomnibot(host, port) do bot
connectomnibot(HOST, PORT) do bot
for i = 1:100
for i = 1:100
setspeed(bot, [100, 100, 100])
setspeed(bot, [100, 100, 100])
println("x: @(getx(bot))")
println("x: $(getx(bot))")
println("y: @(gety(bot))")
println("y: $(gety(bot))")
println("z: @(getz(bot))")
println("z: $(getz(bot))")
println("theta: @(gettheta(bot))")
println("theta: $(gettheta(bot))")
sleep(0.1)
sleep(0.1)
sleep(0.1)
end
end
...
@@ -69,7 +70,7 @@ end
...
@@ -69,7 +70,7 @@ end
```
```
### Network
### 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*. You can connect to this router via IP `130.235.83.171`. Use port `90XX` to rout to bot number `XX`, e.g. `9006` routs to bot number 6.
The omnibots automatically connect to the router named "robotlab". You can connect to the omnibots via this router, IP `130.235.83.171`. Use port `90XX` to rout to bot number `XX`, e.g. `9006` routs to bot number 6.