background image

compensate for any high-frequency oscillations (vibrations) that may occur, as the Impedance
controller works at 40kHz (much faster than <100 Hz).

Raw torque controller

- when kP and kD are set to zero, the torque_ff command is equal to the

output controller torque.

The impedance controller is quite simple and works according to the schematic below:

2.4. Controller tuning

TL;DR: The best way to get started with tuning is to copy the

default gains

and tweak them. You can

treat this section as our recommendation for tuning the controllers, but online articles can be useful as
well (

link

)

The first step to correctly set up the gains is to start with our

default gains

There are three sets of default

gains that are set on each motor power up and thus they allow for restoring the actuator to a default state in
case some gains were set incorrectly by the user. These gains are also a great starting point for user
modifications when the actuator has to be used in a specific application requiring high positioning accuracy
or very dynamic movements.

Note: Default gains are set to work with CANdle examples. This way they can be assumed to be
universal but it does not have to always be the case.

Note: When something does go wrong during the tuning process just power-cycle the actuator - the
default gains will be restored.

Warning: Always keep your safety limits low when experimenting with gains. Gains not suitable for
your system may cause oscillations and unstable operation of the MD80-based actuators.

Velocity PID

The velocity PID controller can be used to command different velocity profiles to the motor. This mode uses
a regular PID controller architecture and has four user-defined parameters: kP, kI, kD, and windup. Since
velocity readout is somewhat noisy, it is recommended to keep the kP value as low as possible and play with
kI gain. It is necessary to find the sweet spot that makes the actuator response resistant to disturbances, but
also not too noisy (too high kP gain may introduce oscillations). Usually, the kI gain is set to a higher value,
however, do not treat it as a rule of thumb. Setting the kI gain to a too high value can cause an overshoot
when the target velocity is changed rapidly. The kD gain may be used to partially overcome this issue. The
windup parameter is used to limit the integral action which could potentially rise to high values when
velocity error is present for longer periods.

www.mabrobotics.pl

[email protected]

Summary of Contents for MD80 x CANdle

Page 1: ...MAB ROBOTICS MD80 x CANdle User Manual rev 2 0 05 09 2022 www mabrobotics pl contact mabrobotics pl...

Page 2: ...e HAT 14 Principle of operation 15 USB bus 16 SPI bus 16 UART bus 16 Using CANdle and CANdle HAT 16 Latency 18 Software Pack 20 CANdle C library 20 MDtool 22 CANdle ROS ROS2 nodes 24 MD80 update tool...

Page 3: ...ss motor controller It can be interfaced with a great variety of motors to turn them into advanced servo actuators MD80 can work with both direct drive no gearbox and geared motors MD80 brushless cont...

Page 4: ...ent wait at least 10 minutes before touching any parts of the device as it can remain electrically charged or hot Do not remove the casing of the device The following statements should be considered t...

Page 5: ...on condensing at 40 C Maximum Humidity Non Operating up to 95 non condensing at 60 C Altitude Operating 400 m to 2000 m 1 5 Hardware setup A typical hardware connection wiring scheme is presented in t...

Page 6: ...uide on our YouTube channel Md80 x CANdle Getting Started Tutorial 2 MD80 2 1 General parameters MD80 is a brushless servo drive It may come with a variety of motors and reductors that can be precisel...

Page 7: ...wires 2 3 Control modes TL DR MD80 x CANdle motion modes To control the motor shaft with the user s command MD80 is equipped with multiple control loops All controllers are based on a regular PID con...

Page 8: ...t in Nm Max output in Nm Position PID Position PID mode is the most common controller mode used in industrial servo applications In MD80 it is implemented as a cascaded PID controller This means that...

Page 9: ...he torque output is proportional to the position error and velocity error and additionally supplemented with a torque command from the user Here are some of the most common applications for this contr...

Page 10: ...med to be universal but it does not have to always be the case Note When something does go wrong during the tuning process just power cycle the actuator the default gains will be restored Warning Alwa...

Page 11: ...gh when very low velocities are required may result in oscillations Impedance PD The impedance mode is relatively straightforward to get started with since there are only two main parameters that affe...

Page 12: ...you should use the following formula where calculated current in Amps desired maximum torque gear ratio motor s torque constant for example let s calculate the max current limit for AK80 9 motor for...

Page 13: ...o 2000ms using mdtool config can command When the watchdog is set to 0 it will disable the timer however this can lead to dangerous situations and it is not a recommended way of operating MD80 Warning...

Page 14: ...ingle rotation in both directions to assess the amount of error due to non axial encoder placement Torque bandwidth Even though the torque command on MD80 controllers seems to be applied instantaneous...

Page 15: ...prepare them for a low latency operation in the UPDATE mode When the configuration is done the user calls candle begin which starts a low latency continuous connection with the MD80 controllers In th...

Page 16: ...s internal list and send an acknowledgment to the CANdle lib If the drive is successfully added the addMd80 method will add this particular md80 to its internal vector for future use and return true W...

Page 17: ...T Together with the RT PATCHED kernel of the system you will get the best performance Note CANdle HAT in SPI mode works with all FDCAN speeds however we advise setting it to 8M for the best performanc...

Page 18: ...g SPI or UART a few other requirements have to be met We will guide you through the setup process on Raspberry PI 4 Note when using SBCs other than Raspberry the process may vary and should be perform...

Page 19: ...A special flag was embedded into the MD80 command which the MD80 should return in the next response it sends This way the whole route from the host through CANdle MD80 and back was profiled in terms o...

Page 20: ...u can also embed the following snippet in your C code if you can run it with sudo directly struct sched_param sp memset sp 0 sizeof sp sp sched_priority 99 sched_setscheduler 0 SCHED_FIFO sp During te...

Page 21: ...be able to see the compiled examples in the candle build directory To run one of them use the following command exampleX where X is the number of the example Building as a static lib Candle C library...

Page 22: ...led using pip sudo python3 m pip install pyCandleMAB It can be used to quickly start playing with the actuators without the need to build the C software pack Example usage of Python examples is shown...

Page 23: ...th different CAN speeds on the same CAN bus please make sure when mdtool ping all command is executed all discovered drives lie in a single speed category mdtool config zero command ID This command se...

Page 24: ...of debugging possible problems with the drive Error code Description ERROR_BRIDGE_OCP Overcurrent was detected by the MOSFET driver ERROR_BRIDGE_FAULT A general fault of the MOSFET driver ERROR_OUT_EN...

Page 25: ...set_mode_md80s There are also two additional services for enabling disabling the drives enable_md80s disable_md80s Once the drives are enabled via enable_md80s service the nodes will ignore all calls...

Page 26: ...ed and were added to the node s drives list You can also look for status messages in the terminal window where the node was started According to the status messages we have added two MD80 actuators As...

Page 27: ...example to set up custom gains for IMPEDANCE mode use rostopic pub md80 impedance_command candle_ros ImpedanceCommand drive_ids 200 800 kp 0 25 1 0 kd 0 1 0 05 max_output 2 0 2 0 Example set up of cus...

Page 28: ...with a USB bus and 8M FDCAN baudrate Adding drives Firstly the node should be informed which drives should be present on the FDCAN bus This can be done via candle_ros2_node add_md80s service Note Do n...

Page 29: ...her than candle_ros2_node disable_md80s should be done After enabling the node will publish current joint states to joint_states at a frequency dependent on a currently chosen communication bus and sp...

Page 30: ...80 velocity_pid_command candle_ros2 msg VelocityPidCommand drive_ids 200 800 velocity_pid kp 0 2 ki 0 3 kd 0 0 i_windup 2 0 max_output 2 0 kp 0 1 ki 0 1 kd 0 0 i_windup 1 max_output 2 0 Setting desire...

Page 31: ...the controllers After that you are ready to run the update tool We highly advise you to call MAB_CAN_Flasher help command on the first use to get acquainted with the available options Note In case th...

Page 32: ...low 4 5 CANdle update tool MAB USB Flasher MAB_USB_Flasher is a console application used to update the CANdle software using USB bus Currently only updates over USB are supported updates over SPI and...

Page 33: ...azardous situations for both the operator and the driver 5 3 Failed calibration The calibration can fail for several reasons yet the most common one is just improperly soldered motor wires In this cas...

Page 34: ...he mdtool config can command to fix it 5 6 Too low torque bandwidth setting When the torque bandwidth is set to a too low value it can cause the motor to behave improperly in highly dynamic scenarios...

Page 35: ...Revision history Revision Release date Changes v1 0 December 2021 Preliminary release v2 0 September 2022 CANdle HAT release software pack update www mabrobotics pl contact mabrobotics pl...

Reviews: