set_desired_force(fd, dir, time, mod)
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 Three rotational target moments |
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 |
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) |
Caution
In the Non-FTS A model, the data types of fd and dir parameters are changed to float[3]. (Rotational parameter input is not allowed)
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
- 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
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)
x0 = posx(0, 0, 90, 0, 90, 0)
movej(x0)
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
# 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)