rby1_sdk.OptimalControlCommandBuilder¶
- class OptimalControlCommandBuilder¶
Bases:
pybind11_objectOptimal control command builder.
Constructs an optimal control objective composed of Cartesian pose costs, center-of-mass (COM) costs, and joint position costs, with global error and limit scalings.
Notes
The overall objective can be viewed as a weighted least-squares form:
\[J \;=\; \sum_{i} w_t^{(i)} \,\|\, p^{(i)}_d - p^{(i)} \,\|^2 \;+\; \sum_{i} w_r^{(i)} \,\|\, r^{(i)}_d \ominus r^{(i)} \,\|^2 \;+\; w_{\mathrm{com}} \,\|\, c_d - c \,\|^2 \;+\; \sum_j w_q^{(j)} \,(q^{(j)}_d - q^{(j)})^2\]where \(p, r\) denote translation and rotation of a link in a reference frame, \(c\) is the COM position, and \(q\) are joint positions.
Velocity/acceleration limit scalings multiply internal limits used by the optimizer; they do not redefine hardware limits.
Examples
Set a right-wrist Cartesian target and a joint hint, with moderate limit scalings:
>>> import numpy as np, rby1_sdk as rby >>> T = np.eye(4); T[0,3] = 0.35; T[2,3] = 0.55 >>> oc = ( ... rby.OptimalControlCommandBuilder() ... .add_cartesian_target("base_link", "ee_right", T, translation_weight=1.0, rotation_weight=0.5) ... .add_joint_position_target("right_arm_4", 0.4, weight=0.2) ... .set_velocity_limit_scaling(0.8) ... .set_acceleration_limit_scaling(0.6) ... .set_error_scaling(1.0) ... )
- __init__(self: rby1_sdk.OptimalControlCommandBuilder) None¶
Methods
__init__(self)add_cartesian_target(self, ref_link_name, ...)Add a Cartesian pose target for a link.
add_joint_position_target(self, joint_name, ...)Add a joint position target.
set_acceleration_limit_scaling(self, ...)Scale internal joint acceleration limits used by the optimizer.
set_center_of_mass_target(self, ...)Set a center-of-mass (COM) position target.
set_command_header(self, command_header_builder)Attach a command header to this builder.
set_error_scaling(self, error_scaling)Set a global error scaling applied to cost terms.
set_min_delta_cost(self, min_delta_cost)Set the minimum required improvement in cost between iterations.
set_patience(self, patience)Set the iteration patience before stopping on small improvements.
set_stop_cost(self, stop_cost)Set the absolute objective threshold to consider the problem "solved".
set_velocity_limit_scaling(self, ...)Scale internal joint velocity limits used by the optimizer.