Import the connection-object with `from omnibot.tcp import Connection`. Use the `with Connection(HOST) as bot:` command, as this will automatically open and close the connection cleanly. To e.g. set the reference speed for servo 1 to 100, use `bot.set_speed(1,100)`. To set all servo speeds at once, use `bot.set_speeds([100,100,100])`.
Import the connection-object with `from omnibot.tcp import Connection`. Use the `with Connection(HOST, PORT) as bot:` command, as this will automatically open and close the connection cleanly. To e.g. set the reference speed for servo 1 to 100, use `bot.set_speed(1,100)`. To set all servo speeds at once, use `bot.set_speeds([100,100,100])`.
To read positions from the crazyflie, use
To read positions from the crazyflie, use
`x = bot.get_x()`,
`x = bot.get_x()`,
...
@@ -29,9 +29,10 @@ from omnibot.tcp import Connection
...
@@ -29,9 +29,10 @@ from omnibot.tcp import Connection
from time import time, sleep
from time import time, sleep
# Insert suitable IP-adress
# Insert suitable IP-adress
HOST = "localhost"
HOST = "192.168.0.101"
PORT = 9001
with Connection(HOST) as bot:
with Connection(HOST, PORT) as bot:
# Target speed for servos
# Target speed for servos
vset = 100
vset = 100
...
@@ -58,15 +59,16 @@ A pre-defined script which rotates first one way, then the other, and prints log
...
@@ -58,15 +59,16 @@ A pre-defined script which rotates first one way, then the other, and prints log
from omnibot.dummybot import run_dummybot
from omnibot.dummybot import run_dummybot
# Insert suitable IP-adress
# Insert suitable IP-adress
HOST = "localhost"
HOST = "192.168.0.101"
run_dummybot(HOST)
PORT = 9001
run_dummybot(HOST, PORT)
```
```
### Maximum servo speed
### Maximum servo speed
You can get the maximum absolute value of servo-speed-setpoints with `max_speed = bot.get_max_speed()`. Any value above (below) `max_speed` (`-max_speed`) is rounded down (up) on the server side.
You can get the maximum absolute value of servo-speed-setpoints with `max_speed = bot.get_max_speed()`. Any value above (below) `max_speed` (`-max_speed`) is rounded down (up) on the server side.
### 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*, 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`.