32 std::string version();
38 using CartesianPose = std::map<std::string, double>;
39 using DoubleVector = std::vector<double>;
99 explicit Robot(std::string ip,
bool simulator =
false);
124 std::tuple<int, std::string>
call(
const std::string &method,
125 const std::string ¶ms);
272 int movej(
const std::vector<double> &joint_positions,
double a,
double v,
296 int movej(
const CartesianPose &cart_pose,
double a,
double v,
double t,
318 int movel(
const std::vector<double> &joint_positions,
double a,
double v,
342 int movel(
const CartesianPose &cart_pose,
double a,
double v,
double t,
368 int movec(
const std::vector<double> &joint_via,
369 const std::vector<double> &joint,
double rad,
double a,
double v,
388 int movec(
const CartesianPose &cart_via,
const CartesianPose &cart,
389 double rad,
double a,
double v,
double t,
double r);
402 int speedj(
double a,
const std::vector<double> &v,
double t = 0.0);
418 int speedl(
double a,
const CartesianPose &v,
double t = 0.0,
419 const CartesianPose &reference = {{
"x", 0.0},
446 int towardj(
const std::vector<double> &joint_positions,
double a,
double v,
456 void move_pvat(std::vector<double> p, std::vector<double> v,
457 std::vector<double> a,
double t);
615 void set_do(std::string device,
unsigned int pin,
unsigned int value);
623 unsigned int get_do(std::string device,
unsigned int pin);
632 std::vector<unsigned int>
get_dos(std::string device,
unsigned int pin,
641 unsigned int get_di(std::string device,
unsigned int pin);
650 std::vector<unsigned int>
get_dis(std::string device,
unsigned int pin,
660 void set_ao(std::string device,
unsigned int pin,
double value);
668 double get_ao(std::string device,
unsigned int pin);
677 std::vector<double>
get_aos(std::string device,
unsigned int pin,
686 double get_ai(std::string device,
unsigned int pin);
695 std::vector<double>
get_ais(std::string device,
unsigned int pin,
756 void set_led(
unsigned int mode,
unsigned int speed,
757 const std::vector<unsigned int> &color);
764 void set_voice(
unsigned int voice,
unsigned int volume);
816 const std::vector<std::string> ¶ms,
817 const std::string &dir,
bool is_parallel,
818 unsigned int loop_to);
836 void pause_task(
unsigned int id,
unsigned long time,
bool wait);
882 const std::vector<double> &joint_positions);
891 const CartesianPose &pose,
892 const std::vector<double> &joint_init_positions = {});
901 CartesianPose
pose_times(
const CartesianPose &a,
const CartesianPose &b);
923 void save_file(
const std::string &dir,
const std::string &name,
bool is_dir,
924 const std::string &data);
933 void rename_file(
const std::string &from_dir,
const std::string &from_name,
934 const std::string &to_dir,
const std::string &to_name);
944 std::tuple<bool, std::string>
load_file(
const std::string &dir,
945 const std::string &name);
957 const std::string &dir,
const std::string &prefix,
958 const std::string &suffix);
1065 CartesianPose
load_tcp(std::string name, std::string dir =
"");
1089 std::vector<bool> values);
1098 std::vector<bool>
read_coils(std::string device, std::string addr,
1118 unsigned int value);
1127 std::vector<unsigned int> values);
机械臂的主要接口对象,通过本对象的方法与机械臂进行数据交互.
Definition: robot.hh:80
std::unique_ptr< RobotImpl > impl_
Definition: robot.hh:1172
virtual ~Robot()
析构Robot对象.
Robot(std::string ip, bool simulator=false)
构造Robot对象.
std::tuple< int, std::string > call(const std::string &method, const std::string ¶ms)
用JSON格式字符串调用机械臂的接口.
bool is_network_connected()
返回是否和机械臂的网络连接正常,如果网络连接异常,调用和机械臂交互的接口会抛出异常std::runtime_error。
ClawData get_claw_data()
获取夹爪当前数据
std::tuple< double, double, bool > get_claw()
获取夹爪当前数据
void set_claw(double force, double amplitude)
设置夹爪力度(力控)和幅度(位控).如果在闭合过程中抓取到物体,则不再继续闭合以避免夹坏物体,判断的准则为这里设置的力的大小.
int get_velocity_factor()
获取当前的速度因子.
void set_payload_cog(std::map< std::string, double > cog)
设置机器人末端负载重心.
std::map< std::string, double > get_payload()
获取末端负载设置.
void set_gravity(std::map< std::string, double > gravity)
设置机器人重力加速度方向.
std::map< std::string, double > get_gravity()
获取机器人重力加速度的方向.
CartesianPose load_tcp(std::string name, std::string dir="")
从资源库加载tcp.
void set_payload(double mass, std::map< std::string, double > cog)
设置机器人末端负载.
void set_tcp(std::array< double, 6 > tcp)
设置工具中心点(TCP)坐标,坐标值相对于工具坐标系.
void set_velocity_factor(int factor)
设置速度因子.
std::array< double, 6 > get_tcp()
获取当前机器人工具中心点设置.
void set_payload_mass(double mass)
设置机器人末端负载质量.
std::vector< std::tuple< bool, std::string > > load_file_list(const std::string &dir, const std::string &prefix, const std::string &suffix)
查询文件列表.
void rename_file(const std::string &from_dir, const std::string &from_name, const std::string &to_dir, const std::string &to_name)
重命名文件
void save_file(const std::string &dir, const std::string &name, bool is_dir, const std::string &data)
保存文件(以字节形式).
std::tuple< bool, std::string > load_file(const std::string &dir, const std::string &name)
查询文件
std::vector< unsigned int > get_dos(std::string device, unsigned int pin, unsigned int num)
获取多个数字输出
void set_do(std::string device, unsigned int pin, unsigned int value)
设置数字输出
std::vector< bool > get_dios_mode(std::string device, unsigned int pin, unsigned int count)
获取数字端口模式
std::vector< unsigned int > get_dis(std::string device, unsigned int pin, unsigned int num)
获取多个数字输入
double get_ai(std::string device, unsigned int pin)
获取模拟输入
unsigned int get_do(std::string device, unsigned int pin)
获取数字输出
std::vector< double > get_ais(std::string device, unsigned int pin, unsigned int num)
获取多个模拟输入
std::vector< double > get_aos(std::string device, unsigned int pin, unsigned int num)
获取多个模拟输出
unsigned int get_di(std::string device, unsigned int pin)
获取数字输入
void set_ao(std::string device, unsigned int pin, double value)
设置模拟输出
double get_ao(std::string device, unsigned int pin)
获取模拟输出
void set_dio_mode(std::string device, unsigned int pin, bool value)
设置数字端口模式
void set_fan(unsigned int status)
开关风扇
void set_voice(unsigned int voice, unsigned int volume)
设置声音
void set_led(unsigned int mode, unsigned int speed, const std::vector< unsigned int > &color)
设置LED灯状态.
void wirte_multiple_coils(std::string device, std::string addr, std::vector< bool > values)
写多个线圈
std::vector< bool > read_coils(std::string device, std::string addr, unsigned int num)
读线圈
std::vector< unsigned int > read_holding_registers(std::string device, std::string addr, unsigned int num)
读保持寄存器
void write_single_coil(std::string device, std::string addr, bool value)
写单个线圈.
void write_multiple_registers(std::string device, std::string addr, std::vector< unsigned int > values)
写多个寄存器
void write_single_register(std::string device, std::string addr, unsigned int value)
写单个寄存器
std::vector< unsigned int > read_input_registers(std::string device, std::string addr, unsigned int num)
读输入寄存器
std::vector< bool > read_discrete_inputs(std::string device, std::string addr, unsigned int num)
读离散输入
std::string get_motion_state(unsigned int id)
查询指定MotionId的运动状态.
int speedl(double a, const CartesianPose &v, double t=0.0, const CartesianPose &reference={{"x", 0.0}, {"y", 0.0}, {"z", 0.0}, {"rx", 0.0}, {"ry", 0.0}, {"rz", 0.0}})
通过坐标速度矢量发送机械臂关节匀速运动
int movej(const std::vector< double > &joint_positions, double a, double v, double t, double r)
通过关节位置发送机械臂关节移动
int towardj(const std::vector< double > &joint_positions, double a, double v, double t, double r)
通过关节位置发送机械臂关节自由移动.
int movel(const CartesianPose &cart_pose, double a, double v, double t, double r)
通过坐标位置发送机械臂直线移动
int movec(const std::vector< double > &joint_via, const std::vector< double > &joint, double rad, double a, double v, double t, double r)
通过关节位置发送机械臂圆弧运动.
void move_pvat(std::vector< double > p, std::vector< double > v, std::vector< double > a, double t)
伺服运动PVAT
int movel(const std::vector< double > &joint_positions, double a, double v, double t, double r)
通过关节位置发送机械臂直线移动
int movec(const CartesianPose &cart_via, const CartesianPose &cart, double rad, double a, double v, double t, double r)
通过坐标位置发送机械臂圆弧运动
void wait_move(unsigned int id)
等待运动完成.
void wait_move()
等待所有运动完成.
int speedj(double a, const std::vector< double > &v, double t=0.0)
通过关节速度矢量发送机械臂关节匀速运动
unsigned int get_running_motion()
查询当前正在运动的MotionId(无运动时返回上次MotionId).
int movej(const CartesianPose &cart_pose, double a, double v, double t, double r)
通过坐标位置发送机械臂关节移动
KinematicsInverseResp kinematics_inverse(const CartesianPose &pose, const std::vector< double > &joint_init_positions={})
根据机械臂的末端位姿计算关节位置(位置的运动学逆解).
CartesianPose pose_times(const CartesianPose &a, const CartesianPose &b)
位姿变换乘法(等价于对应的齐次坐标矩阵乘法)
KinematicsForwardResp kinematics_forward(const std::vector< double > &joint_positions)
根据机械臂关节位置计算机器人末端位姿(位置的运动学正解).
CartesianPose pose_inverse(const CartesianPose &in)
位姿变换的逆(等价于对应的齐次坐标矩的逆)
void cancel_task(unsigned int id)
取消任务与运动.
unsigned int start_task(const std::string &name, const std::vector< std::string > ¶ms, const std::string &dir, bool is_parallel, unsigned int loop_to)
调用场景
unsigned int start_task(const std::string &name)
调用场景
unsigned int exec_hook(unsigned int id)
根据已设置的Hook执行对应场景
std::vector< unsigned int > load_task_list()
查询任务列表
std::string get_task_state(unsigned int id)
获取任务状态.
void pause_task(unsigned int id, unsigned long time, bool wait)
暂停任务与运动
void resume_task(unsigned int id)
恢复任务与运动
std::string get_task_state()
获取任务状态.
void pause_task(unsigned int id)
暂停任务与运动
void set_serial_parity(std::string device, unsigned int parity)
设置串口校验位.
void set_serial_baud_rate(std::string device, unsigned int baud_rate)
设置串口波特率.
int get_signal(unsigned int index)
获取信号量
void add_signal(unsigned int index, int value)
增加指定下标的信号量值,该操作是原子的.
void set_signal(unsigned int index, int value)
设置信号量
void start_sys()
启动机械臂(机械臂上使能).
void end_teach_mode()
退出示教模式.
void powerdown()
关闭机器人电源(关机).
void stop_sys()
停止机械臂(机械臂下使能).
std::vector< double > get_actual_joint_torques()
获取机械臂关节当前反馈力矩
std::vector< double > get_actual_joint_speed()
获取机械臂关节当前反馈速度
std::vector< double > get_target_joint_positions()
获取机械臂关节当前控制位置
int get_estop_reason()
查看急停原因
bool is_disconnected()
是否已与手臂断开连接
CartesianPose get_target_tcp_pose()
获取机械臂末端在机械臂基坐标系下的控制位姿,CartesianPose = std::map<std::string,double>,应当包括键为x,y,z,rz,...
std::vector< double > get_actual_joint_positions()
获取机械臂关节当前反馈位置
std::vector< double > get_target_joint_torques()
获取机械臂关节当前控制力矩
double get_joint_temp(unsigned int joint_index)
获取单个关节温度
CartesianPose get_actual_tcp_pose()
获取机械臂末端在机械臂基坐标系下的实际位姿,CartesianPose = std::map<std::string,double>,应当包括键为x,y,z,rz,...
std::vector< double > get_target_joint_speed()
获取机械臂关节当前控制力矩
int get_robot_mode()
获取机器人状态码
Definition: discovery.hh:23
double amplitude
Definition: robot.hh:68
bool hold_on
Definition: robot.hh:69
double force
Definition: robot.hh:67
运动学正解的返回值数据结构.
Definition: robot.hh:44
bool ok
Definition: robot.hh:49
CartesianPose pose
Definition: robot.hh:46
运动学逆解的返回值数据结构
Definition: robot.hh:55
bool ok
Definition: robot.hh:60
DoubleVector joint_positions
Definition: robot.hh:57