background image

Generally, a program using CANdle should follow the workflow below:

Creating a Candle object creates a class that will hold all the data and provides an API for the user. During the
creation of the class, the so ware will attach itself to the ttyACMx port used by the CANdle, or SPI/UART bus if
CANdle HAT is considered. It will also perform a reset operation on the device and set up basic parameters.
This ensures that the device is in the known state at the start of the program. When an object is created, the
CANdle is in the CONFIG state.

Now the configuration of the drives can be done. As a rule of thumb, all class methods starting with the word
ʻconfigʼ can be used here. They do not require adding md80 to the update list, just require an ID of the drive
to talk to. This is a good place to set current limits, change FDCAN parameters, or save data to flash.

Note: This is also a good place to call Candle::ping(), this will trigger the CANdle device to send an FDCAN frame
to all valid FDCAN IDs. The method will return a vector of all IDs that have responded. This can be used to check
if all the drives have power and if all communication is set up correctly. Please note that scanning of the entire
ID range will take about 2.5 seconds.

The next step is adding md80s to the update list. To do so, use

Candle::addMd80()

method, with an FDCAN

ID (drive ID) as an argument. This will trigger CANdle to quickly check if the drive is available on the bus at
the ID, and if it is, the CANdle device will add the drive to its 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.

When all drives have been added, the drives should be ready to move. This can be done with methods
starting with the “control(...)” keyword. Firstly the control mode should be set, then zero position set (if
desired), and finally the drives can be enabled by using

Candle::controlMd80Enable()

method.

Note: sending an ENABLE frame will start the CAN Watchdog Timer. If no commands follow, the drive will shut
itself down.

When all drives are enabled, Candle::begin() can be called. This will set the CANdle (both device and library)
to UPDATE state. The device will immediately start sending command frames to the md80s. From now on the
library will no longer accept config* methods. Right now it is up to the user to decide what to do. A er the
first 10 milliseconds, the whole md80 vector will be updated with the most recent data from MD80s and the
control code can be executed to start moving the drives.
Individual drives can be accessed via Candle::md80s vector. The vector holds instances of ʻMd80ʼ class, with
methods giving access to every md80 control mode. Latest data from md80ʼs responses can be accessed with
Md80::getPosition(), Md80::getVelocity(), Md80::getTorque(), Md80::getErrorVector().

Note: As the communication is done in the background, it is up to the user to take care of the so ware timing
here. If you for example set a position command, but donʼt put any delay a er it, the program will get to an
end, disabling the communication and the servo drives, without you seeing any movement!

www.mabrobotics.pl

[email protected]

Содержание MD80 x CANdle

Страница 1: ...MAB ROBOTICS MD80 x CANdle User Manual rev 2 0 05 09 2022 www mabrobotics pl contact mabrobotics pl...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: