CanServo/Manual/Summary/en
Overview of this page
CAN servo is a servo controlled through CAN communication.
It supports CAN 2.0A, 2.0B, 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, you can 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.
- For details, refer to CanServo/Packet Accept Rule/en.
According to the status of CanServo/MODE/CAN/en, the following protocol is followed.
- CAN 2.0A, 2.0B: CanServo/Protocol/Control/en
- DroneCAN: CanServo/Protocol/UAVCAN/en
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:
- CAN ID and Node ID are set through Register CanServo/ID2/en.
- Servo ID and Actuator ID are set through Register CanServo/ID1/en.
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.
- CanServo/Protocol/Control/en
- CanServo/Register/en
- CanServo/Register/Write/en
- CanServo/Register/Read/en
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.
- Communication settings: communication speed, communication protocol, ID2, ID1
- Operation mode ( CanServo/MODE/RUN/en )
- Stream CAN ID set value ( CanServo/Stream/CAN ID/en )
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
- Exceptions are:
- !!! 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
- CanServo/POSITION, POSITION_NEW: Resolution: 16384 = 360 deg
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.
- Refer to CanServo/Protocol/Control/en for details.
- 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
- Let's take the following three examples.
- 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)
- Change the target angle (deg) in POSITION units.
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
- CanServo/POSITION/en - Position value within 1 rotation
- CanServo/TURN/en - rotation status
- CanServo/POSITION-32/en - 32-bit position value with rotation state combined
- CanServo/POSITION-32/LOW/en - When reading only Low Word from 32-bit position value
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
Read acceleration of movement
- If you read Register ACC, you can know the current acceleration of the servo.
Servo internal temperature sensors
CAN servos have various temperature sensors depending on the product.
- MCU temperature
- Data from the temperature sensor built into the MCU of the control board.
- Motor temperature
- Data from the temperature sensor attached to the motor.
- Temperature of humidity sensor
- Data from the temperature sensor included in the humidity sensor.
If you specify the minimum and maximum values of MCU temperature, the motor output is automatically turned on or off according to the temperature condition.
Since there is no separate monitoring code for the temperature data of the motor temperature and humidity sensor, the servo output must be turned off or controlled by periodically reading and judging from the host.
Additional Features
User Data
- You can put the information you want in 2 registers.
- If the value is changed and the SAVE procedure is performed, it is maintained even if it is reset.
Stream
Transmits information such as *Register POSITION, CanServo/TURN/en at specified intervals.
- UAVCAN sends an Actuator Status message.
- Refer to CanServo/Stream/en.
Stream Address
- Through 4 registers, you can designate up to 8 addresses, 2 each.
- Please refer to CanServo/Stream/Address/en.
Stream CAN ID
- This is a function to separately designate CAN ID to be used when sending Stream CAN Packet.
- Refer to CanServo/Stream/CAN ID/en.
Start Position
- CAN servo maintains the reset position when starting.
- This function is used when you want to move to a specific location at the time of reset.
- Refer to CanServo/Start Position/en.
Fail Safe
- This function moves to the designated location when the Reg POSITION_NEW write message does not come for a certain period of time.
- POSITION_NEW Write message must be received once to be activated.
- Set the time and location respectively.
- Refer to CanServo/Fail Safe/en.
Pause Stream
- This is a function to temporarily stop sending the stream.
- This state is not saved, and the stop is released when the servo is reset.
- Refer to CanServo/Stream/Pause/en.
Switch to Bootloader
- This is a function to switch to Bootloader during FW execution.
- You can specify the communication speed, CAN ID, etc. to be used in the bootloader.
- With this, only one servo can update FW while all servos are turned on.
- Please refer to CanServo/Switch to Bootloader/en.
Classification by function
With Motor Current Measuring Circuit
- Some MD series (eg MD89), SG series, RB series, DB series have motor current measuring circuit.
- The output is adjusted using the real-time measured voltage and current.
With motor temperature sensor
- On some models, we provide temperature data for the motor.
- Host should check periodically to turn off the servo or lower the output.
With voltage rise protection circuit
- Some models are equipped with a circuit that limits the voltage from exceeding a certain voltage.
- Example: SG50
- Depending on the operating conditions, the servo may generate power and increase the voltage.
- Example: slow motion, lower winch
- This is a circuit that prevents this by hardware.
- However, if the limit is exceeded, the circuit is turned off by the electronic fuse and the function stops.
- When this circuit is turned off, the Over Voltage Brake function catches the high voltage next.
- In the case of SG50, the prevention circuit blocks the first, and the Over Voltage Brake function blocks the second.
With humidity sensor
- Some models have an additional humidity sensor.
- Example: SG33, SG50
- Humidity sensor provides relative humidity and temperature data inside the servo.
- Servo provides Low Data as it is, so it must be calculated according to the formula.
- After receiving data periodically, the host must decide to turn off the servo or limit the operation.