Struct GripperCommand

Source
pub struct GripperCommand {
    pub act: bool,
    pub gto: bool,
    pub atr: bool,
    pub ard: bool,
    pub pos_req: u8,
    pub speed: u8,
    pub force: u8,
}
Expand description

Robot Output/ Functionalities

Write to registers starting at 1000, 6 byte of data. specified the command parameter e.g. request position, speed, force …

§Reset

To reset the gripper send a command with act = false.

§Activating the gripper

To activate the gripper, send a command with act = true.

act need to remain true in all following command, otherwise the gripper will reset.

Fields§

§act: bool

First action to be made prior to any other actions, rACT bit will activate the gripper. Clear the rACT bit to reset the gripper and clear any fault status

§Warning

when setting act = true(rACT == 1), the gripper will begin movement to complete its activation feature.

§Info

Power loss will set rACT == 1; the rACT bit must be clear act = false(rACT = 0), then set again to allow operation of the gripper

§Caution

The rACT bit must stay on (act = true) afterward for any other action to be performed.

§gto: bool

The “Go To” action moves the gripper fingers to the requested position using the configuration defined by the other register, gto(rGTO) will engage motion while byte 3,4,5 will determine aimed position, force, and speed. The only motions performed without gto(rGTO) bit are activation and automation release routines.

§atr: bool

Automatic Release routine action slowly opens the gripper fingers until all motion axes reach their mechanical limits After all motion are completed, the gripper sends a fault signal and needed to be reinitalized before any other motion is performed. The atr(rATR) bit overrides all other commands excluding the activation bit act(rACT).

§ard: bool

Auto-release direction. When auto-releasing, ard(rARD) commands the direction of the movement. The ard(rARD) bit should be set prior to or at the same time as the atr(rATR) bit. as the motion direction is set when the auto-release is initated.

§pos_req: u8

This register is used to set the target position for the gripper’s fingers. The position 0x00 and 0xFF correspond respectively to the fully opened and fully closed mechanical stops. For detail finger trajectory, please refer to the Specifications section of repective manual.

  • 0x00 - Open position
  • 0xFF - Close position

§Info

The activation will allow the gripper to adjust to any fingertips. No matter what is the size and/or shape of the fingertips, 0 will always be fully opened and 255 fully closed, with a quasi-linear relationship between the two values.

§speed: u8

This register is used to set the gripper closing and opening speed in real time, however, setting a speed will not initiate a motion.

  • 0x00 - Minimum speed
  • 0xFF - Maximum speed
§force: u8

The force setting defines the final gripper force for the gripper. The force will fix the maximum current sent to the motor. If the current limit is exceeded, the fingers stop and trigger an object detection notification. Please refer to the “Picking Features” section of respective manual.

  • 0x00- Minimum force
  • 0xFF- Maximum force

Implementations§

Source§

impl GripperCommand

Source

pub fn new() -> Self

Create a new default gripper command.

Examples found in repository?
examples/001_basic.rs (line 59)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn act(self, b: bool) -> Self

First action to be made prior to any other actions, rACT bit will activate the gripper. Clear the rACT bit to reset the gripper and clear any fault status

§Warning

when setting act = true(rACT == 1), the gripper will begin movement to complete its activation feature.

§Info

Power loss will set rACT == 1; the rACT bit must be clear act = false(rACT = 0), then set again to allow operation of the gripper

§Caution

The rACT bit must stay on (act = true) afterward for any other action to be performed.

Examples found in repository?
examples/001_basic.rs (line 61)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn gto(self, b: bool) -> Self

The “Go To” action moves the gripper fingers to the requested position using the configuration defined by the other register, gto(rGTO) will engage motion while byte 3,4,5 will determine aimed position, force, and speed. The only motions performed without gto(rGTO) bit are activation and automation release routines.

Examples found in repository?
examples/001_basic.rs (line 65)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn atr(self, b: bool) -> Self

Automatic Release routine action slowly opens the gripper fingers until all motion axes reach their mechanical limits After all motion are completed, the gripper sends a fault signal and needed to be reinitalized before any other motion is performed. The atr(rATR) bit overrides all other commands excluding the activation bit act(rACT).

Examples found in repository?
examples/001_basic.rs (line 76)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn ard(self, b: bool) -> Self

Auto-release direction.

When auto-releasing, ard(rARD) commands the direction of the movement. The ard(rARD) bit should be set prior to or at the same time as the atr(rATR) bit. as the motion direction is set when the auto-release is initated.

Examples found in repository?
examples/001_basic.rs (line 76)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn pos_req(self, b: u8) -> Self

This register is used to set the target position for the gripper’s fingers. The position 0x00 and 0xFF correspond respectively to the fully opened and fully closed mechanical stops. For detail finger trajectory, please refer to the Specifications section of repective manual.

  • 0x00 - Open position
  • 0xFF - Close position
§Info

The activation will allow the gripper to adjust to any fingertips. No matter what is the size and/or shape of the fingertips, 0 will always be fully opened and 255 fully closed, with a quasi-linear relationship between the two values.

Examples found in repository?
examples/001_basic.rs (line 66)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn speed(self, b: u8) -> Self

This register is used to set the gripper closing and opening speed in real time, however, setting a speed will not initiate a motion.

  • 0x00 - Minimum speed
  • 0xFF - Maximum speed
Examples found in repository?
examples/001_basic.rs (line 67)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn force(self, b: u8) -> Self

The force setting defines the final gripper force for the gripper. The force will fix the maximum current sent to the motor. If the current limit is exceeded, the fingers stop and trigger an object detection notification. Please refer to the “Picking Features” section of respective manual.

  • 0x00- Minimum force
  • 0xFF- Maximum force
Examples found in repository?
examples/001_basic.rs (line 68)
4async fn main() -> Result<(), RobotiqError> {
5    // The serial port path
6    let path = "COM17";
7
8    // create a connection to serial RS485 modbus
9    let mut gripper = RobotiqGripper::from_path(path)?;
10
11    // Reset and Activation of Gripper
12    //
13    // reset gripper, recommended
14    gripper.reset().await?;
15    // activate the gripper, it will try to open and close.
16    gripper.activate().await?.await_activate().await?;
17    println!("finished activation.");
18    std::thread::sleep(std::time::Duration::from_millis(1000));
19
20    // Basic Gripper Command
21    //
22    // set gripper with position, speed and force
23    gripper.go_to(0x08, 0x00, 0x00).await?;
24    // the result of the setting command, return whether or not it have clamp an object
25    let obj_detect_status = gripper.await_go_to().await?;
26    println!("Object Detect Status : {:?}", obj_detect_status);
27    std::thread::sleep(std::time::Duration::from_millis(1000));
28
29    // Chained command
30    //
31    // chained command with builder pattern
32    let obj_detect_status = gripper.go_to(0xFF, 0xFF, 0xFF).await?.await_go_to().await?;
33    println!("Object Detect Status : {:?}", obj_detect_status);
34    std::thread::sleep(std::time::Duration::from_millis(1000));
35
36    // Automatic Release Routine
37    //
38    // set the gripper into motion
39    gripper.go_to(0x08, 0x00, 0x00).await?;
40    std::thread::sleep(std::time::Duration::from_millis(100));
41    gripper.automatic_release(false).await?;
42    // you will need to reset and reactivate the gripper after automatic release routine
43    gripper
44        .reset()
45        .await?
46        .activate()
47        .await?
48        .await_activate()
49        .await?;
50    std::thread::sleep(std::time::Duration::from_millis(1000));
51    gripper.go_to(0x08, 0x00, 0x00).await?;
52    std::thread::sleep(std::time::Duration::from_millis(1000));
53
54    // Gripper Command
55    //
56    // Construct GripperCommand to command gripper
57    //
58    // a null command, all zero, will deactivate and reset the gripper
59    let cmd_null = GripperCommand::new();
60    // command to activate the gripper
61    let cmd_act = GripperCommand::new().act(true);
62    // commands to set the gripper with position requested, speed, and force
63    let cmd_goto_1 = GripperCommand::new()
64        .act(true)
65        .gto(true)
66        .pos_req(0x08)
67        .speed(0x00)
68        .force(0x00);
69    let cmd_goto_2 = GripperCommand::new()
70        .act(true)
71        .gto(true)
72        .pos_req(0xFF)
73        .speed(0xFF)
74        .force(0xFF);
75    // command to perform automatic release routine
76    let cmd_atr = GripperCommand::new().act(true).atr(true).ard(true);
77
78    //
79    //
80    gripper.write_async(cmd_null).await?;
81    gripper.write_async(cmd_act).await?;
82    while gripper.read_async().await?.sta != ActivationStatus::Completed {
83        std::thread::sleep(std::time::Duration::from_millis(100));
84    }
85    std::thread::sleep(std::time::Duration::from_millis(1000));
86
87    //
88    //
89    gripper.write_async(cmd_goto_1).await?;
90    while gripper.read_async().await?.obj == ObjDetectStatus::InMotion {
91        std::thread::sleep(std::time::Duration::from_millis(100));
92    }
93    std::thread::sleep(std::time::Duration::from_millis(1000));
94
95    //
96    //
97    gripper.write_async(cmd_goto_2).await?;
98    std::thread::sleep(std::time::Duration::from_millis(100));
99    gripper.write_async(cmd_atr).await?;
100    while gripper.read_async().await?.fault != GripperFault::AutomaticReleaseCompleted {
101        std::thread::sleep(std::time::Duration::from_millis(100));
102    }
103    std::thread::sleep(std::time::Duration::from_millis(1000));
104
105    gripper
106        .reset()
107        .await?
108        .activate()
109        .await?
110        .await_activate()
111        .await?
112        .go_to(0x00, 0xFF, 0xFF)
113        .await?
114        .await_go_to()
115        .await?;
116
117    Ok(())
118}
Source

pub fn to_array(&self) -> [u16; 3]

make array for writing to register.

Trait Implementations§

Source§

impl Clone for GripperCommand

Source§

fn clone(&self) -> GripperCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GripperCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GripperCommand

Source§

fn default() -> GripperCommand

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GripperCommand

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for GripperCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,