set constraints all deferred|immediate的作用

约束有三个选项:
DEFERRABLE INITIALLY DEFERRED
DEFERRABLE INITIALLY IMMEDIATE
NOT DEFERRABLE
默认的话是第三种,而第三中是immediate的,并不受set constraint影响[@more@]约束有三个选项:
DEFERRABLE INITIALLY DEFERRED
DEFERRABLE INITIALLY IMMEDIATE
NOT DEFERRABLE
默认的话是第三种,而第三中是immediate的,并不受set constraint影响

例如:
以一般方式添加的约束
SQL> create table t1(a int);

Table created.

SQL> alter table t1 add constraint pk unique(a);

Table altered.

SQL> select deferrable from dba_constraints where owner='GOWIN' and constraint_n
ame='PK';

DEFERRABLE
--------------
NOT DEFERRABLE

SQL> create or replace procedure tes
2 as
3 begin
4 insert into t1 values (1);
5 insert into t1 values (1);
6 end;
7 /

Procedure created.

SQL> set constraints all deferred;

constraint set.

SQL> exec tes
BEGIN tes; END;

*
ERROR at line 1:
ORA-00001: unique constraint (GOWIN.PK) violated
ORA-06512: at "GOWIN.TES", line 5
ORA-06512: at line 1

然后以另两种方式中的一种添加约束的方式
SQL> drop table t1;

Table dropped.

SQL> create table t1(a int);

Table created.

SQL> alter table t1 add constraint pk unique(a) DEFERRABLE initially deferred;

Table altered.

SQL> select deferrable from dba_constraints where owner='GOWIN' and constraint_n
ame='PK';

DEFERRABLE
--------------
DEFERRABLE

SQL> create or replace procedure tes
2 as
3 begin
4 insert into t1 values (1);
5 insert into t1 values (1);
6 end;
7 /

Procedure created.

SQL> exec tes

PL/SQL procedure successfully completed.

SQL> select * from t1;

A
----------
1
1

SQL> commit;
commit
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-00001: unique constraint (GOWIN.PK) violated

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28429/viewspace-839545/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28429/viewspace-839545/

MoveGroupCommander.set_path_constraints()函数是MoveIt!中MoveGroupCommander类的一个成员函数。它的作用是设置运动规划过程中的路径约束。路径约束可以限制机器人运动轨迹的一些属性,如姿态、位置、速度和加速度等。在执行运动规划时,MoveIt!会考虑这些约束条件来生成合法的路径。 set_path_constraints()函数的具体用法如下: ```python set_path_constraints(constraints) ``` 其中,constraints参数是一个MoveIt!消息类型的实例,包含了路径约束的具体信息。常见的路径约束类型包括: - JointConstraint:关节角度限制; - PositionConstraint:末端执行器的位置限制; - OrientationConstraint:末端执行器的姿态限制; - VelocityConstraint:末端执行器的速度限制; - AccelerationConstraint:末端执行器的加速度限制。 例如,以下代码演示如何设置一个姿态约束: ```python from moveit_msgs.msg import OrientationConstraint # 创建一个姿态约束 orientation_constraint = OrientationConstraint() orientation_constraint.header.frame_id = "panda_link0" orientation_constraint.link_name = "panda_link8" orientation_constraint.orientation.w = 1.0 orientation_constraint.absolute_x_axis_tolerance = 0.1 orientation_constraint.absolute_y_axis_tolerance = 0.1 orientation_constraint.absolute_z_axis_tolerance = 0.1 orientation_constraint.weight = 1.0 # 设置路径约束 move_group.set_path_constraints(orientation_constraint) ``` 在这个例子中,我们设置了一个姿态约束,机器人的执行器必须在panda_link0坐标系下,保持panda_link8坐标系的朝向为[1,0,0,0],并且在x、y、z轴方向上的偏差不能超过0.1。这个约束的权重设置为1.0,表示它是非常重要的。 需要注意的是,设置路径约束后,机器人的路径规划可能会受到影响,可能会导致规划时间变长或规划失败。因此,应该根据实际需求选择合适的路径约束类型和参数。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值