Note: We have officially stopped supporting Python2. While it is still possible to use PyBEAR with Python 2, please be aware that certain functions may no longer be functional.
This is the Python SDK for the Westwood Robotics actuator module BEAR (Back-drivable Electromechanical Actuator for Robotics).
Current version: 0.1.3
In this version, the return format is always [([data1, data2, ...], error), ([data1, data2, ...], error), ...] no matter if returning only one register or more per BEAR.
A new function set_posi() is added to clear absolute position error on BEAR, e.g., set_posi((id, position, tolerance)).
Website: www.westwoodrobotics.io
Email: info@westwoodrobotics.io
It is advised to use the Boosted USB2BEAR/USB2RoMeLa device for maximum speed.
Use at own risk when using other generic RS485 dangles.
When using the Boosted USB2BEAR/USB2RoMeLa device, you can use udev rules to allow local machine to asign a unique SYMLINK according to the serial number of the USB dangle.
- Move 00-WestwoodRobotics.rules file into /etc/udev/rules.d/ with 'sudo cp'
- Reload the rules
sudo udevadm control --reloadEverytime a Boosted USB2BEAR/USB2RoMeLa device is plugged in, a symlink that is: '/dev/serial#' will be created. For example, a device with serial number UB021 will have this SYMLINK: /dev/UB021
USB2RoMeLa from RoMeLa has 3 digit hexadecimal serial numbers.
USB2BEAR from Westwood Robotics has 4 digit hexadecimal serial numbers.
- Modify the permissions of your computer such that PyBEAR can access the serial port.
sudo chown -R your_username /usr/local
sudo usermod -a -G dialout your_username- CD into PyBEAR/ directory and use pip3 to install the package(Python3).
pip3 install .- Make sure pyserial, numpy, termcolor are installed. Othewise, install the missing package(s). You can check this by running:
pip3 show pyserial numpy termcolor- Enjoy!
Download the latest SDK Manual from www.westwoodrobotics.io for detailed instructions, helpful tips, and various examples.
For detailed examples please refer to the SDK from https://westwoodrobotics.io/support/.
A new function set_posi() is added to clear absolute position error on BEAR, e.g., set_posi((id, position, tolerance)). If tolerance is non-zero, BEAR tries to find the multi-turn value to match the expected position within the tolerance. If tolerance is zero, BEAR modifies the homing offset to match the expected position. A save_config() action will be performed automatically once set_posi() is successfully excuted.
Note: set_posi() only works with BEARs with battery-backed encoders: Panda, Kodiak and Mountain.
When BEAR is free from Absolute Position error, Hardware Fault or Initialization error, set_posi() can be used to find homing offset autonomously. For example:
# Find and set homing offset for BEAR with ID 1 so that the present position is 2.0
id = 1
position = 2.0
tolerance = 0.0
bear.set_posi((id, position, tolerance))If BEAR is in Absolute Position error, set_posi() can be used to clear it. Note: set to non-zero tolerance when using set_posi() to clear Absolute Position error, then disable to clear the error. For example:
# Clear Absolute Position error on BEAR with ID 5 and find offset to make present position 0.0
id = 5
position = 0.0
tolerance = 0.2
bear.set_posi((id, position, tolerance))
bear.set_torque_enable((id,0))