4.12 BasScript Program Class
Overview
BasScript lets you construct BAS instruction sequences for the robot in a structured way from the host PC, covering motion, logic, program calls, communication, vision, and Modbus commands.
Core Features
- Support for building motion instructions (MoveJoint, MoveLine, MoveCircle, etc.)
- Support for building logic instructions (If, While, Switch, Goto, etc.)
- Support for building assignment, wait, pause, and abort instructions
- Support for building program call and management instructions
- Support for building Socket communication instructions
- Support for building Modbus register read/write instructions
- Support for building vision program instructions
- Support for setting extra parameters (acceleration, RTCP, frame offset, etc.)
- Support for quick motion instructions (JUMP series)
Use Cases
- Automatically generate complex robot programs
- Edit and modify robot programs
- Reuse common program modules and instruction sequences
- Achieve seamless integration between host PC and robot programs
- Build customized robot motion trajectories
- Integrate vision, communication, and Modbus functions into robot programs
Constructor
| Method Name | BasScript( name : str) -> BasScript |
|---|---|
| Description | Construct BAS instruction sequences for the robot |
| Request Parameters | name : Script name |
| Compatible Robot Software Versions | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): v7.6.0.0+ |
| Notes | All methods under this class have the same compatibility requirements as this class |
Subclass Structure
BasScript class contains the following subclasses to organize different types of instructions:
- ExtraParam: Extra parameter class for building complex robot control commands
- BasMotion: Motion instruction subclass containing all robot motion-related methods
- BasLogical: Logic instruction subclass containing all logic control-related methods
- BasStructure: Structure instruction subclass containing all structure control-related methods
- BasSocket: Socket communication subclass containing all Socket communication-related methods
- BasModbus: Modbus communication subclass containing all Modbus communication-related methods
- BasVision: Vision instruction subclass containing all vision-related methods
4.12.1 ExtraParam
| Method Name | ExtraParam() -> ExtraParam |
|---|---|
| Description | Extra parameter class for building complex robot control commands |
| Request Parameters | None |
| Return Value | ExtraParam object |
4.12.1.1 Set Acceleration
| Method Name | extra_param.acceleration( value : float) -> None |
|---|---|
| Description | Set acceleration, range is 1~120% |
| Request Parameters | value : float Acceleration value, unit: % (float) |
| Return Value | None |
4.12.1.2 Set RTCP Parameter
| Method Name | extra_param.rtcp() -> None |
|---|---|
| Description | Set RTCP parameter, only supports MoveL and MoveC instructions |
| Request Parameters | None |
| Return Value | None |
4.12.1.3 Set Frame Offset
| Method Name | extra_param.offset( index : int) -> None |
|---|---|
| Description | Set frame offset |
| Request Parameters | index : int Offset index (integer) |
| Return Value | None |
4.12.1.4 Set Time-Based Operation or Assignment
| Method Name | extra_param.tb( second : int, type : str, name : str = None, index : int = None, status : str = None) -> None |
|---|---|
| Description | Set time-based operation or assignment, range is 0.01-30s, values less than 0.01 will not be saved successfully |
| Request Parameters | second : int Seconds, unit: sec (integer) type : str Execution type (string) name : str Name (for operation, string) index : int Index (for assignment, integer) status : str Status (for assignment, string) |
| Return Value | None |
4.12.1.5 Set Jump
| Method Name | extra_param.skip( index : int) -> None |
|---|---|
| Description | Set jump, when the jump condition set by the SKIP CONDITION instruction is met, jump directly from the current line containing the SKIP instruction to the target instruction line or target program |
| Request Parameters | index : int Index of the target label (integer) |
| Return Value | None |
4.12.1.6 Set Departure Distance and Approaching Distance
| Method Name | extra_param.approach( departure_dist : float, approaching_dist : float) -> None |
|---|---|
| Description | Set departure distance and approaching distance for door-type motion, only used for JUMP instructions |
| Request Parameters | departure_dist : float Departure distance, unit: mm (float) approaching_dist : float Approaching distance, unit: mm (float) |
| Return Value | None |
4.12.2 BasMotion
4.12.2.1 MoveJoint Motion to Point Instruction
| Method Name | motion.move_joint( pose_type : MovePoseType, pose_index : int, speed_type : SpeedType, speed_value : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Joint motion instruction, moves the robot to a specified position in the workspace with the specified movement speed and method |
| Request Parameters | pose_type : MovePoseType Pose type pose_index : int Pose index speed_type : SpeedType Speed type speed_value : float Speed value, unit: % smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.2.2 MoveLine Linear Motion to Point Instruction
| Method Name | motion.move_line( pose_type : MovePoseType, pose_index : int, speed_type : SpeedType, speed_value : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Linear motion instruction, moves the robot in a straight line to a specified position in the workspace with the specified movement speed and method |
| Request Parameters | pose_type : MovePoseType Pose type pose_index : int Pose index speed_type : SpeedType Speed type speed_value : float Speed value, unit: mm/s smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.2.3 MoveCircle Arc Motion to Point Instruction
| Method Name | motion.move_circle( pose_type1 : MovePoseType, pose_index1 : int, pose_type2 : MovePoseType, pose_index2 : int, speed_type : SpeedType, speed_value : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Arc motion instruction, moves the robot in an arc to a specified position in the workspace with the specified movement speed and method |
| Request Parameters | pose_type1 : MovePoseType First pose type pose_index1 : int First pose index pose_type2 : MovePoseType Second pose type pose_index2 : int Second pose index speed_type : SpeedType Speed type speed_value : float Speed value, unit: mm/s smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.2.4 JUMP Quick Motion Instruction
| Method Name | motion.move_jump( pose_type : MovePoseType, pose_index : int, speed_value : float, speed_ratio : float, lim_Z_type : SpeedType, lim_Z_value : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Door-type motion instruction, specifies the robot to perform door-type motion (first vertical ascent, then horizontal movement, finally vertical descent) |
| Request Parameters | pose_type : MovePoseType Target pose storage type pose_index : int Index of the target position speed_value : float Movement speed value, unit: mm/s speed_ratio : float Movement speed ratio, unit: % lim_Z_type : SpeedType Z-axis limit type lim_Z_value : float Z-axis limit value smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.2.5 JUMP3 Quick Motion Instruction
| Method Name | motion.move_jump3( pose_type : MovePoseType, pose_index : List[int], speed_value : float, speed_ratio : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Door-type motion instruction, specifies the robot to perform door-type motion with three positions: departure, approach, and target |
| Request Parameters | pose_type : MovePoseType Target pose storage type pose_index : List[int] List of 3 target position indices (departure, approach, target) speed_value : float Movement speed value, unit: mm/s speed_ratio : float Movement speed ratio, unit: % smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.2.6 JUMP3CP Quick Motion Instruction
| Method Name | motion.move_jump3cp( pose_type : MovePoseType, pose_index : List[int], speed_value : float, smooth_type : SmoothType, smooth_distance : float = 0.0, extra_param : ExtraParam = None) -> StatusCodeEnum |
|---|---|
| Description | Door-type motion instruction, specifies the robot to perform door-type motion with three positions: departure, approach, and target |
| Request Parameters | pose_type : MovePoseType Target pose storage type pose_index : List[int] List of 3 target position indices (departure, approach, target) speed_value : float Movement speed value, unit: mm/s smooth_type : SmoothType Smooth type smooth_distance : float Smooth distance, unit: mm, range: 0~1000 extra_param : ExtraParam Additional parameters |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3 BasLogical
4.12.3.1 LogiIf Conditional Instruction
| Method Name | logical.logi_if( param1 : Union[RegisterType, IOType], index : int, param2 : Union[RegisterType, IOType, OtherType], value : Union[int, float, str, IOStatus], operator : BooleanOperator = BooleanOperator.EQ) -> StatusCodeEnum |
|---|---|
| Description | Conditional judgment instruction, executes different code blocks according to the specified condition |
| Request Parameters | param1 : Union[RegisterType, IOType] First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[RegisterType, IOType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, str, IOStatus] Index or value of parameter 2 operator : BooleanOperator Logical operator |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.2 LogiElseIf Conditional Branch Instruction
| Method Name | logical.logi_else_if( param1 : Union[RegisterType, IOType], index : int, param2 : Union[RegisterType, IOType, OtherType], value : Union[int, float, str, IOStatus], operator : BooleanOperator = BooleanOperator.EQ) -> StatusCodeEnum |
|---|---|
| Description | Conditional branch instruction, judges whether the ElseIf condition is met when the If condition is not met |
| Request Parameters | param1 : Union[RegisterType, IOType] First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[ValueType, IOType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, IOStatus] Index or value of parameter 2 operator : BooleanOperator Logical operator |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.3 LogiElse Else Instruction
| Method Name | logical.logi_else() -> StatusCodeEnum |
|---|---|
| Description | Else instruction, executes when all If and ElseIf conditions are not met |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.4 LogiEndIf End Conditional Instruction
| Method Name | logical.logi_end_if() -> StatusCodeEnum |
|---|---|
| Description | End conditional instruction, used to end the If condition statement block |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.5 LogiWhile Loop Instruction
| Method Name | logical.logi_while( param1 : Union[RegisterType, IOType], index : int, param2 : Union[RegisterType, IOType, OtherType], value : Union[int, float, str, IOStatus], operator : BooleanOperator = BooleanOperator.EQ) -> StatusCodeEnum |
|---|---|
| Description | Loop instruction, repeatedly executes the code in the loop body when the condition is met |
| Request Parameters | param1 : Union[RegisterType, IOType] First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[RegisterType, IOType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, str, IOStatus] Index or value of parameter 2 operator : BooleanOperator Logical operator |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.6 LogiEndWhile End Loop Instruction
| Method Name | logical.logi_end_while() -> StatusCodeEnum |
|---|---|
| Description | End loop instruction, used to end the While loop statement block |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.7 LogiSwitch Multi-branch Selection Instruction
| Method Name | logical.logi_switch( param : Union[RegisterType, IOType], index : int) -> StatusCodeEnum |
|---|---|
| Description | Multi-branch selection instruction, selects different branches to execute according to the value of the expression, supports BREAK statement to exit the branch |
| Request Parameters | param : Union[RegisterType, IOType] Register or IO signal index : int Index number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.8 LogiCase Branch Instruction
| Method Name | logical.logi_case( param : Union[RegisterType, IOType, OtherType], value : Union[int, float, str]) -> StatusCodeEnum |
|---|---|
| Description | Branch instruction, used to define branch conditions in Switch statements |
| Request Parameters | param : Union[RegisterType, IOType, OtherType] Register, IO signal, or other type value : Union[int, float, str] Index number or value |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.9 LogiDefault Default Branch Instruction
| Method Name | logical.logi_default() -> StatusCodeEnum |
|---|---|
| Description | Default branch instruction, executes when all Case conditions are not met |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.10 LogiEndSwitch End Multi-branch Selection Instruction
| Method Name | logical.logi_end_switch() -> StatusCodeEnum |
|---|---|
| Description | End multi-branch selection instruction, used to end the Switch statement block |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.11 LogiGoto Jump Instruction
| Method Name | logical.logi_goto( index : int) -> StatusCodeEnum |
|---|---|
| Description | Jump instruction, used to jump the program to a specified label position within the same program and continue executing from that position; must insert the LABEL instruction first, then use the GOTO instruction |
| Request Parameters | index : int Index of the target label |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.12 LogiLabel Label Instruction
| Method Name | logical.logi_label( index : int) -> StatusCodeEnum |
|---|---|
| Description | Label instruction, used to define jump target positions in the program, GOTO instructions can jump to this label position |
| Request Parameters | index : int Label index |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.13 LogiSkipCondition Skip Condition Instruction
| Method Name | logical.logi_skip_condition( param1 : Union[RegisterType, IOType], index : int, param2 : Union[RegisterType, IOType, OtherType], value : Union[int, float, str, IOStatus], operator : BooleanOperator = BooleanOperator.EQ) -> StatusCodeEnum |
|---|---|
| Description | Skip condition instruction, used to set jump conditions, when the condition is met, jump directly from the current line containing the SKIP instruction to the target instruction line or target program |
| Request Parameters | param1 : Union[RegisterType, IOType] First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[RegisterType, IOType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, str, IOStatus] Index or value of parameter 2 operator : BooleanOperator Logical operator |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.14 LogiBreak Break Loop Instruction
| Method Name | logical.logi_break() -> StatusCodeEnum |
|---|---|
| Description | Break loop instruction, used to exit the current loop or Switch statement |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.3.15 LogiContinue Skip Loop Instruction
| Method Name | logical.logi_continue() -> StatusCodeEnum |
|---|---|
| Description | Skip loop instruction, used to skip the remaining part of the current loop and enter the next loop |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4 BasStructure
4.12.4.1 Wait Wait Condition Instruction
| Method Name | structure.wait( param1 : Union[RegisterType, IOType], index : int, param2 : Union[ValueType, IOType, OtherType], value : Union[int, float, IOStatus], operator : BooleanOperator = BooleanOperator.EQ) -> StatusCodeEnum |
|---|---|
| Description | Wait condition instruction, executes the WAIT instruction only when the condition is met, otherwise waits until the condition is met |
| Request Parameters | param1 : Union[RegisterType, IOType] First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[ValueType, IOType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, IOStatus] Index or value of parameter 2 operator : BooleanOperator Logical operator |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.2 WaitTime Wait Time Instruction
| Method Name | structure.wait_time( param : ValueType, value : Union[int, float]) -> StatusCodeEnum |
|---|---|
| Description | Wait time instruction, executes the WAIT TIME instruction, the robot waits for the specified time before continuing to execute subsequent instructions |
| Request Parameters | param : ValueType Parameter type (R register or value) value : Union[int, float] Time value, unit: sec |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.3 Pause Pause Instruction
| Method Name | structure.pause() -> StatusCodeEnum |
|---|---|
| Description | Pause instruction, when executing to the Pause instruction, pauses the program execution, the robot immediately plans a deceleration trajectory and stops, the program enters the pause state. To continue execution, you need to press the start button again |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.4 Abort Abort Instruction
| Method Name | structure.abort() -> StatusCodeEnum |
|---|---|
| Description | Force end instruction: Ends program execution, the robot servo immediately brakes, the brake is applied, and the servo bus is powered off. After executing the force end instruction, the program enters the terminated state, and the cursor stops at the current line |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.5 Call Synchronous Program Call Instruction
| Method Name | structure.call( name : str) -> StatusCodeEnum |
|---|---|
| Description | Synchronous program call instruction, calls the specified program and waits for its execution to complete before continuing to execute the current program, supports calling preset BAS programs |
| Request Parameters | name : str Program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.6 Run Asynchronous Program Call Instruction
| Method Name | structure.run( name : str) -> StatusCodeEnum |
|---|---|
| Description | Asynchronous program call instruction, calls the specified program and returns immediately, continuing to execute the current program, supports calling preset BAS programs |
| Request Parameters | name : str Program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.7 Load Load Program Instruction
| Method Name | structure.load( name : str) -> StatusCodeEnum |
|---|---|
| Description | Load program instruction, loads the specified program into memory |
| Request Parameters | name : str Program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.8 Unload Unload Program Instruction
| Method Name | structure.unload( name : str) -> StatusCodeEnum |
|---|---|
| Description | Unload program instruction, unloads the specified program from memory |
| Request Parameters | name : str Program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.4.9 Exec Execute Program Instruction
| Method Name | structure.exec( name : str) -> StatusCodeEnum |
|---|---|
| Description | Execute program instruction, executes the specified program |
| Request Parameters | name : str Program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.5 BasSocket
4.12.5.1 SocketOpen Open Socket Connection Instruction
| Method Name | socket.socket_open( index : int) -> StatusCodeEnum |
|---|---|
| Description | Use Socket Open instruction to create a Server and wait for Client connection |
| Request Parameters | index : int SK register sequence number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.5.2 SocketClose Close Socket Connection Instruction
| Method Name | socket.socket_close( index : int) -> StatusCodeEnum |
|---|---|
| Description | Close the specified socket connection |
| Request Parameters | index : int SK register sequence number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.5.3 SocketConnect Connect Socket Instruction
| Method Name | socket.socket_connect( index : int) -> StatusCodeEnum |
|---|---|
| Description | Use Socket Connect instruction to connect to the specified socket server |
| Request Parameters | index : int SK register sequence number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.5.4 SocketSend Send Socket Data Instruction
| Method Name | socket.socket_send( index : int, msg_type : StrType, value : Union[int, str]) -> StatusCodeEnum |
|---|---|
| Description | Use Socket Send instruction to send data to the specified socket connection |
| Request Parameters | index : int SK register sequence number msg_type : StrType Message type value : Union[int, str] Message content or sequence number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.5.5 SocketRecv Receive Socket Data Instruction
| Method Name | socket.socket_recv( index : int, msg_lenth : int, msg_type : StrType, value : Union[int, str]) -> StatusCodeEnum |
|---|---|
| Description | Use Socket Recv instruction to read characters from the specified socket connection, can specify maximum length |
| Request Parameters | index : int SK register sequence number msg_lenth : int Maximum message length msg_type : StrType Message type value : Union[int, str] Message content or sequence number |
| Return Value | StatusCodeEnum: Function execution result |
4.12.6 BasModbus
4.12.6.1 ModbusReadMH Read Modbus Holding Register Instruction
| Method Name | modbus.modbus_read_MH( index : int, id : int, address : int, length : int, r_index : int) -> StatusCodeEnum |
|---|---|
| Description | Read Modbus holding register instruction |
| Request Parameters | index : int Channel sequence number id : int Modbus ID address : int Register starting address length : int Register length, i.e., the number of registers to read r_index : int R register starting sequence number for writing results |
| Return Value | StatusCodeEnum: Function execution result |
4.12.6.2 ModbusReadMI Read Modbus Input Register Instruction
| Method Name | modbus.modbus_read_MI( index : int, id : int, address : int, length : int, r_index : int) -> StatusCodeEnum |
|---|---|
| Description | Read Modbus input register instruction |
| Request Parameters | index : int Channel sequence number id : int Modbus ID address : int Register starting address length : int Register length, i.e., the number of registers to read r_index : int R register starting sequence number for writing results |
| Return Value | StatusCodeEnum: Function execution result |
4.12.6.3 ModbusWriteMH Write Modbus Holding Register Instruction
| Method Name | modbus.modbus_write_MH( index : int, id : int, address : int, length : int, value_type : ValueType, value : int) -> StatusCodeEnum |
|---|---|
| Description | Write Modbus holding register instruction |
| Request Parameters | index : int Channel sequence number id : int Modbus ID address : int Register starting address length : int Register length, i.e., the number of registers to write value_type : ValueType Value type value : int Value or R register starting index |
| Return Value | StatusCodeEnum: Function execution result |
4.12.7 BasVision
4.12.7.1 VisionFind Find Vision Program Instruction
| Method Name | vision.vision_find( name : str) -> StatusCodeEnum |
|---|---|
| Description | Execute vision find program |
| Request Parameters | name : str Vision program name |
| Return Value | StatusCodeEnum: Function execution result |
4.12.7.2 VisionGetOffset Get Vision Program Offset Instruction
| Method Name | vision.vision_get_offset( name : str, index : int, label_index : int) -> StatusCodeEnum |
|---|---|
| Description | Get the offset after executing the vision program |
| Request Parameters | name : str Vision program name index : int Vision register index label_index : int Label index |
| Return Value | StatusCodeEnum: Function execution result |
4.12.7.3 VisionGetQuantity Get Vision Program Result Instruction
| Method Name | vision.vision_get_quantity( name : str, index : int) -> StatusCodeEnum |
|---|---|
| Description | Get the result quantity after executing the vision program |
| Request Parameters | name : str Vision program name index : int R register index for storing results |
| Return Value | StatusCodeEnum: Function execution result |
4.12.8 Direct Methods
4.12.8.1 SetParam Set Parameter Instruction
| Method Name | bas_script.set_param( type : ParamType, value_type : ValueType, value : Union[int, float]) -> StatusCodeEnum |
|---|---|
| Description | Set parameter instruction, used to set various parameters of the robot |
| Request Parameters | type : ParamType Parameter type value_type : ValueType Value type value : Union[int, float] Value |
| Return Value | StatusCodeEnum: Function execution result |
4.12.8.2 AssignValue Assignment Instruction
| Method Name | bas_script.assign_value( param1 : AssignType, index : int, param2 : Union[AssignType, OtherType], value : Union[int, float, str, IOStatus, CurrentPose], opt_index : int = 0, opt_value = 0) -> StatusCodeEnum |
|---|---|
| Description | Assignment instruction, used to assign values to registers, IO signals, etc. |
| Request Parameters | param1 : AssignType First parameter (register or IO signal) index : int Index of parameter 1 param2 : Union[AssignType, OtherType] Second parameter (register, IO signal, or other type) value : Union[int, float, str, IOStatus, CurrentPose] Index or value of parameter 2 opt_index : int Additional index when parameter 1 is PR_ELEMENT opt_value : int Additional index when parameter 2 is PR_ELEMENT or pulse value when value is IOStatus.PULSE |
| Return Value | StatusCodeEnum: Function execution result |