Skip to content

Latest commit

 

History

History
195 lines (151 loc) · 33.3 KB

multi_turn_angle_control.rst

File metadata and controls

195 lines (151 loc) · 33.3 KB

Multi Turn Angle Control

The Multi-turn Angle Controller is a non-wrapping, PID, position controller. It is capable of storing angular to linear transmission information, mimicking a linear position controller. It also features a minimum jerk trajectory generator. The controller has a 32 trajectory buffer so that transitions between trajectories are seamless.

Arduino

To use Multi-turn Angle Controller in Arduino, ensure iq_module_communication.hpp is included. This allows the creation of a MultiTurnAngleControlClient object. See the Message Table below for available messages. All message objects use the Short Name with a trailing underscore.

A minimal working example for the MultiTurnAngleControlClient is:

#include <iq_module_communication.hpp>

IqSerial ser(Serial2);
MultiTurnAngleControlClient mult(0);

void setup() {
    ser.begin();
}

void loop() {
    ser.set(mult.trajectory_angular_displacement_,3.14f);
    ser.set(mult.trajectory_duration_,0.5f);
    ser.set(mult.trajectory_angular_displacement_,0.0f);
    ser.set(mult.trajectory_duration_,0.5f);
    delay(1000);
}

C++

To use Multi-turn Angle Controller in C++, include multi turn angle control client.hpp. This allows the creation of a MultiTurnAngleControlClient object. See the Message Table below for available messages. All message objects use the Short Name with a trailing underscore.

A minimal working example for the MultiTurnAngleControlClient is:

Matlab

To use Multi-turn Angle Controller in Matlab, all Vertiq communication code must be included in your path. This allows the creation of a MultiTurnAngleControlClient object. See the Message Table below for available messages. All message strings use the Short Names.

A minimal working example for the MultiTurnAngleControlClient is:

% Make a communication interface object
com = MessageInterface(’COM18’,115200);

% Make a MultiTurnAngleControlClient object with obj_id 0
MultiTurnAngleControl = MultiTurnAngleControlClient(’com’,com);

% Use the MultiTurnAngleControlClient object
velocityFiltered = MultiTurnAngleControl.get(’obs_angular_displacement’);
MultiTurnAngleControl.set(’ctrl_angle’,0);

Python

To use the Multi-Turn Angle Control Client in Python, import iqmotion and create a module that has the Multi-Turn Angle Control Client within its firmware. See the Message Table below for available messages. All message strings use the Short Names.

A minimal working example for the Multi-Turn Angle Control Client is:

import iqmotion as iq
import math

com = iq.SerialCommunicator("/dev/ttyUSB0")
|variable_name| = iq.|module_name|(com, 0, firmware="servo")  # Servo Firmware uses this client

# Set the trajectory for the motor to complete 1 full rotation
|variable_name|.set("multi_turn_angle_control", "trajectory_angular_displacement", 2*math.pi)

# Sets trajectory duration for 2 seconds
|variable_name|.set("multi_turn_angle_control", "trajectory_duration", 2)  

Message Table

Type ID 59 | Multi-turn Angle Controller
Multi-turn Angle Controller
Sub ID Short Name Access Data Type Unit Note
0 ctrl_mode get int8 Enum no_change = -1, brake=0, coast=1, pwm=2, volts=3, velocity=4, angle=5, trajectory=6
1 ctrl_brake set Shorts motor phases, slows motor down dissipating energy in motor.
2 ctrl_coast set Disables all drive circuitry, motor passively coasts.
3 ctrl_angle get, set float rad Angular location command
4 ctrl_velocity get, set float $\frac{\text{rad}}{s}$ Angular velocity command
5 angle_Kp get, set, save float $\frac{V}{\text{rad}}$ Proportional gain
6 angle_Ki get, set, save float $\frac{V}{\text{rad}*s}$ Integral gain
7 angle_Kd get, set, save float $\frac{V}{(\frac{\text{rad}}{s})}$ Derivative gain
8 timeout get, set, save float s The controller must receive a message within this time otherwise it is set to coast mode.
9 ctrl_pwm get, set float PWM Spins motor with this throttle [-1, 1].
10 ctrl_volts get, set float V Spins motor with this voltage.
11 obs_angular_displacement get, set float rad This represents the total distance that the module has spun measured in radians. Unless this value is set explicitly, it represents the distance, positive or negative, that the module has spun away from zero_angle. If this value is set, all future displacement controls and readings will be measured in reference to the set displacement.
12 obs_angular_velocity get float $\frac{\text{rad}}{s}$ Observed angular velocity
13 meter_per_rad get, set, save float $\frac{m}{\text{rad}}$ Transmission between angular and linear motion
14 ctrl_linear_displacement get, set, float m Linear equivalent to ctrl_angle
15 ctrl_linear_velocity get, set, float $\frac{m}{s}$ Linear equivalent to ctrl_velocity
16 obs_linear_displacement get, set, float m Observed linear location
17 obs_linear_velocity get float $\frac{m}{s}$ Observed linear velocity
18 angular_speed_max get, set, save float $\frac{\text{rad}}{s}$ The controller will never attempt to exceed this speed.
19 trajectory_angular_displacement get, set float rad Final absolute displacement of trajectory.
20 trajectory_angular_velocity get, set float $\frac{\text{rad}}{s}$ Final velocity of the trajectory. Defaults to 0.
21 trajectory_angular_acceleration get, set float $\frac{\text{rad}}{s^2}$ Final acceleration of the trajectory. Defaults to 0.
22 trajectory_duration set float s Duration of trajectory. Trajectory is executed or queued once this is sent.
23 trajectory_linear_displacement get, set float m Final absolute displacement of trajectory.
24 trajectory_linear_velocity get, set float $\frac{m}{s}$ Final velocity of the trajectory. Defaults to 0.
25 trajectory_linear_acceleration get, set float $\frac{m}{s^2}$ Final acceleration of the trajectory. Defaults to 0.
26 trajectory_average_speed get, set float $\frac{\text{rad}}{s}$ Average speed of a trajectory. Trajectory is executed or queued once this is sent. Must be >0.
27 trajectory_queue_mode get, set, save int8 Enum append=0, overwrite=1
29 ff get, set uint32 :math:V_{fix16} Feed forward term
30 sample_zero_angle set Sets the module’s current postiion as the zero angle.
31 zero_angle get, set, save float rad The encoder position the module considers to be 0 radians. Since this is an encoder position, zero_angle is constrained to [-pi, pi]. Unless obs_angular_displacement is set explicitly, this is the position regarded as 0 radians, and all displacements are measured in comparison to this point.