standardbots 2.0.0.dev1766179700__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of standardbots might be problematic. Click here for more details.

@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: standardbots
3
+ Version: 2.0.0.dev1766179700
4
+ Summary: Standard Bots RO1 Robotics API
5
+ Home-page:
6
+ Author: Standard Bots Support
7
+ Author-email: support@standardbots.com
8
+ Keywords: Standard Bots RO1 Robotics API
9
+ Requires-Python: >=3.7
10
+ Requires-Dist: setuptools>=21.0.0
11
+ Requires-Dist: typing_extensions>=4.3.0
12
+ Requires-Dist: urllib3>=1.26.7
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: description
16
+ Dynamic: keywords
17
+ Dynamic: requires-dist
18
+ Dynamic: requires-python
19
+ Dynamic: summary
20
+
21
+ Standard Bots RO1 Robotics API. # noqa: E501
22
+
@@ -0,0 +1,216 @@
1
+ You can test the API by using the playground, add your own file or use the
2
+ existing python scripts. When a client has an issue, and they send their code.
3
+ It's helpful to test their code to see possible issues
4
+
5
+ # ENABLE API ON YOUR LOCAL MACHINE
6
+
7
+ Follow the steps here
8
+ https://www.notion.so/standardbots/Using-the-REST-API-b2c778d47969444dac61483f0117acad
9
+
10
+ # CONFIG
11
+
12
+ At the top of the file, use your token
13
+
14
+ # RUN
15
+
16
+ To run a script move into the `sdks/python` folder and run
17
+ `python playground/filename.py`
18
+
19
+ # To create a test build
20
+
21
+ 1. Update version in `setup.py`
22
+ 2. Run `python3 setup.py sdist bdist_wheel`
23
+
24
+ # Tests
25
+
26
+ ## `botctl` commands
27
+
28
+ You may now use the `botctl` commands to setup and run tests.
29
+
30
+ Set up the testing environment on the computer where you are running the tests:
31
+
32
+ ```bash
33
+ # Setup testing environment
34
+ botctl publicapi test:setup --help
35
+
36
+ # Run tests
37
+ botctl publicapi test --help
38
+ ```
39
+
40
+ Set up the bot environment on the robot:
41
+
42
+ ```bash
43
+ botctl publicapi test:setup-bot
44
+ ```
45
+
46
+ ## Setup
47
+
48
+ To set up tests:
49
+
50
+ ```bash
51
+ cd sdks/python
52
+ ```
53
+
54
+ Note: Make sure to select proper python interpreter. Sometimes there is an error
55
+ related to missing "dotenv" module, to solve this install it separately
56
+
57
+ ```
58
+ python3 -m pip install python-dotenv
59
+ python3 -m pip install -r requirements-dev.txt
60
+ ```
61
+
62
+ ### Create sample data
63
+
64
+ #### Sample routine
65
+
66
+ You need to add the sample routine in
67
+ [sdks/python/tests/fixtures/test_public_api_routine.json](./tests/fixtures/test_public_api_routine.json)
68
+ to your target test environment (i.e. upload the routine to ).
69
+
70
+ The name of routine should be "Test Public API"
71
+
72
+ #### Sample globals
73
+
74
+ - _Variable._ Add global variable called "test_public_api_global" with any
75
+ value.
76
+ - _Space._ Create a global space called "Test global space" of any kind.
77
+
78
+ ## Running
79
+
80
+ Here is a basic test command:
81
+
82
+ ```bash
83
+ SB_API_URL=http://34.162.0.32:3000
84
+ SB_API_TOKEN=...
85
+
86
+ python3 -m pytest ./tests --cov=standardbots --token=$SB_API_TOKEN --api-url=$SB_API_URL
87
+ ```
88
+
89
+ You may also set up a `.env` file at `sdks/python/.env` with the following
90
+ contents:
91
+
92
+ ```bash
93
+ export SB_API_URL=http://34.162.0.32:3000
94
+ export SB_API_TOKEN=...
95
+ ```
96
+
97
+ Then you can just do:
98
+
99
+ ```bash
100
+ python3 -m pytest ./tests --cov=standardbots
101
+ ```
102
+
103
+ ### Robot state and testing (Markers)
104
+
105
+ We need the bot to be in a certain state to run certain tests. For example, we
106
+ need a routine to be running in order to stop the routine. Camera should be
107
+ disconnected by default.
108
+
109
+ At start of testing, robot should:
110
+
111
+ - _NOT_ be e-stopped.
112
+
113
+ The basic idea here is:
114
+
115
+ - These special tests will not be run by default.
116
+ - You may pass a flag (e.g. `--camera-connected`) when the bot is in the correct
117
+ state to run the tests.
118
+ - Markers usage:
119
+ - When `--gripper=<type>` flag is passed(`type` is value from `GripperKindEnum`
120
+ enum):
121
+ 1. Tests expect that this specific gripper is connected
122
+ 2. Tests without the flag are not run.
123
+ - When `--camera-connected` flag is passed:
124
+ 1. Tests with the flag are run.
125
+ 2. Tests without the flag are not run.
126
+
127
+ We use [pytest markers](https://docs.pytest.org/en/7.1.x/example/markers.html)
128
+ to do this.
129
+
130
+ #### Camera disconnected
131
+
132
+ The wrist camera should be disabled. Then run:
133
+
134
+ ```bash
135
+ python3 -m pytest ./tests --cov=standardbots --camera-connected
136
+ ```
137
+
138
+ #### E-stop
139
+
140
+ No marker needed for e-stop. However, we do rely on active recovery of e-stop
141
+ and getting the failure state in order to do these tests.
142
+
143
+ When e-stop test runs, cannot have bot in a failure state (pre-test will fail).
144
+
145
+ ## Troubleshooting
146
+
147
+ ### Tests are hanging
148
+
149
+ The first test appears to start but then nothing happens for several seconds:
150
+
151
+ ```bash
152
+ $ python3 -m pytest ./tests --cov=standardbots
153
+ ========================================================================================================== test session starts ===========================================================================================================
154
+ platform linux -- Python 3.10.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
155
+ rootdir: /workspaces/sb/sdks/python, configfile: pytest.ini
156
+ plugins: ament-pep257-0.12.11, ament-xmllint-0.12.11, launch-testing-1.0.6, launch-testing-ros-0.19.7, ament-flake8-0.12.11, ament-lint-0.12.11, ament-copyright-0.12.11, colcon-core-0.18.1, cov-6.0.0
157
+ collected 110 items
158
+
159
+ tests/test_apis.py
160
+ ```
161
+
162
+ Fixes:
163
+
164
+ - _Make sure you can log into remote control._ Ensure that botman is connected.
165
+ - _Ensure that the robot URL is up-to-date._ Botman url will often change when
166
+ you reboot.
167
+
168
+ ### Custom sensors
169
+
170
+ To test custom sensors:
171
+
172
+ - go to the menu on the left bottom corner;
173
+ - Click on 'Equipment';
174
+ - Add Gripper > Custom Gripper;
175
+ - Go to the Sensors tab and click 'Add Sensor';
176
+ - Keep the default values as they are (name: 'Sensor 1', kind: 'Control Box IO',
177
+ sensor value: 'low');
178
+ - Hit 'Save' and make sure the Custom Gripper is enabled.
179
+
180
+ Then run:
181
+
182
+ ```bash
183
+ python3 -m pytest ./tests --cov=standardbots --gripper=custom_sensors
184
+ ```
185
+
186
+ ## Database backups
187
+
188
+ > See command: `botctl publicapi test:setup-bot`.
189
+
190
+ We now have a common robot database state that can be used for testing. While
191
+ this isn't necessary for use, it does provide a common state for testing.
192
+
193
+ ### How to create a new backup
194
+
195
+ In the place where you are running the stack and want to create the backup (e.g.
196
+ on the control box):
197
+
198
+ ```bash
199
+ DB_USER=sb
200
+ DB_NAME=sb
201
+ BACKUP_FILE=$HOME/db-backup-publicapi-test.sql
202
+
203
+ docker exec -it postgres-bot pg_dump -U $DB_USER -d $DB_NAME -F c -f /tmp/backup.sql
204
+
205
+ docker cp postgres-bot:/tmp/backup.sql $BACKUP_FILE
206
+ ```
207
+
208
+ If you need to download to the actual development environment:
209
+
210
+ ```bash
211
+ CB_FILE=/home/control-box-bot/db-backup-publicapi-test.sql
212
+ VM_FILE=~/sb/golang/apps/botctl/commands/publicapi/db-backup-publicapi-test.sql
213
+
214
+ # Move directly to VM:
215
+ scp cb2047:$CB_FILE $VM_FILE
216
+ ```
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Standard Bots RO1 Robotics API
5
+
6
+ Standard Bots RO1 Robotics API. # noqa: E501
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@standardbots.com
10
+ Generated by: https://openapi-generator.tech
11
+ """
12
+
13
+ from setuptools import setup, find_packages # noqa: H301
14
+
15
+ NAME = "standardbots"
16
+ VERSION = "2.0.0-dev1766179700"
17
+ # To install the library, run the following
18
+ #
19
+ # python setup.py install
20
+ #
21
+ # prerequisite: setuptools
22
+ # http://pypi.python.org/pypi/setuptools
23
+
24
+ REQUIRES = [
25
+ "setuptools >= 21.0.0",
26
+ "typing_extensions >= 4.3.0",
27
+ "urllib3 >= 1.26.7",
28
+ ]
29
+
30
+ setup(
31
+ name=NAME,
32
+ version=VERSION,
33
+ description="Standard Bots RO1 Robotics API",
34
+ author="Standard Bots Support",
35
+ author_email="support@standardbots.com",
36
+ url="",
37
+ keywords=["Standard Bots RO1 Robotics API"],
38
+ python_requires=">=3.7",
39
+ install_requires=REQUIRES,
40
+ packages=find_packages(exclude=["test", "tests"]),
41
+ include_package_data=True,
42
+ long_description="""\
43
+ Standard Bots RO1 Robotics API. # noqa: E501
44
+ """
45
+ )
@@ -0,0 +1 @@
1
+ from .auto_generated import *
@@ -0,0 +1,4 @@
1
+ from . import models
2
+ from . import apis
3
+ from .apis import StandardBotsRobot
4
+ from .models import *