To use the locomat for trajectory following, the hardware needs to be correctly set-up. Normally the setup should already be correct and little needs to be changed, check whether the following matches the current system.
Steps to take on the pc to start running a saved trajectory. A standard trajectory is loaded when using the init function, the method to change this trajectory is not yet determined.
init.m
scriptxpcexplr
into the console to open connection with xpcsetparam(tgfree,getparamid(tgfree,'supervision/startWalk','Value'),1)
in the console. This should start the motors. To stop the motors, use the same command but change the last 1 to a 0.Currently, the LI linear actuator (Axis 6) does not function correctly. In the standard model both left actuators are turned off to prevent damage, the right leg and the pelvis still move. To change which linear actuators are used, go to the model, enter ‘supervision’. Near the bottom there is a set of constants labelled ‘enableXXX’. a 1 means the motor is used, a zero turns it off.
To Be Added
This is repetition so that all information is on a single page for ease of use.
Steps:
init.m
scriptxpcexplr
To load a different model
xpcexplr
Different partial models were created in building steps, building towards the full model as found in Lokofree.mdl
. Note that the models are saved as slx
files, which is the new file format and mdl
is the legacy file format (see here)
SettingsOnly.slx
LokoFree.mdl
model
Sensors.slx
Ts
value, which should be 0.002
and can be set from the matlab console by typing Ts=0.002
Supervision.slx
init.m
script by typing init
in the console (assuming the working directory is the root directory LokoNew2021....
)Control.slx
Supervision.slx
+ the Control subsystem.trajenabler
variable originating from one of the state machines in Supervision toggles the reading out of the trajectory data from the trajectories_dario.mat
MotorRefForcePelvis
, depending on value of pelvis_enable
(1=on,0=off)
PelvisControlMode
variable is used to switch between
1
: PositionControl
modeOrth
used to switch between Orthesis control modes (see Hardware_Out/OutputOrtheses)
1
: ref_smooth
- output of tanh transition - ref=0
e
between ref_pos
and act_pos
by some smoothing value (tanh something)?..ref_pos=0
always. So we’re always moving towards zero? --> Stabilizing mode maybe?2
: = 1
3
: ref_smooth
- output of tanh transition
1
, except the reference position ref_pos
is equal to the pelvis_ref
from Pelvis/Trajectory_generator
4
: the raw pelvis_ref
from the Pelvis/Trajectory_generator
5
: = 1
6
: = 1
0.1m
) on each side from where a virtual spring will pull the pelvis back into the middle2
: ZeroForce - Probably used to make the system feel as light as possible, following the human movementsmotforce_knee_l
and motforce_knee_r
. combined into motor_commands_orthoses
kneeL_ref
and kneeR_ref
MotorRefForceBWS
bws_ref
0.06m
for the position limit.HardwareOut.slx
Control.slx
+ the Hardware_Out subsystem.AD622 Humusoft Analog Output
controlforce_knee_l
controlforce_knee_r
MotorRefForceBWS
as long as enableMaxons=1
(comes from Supervision)enableMaxons
to AD622 Humusoft Digital Output
(probably to toggle the above three force commands).motor_command
(from supervision) is sent to the Control Word of the motorMotorRefForcePelvis
is converted to a required currentdemand
in LinMotConversion
enablePelvis
if 0
, sets the motor commands to 0
enable
signal comes from State machine in Supervisor can be
0
: Pelvis motors disabled, motor header=par=0
1
: Pelvis motor homing. header=144
, par=homeposition*10^7
where homeposition
is actually PelvisPoti
from Sensors2
: Pelvis current commanding, header=14592
(header for current demand), par=currentdemand
motor_command
(from supervision) is sent to the Control Word of the motormodeOrth
to switch the mode of the orthoses:
1
: Homing (par=homeposition*10^7
, where homeposition=Linmot_abspos_LA
for LA motor coming from Sensors)2
: Go to intial position3
: Go to start position for trajectory4
: Walk5
: skipped?..6
: Ad-abductionother
: all commands set to 0
Working with the models, certain guidlines exist. As the Lokomat models consist of many different files and layers, it is important to keep structured.
Scope
To read data to the included hardware screens, scopes can be used. Scope blocks set to target the xPC will be visible on screen. For validation or other purposes it might be desired to read the values of a variable many layers deep in the code, do not put a scope there! Instead, add a data store element in the top layer and write to that. Then, the data store can be read in the logger, where the scopes are placed. Keeping all the scopes in the same places improves visibility.
1: Place a data store memory block in the top layer, name it clearly (e.g. “Scope_Camera”)
2: Write to this data where needed
3: Read this data in the logger, attach it to a scope
NOTE: The scopes seem to be read/placed in order of the ‘data store read’ numerical values, not per scope index. Change these values as needed to move the scope around and take care to make the naming clear even when mispositioned.
could not set master state to PREOP
Most likely one of the following has gone wrong:
Sometimes fixing this is as simple as pushing in the Ethernet cables a little bit (if the little clips are broken especially, they might come loose a bit when moving the cables around).
Check if any of the red RT Bus Error LEDs are burning on the LinMot drivers. If they do, one of the following might have caused it:
Note that if this crash happens, there is no way to recover, and the xPC should be rebooted…
CPU overload
This happens when you leave the model running for too long (at ~5 min
of runtime).
You’ll need to reboot the xPC to be able to load another model
Prevent this by stopping the model in time.
ERROR: Model reload required
Unfortunately, you need to reload model after every run…
If after starting the model you get the error:
Error in emExecJob
ERROR: invalid parameter
(or some other error or no error at all), and the whole system hangs. The xPC needs to reboot fully to be usable again (you can’t even ping the system).
To prevent this, always just unload the model after stopping it (never try to start it twice). Not sure why this is required.
Character Encoding error: When open the model (in simulink) you get the following error:
To fix: simply run the command slCharacterEncoding(‘windows-1252’) and re-open the model.