Skip to main content

This is Python API for Agilex Robotics

This is a python API for CAN communication with Agilex Robotics

Installation

Notes:
Make sure that python version >=3.4. if you have python3 and python2 ,please use python3

Communication protocol

Robot Protocol V2 CAN Support Status
Scout 2.0 Y Y Active
Scout Mini Y Y Active
Hunter 2.0 Y Y Active
Bunker Y Y Active
Tracer Y Y Active

pip

$ pip3 install pyagxrobots
Notes:
Make sure that pip3 version >= 9.0.0.
cheak the pip3 version
$ pip3 -V     		
updata pip3
$ python3 -m pip install --upgrade pip                 

Setup CAN-To-USB adapter

  1. Enable gs_usb kernel module

    $ sudo modprobe gs_usb
    
  2. Bringup can device

    $ sudo ip link set can0 up type can bitrate 500000
    
  3. If no error occured during the previous steps, you should be able to see the can device now by using command

    $ ifconfig -a
    
  4. Install and use can-utils to test the hardware

    $ sudo apt install can-utils
    
  5. Testing command

    # receiving data from can0
    $ candump can0
    # send data to can0
    $ cansend can0 001#1122334455667788
    

You can run step 1-5 for the first-time setup and run step 2 to bring up the device each time you unplug and re-plug the adapter.

import to your project

#!/usr/bin/env python3
# coding=utf-8
import pyagxrobots
robots=pyagxrobots.pysdkugv.robotstype()  #    robotstype depend on your robot

function list:

EnableCAN()
SetMotionCommand()
SetLightCommand()
GetRobotStae:
    MotionCommandMessage:
        GetLinearVelocity()
        GetAngularVelocity()
        GetLateralVelocity()
        GetSteeringAngle()
    LightCommandMessage:
        GetLightCmdCtrl()
        GetFrontMode()
        GetFrontCustom()
        GetRearMode()
        GetRearCustom()
    SystemStateMessage:
        GetVehicleState()
        GetControlMode()
        GetBatteryVoltage()
        GetErrorCode()
    RcStateMessage:
    OdometryMessage:
        GetLeftWheel()
        GetRightWheel()
    ActuatorStateMessageV2:
        rpm()
        current()
        pulse_count()
        driver_voltage()
        driver_temp()
        motor_temp()
        driver_state()

EnableCAN

  • Prototype: EnableCAN()
  • Description: Enable command and control mode.

SetMotionCommand

  • Prototype: SetMotionCommand()
  • Description:Send Version Request to robots.
  • Parameters
    • linear_vel:(float)
    • angular_vel:(float)
    • lateral_velocity:(float)
    • steering_angle:(float)

GetLinearVelocity

  • Prototype: GetLinearVelocity()
  • Description:Get the linear velocity from robot
  • Return:linear velocity

GetAngularVelocity

  • Prototype: GetAngularVelocity()
  • Description:Get the angular velocity from robot.
  • Return:angular velocity

GetSteeringAngle

  • Prototype: GetSteeringAngle()
  • Description:Get the steering angle from robot .
  • Return:steering angle

GetLateralVelocity

  • Prototype: GetLateralVelocity()
  • Description:Get the lateral velocity from robot .
  • Return:lateral velocity

GetControlMode

  • Prototype: GetControlMode()
  • Description:Get the control mode from robot .
  • Return:control mode

GetLeftWheelOdeom

  • Prototype: GetLeftWheelOdeo()
  • Description:get robots LeftWheelOdom .
  • Return:LeftWheelOdom

GetRightWheelOdom

  • Prototype: GetRightWheelOdom()
  • Description:get robots RightWheelOdom .
  • Return:RightWheelOdeom

GetBatteryVoltage

  • Prototype: GetBatteryVoltage()
  • Description:Get the battery voltage from robot
  • Return:battery voltage

GetErrorCode

  • Prototype: GetErrorCode()
  • Description:Get the error code from robot
  • Return:error code

Example

Note:

For safety, please ensure that the robot's wheels are off the ground

1.ScoutMini

#!/usr/bin/env python3
# coding=UTF-8
import pyagxrobots
import time
scoutmini=pyagxrobots.pysdkugv.ScoutMiniBase()
scoutmini.EnableCAN()
num=5
while num>0:
    
    scoutmini.SetMotionCommand(linear_vel=0.1)
    print(scoutmini.GetLinearVelocity())
    time.sleep(0.3)
    num-=1

2.Bunker

#!/usr/bin/env python3
# coding=UTF-8
import pyagxrobots
import time
bunker=pyagxrobots.pysdkugv.BunkerBase()
bunker.EnableCAN()
num=5
while num>0:
    
    bunker.SetMotionCommand(linear_vel=0.1)
    print(bunker.GetLinearVelocity())
    time.sleep(0.3)
    num-=1

Metadata

Release files for pyagxrobots 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyagxrobots 0.8.4
File Size Uploaded Provenance
pyagxrobots-0.8.4.tar.gz 13.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyagxrobots 0.8.4
File Interpreter ABI Platform
pyagxrobots-0.8.4-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / pyagxrobots-0.8.4.tar.gz

Download URL pyagxrobots-0.8.4.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a51d715075fe25f034a8e5d9b01757353c08b35c2241652a435af1b6684d1156
BLAKE2b-256 checksum
How to use checksums
6c1056c3c9070cff7cd7362f3686c33e4bec4625cda8a646f853edd9fbedcd50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

Release files / pyagxrobots-0.8.4-py3-none-any.whl

Download URL pyagxrobots-0.8.4-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8f6b9ca3cdcb7fae23bede70028b5968c95dad68bb6a61b29a0f0f99c2edc54
BLAKE2b-256 checksum
How to use checksums
ccf4bab02742a80eaa3742dff78017a59a5d1a427f5d77d51d9cd4e100436122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

Security for pyagxrobots 0.8.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page