Struct Realman

Source
pub struct Realman { /* private fields */ }
Expand description

睿尔曼机械臂

Implementations§

Source§

impl Realman

Source

pub fn new(ip: impl Into<String>, port: u16) -> Realman

创建新的机械臂实例

  • ip 机械臂的IP地址
  • port 机械臂端口号
Source

pub fn connect(&self) -> Result<Transport>

连接机械臂

Examples found in repository?
examples/nod.rs (line 11)
8fn main() {
9    let realman = Realman::default();
10
11    if let Ok(mut socket) = realman.connect() {
12        socket
13            .movej(ArmType::Gen72([0; 7]), 50, 0, TrajectoryConnect::Now)
14            .ok();
15
16        for _ in 0..3 {
17            socket.set_joint_step(&[6, -15000], 50).ok();
18            socket.set_joint_step(&[6, 15000], 50).ok();
19        }
20    }
21}
More examples
Hide additional examples
examples/lebai-lmg90.rs (line 18)
15fn main() {
16    let realman = Realman::default();
17
18    if let Ok(mut socket) = realman.connect() {
19        // 设置工具端电源输出
20        socket.set_tool_voltage(realman::VoltageType::Three).ok();
21
22        // 配置通讯端口ModbusRTU模式
23        socket
24            .set_modbus_mode(
25                realman::PortType::EndRS485RTUMain,
26                realman::BaudrateType::Baud115200,
27                1,
28            )
29            .ok();
30
31        // 回到零位
32        socket
33            .movej(ArmType::Gen72([0; 7]), 50, 0, TrajectoryConnect::Now)
34            .ok();
35
36        // 张开夹抓
37        socket
38            .write_single_register(realman::ModbusPortType::EndRS485RTUMain, 40000, 100, 1)
39            .ok();
40        // 等1秒钟
41        sleep(Duration::from_secs(1));
42        // 关闭夹抓
43        socket
44            .write_single_register(realman::ModbusPortType::EndRS485RTUMain, 40000, 0, 1)
45            .ok();
46        // 等1秒钟
47        sleep(Duration::from_secs(1));
48    }
49}
examples/udlr.rs (line 12)
9fn main() {
10    let realman = Realman::default();
11
12    if let Ok(mut socket) = realman.connect() {
13        // 进入到开始位置
14        socket
15            .movej(
16                ArmType::Gen72([0, -60000, 0, -60000, 0, 0, 0]),
17                50,
18                0,
19                TrajectoryConnect::Now,
20            )
21            .ok();
22        // 前后
23        socket
24            .set_pos_step(realman::StepType::XStep, 80000, 30)
25            .ok();
26        socket
27            .set_pos_step(realman::StepType::XStep, -80000, 30)
28            .ok();
29        // 左右
30        socket
31            .set_pos_step(realman::StepType::YStep, 50000, 30)
32            .ok();
33        socket
34            .set_pos_step(realman::StepType::YStep, -50000, 30)
35            .ok();
36        // 上下
37        socket
38            .set_pos_step(realman::StepType::ZStep, 30000, 30)
39            .ok();
40        socket
41            .set_pos_step(realman::StepType::ZStep, -30000, 30)
42            .ok();
43
44        // X轴旋转
45        socket
46            .set_ort_step(realman::RStepType::RXStep, -500, 30)
47            .ok();
48        socket
49            .set_ort_step(realman::RStepType::RXStep, 500, 30)
50            .ok();
51        // Y轴旋转
52        socket
53            .set_ort_step(realman::RStepType::RYStep, -500, 30)
54            .ok();
55        socket
56            .set_ort_step(realman::RStepType::RYStep, 500, 30)
57            .ok();
58        // Z轴旋转
59        socket
60            .set_ort_step(realman::RStepType::RZStep, -500, 30)
61            .ok();
62        socket
63            .set_ort_step(realman::RStepType::RZStep, 500, 30)
64            .ok();
65
66        // 回到零位
67        socket
68            .movej(ArmType::Gen72([0; 7]), 50, 0, TrajectoryConnect::Now)
69            .ok();
70    }
71}

Trait Implementations§

Source§

impl Debug for Realman

Source§

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

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

impl Default for Realman

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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.