Set up an AGV

Describe your AGV’s wheels to Motorcortex, link them to the axes, and set the speed limits and velocity input.

An AGV moves as one vehicle: you command a speed forward, sideways and around, and the AGV module in Motorcortex works out what every wheel has to do. For that it needs the vehicle type and where each wheel sits. Its parameters are under root/AGVControl/, and the values you set are stored in control/control.xml.

Choose the vehicle type

The type is set in config.json, in the AGVControl block. The AGV module only starts when Enable is true and the application has axes:

"AGVControl": {
  "Enable": true,
  "MobilePlatformType": "differential"
}

Set AxesControl/NumberOfAxes to the number of axes the type needs, plus the axes of an arm if the AGV carries one:

Type MobilePlatformType Axes Moves sideways
Differential differential 2 drive wheels No
Mecanum omnidirectional_mecanum 4 drive wheels Yes
Omni-steered omnisteered 4 drive wheels and 4 steering axes Yes

The module also accepts tricycle and flappybot; they are not covered here.

Describe the wheels

All positions are in m, in the vehicle frame: x points forward, y to the left, and a positive rotation turns the vehicle counter-clockwise, seen from above. Click a type to jump to its parameters.

Differential

Two driven wheels on one line, and casters that follow. The parameters are under root/AGVControl/mechanism/:

Parameter What it does Standard configuration
wheel01/positionY Sideways position of the left wheel, positive 0.26
wheel02/positionY Sideways position of the right wheel, negative -0.26
wheel01/diameter, wheel02/diameter Wheel diameter 0.198

The distance between the wheels is wheel01/positionY minus wheel02/positionY. A differential AGV cannot move sideways: a sideways speed is ignored.

Mecanum

Four mecanum wheels. The order is fixed: wheel01 front right, wheel02 rear right, wheel03 rear left, wheel04 front left. For each wheel, under root/AGVControl/mechanism/wheelNN/:

Parameter What it does Standard configuration
positionX Position forward from the centre ±0.362
positionY Position to the left of the centre ±0.317
diameter Wheel diameter 0.254

Only the distance of each wheel from the centre, |positionX| + |positionY|, affects the wheel speeds.

Omni-steered

Four wheels that each drive and steer. For each wheel, under root/AGVControl/mechanism/steeredWheelNN/:

Parameter What it does Standard configuration
pose Where the wheel’s steering axis stands. Only x, the first value, and y, the second, are used For example 0.35 0.30 … for wheel 1
diameter Wheel diameter 0.22

A steering angle of 0 means the wheel rolls straight forward, along x; a positive angle turns it counter-clockwise. The module has no steering offset: make sure each steering axis reads 0 when its wheel points forward, with the axis’s position transformation.

The AGV module works in wheel speeds, in rad/s. Link its outputs to the axes, and the actual values back:

AGV parameter Direction What it carries
driveWheelVelocitiesTarget to the axes The speed of each drive wheel, in wheel order
driveWheelVelocitiesActual from the axes The measured wheel speeds, for odometry
steeringWheelPositionsTarget to the axes Omni-steered only: the angle of each steering axis
steeringWheelPositionsActual from the axes Omni-steered only: the measured steering angles

The links go in a link file, to root/AxesControl/axesVelocitiesInput for the drive wheels, with the Index of the first axis. For an omni-steered AGV the steering angles go to root/AxesControl/axesPositionsInput, after the drive wheels.

Then set up each wheel axis:

  • Drive mode: run the drive wheels in CSV, 9 in root/DriveLogic/driveMode. See Drive logic.
  • Direction: a positive wheel speed must drive the vehicle forward on both sides. On a differential AGV the motors on the two sides usually face each other, so one side needs a negative gainNum in its position and velocity transformations.
  • Units: the transformations must give rad and rad/s at the wheel, after the gearbox.

Limit the speed

The limits are under root/AGVControl/, in m/s and rad/s:

Parameter What it does Default
highLinearVelocityLimit Largest speed forward and sideways 1.0
highAngularVelocityLimit Largest turning speed 1.0
safetySpeedFactor Multiplies both limits, for example from a safety scanner 1.0
targetVelocityLimiter/linearVelocityLimiter/enable 1 applies the linear limit 0
targetVelocityLimiter/angularVelocityLimiter/enable 1 applies the turning limit 0
hostInSignalTimeout Stops the vehicle if its speed input has not been updated for this long, in s. Negative switches it off 0.1

Drive it

The vehicle takes its speed as a twist of six values: forward, sideways and up in m/s, then the rotation about x, y and z in rad/s. Only forward, sideways and the rotation about z, the sixth value, are used. There are three inputs, and targetVelocityConfigSelector/configurationIndex picks the one in use:

configurationIndex Input Use it for
0 (default) hostInTargetVelocity A client application, such as a navigation stack
1 hmiInTargetVelocity A dashboard
2 hidInTargetVelocity A joystick. Link its axes to the first and sixth values, and for a mecanum or omni-steered AGV also to the second

The input must keep updating: when it stops for longer than hostInSignalTimeout, the vehicle stops.

Check the odometry

The module works out where the vehicle is from the wheel speeds alone: there is no other localisation.

Output What it shows
actualPose The position and heading in the world frame: x, y, z, then the rotation about z, y and x
actualVelocityLocal The measured speed in the vehicle frame
actualVelocityGlobal The measured speed in the world frame

resetActualPose sets actualPose back to actualPoseRef.

  1. In simulation, drive forward and check that actualPose grows in x.
  2. Turn left and check that the heading grows.
  3. On the real vehicle, drive a measured distance and compare it with actualPose. A difference that grows with distance means a wrong wheel diameter; a wrong heading after a straight run means the two sides differ.