Skip to main content

Controller library for robotmoose robots.

Project description

logo

MoosePy

A python robotics library for interfacing with RobotMoose

Summary

MoosePy offers functionality for driving and retreiving sensors values from robots deployed using RobotMoose. It supports arbitrary robot configurations using the JSON structure found on the Superstar server.

Installation

  1. Download the latest supported version of Python3

  2. Install the library with following pip command:

     pip3 install moosepy
    

    MoosePy uses the requests library, which can be installed using the following command if you are experiencing dependency issues:

    pip3 install requests
    

Setup

Instantiating a robot object is dependent on two parameters:

Required Parameter Description
superstar_path The path after https://robotmoose.com/superstar/ For example, if the path to your robot is https://robotmoose.com/superstar/robots/20xx-yy/uaf/robotName then superstar_path = robots/20xx-yy/uaf/robotName
password The robot's password

Usage

import moosepy

# The path after https://robotmoose.com/superstar/
superstar_path = "robots/20xx-yy/uaf/robotName"
password = "password"

robot = moosepy.Robot(superstar_path, password) 

Examples

Drive Forward

import moosepy
import time

robot = moosepy.Robot("superstar_path", "password")

# Drive forward with left and right motors at 10% speed for 1 second
robot.drive(10,10)
time.sleep(1)

# Stop the robot
robot.drive(0,0)

Drive Forward, Backward, Left, and Right

import moosepy
import time

robot = moosepy.Robot("superstar_path", "password")

# Forward
robot.drive(10,10)
time.sleep(1)

# Backward
robot.drive(-10,-10)
time.sleep(1)

# Left
robot.drive(-10, 10)
time.sleep(1)

# Right
robot.drive(10, -10)
time.sleep(1)

# Stop
robot.drive(0,0)

Get Sensor Data JSON

import moosepy

robot = moosepy.Robot("superstar_path", "password")
sensor_data = robot.getSensors()

print(json.dumps(sensor_data, indent=4))

Example Output:

{
    "backend": {
        "battery": {
            "is_charging": false,
            "percent": "2.00%",
            "time_till_discharged": "7.63 minutes"
        },
        "name": "RobotMoose",
        "version": "2017.3.6.0"
    },
    "battery": {
        "charge": 43,
        "state": 16
    },
    "heartbeats": 188,
    "power": {
        "L": 0,
        "R": 0
    }
}

Control a Servo

import moosepy

robot = moosepy.Robot("superstar_path", "password")
robot.setOpt("servo", {"degree": 70})
robot.sendRequest()

License

Copyright 2019 University of Alaska Fairbanks

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moosepy-1.0.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moosepy-1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file moosepy-1.0.tar.gz.

File metadata

  • Download URL: moosepy-1.0.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0

File hashes

Hashes for moosepy-1.0.tar.gz
Algorithm Hash digest
SHA256 61f311ce040cf02e040fc80dddf4e8808ef4abeabbbf98f310e4cef6f0bcb921
MD5 d3d6aa49fc788eda656b3aa59f336066
BLAKE2b-256 067b8d5cdad71315426c3d4ddf4276255a330fc9eaaa7fa11170153db532de1b

See more details on using hashes here.

File details

Details for the file moosepy-1.0-py3-none-any.whl.

File metadata

  • Download URL: moosepy-1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0

File hashes

Hashes for moosepy-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e0fd0559c142eccbd3c2204b55e02354313de7b8cf6fe3fcdc5d4d566e35dc9
MD5 d25495abe961588511e5730debe5a8aa
BLAKE2b-256 5d2b0727a33ea8aa8ba6519753fab41866836733ba334a75a8777c7bc23d3213

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page