background image

Position PID

Position PID is the mode used when high positioning accuracy is required. Usually, no compliance is
assumed in this mode, so the actuator will try to hold the read position as close to the commanded value as
possible. One must be aware that position mode is actually made out of two PID controllers - the inner loop
which is the velocity PID discussed earlier and the position PID working on top of the velocity loop. This is
why it is essential to first take care of the velocity controller, considering the highest velocity that may occur
in the system between the corresponding position commands in time. When both high and very low
velocities are needed in a system it might be necessary to change the velocity PID gains on the fly, depending
on the commanded velocity in each trajectory segment. When the velocity PID is ready the next step is to
adjust the position PID gains so that a required actuator response is achieved. Since position readout is
much less noisy compared to velocity it is recommended to first pick a kP value that will allow the motor to
get to a setpoint position. In the next step kI and kD can be varied, together with the kI limiting factor
(windup). One should remember the position PID output limit which is called MaxVelocity. This is a
parameter that will limit the maximum commanded velocity and thus may limit actuator performance. It
should be set to a value that is close to the actual trajectory segment maximum achievable velocity. Making
it too high 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 affect the response of the actuator. The easiest way is to think of a motor as a combination
of a torsional spring with a damper, where kP is the spring constant, and kD is the damping coefficient. The
higher the kP gain the more accurate positioning is achieved, but also, when itʼs set too high oscillations may
be introduced. This is why a damping coefficient should be introduced. It makes the response more
“smooth”, usually less aggressive, and minimizes overshoot. It can be thought of as placing the motor in a
viscous fluid where the viscosity of the fluid is the damping coefficient. This mode, however, can introduce
steady-state error due to the lack of integral term. If high positioning accuracy is needed be sure to read
about position PID mode.

Current PI

Current/torque PI is the lowest level controller. Its gains are not directly user-configurable, however, they can
be modified using the bandwidth parameter. Please see the

calibration

section for more insight on the topic.

2.5. Safety limits

There are safety limits imposed on the maximum phase current as well as maximum torque and velocity to
ensure a safe operation of the drive. Safety limits are there to protect the controller and the motor from
overheating and the surrounding environment from too-powerful actuator movements.

Warning: setting the max current limit to above the maximum continuous current may damage the
MD80 controller if the maximum torque is commanded for a prolonged period.

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: