Reference
BaseKevinbotSubsystem
The base subsystem class.
Not to be used directly
Source code in src/kevinbotlib/core.py
33 34 35 36 37 38 39 40 41 |
|
BaseKevinbot
The base robot class.
Not to be used directly
Source code in src/kevinbotlib/core.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
auto_disconnect: bool
property
writable
Getter for auto disconnect state.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Whether to disconnect on application exit |
auto_disable: bool
property
writable
Getter for auto disable state.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Whether to disconnect on application exit |
get_state()
Gets the current state of the robot
Returns:
Name | Type | Description |
---|---|---|
KevinbotState |
KevinbotState
|
State class |
Source code in src/kevinbotlib/core.py
59 60 61 62 63 64 65 |
|
disconnect()
Basic robot disconnect
Source code in src/kevinbotlib/core.py
71 72 73 74 75 |
|
send(data)
Null implementation of the send method
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
Data to send nowhere |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
Always raised |
Source code in src/kevinbotlib/core.py
117 118 119 120 121 122 123 124 125 126 127 |
|
request_enable()
Request the core to enable
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Always 1 |
Source code in src/kevinbotlib/core.py
129 130 131 132 133 134 135 136 |
|
request_disable()
Request the core to disable
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Always 1 |
Source code in src/kevinbotlib/core.py
138 139 140 141 142 143 144 145 |
|
e_stop()
Attempt to send and E-Stop signal to the Core
Source code in src/kevinbotlib/core.py
147 148 149 150 |
|
SerialKevinbot
Bases: BaseKevinbot
The main serial robot class
Source code in src/kevinbotlib/core.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
|
on_data: Callable[[str, str | None], Any] | None
property
writable
Return the data recieved callback function
Returns:
Type | Description |
---|---|
Callable[[str, str | None], Any] | None
|
Callable[[str, str | None], Any] | None: Callback function |
connect(port, baud, timeout, tick_interval, ser_timeout=0.5, *, tick_thread=True)
Start a connection with Kevinbot Core
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port
|
str
|
Serial port to use ( |
required |
baud
|
int
|
Baud rate to use ( |
required |
timeout
|
float
|
Timeout for handshake |
required |
tick_interval
|
float
|
How often a heartbeat should be produced |
required |
ser_timeout
|
float
|
Readline timeout, should be lower than |
0.5
|
tick_thread
|
bool
|
Whether a tick thread should be started. Defaults to True. |
True
|
Raises:
Type | Description |
---|---|
HandshakeTimeoutException
|
Core didn't respond to the connection handshake before the timeout |
Source code in src/kevinbotlib/core.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
disconnect()
Disconnect core gracefully
Source code in src/kevinbotlib/core.py
225 226 227 228 229 230 231 232 233 |
|
tick_loop(interval=1)
Send ticks indefinetely
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval
|
float
|
Interval between ticks in seconds. Defaults to 1. |
1
|
Source code in src/kevinbotlib/core.py
253 254 255 256 257 258 259 260 261 |
|
send(data)
Send a string through serial.
Automatically adds a newline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
Data to send |
required |
Source code in src/kevinbotlib/core.py
263 264 265 266 267 268 269 270 271 |
|
raw_tx(data)
Send raw bytes over serial.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
bytes
|
Raw data |
required |
Source code in src/kevinbotlib/core.py
273 274 275 276 277 278 279 280 281 282 |
|
MqttKevinbot
Bases: BaseKevinbot
KevinbotLib interface over MQTT
Source code in src/kevinbotlib/core.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
|
ts: datetime
property
Get a semi-accurate timestamp from the server. Used for drivebase timeouts.
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
Server time or UNIX timestamp 0 if server hasn't broadcasted a timestamp yet |
__init__(cid=None)
Instansiate a new KevinbotLib interface over MQTT
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cid
|
str | None
|
MQTT Client id. Defaults to an auto-generated uuid. |
None
|
Source code in src/kevinbotlib/core.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
|
connect(root_topic='kevinbot', host='localhost', port=1883, timeout=5.0, keepalive=60, heartbeat=1.0)
Connect to MQTT Broker
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_topic
|
str
|
Root communication topic. Defaults to "kevinbot". |
'kevinbot'
|
host
|
str
|
KevinbotLib server host. Defaults to "localhost". |
'localhost'
|
port
|
int
|
Kevinbot MQTT Broker port. Defaults to 1883. |
1883
|
timeout
|
float
|
KevinbotLib connection timeout in seconds. Defaults to 5. |
5.0
|
keepalive
|
int
|
Maximum period in seconds between communications with the broker. Defaults to 60. |
60
|
heartbeat
|
float
|
Heartbeat interval in seconds. Defaults to 1.0. |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
MQTTErrorCode |
MQTTErrorCode
|
Connection error |
Source code in src/kevinbotlib/core.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
send(data)
Determine topic and publish data. Compatible with send of SerialKevinbot
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
Data to parse and publish |
required |
Source code in src/kevinbotlib/core.py
590 591 592 593 594 595 596 597 598 599 600 601 602 |
|
disconnect()
Disconnect from server
Source code in src/kevinbotlib/core.py
604 605 606 607 608 609 610 611 612 |
|
request_enable()
Request the core to enable
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Always 1 |
Source code in src/kevinbotlib/core.py
614 615 616 617 618 619 620 621 |
|
request_disable()
Request the core to disable
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Always 1 |
Source code in src/kevinbotlib/core.py
623 624 625 626 627 628 629 630 |
|
e_stop()
Attempt to send and E-Stop signal to the Core
Source code in src/kevinbotlib/core.py
632 633 634 |
|
Drivebase
Bases: BaseKevinbotSubsystem
Drivebase subsystem for Kevinbot
Source code in src/kevinbotlib/core.py
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
|
get_amps()
Get the amps being used by the drivebase
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: Amps |
Source code in src/kevinbotlib/core.py
697 698 699 700 701 702 703 |
|
get_watts()
Get the watts being used by the drivebase
Returns:
Type | Description |
---|---|
list[float]
|
list[float]: Watts |
Source code in src/kevinbotlib/core.py
705 706 707 708 709 710 711 |
|
get_powers()
Get the currently set wheel speeds in percent
Returns:
Type | Description |
---|---|
tuple[int, int]
|
tuple[int, int]: Percent values from 0 to 100 |
Source code in src/kevinbotlib/core.py
713 714 715 716 717 718 719 |
|
get_states()
Get the wheels states
Returns:
Type | Description |
---|---|
list[MotorDriveStatus]
|
list[MotorDriveStatus]: States |
Source code in src/kevinbotlib/core.py
721 722 723 724 725 726 727 |
|
drive_at_power(left, right)
Set the drive power for wheels. 0 to 1
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left
|
float
|
Left motor power |
required |
right
|
float
|
Right motor power |
required |
Source code in src/kevinbotlib/core.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
|
stop()
Set all wheel powers to 0
Source code in src/kevinbotlib/core.py
745 746 747 |
|
Servo
Individually controllable servo
Source code in src/kevinbotlib/core.py
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
|
bank: int
property
Get the bank the servo is in
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Bank number |
angle: int
property
writable
Get the optimistic current servo angle
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Angle in degrees |
Servos
Bases: BaseKevinbotSubsystem
Servo subsystem for Kevinbot
Source code in src/kevinbotlib/core.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
|
__len__()
Length will always be 32 since the P2 Kevinbot Board can only control 32
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Number of servos in the subsystem |
Source code in src/kevinbotlib/core.py
795 796 797 798 799 800 801 |
|
get_servo(channel)
Get an individual servo in the subsystem
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
int
|
PWM Port |
required |
Returns:
Name | Type | Description |
---|---|---|
Servo |
Servo
|
Individual servo |
Source code in src/kevinbotlib/core.py
816 817 818 819 820 821 822 823 824 825 826 827 828 |
|
Lighting
Bases: BaseKevinbotSubsystem
Lighting subsystem for Kevinbot
Source code in src/kevinbotlib/core.py
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
|
Channel
Bases: Enum
Lighting segment identifier
Source code in src/kevinbotlib/core.py
845 846 847 848 849 850 |
|
get_state()
Get the state of the robot's light segments
Returns:
Name | Type | Description |
---|---|---|
LightingState |
LightingState
|
State |
Source code in src/kevinbotlib/core.py
852 853 854 855 856 857 858 |
|
set_cam_brightness(brightness)
Set brightness of camera illumination
Parameters:
Name | Type | Description | Default |
---|---|---|---|
brightness
|
int
|
Brightness from 0 to 255 |
required |
Source code in src/kevinbotlib/core.py
860 861 862 863 864 865 866 867 |
|
set_brightness(channel, brightness)
Set the brightness of a lighting segment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
Channel
|
Base, Body, or Head |
required |
brightness
|
int
|
Brightness from 0 to 255 |
required |
Source code in src/kevinbotlib/core.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 |
|
set_color1(channel, color)
Set the Color 1 of a lighting segment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
Channel
|
Base, Body, or Head |
required |
color
|
Iterable[int]
|
RGB Color values. Must have a length of 3 |
required |
Source code in src/kevinbotlib/core.py
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 |
|
set_color2(channel, color)
Set the Color 2 of a lighting segment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
Channel
|
Base, Body, or Head |
required |
color
|
Iterable[int]
|
RGB Color values. Must have a length of 3 |
required |
Source code in src/kevinbotlib/core.py
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
|
set_effect(channel, effect)
Set the animation of a lighting segment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
Channel
|
Base, Body, or Head |
required |
effect
|
str
|
Animation ID |
required |
Source code in src/kevinbotlib/core.py
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
|
set_update(channel, update)
Set the animation of a lighting segment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel
|
Channel
|
Base, Body, or Head |
required |
update
|
int
|
Update rate (no fixed unit) |
required |
Source code in src/kevinbotlib/core.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
|
BaseKevinbotEyes
The base Kevinbot Eyes class.
Not to be used directly
Source code in src/kevinbotlib/eyes.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
auto_disconnect: bool
property
writable
Getter for auto disconnect state.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Whether to disconnect on application exit |
get_state()
Gets the current state of the eyes
Returns:
Name | Type | Description |
---|---|---|
KevinbotEyesState |
KevinbotEyesState
|
State class |
Source code in src/kevinbotlib/eyes.py
289 290 291 292 293 294 295 |
|
disconnect()
Basic disconnect
Source code in src/kevinbotlib/eyes.py
297 298 299 |
|
send(data)
Null implementation of the send method
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
Data to send nowhere |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
Always raised |
Source code in src/kevinbotlib/eyes.py
323 324 325 326 327 328 329 330 331 332 333 |
|
set_skin(skin)
Set the current skin
Parameters:
Name | Type | Description | Default |
---|---|---|---|
skin
|
EyeSkin
|
Skin index |
required |
Source code in src/kevinbotlib/eyes.py
335 336 337 338 339 340 341 342 343 344 345 |
|
set_backlight(bl)
Set the current backlight brightness
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bl
|
float
|
Brightness from 0 to 1 |
required |
Source code in src/kevinbotlib/eyes.py
347 348 349 350 351 352 353 354 355 356 357 |
|
get_backlight()
Get the current backlight setting
Returns:
Name | Type | Description |
---|---|---|
float |
Value from 0 to 1 |
Source code in src/kevinbotlib/eyes.py
359 360 361 362 363 364 365 |
|
set_motion(motion)
Set the current backlight brightness
Parameters:
Name | Type | Description | Default |
---|---|---|---|
motion
|
EyeMotion
|
Motion mode |
required |
Source code in src/kevinbotlib/eyes.py
368 369 370 371 372 373 374 375 376 377 378 |
|
set_manual_pos(x, y)
Set the on-screen position of pupil
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
int
|
X Position of pupil |
required |
y
|
int
|
Y Position of pupil |
required |
Source code in src/kevinbotlib/eyes.py
380 381 382 383 384 385 386 387 388 389 390 391 |
|
set_skin_option(data)
Set a raw skin option.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list
|
list of keys, last item is the value |
required |
Source code in src/kevinbotlib/eyes.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
SerialEyes
Bases: BaseKevinbotEyes
The main serial Kevinbot Eyes class
Source code in src/kevinbotlib/eyes.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
|
connect(port, baud, timeout, ser_timeout=0.5)
Start a connection with Kevinbot Eyes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port
|
str
|
Serial port to use ( |
required |
baud
|
int
|
Baud rate to use ( |
required |
timeout
|
float
|
Timeout for handshake |
required |
ser_timeout
|
float
|
Readline timeout, should be lower than |
0.5
|
Raises:
Type | Description |
---|---|
HandshakeTimeoutException
|
Eyes didn't respond to the connection handshake before the timeout |
Source code in src/kevinbotlib/eyes.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
|
update()
Retrive updated settings from eyes
Source code in src/kevinbotlib/eyes.py
558 559 560 561 |
|
send(data)
Send a string through serial.
Automatically adds a newline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
Data to send |
required |
Source code in src/kevinbotlib/eyes.py
571 572 573 574 575 576 577 578 579 |
|
raw_tx(data)
Send raw bytes over serial.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
bytes
|
Raw data |
required |
Source code in src/kevinbotlib/eyes.py
581 582 583 584 585 586 587 588 589 590 |
|
MqttEyes
Bases: BaseKevinbotEyes
The main serial Kevinbot Eyes class
Source code in src/kevinbotlib/eyes.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 |
|
update()
Retrive updated settings from eyes
Source code in src/kevinbotlib/eyes.py
702 703 704 705 |
|
WirelessRadio
Bases: BaseKevinbotSubsystem
Source code in src/kevinbotlib/xbee.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__init__(robot, port, baud, api, timeout)
Initialize Kevinbot Wireless Radio (XBee)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
robot
|
Kevinbot
|
The main robot class |
required |
port
|
str
|
Serial port to connect to |
required |
baud
|
int
|
Baud rate for serial interface |
required |
api
|
int
|
API mode for xbee interface |
required |
timeout
|
float
|
Timeout for serial operations |
required |
Source code in src/kevinbotlib/xbee.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
get()
Get the latest packet (blocking)
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Data packet |
Source code in src/kevinbotlib/xbee.py
39 40 41 42 43 44 45 |
|
disconnect()
Disconnect robot radio, and halt processing
Source code in src/kevinbotlib/xbee.py
47 48 49 50 |
|
CoreErrors
Bases: Enum
Kevinbot Core Error States
Source code in src/kevinbotlib/states.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
OK = 0
class-attribute
instance-attribute
No errors are present
UNKNOWN = 1
class-attribute
instance-attribute
Error state unknown
OW_SHORT = 2
class-attribute
instance-attribute
One-Wire bus is shorted
OW_ERROR = 3
class-attribute
instance-attribute
One-Wire bus error
OW_DNF = 4
class-attribute
instance-attribute
One-Wire device not found
LCD_INIT_FAIL = 5
class-attribute
instance-attribute
LCD Init failed
PCA_INIT_FAIL = 6
class-attribute
instance-attribute
PCA9685 (servos) init fail
TICK_FAIL = 7
class-attribute
instance-attribute
Failure to recieve core tick
QUEUE_OVERRUN = 8
class-attribute
instance-attribute
Serial queue overrun
ESTOP = 9
class-attribute
instance-attribute
Core is in E-Stop state
BME_CHIP_ID = 10
class-attribute
instance-attribute
Error getting environment sensor chip id
BME_CALIB_NVM = 11
class-attribute
instance-attribute
Error with environment sensor calibration
BME_CALIB_TP = 12
class-attribute
instance-attribute
Error with environment sensor calibration
BME_CALIB_HUM = 13
class-attribute
instance-attribute
Error with environment sensor calibration
BME_THP = 14
class-attribute
instance-attribute
Error with environment sensor
BME_MEAS_TIMEOUT = 15
class-attribute
instance-attribute
Timeout with environment sensor measurement
BME_NOT_NORMAL_MODE = 16
class-attribute
instance-attribute
Environemnt sensor is not in normal mode
BATT1_UV = 17
class-attribute
instance-attribute
Battery #1 Undervoltage
BATT1_OV = 18
class-attribute
instance-attribute
Battery #1 Overvoltage
BATT2_UV = 19
class-attribute
instance-attribute
Battery #2 Undervoltage
BATT2_OV = 20
class-attribute
instance-attribute
Battery #2 Overvoltage
BATT_UV = 21
class-attribute
instance-attribute
Battery Undervoltage (single battery mode)
BATT_OV = 22
class-attribute
instance-attribute
Battery Overvoltage (single battery mode)
MotorDriveStatus
Bases: Enum
The status of each motor in the drivebase
Source code in src/kevinbotlib/states.py
64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
UNKNOWN = 10
class-attribute
instance-attribute
Motor status is unknown
MOVING = 11
class-attribute
instance-attribute
Motor is rotating
HOLDING = 12
class-attribute
instance-attribute
Motor is holding at position
OFF = 13
class-attribute
instance-attribute
Motor is off
BmsBatteryState
Bases: Enum
The status of a single battery attached to the BMS
Source code in src/kevinbotlib/states.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
UNKNOWN = 0
class-attribute
instance-attribute
State is unknown (usually at bootup)
NORMAL = 1
class-attribute
instance-attribute
Battery is normal
UNDER = 2
class-attribute
instance-attribute
Battery is undervoltage
OVER = 3
class-attribute
instance-attribute
Battery is overvoltage
STOPPED = 4
class-attribute
instance-attribute
BMS has crashed or stopped
DrivebaseState
Bases: BaseModel
The state of the drivebase as a whole
Source code in src/kevinbotlib/states.py
96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
left_power: int = 0
class-attribute
instance-attribute
Current power of the left motor
right_power: int = 0
class-attribute
instance-attribute
Current power of the right motor
amps: list[float] = Field(default_factory=lambda: [0, 0])
class-attribute
instance-attribute
Current amps for both motors
watts: list[float] = Field(default_factory=lambda: [0, 0])
class-attribute
instance-attribute
Current watts for both motors
status: list[MotorDriveStatus] = Field(default_factory=lambda: [MotorDriveStatus.UNKNOWN, MotorDriveStatus.UNKNOWN])
class-attribute
instance-attribute
Current status for both motors
ServoState
Bases: BaseModel
The state of the servo subsystem
Source code in src/kevinbotlib/states.py
111 112 113 114 115 |
|
angles: list[int] = Field(default_factory=lambda: [-1] * 32)
class-attribute
instance-attribute
Servo angles
BMState
Bases: BaseModel
The state of the BMS (Battery Management System)
Source code in src/kevinbotlib/states.py
118 119 120 121 122 123 |
|
IMUState
Bases: BaseModel
The state of the IMU (Inertial Measurement System)
Source code in src/kevinbotlib/states.py
126 127 128 129 130 |
|
ThermometerState
Bases: BaseModel
The state of the DS18B20 Thermometers (does not include BME280)
Source code in src/kevinbotlib/states.py
133 134 135 136 137 138 |
|
EnviroState
Bases: BaseModel
The state of the BME280 Envoronmental sensor
Source code in src/kevinbotlib/states.py
141 142 143 144 145 146 |
|
LightingState
Bases: BaseModel
The state of Kevinbot's led segments
Source code in src/kevinbotlib/states.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
KevinbotState
Bases: BaseModel
The state of the robot as a whole
Source code in src/kevinbotlib/states.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
EyeSkin
Bases: Enum
Eye Skins for the eye system
Source code in src/kevinbotlib/states.py
188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
TV_STATIC = 0
class-attribute
instance-attribute
TV Static-style random colors
SIMPLE = 1
class-attribute
instance-attribute
Simple skin with variable pupil, iris, and background
METAL = 2
class-attribute
instance-attribute
Skin with fancy pupil and iris over an aluminum background
NEON = 3
class-attribute
instance-attribute
Neon skin
EyeMotion
Bases: Enum
Motion modes for the eye system
Source code in src/kevinbotlib/states.py
203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
DISABLE = 0
class-attribute
instance-attribute
No motion
LEFT_RIGHT = 1
class-attribute
instance-attribute
Smooth left to right and back
JUMP = 2
class-attribute
instance-attribute
Jumpy left to right and back
MANUAL = 3
class-attribute
instance-attribute
Allow manual control of pupil position
KevinbotEyesState
Bases: BaseModel
The state of the eye system
Source code in src/kevinbotlib/states.py
286 287 288 289 290 |
|
KevinbotServerState
Bases: BaseModel
The state system used internally in the Kevinbot Server
Source code in src/kevinbotlib/states.py
293 294 295 296 297 298 299 300 301 302 303 304 305 |
|
HandshakeTimeoutException
Bases: BaseException
Exception that is produced when the connection handshake times out
Source code in src/kevinbotlib/exceptions.py
6 7 |
|
Configuration manager for KevinbotLib
ConfigLocation
Bases: Enum
Enum to represent the location of the config file
Source code in src/kevinbotlib/config.py
14 15 16 17 18 19 20 21 |
|
KevinbotConfig
Source code in src/kevinbotlib/config.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
dump()
Dump configuration
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
YAML |
Source code in src/kevinbotlib/config.py
327 328 329 330 331 332 333 |
|