Definition
set_desired_force(fd, dir, time, mod, vel_limit_dir, vel_limit)
Features
This function define the s target force, direction, translation time, and mode for force control based on the global coordinate.
Caution
In non-FTS models (A0509, A0912, A0509F, A0912F, E0509), force control is only possible in the translation direction, and the control error may be large.
Caution
If the command is used in a simulation environment without a robot, it may not operate normally.
Parameters
|
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
|
fd |
float[6] |
[0, 0, 0, 0, 0, 0] |
Three translational target forces [N] Three rotational target moments [N·m] |
|
dir |
int[6] |
[0, 0, 0, 0, 0, 0] |
Force control in the corresponding direction if 1 Control compliance of corresponding direction if value is 0 At least one direction must be set to 1. |
|
time |
float |
0 |
Transition time of target force to take effect [sec] Range: 0 - 1.0 |
|
mod |
int |
DR_FC_MOD_ABS |
DR_FC_MOD_ABS: Force control with absolute value DR_FC_MOD_REL: force control with relative value to initial state (the instance when this function is called) |
|
vel_limit_dir |
int[6] |
[0, 0, 0, 0, 0, 0] |
Activate velocity limit in the corresponding direction if 1 Deactivate velocity limit in the corresponding direction if 0 |
|
vel_limit |
float[6] |
[0, 0, 0, 0, 0, 0] |
Velocity limit in each direction: translation [mm/s], rotation [deg/s] (If “vel_limit_dir” in that direction is 0, this value will be ignored) |
Caution
In the Non-FTS A & E model, the data types of fd and dir parameters can be either float[6] or float[3]. (Rotational parameters are automatically set to the default values)
Return
|
Value |
Description |
|---|---|
|
0 |
Success |
|
Negative value |
Error |
Exception
|
Exception |
Description |
|---|---|
|
DR_Error (DR_ERROR_TYPE) |
Parameter data type error occurred |
|
DR_Error (DR_ERROR_VALUE) |
Parameter value is invalid |
|
DR_Error (DR_ERROR_RUNTIME) |
C extension module error occurred |
|
DR_Error (DR_ERROR_STOP) |
Program terminated forcefully |
Note
-
This command takes effect only while task compliance control is active by task_compliance_ctrl(). If it is called without task compliance control active, the command is ignored, and if it is called while a task motion is in progress, it is rejected with a warning. Therefore, call task_compliance_ctrl() and then set_desired_force() while the robot is stopped.
-
The value of external force refers to the sensor measurement at terminating the force control (control mode transition to compliance control) by the command release_force().
Therefore, the variation in external force can occur if the option mod=DR_FC_MOD_REL is applied. -
Tool weight and external force value refer to the sensor measurement regardless of the setting for ‘mod’
Caution
No position control is performed on the axes for which force control is enabled by dir. Therefore, any component of the trajectory commanded by a motion command that overlaps with a force control axis is replaced by force control and is not executed; only the non-overlapping components are executed. This behavior is not limited to particular motion commands; it applies to all motion commands.
The following are examples in which the partial execution of a trajectory is especially noticeable, making the resulting path differ from the intended one.
-
When Z translation is set to force control and a Z amplitude is specified for move_periodic(): the Z translation is not executed, and only the rz rotation is executed.
-
When Y translation is set to force control and move_spiral() is executed about the Z axis: the Y component of the XY spiral is lost, and the motion changes into a reciprocating motion along the X axis.
If no component overlaps with a force control axis, the motion is executed normally. Using movel() or movec() in directions that do not overlap with the force control axes is a normal usage pattern (refer to Example #3).
Caution
To retain the accuracy in force control, it is recommended to start force control with setting mod=DR_FC_MOD_REL near the contact point.
Example
# Example # 1
# Executed in the global coordinate(tool coordinate)
# Zero force control in the z-axis direction of the tool, moment control in the z-axis direction of the tool, and compliance control in the other directions
# Force control with the relative value to the sensor measurement at starting the force control
set_ref_coord(DR_TOOL)
q0 = posj(0, 0, 90, 0, 90, 0)
movej(q0, vel=30, acc=30)
task_compliance_ctrl(stx=[500, 500, 500, 100, 100, 100])
fd = [0, 0, 0, 0, 0, 10]
fctrl_dir= [0, 0, 1, 0, 0, 1]
set_desired_force(fd, dir=fctrl_dir, mod=DR_FC_MOD_REL)
# Example # 2
# Executed in the robot base coordinate(base coordinate)
# Force control in the z-axis direction, and compliance control in the other directions
# Activate velocity limit in the force control direction
set_ref_coord(DR_BASE)
q0 = posj(0, 0, 90, 0, 90, 0)
movej(q0, vel=30, acc=30)
task_compliance_ctrl()
fd = [0, 0, -30, 0, 0, 0]
fctrl_dir = [0, 0, 1, 0, 0, 0]
fctrl_vel_limit = [0, 0, 20, 0, 0, 0]
fctrl_vel_limit_dir = [0, 0, 1, 0, 0, 0]
set_desired_force(fd, dir=fctrl_dir, vel_limit=fctrl_vel_limit, \
vel_limit_dir=fctrl_vel_limit_dir)
# Example #3
# 1. Move to initial posj: [J1, J2, J3, J4, J5, J6] = [0, 0, 90, 0, 90, 0]
# 2. Approach to the position to start force control: move -100mm along Base-z direction
# 3. Start force control : apply -20N force along Base–z direction
# 4. Force & compliance control after detecting external force : while maintaining -20N force along Base-z direction (force control), move 200mm along Base-y direction.
# 5. Retract 150mm in Base-z direction and move to initial posj
# 1. Move to initial posj
q0 = posj(0.0, 0.0, 90.0, 0.0, 90.0, 0.0)
set_velj(30.0)
set_accj(60.0)
movej(q0)
# 2. Approach to the position to start force control
set_velx(75.0)
set_accx(100.0)
delta_approach = [0.0, 0.0, -100.0, 0.0, 0.0, 0.0]
movel(delta_approach, mod=DR_MV_MOD_REL)
# 3. Start force control (apply -20N force along Base–z direction)
k_d = [3000.0, 3000.0, 3000.0, 200.0, 200.0, 200.0]
task_compliance_ctrl(k_d)
force_desired = 20.0
f_d = [0.0, 0.0, -force_desired, 0.0, 0.0, 0.0]
f_dir = [0, 0, 1, 0, 0, 0]
set_desired_force(f_d, f_dir)
# 4. Force & compliance control after detecting external force
force_check = 20.0
force_condition = check_force_condition(DR_AXIS_Z, max=force_check)
while (force_condition):
force_condition = check_force_condition(DR_AXIS_Z, max=force_check)
if force_condition == 0:
break
delta_motion = [0.0, 200.0, 0.0, 0.0, 0.0, 0.0]
movel(delta_motion, mod=DR_MV_MOD_REL)
# 5. Retract 150mm in Base-z direction and move to initial posj
release_force()
wait(0.5)
delta_retract = [0.0, 0.0, 150.0, 0.0, 0.0, 0.0]
release_compliance_ctrl()
movel(delta_retract, mod=DR_MV_MOD_REL)
movej(q0)
Related commands
Keyword
set / desired / force / set_desired / desired_force