roboclaw

package module
v0.0.0-...-7687143 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2019 License: GPL-3.0 Imports: 5 Imported by: 1

README

roboclaw

Library for the RoboClaws motor controller from Ion Motion Control written in Go.

This library was based on the Roboclaw 2x7A sample library for the Arduino found at http://www.basicmicro.com/downloads.

example

Initialize the roboclaw

	var robo *roboclaw.Roboclaw
	var err error

	robo, err = roboclaw.Init(&roboclaw.Config{Name: "/dev/ttyAMA0", Baud: 19200, Retries: 3})

Read the roboclaw version on a roboclaw assigned address 128

	var version string

	version, err = robo.ReadVersion(128)

Drive motor 1 forward at maximum duty cycle

	err = robo.DutyM1(128, 32767)

Documentation

Overview

Created by Michael Dysart

Created by Michael Dysart

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name       string //the name of the serial port
	Baud       int    // the baud rate for the serial port
	Retries    uint8  // the number of attempted retries for sending a command to the roboclaws
	WriteSleep bool   // The timeout for the roboclaws is 10 milliseconds

}

type Roboclaw

type Roboclaw struct {
	// contains filtered or unexported fields
}

A structure for describing the roboclaw interface

func Init

func Init(rc *Config) (*Roboclaw, error)

* Initialize the roboclaw with the desired serial port * @param rc (&Config) the roboclaw config struct * @returns (*Roboclaw, error) the reference to the roboclaw and any errors that occur when opening the file

func (*Roboclaw) BackwardM1

func (r *Roboclaw) BackwardM1(address uint8, speed uint8) error

* Drive motor 1 backwards * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 * @return {error}

func (*Roboclaw) BackwardM2

func (r *Roboclaw) BackwardM2(address uint8, speed uint8) error

* Drive motor 2 backwards * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 * @return {error}

func (*Roboclaw) BackwardMixed

func (r *Roboclaw) BackwardMixed(address uint8, speed uint8) error

* Drive motors backward in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 stop, 127 full speed) * @return {error}

func (*Roboclaw) Close

func (r *Roboclaw) Close() error

* Close the roboclaw's serial port * @return {error}

func (*Roboclaw) DutyAccelM1

func (r *Roboclaw) DutyAccelM1(address uint8, duty int16, accel uint32) error

* Drive motor 1 with duty and acceleration * @param address {uint8} * @param duty {int16} * @param accel {uint32} the acceleration. Valid data from 0 to 655359 (-100% to 100% in 100ms) * @return {error}

func (*Roboclaw) DutyAccelM1M2

func (r *Roboclaw) DutyAccelM1M2(address uint8, duty1 int16, accel1 uint32, duty2 int16, accel2 uint32) error

* Drive motors 1 and 2 with duty and acceleration * @param address {uint8} * @param duty1 {int16} * @param accel1 {uint32} the acceleration. Valid data from 0 to 655359 (-100% to 100% in 100ms) * @param duty2 {int16} * @param accel2 {uint32} the acceleration. Valid data from 0 to 655359 (-100% to 100% in 100ms) * @return {error}

func (*Roboclaw) DutyAccelM2

func (r *Roboclaw) DutyAccelM2(address uint8, duty int16, accel uint32) error

* Drive motor 2 with duty and acceleration * @param address {uint8} * @param duty {int16} * @param accel {uint32} the acceleration. Valid data from 0 to 655359 (-100% to 100% in 100ms) * @return {error}

func (*Roboclaw) DutyM1

func (r *Roboclaw) DutyM1(address uint8, duty int16) error

* Drive motor 1 in duty cycle mode * Values represent +/- 100% duty * @param address {uint8} * @param duty {int16} * @return {error}

func (*Roboclaw) DutyM1M2

func (r *Roboclaw) DutyM1M2(address uint8, duty1 int16, duty2 int16) error

* Drive motor 1 and 2 in duty cycle mode * Values represent +/- 100% duty * @param address {uint8} * @param duty1 {int16} * @param duty2 {int16} * @return {error}

func (*Roboclaw) DutyM2

func (r *Roboclaw) DutyM2(address uint8, duty int16) error

* Drive motor 2 in duty cycle mode * Values represent +/- 100% duty * @param address {uint8} * @param duty {int16} * @return {error}

func (*Roboclaw) ForwardBackwardM1

func (r *Roboclaw) ForwardBackwardM1(address uint8, speed uint8) error

* Drive motor 1 forward or backward * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 full reverse, 64 stop, 127 full forward) * @return {error}

func (*Roboclaw) ForwardBackwardM2

func (r *Roboclaw) ForwardBackwardM2(address uint8, speed uint8) error

* Drive motor 2 forward or backward * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 full reverse, 64 stop, 127 full forward) * @return {error}

func (*Roboclaw) ForwardBackwardMixed

func (r *Roboclaw) ForwardBackwardMixed(address uint8, speed uint8) error

* Drive forward or backward in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 full speed backward, 0 stop, 127 full forward) * @return {error}

func (*Roboclaw) ForwardM1

func (r *Roboclaw) ForwardM1(address uint8, speed uint8) error

* Drive motor 1 forwards * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 * @return {error}

func (*Roboclaw) ForwardM2

func (r *Roboclaw) ForwardM2(address uint8, speed uint8) error

* Drive motor 2 forwards * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 * @return {error}

func (*Roboclaw) ForwardMixed

func (r *Roboclaw) ForwardMixed(address uint8, speed uint8) error

* Drive motors forward in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 stop, 127 full speed) * @return {error}

func (*Roboclaw) GetConfig

func (r *Roboclaw) GetConfig(address uint8) (uint16, error)

* Read config settings * @param address {uint8} * @return {uint16, error} settings, error

func (*Roboclaw) GetDeadBand

func (r *Roboclaw) GetDeadBand(address uint8) (uint8, uint8, error)

* Read deadband for RC/Analog control * RC/Analog mode control in 10th of a percent * @param address {uint8} * @return {uint8, uint8, error} min, max, error

func (*Roboclaw) GetPWMMode

func (r *Roboclaw) GetPWMMode(address uint8) (uint8, error)

* Read PWM mode * @param address {uint8} * @return {uint8, error} mode, error

func (*Roboclaw) GetPinFunctions

func (r *Roboclaw) GetPinFunctions(address uint8) (uint8, uint8, uint8, error)

* Read the pin modes * @param address {uint8} * @return {uint8, uint8, uint8, error} s3 mode, s4 mode, s5 mode, error

func (*Roboclaw) LeftRightMixed

func (r *Roboclaw) LeftRightMixed(address uint8, speed uint8) error

* Turn in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 full speed left, 0 stop, 127 full right) * @return {error}

func (*Roboclaw) ReadBuffers

func (r *Roboclaw) ReadBuffers(address uint8) (uint8, uint8, error)

* Read buffer lengths * Maximum length is 64, * A value of 128 means that the buffer is empty and all commands are finished * A value of 0 means that the last command is executing * @param address {uint8} * @return {uint8, uint8, error} buffer 1 length, buffer 2 length, error

func (*Roboclaw) ReadCTRL12

func (r *Roboclaw) ReadCTRL12(address uint8) (uint16, uint16, error)

* Read CTRL value settings * @param address {uint8} * @return {uint16, uint16, error} ctrl1, ctrl2, error

func (*Roboclaw) ReadCTRLMode

func (r *Roboclaw) ReadCTRLMode(address uint8) (uint8, uint8, error)

* Read CTRL modes (only certain models) * @param address {uint8} * @return {uint8, uint8, error} ctrl 1 mode, ctrl 2 mode, error

func (*Roboclaw) ReadCurrents

func (r *Roboclaw) ReadCurrents(address uint8) (int16, int16, error)

* Read currents * Values in 10 mA increments * Divide by 100 to get A * @param address {uint8} * @return {int16, int16, error} m1 current, m2 current, error

func (*Roboclaw) ReadDefaultAcceleration

func (r *Roboclaw) ReadDefaultAcceleration(address uint8) (uint32, uint32, error)

* Read the default acceleration values * @param address {uint8} * @return {uint32, uint32, error} acceleration m1, acceleration m2, error

func (*Roboclaw) ReadEncM1

func (r *Roboclaw) ReadEncM1(address uint8) (uint32, uint8, error)

* Read the encoder count for m1 * @param address {uint8} * @return {uint32, uint8, error} encoder count, encoder status, error

func (*Roboclaw) ReadEncM2

func (r *Roboclaw) ReadEncM2(address uint8) (uint32, uint8, error)

* Read the encoder count for m2 * @param address {uint8} * @return {uint32, uint8, error} encoder count, encoder status, error

func (*Roboclaw) ReadEncoderModes

func (r *Roboclaw) ReadEncoderModes(address uint8) (uint8, uint8, error)

* Read encoder modes * @param address {uint8} * @return {uint8, uint8, error} encode 1 mode, encoder 2 mode, error

func (*Roboclaw) ReadEncoders

func (r *Roboclaw) ReadEncoders(address uint8) (uint32, uint32, error)

* Read encoder counters * @param address {uint8} * @return {uint32, uint32, error} encoder 1 counter, encoder 2 counter, error

func (*Roboclaw) ReadError

func (r *Roboclaw) ReadError(address uint8) (uint32, error)

* Read any statuses from the roboclaw * The reference manual says that the status is a 16 bit int, * but recently the roboclaws have been returning a 32 bit int * This probably occurred due to a firmware update, though * I have not yet found where it is documented * @param address {uint8} * @return {uint16, error} address, error

func (*Roboclaw) ReadISpeedM1

func (r *Roboclaw) ReadISpeedM1(address uint8) (uint32, uint8, error)

* Read raw speed for motor 1 * Pulses counted in last 300th of a second, but returned as encoder counts per second * Direction is 0 for forward and 1 for backward * @param address {uint8} * @return {uint32, uint8, error} speed, direction, error

func (*Roboclaw) ReadISpeedM2

func (r *Roboclaw) ReadISpeedM2(address uint8) (uint32, uint8, error)

* Read raw speed for motor 2 * Pulses counted in last 300th of a second, but returned as encoder counts per second * Direction is 0 for forward and 1 for backward * @param address {uint8} * @return {uint32, uint8, error} speed, direction, error

func (*Roboclaw) ReadISpeeds

func (r *Roboclaw) ReadISpeeds(address uint8) (uint32, uint32, error)

* Read instantaneous speed * Speed is in counter per second measured over last 300th of a second * @param address {uint8} * @return {uint32, uint32, error} speed encoder 1, speed encoder 2 , error

func (*Roboclaw) ReadLogicBatteryVoltage

func (r *Roboclaw) ReadLogicBatteryVoltage(address uint8) (uint16, error)

* Read the logic battery voltage (connected to LB+ and LB- terminals) * @param address {uint8} * @return {uint16, error} voltage is returned in 10ths of a volt

func (*Roboclaw) ReadM1MaxCurrent

func (r *Roboclaw) ReadM1MaxCurrent(address uint8) (uint32, error)

* Read m1 max current * Current in in 10 mA units * @param address {uint8} * @return {uint32, error} max current, error

func (*Roboclaw) ReadM1PositionPID

func (r *Roboclaw) ReadM1PositionPID(address uint8) (float32, float32, float32, uint32, uint32, uint32, uint32, error)

* Read position PID constants for motor 2 * @param address {uint8} * @return {float32, float32, float32, uint32, uint32, uint32, uint32, error} proportional, integral, derivative, max integral windup, min position, max position, error

func (*Roboclaw) ReadM1VelocityPID

func (r *Roboclaw) ReadM1VelocityPID(address uint8) (float32, float32, float32, uint32, error)

* Read motor 1 PID and QPPS * @param address {uint8} * @return {float32, float32, float32, uint32, error} proportional, integral, derivative, qpps, error

func (*Roboclaw) ReadM2MaxCurrent

func (r *Roboclaw) ReadM2MaxCurrent(address uint8) (uint32, error)

* Read m2 max current * Current in in 10 mA units * @param address {uint8} * @return {uint32, error} max current, error

func (*Roboclaw) ReadM2PositionPID

func (r *Roboclaw) ReadM2PositionPID(address uint8) (float32, float32, float32, uint32, uint32, uint32, uint32, error)

* Read position PID constants for motor 2 * @param address {uint8} * @return {float32, float32, float32, uint32, uint32, uint32, uint32, error} proportional, integral, derivative, max integral windup, min position, max position, error

func (*Roboclaw) ReadM2VelocityPID

func (r *Roboclaw) ReadM2VelocityPID(address uint8) (float32, float32, float32, uint32, error)

* Read motor 2 PID and QPPS * @param address {uint8} * @return {float32, float32, float32, uint32, error} proportional, integral, derivative, qpps, error

func (*Roboclaw) ReadMainBatteryVoltage

func (r *Roboclaw) ReadMainBatteryVoltage(address uint8) (uint16, error)

* Read the main battery voltage (connected to B+ and B- terminals) * @param address {uint8} * @return {uint16, error} voltage is returned in 10ths of a volt

func (*Roboclaw) ReadMinMaxLogicVoltages

func (r *Roboclaw) ReadMinMaxLogicVoltages(address uint8) (uint16, uint16, error)

* Reads min and max logic battery voltage * Voltages are in mV * @param address {uint8} * @return {uint16, uint16, error} min, max, error

func (*Roboclaw) ReadMinMaxMainVoltages

func (r *Roboclaw) ReadMinMaxMainVoltages(address uint8) (uint16, uint16, error)

* Reads min and max main battery voltage * Voltages are in mV * @param address {uint8} * @return {uint16, uint16, error} min, max, error

func (*Roboclaw) ReadNVM

func (r *Roboclaw) ReadNVM(address uint8) (uint8, uint8, error)

* Read settings from non-volatile memory * @param address {uint8} * @return {uint8, uint8, error} encoder 1 mode, encoder 2 mode, error

func (*Roboclaw) ReadPWMs

func (r *Roboclaw) ReadPWMs(address uint8) (int16, int16, error)

* Read pwm values * PWM values are +/- 32767 * Divide by 327.67 to get duty cycle percent * @param address {uint8} * @return {int16, int16, error} m1 pwm, m2 pwm, error

func (*Roboclaw) ReadSpeedM1

func (r *Roboclaw) ReadSpeedM1(address uint8) (uint32, uint8, error)

* Read the encoder speed for m1 * Speed is in pulses per second * Direction is 0 for forward and 1 for backward * @param address {uint8} * @return {uint32, uint8, error} encoder speed, direction, error

func (*Roboclaw) ReadSpeedM2

func (r *Roboclaw) ReadSpeedM2(address uint8) (uint32, uint8, error)

* Read the encoder speed for m2 * Speed is in pulses per second * Direction is 0 for forward and 1 for backward * @param address {uint8} * @return {uint32, uint8, error} encoder speed, direction, error

func (*Roboclaw) ReadTemp

func (r *Roboclaw) ReadTemp(address uint8) (uint16, error)

* Restore board temperature * Value is in 10th of a degree * @param address {uint8} * @return {error} temp, error

func (*Roboclaw) ReadTemp2

func (r *Roboclaw) ReadTemp2(address uint8) (uint16, error)

* Read second board temperature (only on certain devices) * Value is in 10th of a degree * @param address {uint8} * @return {uint16, error} temp, error

func (*Roboclaw) ReadVersion

func (r *Roboclaw) ReadVersion(address uint8) (string, error)

* Read the roboclaw version * @param address {uint8} * @return {string, error}

func (*Roboclaw) ResetEncoders

func (r *Roboclaw) ResetEncoders(address uint8) error

* Reset encoder counters to 0 (for quadrature encoders) * @param address {uint8} * @return {error}

func (*Roboclaw) RestoreDefaults

func (r *Roboclaw) RestoreDefaults(address uint8) error

* Restore default values * @param address {uint8} * @return {error}

func (*Roboclaw) SetCTRL1

func (r *Roboclaw) SetCTRL1(address uint8, value uint16) error

* Set CTRL1 output value (only certain models) * @param address {uint8} * @param value {uint16} * @return {error}

func (*Roboclaw) SetCTRL2

func (r *Roboclaw) SetCTRL2(address uint8, value uint16) error

* Set CTRL2 output value (only certain models) * @param address {uint8} * @param value {uint16} * @return {error}

func (*Roboclaw) SetCTRLMode

func (r *Roboclaw) SetCTRLMode(address uint8, ctrl1 uint8, ctrl2 uint8) error

* Set CTRL mode (only certain models) * NOTE: This function is not properly documented in the user manual * Based on command 101 I have tried to infer the correct command codes * @param address {uint8} * @param ctrl1 {uint8} * @param ctrl2 {uint8} * @return {error}

func (*Roboclaw) SetConfig

func (r *Roboclaw) SetConfig(address uint8, config uint16) error

* Set config settings * @param address {uint8} * @param config {uint16} * @return {error}

func (*Roboclaw) SetDeadBand

func (r *Roboclaw) SetDeadBand(address uint8, Min uint8, Max uint8) error

* Set deadband for RC/Analog control * RC/Analog mode control in 10th of a percent * @param address {uint8} * @param Min {uint8} valid data 0 - 250 (0 to 25%) * @param Max {uint8} valid data 0 - 250 (0 to 25%) * @return {error}

func (*Roboclaw) SetEncM1

func (r *Roboclaw) SetEncM1(address uint8, val int32) error

* Set encoder 1 counter to 0 (for quadrature encoders) * @param address {uint8} * @param val {int32} * @return {error}

func (*Roboclaw) SetEncM2

func (r *Roboclaw) SetEncM2(address uint8, val int32) error

* Set encoder 2 counter to 0 (for quadrature encoders) * @param address {uint8} * @param val {int32} * @return {error}

func (*Roboclaw) SetLogicVoltages

func (r *Roboclaw) SetLogicVoltages(address uint8, min uint16, max uint16) error

* Sets the minimum and maximum logic battery voltage * @param address {uint8} * @param min {uint16} Values in 10th of a volt * @param max {uint16} Values in 10th of a volt * @return {error}

func (*Roboclaw) SetM1DefaultAccel

func (r *Roboclaw) SetM1DefaultAccel(address uint8, accel uint32) error

* Sets the default accelaration for duty cycle commands with motor 1 * @param address {uint8} * @param accel {uint32} * @return {error}

func (*Roboclaw) SetM1EncoderMode

func (r *Roboclaw) SetM1EncoderMode(address uint8, mode uint8) error

* Set motor 1 encoder mode * @param address {uint8} * @param mode {uint8} * @return {error}

func (*Roboclaw) SetM1MaxCurrent

func (r *Roboclaw) SetM1MaxCurrent(address uint8, max uint32) error

* Set m1 max current * @param address {uint8} * @param max {uint32} the maximum current in 10 mA units * @return {error}

func (*Roboclaw) SetM1PositionPID

func (r *Roboclaw) SetM1PositionPID(address uint8, kp_fp float32, ki_fp float32, kd_fp float32, kiMax uint32, deadzone uint32, min uint32, max uint32) error

* Set position PID constants for motor 1 * @param address {uint8} * @param kp_fp {float32} proportional constant. valid data from 0 to 4194304 * @param ki_fp {float32} integral constant. valid data from 0 to 4194304 * @param kd_fp {float32} derivative constant. valid data from 0 to 4194304 * @param kiMax {uint32} maximum integral windup * @param deadzone {uint32} encoder counts deadzone * @param min {uint32} minimum position * @param max {uint32} maximum position * @return {error}

func (*Roboclaw) SetM1VelocityPID

func (r *Roboclaw) SetM1VelocityPID(address uint8, kp_fp float32, ki_fp float32, kd_fp float32, qpps uint32) error

* Set velocity PID constant for motor 1 * @param address {uint8} * @param kp_fp {float32} proportional constant. valid data from 0 to 65536 * @param ki_fp {float32} integral constant. valid data from 0 to 65536 * @param kd_fp {float32} derivative constant. valid data from 0 to 65536 * @param qpps {uint32} speed of encoder when motor is at 100 % * @return {error}

func (*Roboclaw) SetM2DefaultAccel

func (r *Roboclaw) SetM2DefaultAccel(address uint8, accel uint32) error

* Sets the default accelaration for duty cycle commands with motor 2 * @param address {uint8} * @param accel {uint32} * @return {error}

func (*Roboclaw) SetM2EncoderMode

func (r *Roboclaw) SetM2EncoderMode(address uint8, mode uint8) error

* Set motor 2 encoder mode * @param address {uint8} * @param mode {uint8} * @return {error}

func (*Roboclaw) SetM2MaxCurrent

func (r *Roboclaw) SetM2MaxCurrent(address uint8, max uint32) error

* Set m2 max current * @param address {uint8} * @param max {uint32} the maximum current in 10 mA units * @return {error}

func (*Roboclaw) SetM2PositionPID

func (r *Roboclaw) SetM2PositionPID(address uint8, kp_fp float32, ki_fp float32, kd_fp float32, kiMax uint32, deadzone uint32, min uint32, max uint32) error

* Set position PID constants for motor 2 * @param address {uint8} * @param kp_fp {float32} proportional constant. valid data from 0 to 4194304 * @param ki_fp {float32} integral constant. valid data from 0 to 4194304 * @param kd_fp {float32} derivative constant. valid data from 0 to 4194304 * @param kiMax {uint32} maximum integral windup * @param deadzone {uint32} encoder counts deadzone * @param min {uint32} minimum position * @param max {uint32} maximum position * @return {error}

func (*Roboclaw) SetM2VelocityPID

func (r *Roboclaw) SetM2VelocityPID(address uint8, kp_fp float32, ki_fp float32, kd_fp float32, qpps uint32) error

* Set velocity PID constant for motor 2 * @param address {uint8} * @param kp_fp {float32} proportional constant. valid data from 0 to 65536 * @param ki_fp {float32} integral constant. valid data from 0 to 65536 * @param kd_fp {float32} derivative constant. valid data from 0 to 65536 * @param qpps {uint32} speed of encoder when motor is at 100 % * @return {error}

func (*Roboclaw) SetMainVoltages

func (r *Roboclaw) SetMainVoltages(address uint8, min uint16, max uint16) error

* Sets the minimum and maximum main battery voltage * @param address {uint8} * @param min {uint16} Values in 10th of a volt * @param max {uint16} Values in 10th of a volt * @return {error}

func (*Roboclaw) SetMaxVoltageLogicBattery

func (r *Roboclaw) SetMaxVoltageLogicBattery(address uint8, voltage uint8) error

* Sets the maximum logic battery voltage * Volts are Desired volts * 5.12 * @param address {uint8} * @param voltage {uint8} valid data from 30 - 175 (6V to 34V) * @return {error}

func (*Roboclaw) SetMaxVoltageMainBattery

func (r *Roboclaw) SetMaxVoltageMainBattery(address uint8, voltage uint8) error

* Sets maximum main voltage (command 57 preferred) * Roboclaw shuts down if voltage drops below this point * Volts are Desired volts * 5.12 * @param address {uint8} * @param voltage {uint8} valid data is 30 to 175 (6V to 34 V) * @return {error}

func (*Roboclaw) SetMinVoltageLogicBattery

func (r *Roboclaw) SetMinVoltageLogicBattery(address uint8, voltage uint8) error

* Sets the minimum logic battery voltage * Volts are (Desired volts - 6) * 5 * @param address {uint8} * @param voltage {uint8} valid data from 0 - 140 (6V to 34V) * @return {error}

func (*Roboclaw) SetMinVoltageMainBattery

func (r *Roboclaw) SetMinVoltageMainBattery(address uint8, voltage uint8) error

* Sets minimum main voltage (command 57 preferred) * Roboclaw shuts down if voltage drops below this point * Volts are (Desired volts - 6) * 5 * @param address {uint8} * @param voltage {uint8} valid data is 0 to 140 (6V to 34 V) * @return {error}

func (*Roboclaw) SetPWMMode

func (r *Roboclaw) SetPWMMode(address uint8, mode uint8) error

* Set PWM mode * @param address {uint8} * @param mode {uint8} valid values are 0 and 1 * @return {error}

func (*Roboclaw) SetPinFunctions

func (r *Roboclaw) SetPinFunctions(address uint8, s3mode uint8, s4mode uint8, s5mode uint8) error

* Sets the pin modes * @param address {uint8} * @param s3mode {uint8} valid data 0 - 4 * @param s4mode {uint8} valid data 0 - 4 * @param s5mode {uint8} valid data 0 - 4 * @return {error}

func (*Roboclaw) SpeedAccelDeccelPositionM1

func (r *Roboclaw) SpeedAccelDeccelPositionM1(address uint8, accel uint32, speed int32, deccel uint32, position uint32, buffer bool) error

* Drive motor 1 with acceleration and speed * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @param deccel {uint32} decceleration is unsigned * @param position {uint32} position is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDeccelPositionM1M2

func (r *Roboclaw) SpeedAccelDeccelPositionM1M2(address uint8, accel1 uint32, speed1 int32, deccel1 uint32, position1 uint32, accel2 uint32, speed2 int32, deccel2 uint32, position2 uint32, buffer bool) error

* Drive motors 1 and 2 with acceleration and speed * @param address {uint8} * @param accel1 {uint32} acceleration is unsigned * @param speed1 {int32} * @param deccel1 {uint32} decceleration is unsigned * @param position1 {uint32} position is unsigned * @param accel2 {uint32} acceleration is unsigned * @param speed2 {int32} * @param deccel2 {uint32} decceleration is unsigned * @param position2 {uint32} position is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDeccelPositionM2

func (r *Roboclaw) SpeedAccelDeccelPositionM2(address uint8, accel uint32, speed int32, deccel uint32, position uint32, buffer bool) error

* Drive motor 2 with acceleration and speed * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @param deccel {uint32} decceleration is unsigned * @param position {uint32} position is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDistanceM1

func (r *Roboclaw) SpeedAccelDistanceM1(address uint8, accel uint32, speed int32, distance uint32, buffer bool) error

* Drive motor 1 with acceleration and speed to distance * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @param distance {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDistanceM1M2

func (r *Roboclaw) SpeedAccelDistanceM1M2(address uint8, accel uint32, speed1 int32, distance1 uint32, speed2 int32, distance2 uint32, buffer bool) error

* Drive motors 1 and 2 with acceleration and speed to distance * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed1 {int32} * @param distance1 {uint32} distance is unsigned * @param speed2 {int32} * @param distance2 {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDistanceM1M2_2

func (r *Roboclaw) SpeedAccelDistanceM1M2_2(address uint8, accel1 uint32, speed1 int32, distance1 uint32, accel2 uint32, speed2 int32, distance2 uint32, buffer bool) error

* Drive motors 1 and 2 with acceleration and speed * @param address {uint8} * @param accel1 {uint32} acceleration is unsigned * @param speed1 {int32} * @param distance1 {uint32} distance is unsigned * @param accel2 {uint32} acceleration is unsigned * @param speed2 {int32} * @param distance2 {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelDistanceM2

func (r *Roboclaw) SpeedAccelDistanceM2(address uint8, accel uint32, speed int32, distance uint32, buffer bool) error

* Drive motor 2 with acceleration and speed to distance * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @param distance {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedAccelM1

func (r *Roboclaw) SpeedAccelM1(address uint8, accel uint32, speed int32) error

* Drive motor 1 with speed and acceleration * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @return {error}

func (*Roboclaw) SpeedAccelM1M2

func (r *Roboclaw) SpeedAccelM1M2(address uint8, accel uint32, speed1 int32, speed2 int32) error

* Drive motors 1 and 2 with speed and acceleration * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed1 {int32} * @param speed2 {int32} * @return {error}

func (*Roboclaw) SpeedAccelM1M2_2

func (r *Roboclaw) SpeedAccelM1M2_2(address uint8, accel1 uint32, speed1 int32, accel2 uint32, speed2 int32) error

* Drive motors 1 and 2 with acceleration and speed * @param address {uint8} * @param accel1 {uint32} acceleration is unsigned * @param speed1 {int32} * @param accel2 {uint32} acceleration is unsigned * @param speed2 {int32} * @return {error}

func (*Roboclaw) SpeedAccelM2

func (r *Roboclaw) SpeedAccelM2(address uint8, accel uint32, speed int32) error

* Drive motor 2 with speed and acceleration * @param address {uint8} * @param accel {uint32} acceleration is unsigned * @param speed {int32} * @return {error}

func (*Roboclaw) SpeedDistanceM1

func (r *Roboclaw) SpeedDistanceM1(address uint8, speed int32, distance uint32, buffer bool) error

* Drive motors 1 with speed to distance * @param address {uint8} * @param speed {int32} * @param distance {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedDistanceM1M2

func (r *Roboclaw) SpeedDistanceM1M2(address uint8, speed1 int32, distance1 uint32, speed2 int32, distance2 uint32, buffer bool) error

* Drive motors 1 and 2 with speed to distance * @param address {uint8} * @param speed1 {int32} * @param distance1 {uint32} distance is unsigned * @param speed2 {int32} * @param distance2 {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedDistanceM2

func (r *Roboclaw) SpeedDistanceM2(address uint8, speed int32, distance uint32, buffer bool) error

* Drive motors 2 with speed to distance * @param address {uint8} * @param speed {int32} * @param distance {uint32} distance is unsigned * @param buffer {bool} true to override the previous command, false to buffer * @return {error}

func (*Roboclaw) SpeedM1

func (r *Roboclaw) SpeedM1(address uint8, speed int32) error

* Drive motor 1 at given speed. Sign indicates direction. * @param address {uint8} * @param speed {int32} * @return {error}

func (*Roboclaw) SpeedM1M2

func (r *Roboclaw) SpeedM1M2(address uint8, speed1 int32, speed2 int32) error

* Drive motors 1 and 2 at the given speeds. Sign indicates direction. * @param address {uint8} * @param speed1 {int32} * @param speed2 {int32} * @return {error}

func (*Roboclaw) SpeedM2

func (r *Roboclaw) SpeedM2(address uint8, speed int32) error

* Drive motor 2 at given speed. Sign indicates direction. * @param address {uint8} * @param speed {int32} * @return {error}

func (*Roboclaw) TurnLeftMixed

func (r *Roboclaw) TurnLeftMixed(address uint8, speed uint8) error

* Turn left in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 stop, 127 full speed) * @return {error}

func (*Roboclaw) TurnRightMixed

func (r *Roboclaw) TurnRightMixed(address uint8, speed uint8) error

* Turn right in mixed mode * @param address {uint8} * @param speed {uint8} valid data is 0 to 127 (0 stop, 127 full speed) * @return {error}

func (*Roboclaw) WriteNVM

func (r *Roboclaw) WriteNVM(address uint8) error

* Write settings to non-volatile memory * @param address {uint8} * @return {error}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL