CanServo/Manual/Summary/en

From HITEC_HELP
Jump to navigation Jump to search

Under Construction

Overview of this page

CAN servo is a servo controlled through CAN communication. It supports CAN 2.0A, 2.0B and supports DroneCAN protocol.

This document summarizes the contents of the CAN Servo Manual and rearranges them from a functional point of view. For details, refer to the CAN servo manual.

F/W Types

It is divided according to the type of protocol supported.

  • C Type = support CAN 2.0A, 2.0B
  • U Type = support DroneCAN
  • A Type = support CAN 2.0A, 2.0B, DroneCAN

Simple Test

C Type or A Type: The factory default setting of CAN servo is CAN 2.0A, 1000kbps, Servo Mode. For testing purposes, we send the following packets:

  • CAN 2.0A packet, CAN ID = 0, DATA = 'w', 0, 0x1E, 0xAA, 0x2A, DLC = 5 ---> Move to +60 degree position
  • CAN 2.0A packet, CAN ID = 0, DATA = 'w', 0, 0x1E, 0x00, 0x20, DLC = 5 ---> Move to 0 degree position

Communication settings

  • Communication settings are applied at the time of Servo Reset.
  • If you are using CAN communication for the first time, please refer to CAN/Overview.

CAN baudrate

Select the communication speed to use. The unit is kbps.

  • Register Address: 0x38
  • 0 - 1000
  • 1 - 800
  • 2 - 750
  • 3 - 500
  • 4 - 400
  • 5 - 250
  • 6 - 200
  • 7 - 150
  • 8 - 125

Select Protocol

Select the protocol type to be used for communication through CanServo/MODE/CAN/en.

Select from CAN 2.0A, 2.0B, or DroneCAN. Depending on the protocol, it may be necessary to change the FW Type.

The reason CAN 2.0A and B are divided is because the CAN ID value must also match, but the Type is also checked. That is, CAN ID = 100 with CAN 2.0A and CAN ID = 100 with CAN 2.0B are recognized differently.

According to the status of CanServo/MODE/CAN/en, the following protocol is followed.

Servo ID designation

To control servos, you need to distinguish between servos. Servos are distinguished by two types of IDs.

  • When using CAN 2.0A, 2.0B protocol, it is divided into CAN ID and Servo ID.
  • When using DroneCAN, it is divided into Node ID and Actuator ID.

Set each ID:

Operation Mode

  • CAN servo supports Servo Mode that operates within one rotation and Turn Mode that allows +/-32760 x 360 deg operation.
    • Note: When Turn Mode is selected, the position at the time of servo reset becomes 0 deg, 0 Turn position.
  • Choose from 2 options.
  • Operation mode is applied at the time of servo reset.
  • Please refer to Register CanServo/MODE/RUN/en.

Servo control method

  • CAN servo has 128 registers of 2 byte size.
  • It operates according to these values.
  • For example
    • In Servo Mode, if you set a value of 8192 in Register POSITION_NEW, it moves to the center position.
    • If you read the Register CanServo/POSITION/en value, you can know the current position of the servo.

Applied time when setting value is changed

  • Most user-use settings take effect immediately after change.
  • But, the following items, as an exception, are applied at the time of Servo Reset, so SAVE and RESET procedures must be performed.

Storage of setting value

  • Most of the registers are saved at the time of SAVE command and are maintained even after Servo Reset.
    • Exceptions are:
      • Control values ​​(POSITION_NEW, TURN_NEW, etc.)
      • Various status values ​​(ex: POSITION)
      • Other exceptions
  • !!! caution !!!
    • It is recommended to do SAVE with the motor stopped.
    • You should not SAVE too often.
    • In particular, this should not be done periodically.
    • After changing as many values ​​as possible, it is recommended to SAVE and Servo Reset.
    • However, it is recommended to change or reset the communication setting value, ID, RUN_MODE, etc., not together with other values.

Location coordinate system

Servo Mode

  • This mode operates within 1 rotation.
  • Set the desired position in Register POSITION_NEW.
    • Range: 0 ~ 16383
    • Center: 8192
  • You can limit the range of motion with POSITION_MIN, POSITION_MAX.

Turn Mode

  • Multi-rotation position control mode.
  • It works if you set the number of rotations in CanServo/TURN_NEW/en and set the angle within 360 degrees in CanServo/POSITION_NEW/en.
  • Both values ​​follow the int16_t ( 16 bits signed integer ) method, so negative numbers can be specified.
  • !!! caution !!!
    • When the servo is reset, the position value is initialized to 0.
    • Immediately after Servo Reset, if TURN_NEW = 0, POSITION_NEW = 0 is transmitted, it remains motionless.
      • It is recommended to use the 'W' Write message that can transmit two registers at the same time.
      • When transmitting separately, an error occurs in either of the two transmissions, resulting in undesirable behavior.

DroneCAN UNITLESS Coordinate System

  • If you use UNITLESS mode when designating the target position in DroneCAN Actuator.ArrayCommand message, you can specify from -1.0000 to +1.0000 in normalized form.
  • The position values ​​specified in this way are converted to actual position values ​​from -1 to 0 to +1 ---> POSITION_MIN, POSITION_MID, and POSITION_MAX.
  • For example, -0.5000 becomes (POSITION_MIN+POSITION_MID)/2 .

Communication example

For example, if you have 4 servos as

  • S1: PROTOCOL=2.0A, ID2 = 10, ID1 = 101
  • S2: PROTOCOL=2.0A, ID2 = 20, ID1 = 102
  • S3: PROTOCOL=2.0B, ID2 = 10, ID1 = 103
  • S4: PROTOCOL=2.0B, ID2 = 20, ID1 = 104

Assuming that the value 0x11 is written to register 0x30 of S2 servo

  • CAN ID = 0, TYPE=2.0A, DATA = 'w', 102, 0x30, 0x11, 0x00 -> Received and processed by S2
  • CAN ID = 0, TYPE=2.0B, DATA = 'w', 102, 0x30, 0x11, 0x00 -> S2 ignored, TYPE incorrect

To explain the DATA part,

  • The first byte 'w' means the command to write 1 Register.
  • The second byte 102 means Target Servo ID, and since it is 102, it points to S2.

Basic usage

Change target position

You can specify the target position through *Register POSITION_NEW.

    • In Turn Mode, Register TURN_NEW is used together.
    • Register TURN_NEW is ignored in Servo Mode.
  • POSITION_NEW and TURN_NEW are not saved.


  • In Turn Mode, there are two ways to specify the target position, depending on whether POSITION_NEW is used as a negative number.
    • Let's take the following three examples.
      • -370 deg = -370 x 16384 / 360 = -16839.111 = -16839
      • -10 deg = -10 x 16384 / 360 = -455.111 = -455
      • 10 deg = 10 x 16384 / 360 = 455.111 = 455
    • -370 deg
      • TURN_NEW = -1, POSITION_NEW = -455 -> when using negative numbers
      • TURN_NEW = -2, POSITION_NEW = 15929 -> When not to use negative numbers
    • -10 deg
      • TURN_NEW = 0, POSITION_NEW = -455 -> when using negative numbers
      • TURN_NEW = -1, POSITION_NEW = 15929 -> When not to use negative numbers
    • 10 deg
      • TURN_NEW = 0, POSITION_NEW = 455


  • Calculating TURN_NEW, POSITION_NEW in Turn Mode
    • Change the target angle (deg) in POSITION units.
      • pos = (integer conversion) ( deg x 16384 / 360 )
    • turn and the remainder.
      • TURN_NEW = (convert to round off) (pos / 16384)
      • POSITION_NEW = pos % 16384 ( C style )
    • Transmit two values ​​(Type 1)
      • POSITION_NEW can be less than 0 here.
    • If you change POSITION_NEW to a positive number, set CanServo/TURN to -1. (Type 2)
int32_t pos = (int32_t)(deg * 16384 / 360);
int32_t turn = pos / 16384;
int32_t posi = pos % 16834;
// TYPE 1: send 'W' command: turn -> TURN_NEW, posi -> POSITION_NEW
while( posi < 0 )
{
    posi += 16384;
    turn -= 1;
}
// TYPE 2: send 'W' command: turn -> TURN_NEW, posi -> POSITION_NEW

Limiting the target position

  • In Servo Mode, you can specify the operating range in Register POSITION_MIN and POSITION_MAX.
  • Resolution is 16384 = 360 deg.
  • Recommended maximum range of motion: Center (8192) +/- 150 degrees
  • For example, if you specify +/- 60 degrees
    • 60 deg = 60 x 16384 / 360 = 2730
    • POSITION_MIN = -60 deg = 8192 - 2730 = 5462
    • POSITION_MAX = +60 deg = 8192 + 2730 = 10922

Read current location

The servo's current position value is provided in various formats.

Register

Read value:

  • In Servo Mode, read Register POSITION or POSITION-32-LOW.
  • In Turn Mode, read Register POSITION, TURN. Or read POSITION-32.

The difference between POSITION and POSITION-32-LOW

  • POSITION is stored only from 0 to 16383, and the change in TURN is known only by reading TURN.
  • POSITION-32-LOW has 2 additional bits, so you can know the status up to 4 turns back and forth.

Change speed

  • You can specify the maximum operating speed.
  • If it is changed to 0, it will not move even if the target position is changed.

The unit of speed in CAN servo is pos/100msec.

The resolution of pos is 16384 = 360 deg .

The conversion formula for Vt (sec/60deg) and Vp (pos/100msec) is as follows. However, PT = Reg PID TIME, PX = PT / 10

  • Vp = 60 x 16384 / 360 / Vt / 10 x PX
  • Vt = 60 x 16384 / 360 / Vp / 10 x PX

ex) 1920 pos/100msec = 0.142 sec/60deg, PX=1

ex) 1920 pos/100msec = 0.284 sec/60deg, PX=2

Torque change

  • Adjusts the maximum output.
  • Maximum speed is also adjusted proportionally.
  • If you change it to 0, the force is completely released and you can move by external force.

OLP

  • Over Load Protection function.
  • It is activated when the internal controller output remains Full for more than the specified time.
  • When OLP is triggered, the output is adjusted to the value specified by OLP Ratio.
    • If it is 90 then the output will be 90%.
  • OLP activation time depends on PX = PT / 10, PT = PID TIME.
  • OLP activation time = OLP Time x PX.
    • If PX = 2 and OLP Time = 3, the OLP activation time will be 6 seconds.

Emergency stop

  • Temporarily stops servo movement.
  • This state is not saved and is released after Servo Reset.
  • Depending on the emergency stop status, the process until the stop and the status maintenance method are different.
    • 0 = emergency stop release
    • 1 = Turns off motor output immediately. It can be moved by external force.
    • 2 = Decelerate according to the Time Speed ​​ES value, and hold the stop position.
    • 3 = Stop immediately, hold stop position.

Emergency stop according to voltage and MCU temperature

  • When the condition of MCU temperature and voltage is outside the specified operating range, the motor output is turned off.
  • It is not real-time, it is averaged to some extent.

Specifying the acceleration/deceleration time

  • Acceleration time (Time Speed ​​Up) and deceleration time (Time Speed ​​Down) can be set separately.
    • In addition, set the emergency stop time (Time Speed ​​ES: Emergency Stop).
  • This setup implements a trapezoidal velocity profile.
  • You can specify the time to accelerate to the specified maximum speed and the time to decelerate from the maximum speed to 0 speed.
  • Used when smooth acceleration/deceleration is required.
  • When used as a general servo, set to 0.
  • The unit of these setting values ​​depends on PX = PT / 10 ( PT = PID TIME ).
  • For example
    • If PX = 1: Time Speed ​​Up = 100 = 100 msec.
    • If PX = 2: Time Speed ​​Up = 100 = 200 msec.

Read movement speed

You can find out the current speed of the servo by reading Register VELOCITY.

The unit of speed is pos/100msec.

The resolution of pos is 16384 = 360 deg .

The conversion formula for Vt (sec/60deg) and Vp (pos/100msec) is as follows.

  • Vp = 60 x 16384 / 360 / Vt / 10
  • Vt = 60 x 16384 / 360 / Vp / 10

ex) 1920 pos/100msec = 0.142 sec/60deg

현재 가속도 읽기

  • Register ACC 를 읽으면 서보의 현재 가속도를 알수 있습니다.

서보 내부 온도 센서 종류

  • CAN 서보는 제품에 따라 다양한 온도 센서를 가지고 있습니다.
    • MCU 온도
      • 제어 보드의 MCU 에 내장된 온도 센서의 데이터 입니다.
    • 모터 온도
      • 모터에 부착된 온도 센서의 데이터 입니다.
    • 습도 센서의 온도
      • 습도 센서에 포함된 온도 센서의 데이터 입니다.
  • 온도에 의한 모터 출력 끄기
    • MCU 온도의 최소, 최대 값을 각각 지정하여, 모터 출력을 끌 수 있습니다.
  • 모터 온도, 습도 센서의 온도 데이터는 별도의 감시 코드가 없으므로, Host 에서 주기적으로 읽어서 판단하여 서보 출력을 끄거나 제어해야 합니다.

추가 기능

User Data

  • Register 2개에 사용자가 원하는 정보를 넣어 둘수 있습니다.
  • 값을 변경하고 SAVE 절차를 수행하면, Reset 되어도 유지됩니다.

Stream

  • Register POSITION, CanServo/TURN 등의 정보를 지정한 간격으로 전송합니다.
  • UAVCAN 에서는 Actuator Status 메시지를 발신합니다.
  • CanServo/Stream 을 참조해 주십시오.

Stream Address

  • 총 4개의 Register 를 통해, 원하는 주소 2개씩 최대 8개까지 지정 할수 있습니다.
  • CanServo/Stream/Address 를 참조해 주십시오.

Stream CAN ID

  • Stream CAN Packet 발신 때 사용할 CAN ID 를 별도 지정하는 기능입니다.

Start Position

  • CAN 서보는 기동시 Reset 시점의 위치를 유지합니다.
  • Reset 시점에 특정 위치로 이동시키고 싶을 때 사용하는 기능입니다.

Fail Safe

  • POSITION_NEW 가 일정 시간 동안 오지 않으면 특정 위치로 이동시키고 싶을 때 사용하는 기능입니다.
  • 시간과 위치를 각각 설정합니다.
  • CanServo/Fail Safe 를 참조해 주십시오.

Pause Stream

  • Stream 발신을 일시적으로 정지시키는 기능입니다. 이 상태는 저장되지 않으며, 서보 Reset 이 되면 정지는 풀립니다.

Switch to Bootloader

  • FW 실행 중에 Bootloader 로 전환하는 기능입니다.
  • Bootloader 에서 사용할 통신 속도, CAN ID 등을 지정할수 있습니다.
  • 이를 통해 각 서보가 모두 켜져 있는 상태에서 1대의 서보만 FW 를 업데이트 할수 있습니다.

기능별 구분

전류 측정 회로가 있는 경우

  • MD 시리즈 일부 (예: MD89), SG 시리즈, RB 시리즈, DB 시리즈는 전류 측정 회로가 있습니다.
  • 실시간 측정한 전압과 전류를 이용하여 출력을 조절합니다.

모터 온도 센서가 있는 경우

  • 일부 모델에서는, 모터의 온도 데이터를 제공합니다.
  • Host 에서 주기적으로 확인하여, 서보를 끄거나, 출력을 낮추어야 합니다.

전압 상승 방지 회로가 있는 경우

  • 특정 전압 이상이 되지 못하도록 제한해 주는 회로가 장착된 모델이 있습니다.
    • 예: SG50
  • 서보는 동작 상황에 따라 발전이 되어 전압이 높아지는 경우가 있습니다.
    • 예: 감속 동작, 윈치 내리기
    • 이를 하드웨어적으로 방지하는 회로입니다.
    • 다만, 한도를 넘어서면 전자 퓨즈에 의해 회로가 꺼지면서 기능이 멈춥니다.
  • 이 회로가 꺼지면 그 다음으로 Over Voltage Brake 기능이 고전압을 잡아줍니다.
  • SG50 의 경우에는 방지 회로가 1차로 막고, 2차로 Over Voltage Brake 기능이 막습니다.

습도 센서가 있는 경우

  • 습도 센서가 추가로 있는 모델이 있습니다.
    • 예: SG 시리즈 일부: SG33, SG50
  • 습도 센서는 서보 내부의 상대 습도와 온도 데이터를 제공합니다.
  • Low Data 를 그대로 제공하므로, 공식에 따라 계산해야 합니다.
  • 주기적으로 데이터를 받아서, Host 에서 판단하여 서보를 끄거나, 동작을 제한해야 합니다.