From 0442fb0078d41a27acd6b01d08ad5e2270fba905 Mon Sep 17 00:00:00 2001
From: Felix Agner <felix.agner@control.lth.se>
Date: Tue, 1 Nov 2022 13:35:19 +0100
Subject: [PATCH] changed names to improve clarity and following naming
 conventions

---
 README.md                                     | 35 ++++++++-----------
 src/{omnibot_client => omnibot}/__init__.py   |  0
 .../Dummybot.py => omnibot/dummybot.py}       |  4 +--
 .../Omnibot.py => omnibot/tcp.py}             |  2 +-
 .../testcontroller.py}                        |  4 +--
 5 files changed, 20 insertions(+), 25 deletions(-)
 rename src/{omnibot_client => omnibot}/__init__.py (100%)
 rename src/{omnibot_client/Dummybot.py => omnibot/dummybot.py} (93%)
 rename src/{omnibot_client/Omnibot.py => omnibot/tcp.py} (99%)
 rename src/{omnibot_client/ControllerTest.py => omnibot/testcontroller.py} (97%)

diff --git a/README.md b/README.md
index 86f5918..ff9549a 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,33 @@
-## omnibot_client
+## omnibot.py
 
 ## Description
-This is a python package which allows TCP connection with the omnibots at the Department of Automatic Control.
+This is a python package which allows connection (currently only TCP-based) with the omnibots at the Department of Automatic Control.
+
+Note that this package convers the **client side**. For information about setting up the omnibot, see (link here).
 
 ## Installation
-On linus:
-`pip install git+https://gitlab.control.lth.se/processes/omnibot/omnibotclient.py`
+On linux:
+`pip install git+https://gitlab.control.lth.se/processes/omnibot/omnibot.py`
 
 ## Usage
-Import the omnibot-object with
-`from omnibot_client.Omnibot import OmniBot`
-Use the `with` command to create an omnibot-object, as this will automatically open and close the connection cleanly.
-`with OmniBot("localhost") as bot`
-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) 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
-`x = bot.get_x()`
-`y = bot.get_y()`
-`z = bot.get_z()`
-`theta = bot.get_theta()`
+`x = bot.get_x()`,
+`y = bot.get_y()`,
+`z = bot.get_z()`,
+`theta = bot.get_theta()`.
 
-Example:
+*Example:*
 Connect to a robot at localhost, make it spin in a circle and read the x and y positions.
 ```
-from omnibot_client.Omnibot import OmniBot
+from omnibot.tcp import Connection
 from time import time, sleep
 
 # Insert suitable IP-adress
 HOST = "localhost"
 
-with OmniBot(HOST) as bot:
+with Connection(HOST) as bot:
         
         # Target speed for servos
         vset = 100
@@ -51,7 +46,7 @@ with OmniBot(HOST) as bot:
             sleep(0.1)
 ```
 
-Example:
+*Example:*
 A pre-defined script which rotates first one way, then the other, and prints logged angle:
 ```
 from omnibot_client.Dummybot import run_dummybot
diff --git a/src/omnibot_client/__init__.py b/src/omnibot/__init__.py
similarity index 100%
rename from src/omnibot_client/__init__.py
rename to src/omnibot/__init__.py
diff --git a/src/omnibot_client/Dummybot.py b/src/omnibot/dummybot.py
similarity index 93%
rename from src/omnibot_client/Dummybot.py
rename to src/omnibot/dummybot.py
index b9dcf72..570a4da 100644
--- a/src/omnibot_client/Dummybot.py
+++ b/src/omnibot/dummybot.py
@@ -2,7 +2,7 @@
 import sys
 from time import time, sleep
 
-from .Omnibot import OmniBot
+from .tcp import Connection
 
 
 def run_dummybot(HOST,verbose=True):
@@ -13,7 +13,7 @@ def run_dummybot(HOST,verbose=True):
     ts = 0.1 # sampling time
     tstart = time()
 
-    with OmniBot(HOST,verbose=verbose) as bot:
+    with Connection(HOST,verbose=verbose) as bot:
         print("Connected")
         
         # Target speed for servos
diff --git a/src/omnibot_client/Omnibot.py b/src/omnibot/tcp.py
similarity index 99%
rename from src/omnibot_client/Omnibot.py
rename to src/omnibot/tcp.py
index 4482668..d5e4742 100644
--- a/src/omnibot_client/Omnibot.py
+++ b/src/omnibot/tcp.py
@@ -1,6 +1,6 @@
 import socket
         
-class OmniBot(object):
+class Connection(object):
     """
     A class that implements a servo-client which is capable of sending servo speed-settings
     to an omnibot. 
diff --git a/src/omnibot_client/ControllerTest.py b/src/omnibot/testcontroller.py
similarity index 97%
rename from src/omnibot_client/ControllerTest.py
rename to src/omnibot/testcontroller.py
index 54787eb..d2244c5 100644
--- a/src/omnibot_client/ControllerTest.py
+++ b/src/omnibot/testcontroller.py
@@ -9,7 +9,7 @@ import threading
 # Controller
 from inputs import get_gamepad
 
-from .Omnibot import OmniBot
+from .tcp import Connection
 
 class ControllerState:
     """
@@ -84,7 +84,7 @@ def run_omnibot_with_controller(HOST,verbose=False):
     
     ts = 0.1 # sampling time
     
-    with OmniBot(HOST,verbose=verbose) as bot:
+    with Connection(HOST,verbose=verbose) as bot:
         while state.on:
             t0 = time()
 
-- 
GitLab