update AuboRobot

This commit is contained in:
linbo 2025-11-17 13:48:22 +08:00
parent 68756bd57a
commit 95081c5155
173 changed files with 82945 additions and 343 deletions

View File

@ -49,7 +49,7 @@ protobuf_generate(
PROTOC_OUT_DIR ${PROTO_BINARY_DIR}
)
target_include_directories(proto-objects PUBLIC ${PROTO_BINARY_DIR} ${PROTO_IMPORT_DIR})
target_link_libraries(proto-objects PUBLIC protobuf::libprotobuf gRPC::grpc++)
target_link_libraries(proto-objects PUBLIC protobuf::libprotobuf gRPC::grpc++ gRPC::grpc++_reflection)
############################################################
# include

View File

@ -144,4 +144,9 @@ sudo dkpg -i Mech-Eye_API_2.5.1_amd64.deb
sudo systemctl stop brltty
sudo systemctl disable brltty
sudo apt remove brltty
```
```
### 开放端口
```shell
sudo iptables -A INPUT -p tcp --dport 50052 -j ACCEPT
```

View File

@ -32,44 +32,44 @@
<!-- <LeftArm id="left_arm" devtype="ti5Robot" />-->
<!-- <RightArm />-->
<!-- <Neck/>-->
<!-- <Humanoid id="hc01" dof="14"-->
<!-- urdf="/home/lgv/cmvr/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"-->
<!-- baseLink="PELVIS_S"-->
<!-- jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"-->
<!-- linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM"-->
<!-- bufferSize="50"-->
<!-- verbose="false">-->
<!-- <CanManger id="" devId="">-->
<!-- <LeftArmCan id = " " devId = " " channelId ="0" enable="true" toolFrame="L_FINGER_TIP">-->
<!-- <Motor id="23" jointName="L_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="24" jointName="L_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="25" jointName="L_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="26" jointName="L_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="27" jointName="L_WRIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="28" jointName="L_WRIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="1" jointName="L_WRIST_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- </LeftArmCan>-->
<!-- <RightArmCan id = " " devId = " " channelId ="1" enable="true" toolFrame="R_FINGER_TIP">-->
<!-- <Motor id="16" jointName="R_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="17" jointName="R_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="18" jointName="R_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="19" jointName="R_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="20" jointName="R_WRIST_P" limitQLb="-3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="21" jointName="R_WRIST_Y" limitQLb="-1.102" limitQUb="1.02" limitQd="3.0"/>-->
<!-- <Motor id="22" jointName="R_WRIST_R" limitQLb="-0.293" limitQUb="1.57079" limitQd="3.0"/>-->
<!-- </RightArmCan>-->
<!-- <HeadCan id = " " devId = " " channelId ="2" enable="false">-->
<!-- <Motor id="32" jointName="HEAD_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="30" jointName="HEAD_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="31" jointName="HEAD_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- </HeadCan>-->
<!-- <WaistCan id = " " devId = " " channelId ="3" enable="false">-->
<!-- <Motor id="14" jointName="WAIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- <Motor id="15" jointName="WAIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
<!-- </WaistCan>-->
<!-- </CanManger>-->
<Humanoid id="hc01" dof="14"
urdf="/home/lgv/cmvr/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"
baseLink="PELVIS_S"
jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"
linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM"
bufferSize="50"
verbose="false">
<CanManger id="" devId="">
<LeftArmCan id = " " devId = " " channelId ="0" enable="true" toolFrame="L_FINGER_TIP">
<Motor id="23" jointName="L_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="24" jointName="L_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="25" jointName="L_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="26" jointName="L_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="27" jointName="L_WRIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="28" jointName="L_WRIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="1" jointName="L_WRIST_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
</LeftArmCan>
<RightArmCan id = " " devId = " " channelId ="1" enable="true" toolFrame="R_FINGER_TIP">
<Motor id="16" jointName="R_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="17" jointName="R_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="18" jointName="R_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="19" jointName="R_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="20" jointName="R_WRIST_P" limitQLb="-3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="21" jointName="R_WRIST_Y" limitQLb="-1.102" limitQUb="1.02" limitQd="3.0"/>
<Motor id="22" jointName="R_WRIST_R" limitQLb="-0.293" limitQUb="1.57079" limitQd="3.0"/>
</RightArmCan>
<HeadCan id = " " devId = " " channelId ="2" enable="false">
<Motor id="32" jointName="HEAD_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="30" jointName="HEAD_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="31" jointName="HEAD_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
</HeadCan>
<WaistCan id = " " devId = " " channelId ="3" enable="false">
<Motor id="14" jointName="WAIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="15" jointName="WAIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
</WaistCan>
</CanManger>
<!-- </Humanoid>-->
</Humanoid>
</Robot>
<BioHead>

View File

@ -53,35 +53,41 @@
<Devices>
<AGV>
</AGV>
<Battery>
</Battery>
<Camera>
<UVCCamera id="cam1" serial="/dev/video6" w="640" h="480" fps="30" mode="video" codec="H265"/>
<UVCCamera id="cam2" serial="/dev/video14" w="640" h="480" fps="30" mode="video" codec="H265"/>
<RealsenseCamera id="left_hand_cam" serial="243122072252" w="640" h="480" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>
<RealsenseCamera id="right_hand_cam4" serial="243122075614" w="1280" h="720" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>
<!-- <UVCCamera id="cam1" serial="/dev/video6" w="640" h="480" fps="30" mode="video" codec="H265"/>-->
<!-- <UVCCamera id="cam2" serial="/dev/video14" w="640" h="480" fps="30" mode="video" codec="H265"/>-->
<!-- <RealsenseCamera id="left_hand_cam" serial="243122072252" w="640" h="480" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>-->
<!-- <RealsenseCamera id="right_hand_cam" serial="243122075614" w="1280" h="720" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>-->
</Camera>
<DexHand>
<RH56DFTP id="left_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>
<RH56DFTP id="right_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>
<!-- <RH56DFTP id="left_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>-->
<!-- <RH56DFTP id="right_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>-->
</DexHand>
<Robot id="" urdfPath="">
<ControllerManager>
<ComponentGroup id="leftArm" CanGroupID="LeftArmCAN">
<JointPositionCtrl defaultSpeed="" defaultAcc=""/>
<CartesianController baseLine="" eeLink="" defaultSpeed="" defaultAcc=""/>
</ComponentGroup>
<ComponentGroup id="rightArm" CanGroupID="RightArmCAN">
<JointPositionCtrl/>
</ComponentGroup>
<ComponentGroup id="WholeBody" CanGroupID="LeftArmCAN,RightArmCAN,NeckCAN,WaistCAN">
<JointPositionCtrl/>
</ComponentGroup>
</ControllerManager>
<Robot >
<HumanoidRobot id="hc01" urdfPath="/home/lgv/cmvr/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"
jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"
linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM">
<ControllerManager>
<ComponentGroup id="leftArm" CanGroupID="LeftArmCAN">
<JointPositionCtrl defaultSpeed="" defaultAcc=""/>
<CartesianController baseLine="" eeLink="" defaultSpeed="" defaultAcc=""/>
</ComponentGroup>
<ComponentGroup id="rightArm" CanGroupID="RightArmCAN">
<JointPositionCtrl/>
</ComponentGroup>
<ComponentGroup id="WholeBody" CanGroupID="LeftArmCAN,RightArmCAN,NeckCAN,WaistCAN">
<JointPositionCtrl/>
</ComponentGroup>
</ControllerManager>
</HumanoidRobot>
<AuboRobot id="hc02" ip="127.0.0.1" usrname="aubo" password="123456">
</AuboRobot>
</Robot>
<BioHead>
@ -90,11 +96,11 @@
<Microphone>
<!-- <ffmpegMicPhone id="mic1" alsa="hw:0" channels="2" sampleRate="44100" volume="80"/>-->
<ffmpegMicPhone id="mic2" alsa="hw:1" channels="1" sampleRate="44100" volume="80"/>
<!-- <ffmpegMicPhone id="mic2" alsa="hw:1" channels="1" sampleRate="44100" volume="80"/>-->
</Microphone>
<Speaker>
<ffmpegSpeaker id="spk1" alas="hw:0,0" channels="2" sampleRate="44100" softResample="1" latency="50000" volume="80"/>
<!-- <ffmpegSpeaker id="spk1" alas="hw:0,0" channels="2" sampleRate="44100" softResample="1" latency="50000" volume="80"/>-->
</Speaker>
</Devices>

140
config/dev_config_v2.xml Normal file
View File

@ -0,0 +1,140 @@
<CMVR-ES>
<Constants rootDir="/home/xtkuang/projects/cmvr-es"/>
<Logger dir="../log" level="info" bufSize="5" logSize="1024"/>
<HardwareManager>
<CanManager>
<CanGroup id="LeftArmCAN" channelId="0" enable="true">
<MotorProtocolManager>
<Ti5MotorProtocol/>
</MotorProtocolManager>
</CanGroup>
<CanGroup id="RightArmCAN" channelId="1" enable="true">
<MotorProtocolManager>
<Ti5MotorProtocol/>
</MotorProtocolManager>
</CanGroup>
<CanGroup id="NeckCAN" channelId ="2" enable="true">
<MotorProtocolManager>
<Ti5MotorProtocol/>
</MotorProtocolManager>
</CanGroup>
<CanGroup id = "WaistCAN" channelId ="3" enable="false">
<MotorProtocolManager>
<Ti5MotorProtocol/>
</MotorProtocolManager>
</CanGroup>
</CanManager>
<SerialManager>
<RS485Manager>
</RS485Manager>
<IOManager>
</IOManager>
</SerialManager>
</HardwareManager>
<DeviceManager>
<Devices>
<AGV>
</AGV>
<Battery>
</Battery>
<Camera>
<!-- <UVCCamera id="cam1" serial="/dev/video6" w="640" h="480" fps="30" mode="video" codec="H265"/>-->
<!-- <UVCCamera id="cam2" serial="/dev/video14" w="640" h="480" fps="30" mode="video" codec="H265"/>-->
<!-- <RealsenseCamera id="left_hand_cam" serial="243122072252" w="640" h="480" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>-->
<!-- <RealsenseCamera id="right_hand_cam" serial="243122075614" w="1280" h="720" fps="30" mode="video" stream_mode="rgbd" align_mode="color" codec="H265"/>-->
</Camera>
<DexHand>
<!-- <RH56DFTP id="left_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>-->
<!-- <RH56DFTP id="right_hand" default_force="500" default_speed="500" ip_address="192.168.1.223" port="6000"/>-->
</DexHand>
<Robot >
<HumanoidRobot id="hc01" urdfPath="/home/lgv/cmvr/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"
jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"
linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM"
baseLink="PELVIS_S">
<MotorManager>
<Motor id="23" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="24" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="25" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="26" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="27" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_WRIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="28" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_WRIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
<Motor id="1" canGroupId="LeftArmCAN" protocolType="Ti5MotorProtocol" jointName="L_WRIST_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
</MotorManager>
<ControllerManager>
<ComponentGroup id="leftArm" CanGroupID="LeftArmCAN">
<JointPositionCtrl defaultSpeed="" defaultAcc=""/>
<CartesianController baseLine="" eeLink="" defaultSpeed="" defaultAcc=""/>
</ComponentGroup>
<ComponentGroup id="rightArm" CanGroupID="RightArmCAN">
<JointPositionCtrl/>
</ComponentGroup>
<ComponentGroup id="WholeBody" CanGroupID="LeftArmCAN,RightArmCAN,NeckCAN,WaistCAN">
<JointPositionCtrl/>
</ComponentGroup>
</ControllerManager>
</HumanoidRobot>
<!-- <AuboRobot id="hc02" ip="127.0.0.1" usrname="aubo" password="123456">-->
<!-- </AuboRobot>-->
</Robot>
<BioHead>
</BioHead >
<Microphone>
<!-- <ffmpegMicPhone id="mic1" alsa="hw:0" channels="2" sampleRate="44100" volume="80"/>-->
<!-- <ffmpegMicPhone id="mic2" alsa="hw:1" channels="1" sampleRate="44100" volume="80"/>-->
</Microphone>
<Speaker>
<!-- <ffmpegSpeaker id="spk1" alas="hw:0,0" channels="2" sampleRate="44100" softResample="1" latency="50000" volume="80"/>-->
</Speaker>
</Devices>
<HighLevelController>
<BioHeadExpre headId="bio_head" />
<CartesianWBC urdf="" />
<ScreenTouch robotID="" DexhandID="" />
</HighLevelController>
</DeviceManager>
<MonitorManager>
<DiskMonitor id="file_monitor" freq="1">
<!-- <Folder fileDir="/home/share/assets/audio" maxVolume="1000"/>-->
<!-- <Folder fileDir="/home/share/assets/image" maxVolume="1000"/>-->
<!-- <Folder fileDir="/home/share/assets/video" maxVolume="1000"/>-->
<!-- <Folder fileDir="../log" maxVolume="1000"/>-->
</DiskMonitor>
<JointMonitor id="robot_joint_monitor" freq="200">
<RobotJoint robotID="left_arm" motorID="0" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="1" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="2" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="3" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="4" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="6" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="left_arm" motorID="7" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="0" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="1" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="2" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="3" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="4" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="6" maxTemp="80" maxCurrent="5" maxVel="2"/>
<RobotJoint robotID="right_arm" motorID="7" maxTemp="80" maxCurrent="5" maxVel="2"/>
</JointMonitor>
</MonitorManager>
<Server>
<gRPCServer port="50053"/>
</Server>
</CMVR-ES>

View File

@ -9,7 +9,7 @@
#include "abstract_device.h"
#include "utils/dynamics/joint.h"
#include "motor/motor_protocol_interface.h"
#include "hardware/can/motor_protocol/abstractmotorprotocol.h"
#include <mutex>
namespace cmvr::device{
@ -27,6 +27,8 @@ namespace cmvr::device{
std::string joint_name;
float limitQ;
float limitQd;
std::string protocol_type;
std::string canGroupId;
};
typedef struct {
@ -155,7 +157,7 @@ namespace cmvr::device{
// 使用的通讯协议
virtual void setProtocol(std::shared_ptr<MotorProtocolInterface> protocol) {
virtual void setProtocol(std::shared_ptr<hardware::AbstractMotorProtocol> protocol) {
std::scoped_lock lock(mtx_);
protocol_ = std::move(protocol);
protocol_->initNode(node_id_);
@ -172,7 +174,7 @@ namespace cmvr::device{
MotorInfo info_{};
uint8_t node_id_;
// 使用的通讯协议
std::shared_ptr<MotorProtocolInterface> protocol_;
std::shared_ptr<hardware::AbstractMotorProtocol> protocol_;
};
}
#endif //CMVR_ES_ABSTRACT_MOTOR_H

View File

@ -11,7 +11,7 @@
#include "utils/solver/qp_solver.h"
#include "cmvr/msgs/geometry.pb.h"
#include "cmvr/msgs/motor.pb.h"
#include "robot/controller/controller_manager.h"
#include "controller/controller_manager.h"
namespace cmvr::device{

View File

@ -15,7 +15,7 @@ target_link_libraries(device_manager PRIVATE
cmvr_es::device::rh56dftp_dexhand
cmvr::device::head_esp32
cmvr_es::device::humanoid_robot
# cmvr_es::device::ti5robot
cmvr_es::device::aubo_robot
)
add_library(cmvr_es::device_manager ALIAS device_manager)

View File

@ -11,7 +11,7 @@
#include "camera/realsense_camera/realsense_camera.h"
#include "dexhand/rh56dftp_dexhand/rh56dftp_dexhand.h"
#include "robot/humanoid_robot/humanoid_robot.h"
//#include "robot/ti5_robot/ti5_robot.h"
#include "robot/aubo_robot/aubo_robot.h"
using namespace std;
using namespace cmvr::device;
@ -119,9 +119,12 @@ std::shared_ptr<AbstractMicrophone> DeviceFactory::create_mic_(const XmlNode& cf
std::shared_ptr<AbstractRobot> DeviceFactory::create_robot_(const XmlNode& cfg) {
try {
if (cfg.getNodeName() == "Humanoid") {
if (cfg.getNodeName() == "HumanoidRobot") {
return std::make_shared<HumanoidRobot<14>>(cfg);
}
else if (cfg.getNodeName() == "AuboRobot") {
return std::make_shared<AuboRobot<6>>(cfg);
}
else {
LOG(ERROR) << "[DeviceFactory]: Unsupported device type " << cfg.getNodeName();
return nullptr;

View File

@ -6,3 +6,5 @@ add_subdirectory(biohead)
add_subdirectory(robot)
add_subdirectory(canbus)
add_subdirectory(motor)
add_subdirectory(controller)
add_subdirectory(solver)

View File

@ -7,6 +7,7 @@
* @file
* @brief nmt
*/
#pragma once
#include "canbus/can_comm/protocol_data.h"
#include "cmvr/msgs/robot_detail.pb.h"

View File

@ -1,6 +1,7 @@
//
// Created by lgv on 2025/7/31.
//
#pragma once
#include "canbus/can_comm/protocol_data.h"
#include "cmvr/msgs/robot_detail.pb.h"

View File

@ -5,6 +5,6 @@ add_library(controller_manager SHARED
controller_manager.cpp
)
target_include_directories(controller_manager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(controller_manager PUBLIC .)
target_link_libraries(controller_manager PRIVATE jsoncpp_lib)
add_library(cmvr_es::device::controller_manager ALIAS controller_manager)

View File

@ -1,11 +1,12 @@
//
// Created by lgv on 2025/8/1.
//
#pragma once
#include "devices/abstract_motor.h"
#include "motor/motor_protocol_interface.h"
#include "motor/ti5_motor/canopen/ti5_motor_canopen_protocol.h"
#include "hardware/can/motor_protocol/motorprotocolmanager.h"
#include "hardware/can/motor_protocol/ti5motorprotocol.h"
#include "hardware_manager/hardware_manager.h"
/**
* class: Ti5Motor protocol
*/
@ -14,12 +15,14 @@ namespace cmvr {
class Ti5Motor : public AbstractMotor {
public:
Ti5Motor(const XmlNode &config,uint8_t node_id):AbstractMotor(config,node_id){}
Ti5Motor(const XmlNode &config):AbstractMotor(config) {
explicit Ti5Motor(const XmlNode &config):AbstractMotor(config) {
info_.id = config.getAttrDefault("id", -1);
info_.joint_name = config.getAttrString("jointName");
info_.limitQ = config.getAttrDefault("limitQ", 3.14f);
info_.limitQd = config.getAttrDefault("limitQd", 0.5f);
node_id_ = info_.id;
info_.protocol_type = config.getAttrString("protocolType");
info_.canGroupId = config.getAttrString("canGroupId");
}
/**
@ -27,10 +30,11 @@ namespace cmvr {
*/
void init() override {
if (!protocol_) {
throw std::runtime_error("Protocol not set for motor");
const auto canGroup = hardware::HardWareManager::getInstance().getCanGroup(info_.canGroupId);
protocol_ = canGroup->getMotorProtocol(info_.protocol_type);
}
if (protocol_->comm_proto == MotorProtocolInterface::CommProto::CANOPEN ) {
auto canopen_protocol = std::dynamic_pointer_cast<Ti5MotorCanopenProtocol>(protocol_);
if (protocol_->comm_proto == hardware::AbstractMotorProtocol::CommProto::CANOPEN ) {
auto canopen_protocol = std::dynamic_pointer_cast<cmvr::hardware::Ti5MotorProtocol>(protocol_);
canopen_protocol->configPdo(node_id_);
canopen_protocol->configProfile(node_id_,2000,2000,2000);
canopen_protocol->seedNmtRequest(node_id_,msgs::NMT_ENTER_PRE_OPERATIONAL);

View File

@ -1,2 +1,2 @@
add_subdirectory(humanoid_robot)
add_subdirectory(controller)
add_subdirectory(aubo_robot)

View File

@ -0,0 +1,34 @@
# Aubo SDK add_library
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(AUBO_SDK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/AuboSdk/linux/include)
set(AUBO_SDK_LIB_DIR ${CMAKE_SOURCE_DIR}/third_party/AuboSdk/linux/lib)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(AUBO_SDK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/AuboSdk/win/include)
set(AUBO_SDK_LIB_DIR ${CMAKE_SOURCE_DIR}/third_party/AuboSdk/win/lib)
endif()
# aubo_robot SDK
add_library(aubo_robot SHARED aubo_robot.cpp)
# aubo_robot ${CMAKE_CURRENT_SOURCE_DIR} SDK include
target_include_directories(aubo_robot
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR} #
${AUBO_SDK_INCLUDE_DIR} # SDK
)
# aubo_robot link_directories
target_link_directories(aubo_robot
PRIVATE
${AUBO_SDK_LIB_DIR} # SDK
)
# SDK
target_link_libraries(aubo_robot
PRIVATE
aubo_sdk
robot_proxy
)
#
add_library(cmvr_es::device::aubo_robot ALIAS aubo_robot)

View File

@ -0,0 +1,269 @@
//
// Created by linbo on 2025/11/7.
//
#include "aubo_robot.h"
using namespace std;
using namespace cmvr::device;
template<int DOF>
AuboRobot<DOF>::AuboRobot(const XmlNode &cfg) : AbstractRobot(cfg)
{
try {
id_ = cfg.getAttrString("id");
ip_ = cfg.getAttrString("ip");
port_ = cfg.getAttrString("port");
} catch (std::exception &e) {
throw runtime_error(e.what());
}
}
template<int DOF>
AuboRobot<DOF>::~AuboRobot()
{
if (rpc_cli_)
{
// 接口调用: 退出登录
rpc_cli_->logout();
// 接口调用: 断开连接
rpc_cli_->disconnect();
}
}
template<int DOF>
void AuboRobot<DOF>::init ()
{
//初始化AuboSDK
rpc_cli_ = std::make_shared<RpcClient>();
// 接口调用: 设置 RPC 超时
rpc_cli_->setRequestTimeout(1000);
// 接口调用: 连接到 RPC 服务
rpc_cli_->connect(ip_, 30004);
// 接口调用: 登录
rpc_cli_->login("aubo", "123456");
}
template<int DOF>
void AuboRobot<DOF>::waitForRobotMode(const RobotInterfacePtr& robot_interface,
const RobotModeType target_mode)
{
// 接口调用: 获取当前机械臂的模式
auto current_mode = robot_interface->getRobotState()->getRobotModeType();
while (current_mode != target_mode) {
std::cout << "机械臂当前模式:" << current_mode << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
current_mode = robot_interface->getRobotState()->getRobotModeType();
}
}
template<int DOF>
void AuboRobot<DOF>::torqueOn()
{
// 接口调用: 获取机器人的名字
auto robot_name = rpc_cli_->getRobotNames().front();
auto robot_interface = rpc_cli_->getRobotInterface(robot_name);
// 接口调用: 设置负载
double mass = 0.0;
std::vector<double> cog(3, 0.0);
std::vector<double> aom(3, 0.0);
std::vector<double> inertia(6, 0.0);
robot_interface->getRobotConfig()->setPayload(mass, cog, aom, inertia);
// 接口调用: 获取机械臂当前模式
auto robot_mode = robot_interface->getRobotState()->getRobotModeType();
if (robot_mode == RobotModeType::Running) {
std::cout << "机械臂已松刹车,处于运行模式" << std::endl;
} else {
// 接口调用: 机械臂发起上电请求
robot_interface->getRobotManage()->poweron();
// 等待机械臂进入空闲模式
waitForRobotMode(robot_interface, RobotModeType::Idle);
std::cout << "机械臂上电成功,当前模式:"
<< robot_interface->getRobotState()->getRobotModeType()
<< std::endl;
// 接口调用: 机械臂发起松刹车请求
rpc_cli_->getRobotInterface(robot_name)->getRobotManage()->startup();
// 等待机械臂进入运行模式
waitForRobotMode(robot_interface, RobotModeType::Running);
std::cout << "机械臂松刹车成功,当前模式:"
<< robot_interface->getRobotState()->getRobotModeType()
<< std::endl;
}
}
template<int DOF>
void AuboRobot<DOF>::getJointsState(std::vector<JointState>& states)
{
try {
// 接口调用: 获取机器人的名字
auto robot_name = rpc_cli_->getRobotNames().front();
auto robot_interface = rpc_cli_->getRobotInterface(robot_name);
auto rebotState = robot_interface->getRobotState();
states.clear();
JointState state;
//获取关节位置和速度
for (int i = 0; i < 6; i++) {
state.velocity = rebotState->getJointSpeeds()[i];
state.position = rebotState->getJointPositions()[i];
states.push_back(state);
}
} catch (exception &e) {
throw runtime_error(e.what());
}
}
template<int DOF>
void AuboRobot<DOF>::torqueOff()
{
// 接口调用: 获取机器人的名字
auto robot_name = rpc_cli_->getRobotNames().front();
auto robot_interface = rpc_cli_->getRobotInterface(robot_name);
// 接口调用: 机械臂断电
robot_interface->getRobotManage()->poweroff();
// 等待机械臂进入断电模式
waitForRobotMode(robot_interface, RobotModeType::PowerOff);
std::cout << "机械臂断电成功,当前模式:"
<< robot_interface->getRobotState()->getRobotModeType()
<< std::endl;
}
template<int DOF>
void AuboRobot<DOF>::moveJ(std::vector<JointPoint>& cmd, double vel, double acc)
{
try
{
//检查参数
if (cmd.size() != dof_)
{
LOG(ERROR) << "[AuboRobot](moveJ)Wrong number of cmd";
throw std::invalid_argument("[AuboRobot](moveJ)Wrong number of cmd");
}
//调用aubo sdk接口实现moveJ
// 接口调用: 获取机器人的名字
auto robot_name = rpc_cli_->getRobotNames().front();
auto robot_interface = rpc_cli_->getRobotInterface(robot_name);
// 接口调用: 设置机械臂的速度比率
robot_interface->getMotionControl()->setSpeedFraction(0.3);
/*
* 1
* 2
* 3
* 4
* 5
*/
// 接口调用: 关节运动
// 关节角,单位: 弧度 (此处为6关节)
std::vector<double> joint_angle;
for (int i = 0; i < cmd.size(); i++)
{
joint_angle.emplace_back(cmd[i].rad);
}
robot_interface->getMotionControl()->moveJoint(
joint_angle, acc, vel, 0, 0);
}
catch (std::exception& e)
{
throw std::invalid_argument(e.what());
}
}
template<int DOF>
void AuboRobot<DOF>::calibrateZeroQ(const std::string& joint_name)
{
}
template<int DOF>
cmvr::msgs::Pose3d AuboRobot<DOF>::fk(const std::string &base_link, const std::string &ee_link)
{
cmvr::msgs::Pose3d pose;
return pose;
}
template<int DOF>
std::vector<double> AuboRobot<DOF>::ik(const std::string &base_link, const std::string &ee_link,msgs::Pose3d pose)
{
std::vector<double> ik;
return ik;
}
// 实现阻塞功能: 当机械臂运动到目标路点时,程序再往下执行
int waitArrival(RobotInterfacePtr impl) {
const int max_retry_count = 5;
int cnt = 0;
// 接口调用: 获取当前的运动指令 ID
int exec_id = impl->getMotionControl()->getExecId();
// 等待机械臂开始运动
while (exec_id == -1) {
if (cnt++ > max_retry_count) {
return -1;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
exec_id = impl->getMotionControl()->getExecId();
}
// 等待机械臂动作完成
while (impl->getMotionControl()->getExecId() != -1) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
return 0;
}
template <int DOF>
void AuboRobot<DOF>::moveL(math::Pose3d& pose, double vel, double acc)
{
// 接口调用: 获取机器人的名字
auto robot_name = rpc_cli_->getRobotNames().front();
auto robot_interface = rpc_cli_->getRobotInterface(robot_name);
// 接口调用: 设置机械臂的速度比率
robot_interface->getMotionControl()->setSpeedFraction(0.75);
// 接口调用: 设置工具中心点TCP相对于法兰盘中心的偏移
std::vector<double> tcp_offset(6, 0.0);
robot_interface->getRobotConfig()->setTcpOffset(tcp_offset);
// 接口调用: 直线运动到位置
std::vector<double> pose1;
pose1.emplace_back(pose.position.x);
pose1.emplace_back(pose.position.y);
pose1.emplace_back(pose.position.z);
pose1.emplace_back(pose.euler.rx);
pose1.emplace_back(pose.euler.ry);
pose1.emplace_back(pose.euler.rz);
robot_interface->getMotionControl()->moveLine(pose1, acc, vel, 0.025, 0);
// 阻塞
auto ret = waitArrival(robot_interface);
if (ret == 0) {
LOG(INFO)<<"直线运动到位置成功!";
} else {
LOG(INFO)<<"直线运动到位置失败!";
}
}
template class cmvr::device::AuboRobot<6>;

View File

@ -0,0 +1,46 @@
//
// Created by linbo on 2025/11/7.
//
#ifndef CMVR_ES_AUBO_ROBOT_H
#define CMVR_ES_AUBO_ROBOT_H
#include "devices/abstract_robot.h"
#include "aubo_sdk/rpc.h"
#include "cmvr/msgs/robot_detail.pb.h"
using namespace arcs::common_interface;
using namespace arcs::aubo_sdk;
namespace cmvr::device
{
template<int DOF>
class AuboRobot: public AbstractRobot {
public:
explicit AuboRobot(const XmlNode& cfg);
~AuboRobot();
void init () override;
void torqueOn() override;
void torqueOff() override;
void getJointsState(std::vector<JointState>& states) override;
void moveJ(std::vector<JointPoint>& cmd, double vel, double acc) override;
void moveL(math::Pose3d& pose, double vel, double acc) override;
void calibrateZeroQ(const std::string& joint_name) override;
msgs::Pose3d fk(const std::string &base_link, const std::string &ee_link) override;
std::vector<double> ik(const std::string &base_link, const std::string &ee_link,msgs::Pose3d pose) override;
private:
static void waitForRobotMode(const RobotInterfacePtr& robot_interface,
const RobotModeType target_mode);
private:
std::string ip_;
std::string port_;
std::shared_ptr<RpcClient> rpc_cli_;
};
}
#endif //CMVR_ES_AUBO_ROBOT_H

View File

@ -17,11 +17,12 @@ HumanoidRobot<DOF>::HumanoidRobot(const XmlNode &cfg) : AbstractRobot(cfg) {
id_ = cfg.getAttrString("id");
dof_ = DOF;
if (!pathExists(cfg.getAttrString("urdf"))) {
std::string urdf = cfg.getAttrString("urdfPath");
if (!pathExists(urdf)) {
throw runtime_error("urdf file does not exist");
}
auto rcfg = cmvr::dyn::LoadRobotFromURDF(
cfg.getAttrString("urdf"), cfg.getAttrString("baseLink"));
urdf, cfg.getAttrString("baseLink"));
m_robot_ = std::make_shared<cmvr::dyn::Robot<DOF> >(rcfg);
joint_names_ = splitString(cfg.getAttrString("jointNames"), ",");
link_names_ = splitString(cfg.getAttrString("linkNames"), ",");
@ -36,58 +37,6 @@ HumanoidRobot<DOF>::HumanoidRobot(const XmlNode &cfg) : AbstractRobot(cfg) {
CSV_buffer_ = make_shared<SPMCRingBuffer<JointVelocityCommand> >(cfg.getAttrDefault("bufferSize", 50));
CSC_buffer_ = make_shared<SPMCRingBuffer<JointCurrentCommand> >(cfg.getAttrDefault("bufferSize", 50));
// 定义 lambda 函数,用于读取 XML 节点 enable 属性
auto readEnable = [](const XmlNode &node) -> bool {
std::string enable_str = node.getAttrString("enable"); // 默认 false
return (enable_str == "true" || enable_str == "1");
};
auto can_cfg = cfg.getChild("CanManger");
auto l_can_cfg = can_cfg.getChild("LeftArmCan");
left_arm_enabled_ = readEnable(l_can_cfg);
if (left_arm_enabled_) {
l_motors_cfg_ = l_can_cfg.getChildren("Motor");
l_can_client_ = std::make_shared<SocketCanClientRaw>(l_can_cfg);
l_can_sender_ = std::make_shared<CanSender<msgs::RobotDetail> >();
l_can_receiver_ = std::make_shared<CanReceiver<msgs::RobotDetail> >();
l_message_manager_ = std::make_shared<MessageManager<msgs::RobotDetail> >();
}
auto r_can_cfg = can_cfg.getChild("RightArmCan");
right_arm_enabled_ = readEnable(r_can_cfg);
if (right_arm_enabled_) {
r_motors_cfg_ = r_can_cfg.getChildren("Motor");
r_can_client_ = std::make_shared<SocketCanClientRaw>(r_can_cfg);
r_can_sender_ = std::make_shared<CanSender<msgs::RobotDetail> >();
r_can_receiver_ = std::make_shared<CanReceiver<msgs::RobotDetail> >();
r_message_manager_ = std::make_shared<MessageManager<msgs::RobotDetail> >();
}
auto waist_can_cfg = can_cfg.getChild("WaistCan");
waist_enabled_ = readEnable(waist_can_cfg);
if (waist_enabled_) {
waist_motors_cfg_ = waist_can_cfg.getChildren("Motor");
waist_can_client_ = std::make_shared<SocketCanClientRaw>(waist_can_cfg);
waist_can_sender_ = std::make_shared<CanSender<msgs::RobotDetail> >();
waist_can_receiver_ = std::make_shared<CanReceiver<msgs::RobotDetail> >();
waist_message_manager_ = std::make_shared<MessageManager<msgs::RobotDetail> >();
}
auto head_can_cfg = can_cfg.getChild("HeadCan");
head_enabled_ = readEnable(head_can_cfg);
if (head_enabled_) {
head_motors_cfg_ = head_can_cfg.getChildren("Motor");
head_can_client_ = std::make_shared<SocketCanClientRaw>(head_can_cfg);
head_can_sender_ = std::make_shared<CanSender<msgs::RobotDetail> >();
head_can_receiver_ = std::make_shared<CanReceiver<msgs::RobotDetail> >();
head_message_manager_ = std::make_shared<MessageManager<msgs::RobotDetail> >();
}
upd_timer_ = make_shared<FDTimer>();
upd_timer_->start(chrono::nanoseconds(1000 / upd_freq_ * 1000),
[this] { update_state_(); });
@ -105,90 +54,19 @@ HumanoidRobot<DOF>::HumanoidRobot(const XmlNode &cfg) : AbstractRobot(cfg) {
template<int DOF>
void HumanoidRobot<DOF>::init() {
struct Limb {
std::string name;
bool enabled;
std::shared_ptr<AbstractCanbus> client;
std::shared_ptr<CanSender<msgs::RobotDetail> > sender;
std::shared_ptr<CanReceiver<msgs::RobotDetail> > receiver;
std::shared_ptr<MessageManager<msgs::RobotDetail> > message_manager;
std::vector<XmlNode> motor_cfgs;
};
std::vector<Limb> limbs{
{
"WAIST", waist_enabled_, waist_can_client_, waist_can_sender_, waist_can_receiver_, waist_message_manager_,
waist_motors_cfg_
},
{
"LEFT_ARM", left_arm_enabled_, l_can_client_, l_can_sender_, l_can_receiver_, l_message_manager_,
l_motors_cfg_
},
{
"RIGHT_ARM", right_arm_enabled_, r_can_client_, r_can_sender_, r_can_receiver_, r_message_manager_,
r_motors_cfg_
},
{
"HEAD", head_enabled_, head_can_client_, head_can_sender_, head_can_receiver_, head_message_manager_,
head_motors_cfg_
}
};
auto motorManagerCfg = cfg_.getChild("MotorManager");
// 创建 MotorManager
motor_manager_ = std::make_shared<MotorManager>();
std::vector<std::future<void> > tasks;
for (auto &limb: limbs) {
if (!limb.enabled) continue;
if (limb.client) limb.client->init();
// 2. 初始化 Sender / Receiver如果有
if (limb.sender && limb.receiver && limb.client) {
auto ret = limb.sender->Init(limb.client.get(), false);
if (ret != ErrorCode::OK)
LOG(ERROR) << "Failed to init " << limb.name << " CAN sender.";
ret = limb.receiver->Init(limb.client.get(), limb.message_manager.get(), false);
if (ret != ErrorCode::OK)
LOG(ERROR) << "Failed to init " << limb.name << " CAN receiver.";
limb.client->start();
ret = limb.sender->Start();
if (ret != ErrorCode::OK)
LOG(ERROR) << "Failed to start " << limb.name << " CAN sender.";
ret = limb.receiver->Start();
if (ret != ErrorCode::OK)
LOG(ERROR) << "Failed to start " << limb.name << " CAN receiver.";
}
// 3. 创建协议如果有CAN
std::shared_ptr<Ti5MotorCanopenProtocol> protocol = nullptr;
if (limb.sender && limb.message_manager) {
protocol = std::make_shared<Ti5MotorCanopenProtocol>(limb.sender, limb.message_manager);
}
// 4. 并行初始化电机
if (!limb.motor_cfgs.empty()) {
tasks.push_back(std::async(std::launch::async, [this, protocol, &limb] {
LOG(INFO) << "[Thread " << std::this_thread::get_id() << "] Start initializing " << limb.name <<
" motors...";
for (const auto &cfg: limb.motor_cfgs) {
auto motor = std::make_shared<Ti5Motor>(cfg);
if (protocol) motor->setProtocol(protocol);
motor->init();
motor_manager_->addMotor(motor);
}
}));
}
// 3. 创建协议如果有CAN
std::shared_ptr<hardware::AbstractMotorProtocol> protocol = nullptr;
for (const auto& motorCfg: motorManagerCfg.getChildren())
{
auto canGroupID = motorCfg.getAttrString("canGroupID");
auto protocolType = motorCfg.getAttrString("protocolType");
auto motor = std::make_shared<Ti5Motor>(motorCfg);
//motor->init();
motor_manager_->addMotor(motor);
}
// 等待所有任务完成
for (auto &task: tasks) task.get();
rsm_.store(ROBOT_ESTOP);
LOG(INFO) << "[HumanoidRobot](init):All enabled motors initialized successfully.";
}
@ -318,7 +196,7 @@ void HumanoidRobot<DOF>::moveJ(std::vector<JointPoint> &cmd, double vel, double
{
throw runtime_error("Controller state error, current state:" + std::to_string(state));
}
else if (state == ControlManagerState_Command)
else if (state == ControlManagerState_Command || state == ControlManagerState_Idle)
{
//先获取当前正在执行的控制器
auto activeController = controller_manager_->getActiveController();

View File

@ -31,7 +31,7 @@
#include <Eigen/Dense>
#include <Eigen/Geometry>
#include "../controller/controller_manager.h"
#include "controller/controller_manager.h"
namespace cmvr::device{

View File

@ -0,0 +1,12 @@
add_library(solver SHARED
solver_interface.cpp
)
target_include_directories(solver PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(solver PRIVATE
cmvr_es::hardware::can
cmvr_es::hardware::serial
)
add_library(cmvr_es::solver ALIAS solver)

View File

@ -0,0 +1,57 @@
//
// Created by linbo on 2025/11/11.
//
#include "solver_interface.h"
#include <glog/logging.h>
using namespace std;
using namespace cmvr::device;
template<int DOF>
std::shared_ptr<SolverInterface<DOF>> SolverInterface<DOF>::instance_ = nullptr;
template<int DOF>
std::once_flag SolverInterface<DOF>::init_flag_;
template<int DOF>
SolverInterface<DOF>::SolverInterface(const XmlNode& cfg) {
try {
cfg_ = cfg;
if (!pathExists(cfg.getAttrString("urdf"))) {
throw runtime_error("urdf file does not exist");
}
auto rcfg = cmvr::dyn::LoadRobotFromURDF(
cfg.getAttrString("urdf"), cfg.getAttrString("baseLink"));
joint_names_ = splitString(cfg.getAttrString("jointNames"), ",");
link_names_ = splitString(cfg.getAttrString("linkNames"), ",");
if (joint_names_.size() != DOF) {
throw runtime_error("joint names size mismatched with dof");
}
m_robot_ = std::make_shared<cmvr::dyn::Robot<DOF> >(rcfg);
m_state_ = m_robot_->MakeState(link_names_, joint_names_);
m_cctrl_ = make_shared<ctrl::QPSolver<DOF> >(m_robot_);
}
catch (const exception &e) {
LOG(FATAL) << "[SolverInterface] (SolverInterface): Device manager initialization failed: " << e.what();
throw std::runtime_error("[SolverInterface] (SolverInterface): Device manager create failed" + string(e.what()));
}
}
template<int DOF>
SolverInterface<DOF>& SolverInterface<DOF>::getInstance(const XmlNode& cfg) {
std::call_once(init_flag_, [&cfg] {
instance_.reset(new SolverInterface(cfg));
});
return *instance_;
}
template<int DOF>
SolverInterface<DOF>& SolverInterface<DOF>::getInstance() {
if (!instance_) {
throw std::runtime_error("[SolverInterface] (getInstance): SolverInterface not initialized. Call getInstance(const XmlNode&) first.");
}
return *instance_;
}
template<int DOF>
void SolverInterface<DOF>::destroyInstance() {
instance_.reset();
}

View File

@ -0,0 +1,42 @@
//
// Created by linbo on 2025/11/11.
//
#ifndef CMVR_ES_SOVLER_INTERFACE_H
#define CMVR_ES_SOVLER_INTERFACE_H
#include <mutex>
#include "rapidxml/xml_parser.h"
#include "utils/solver/qp_solver.h"
#include "utils/base/os.h"
#include "utils/base/timer.h"
#include "utils/base/ring_buffer.h"
namespace cmvr::device
{
template<int DOF>
class SolverInterface
{
public:
SolverInterface(const SolverInterface&) = delete;
SolverInterface& operator=(const SolverInterface&) = delete;
static SolverInterface& getInstance(const XmlNode& cfg);
static SolverInterface& getInstance();
static void destroyInstance();
private:
explicit SolverInterface(const XmlNode &cfg);
private:
XmlNode cfg_;
static std::once_flag init_flag_;
static std::shared_ptr<SolverInterface> instance_;
std::vector<std::string> joint_names_;
std::vector<std::string> link_names_;
std::shared_ptr<cmvr::dyn::State<DOF>> m_state_;
std::shared_ptr<cmvr::dyn::Robot<DOF>> m_robot_;
std::shared_ptr<cmvr::ctrl::QPSolver<DOF>> m_cctrl_;
};
}
#endif //CMVR_ES_SOVLER_INTERFACE_H

View File

@ -17,7 +17,8 @@ MotorProtocolManager::MotorProtocolManager(const XmlNode &cfg,std::shared_ptr<de
try {
if (cfg.hasChild("Ti5MotorProtocol"))
{
motor_protocols_["Ti5MotorProtocol"] = std::make_shared<Ti5MotorProtocol>(cfg,can_sender_,message_manager_);
auto protocol = std::make_shared<Ti5MotorProtocol>(cfg,can_sender_,message_manager_);
motor_protocols_["Ti5MotorProtocol"] = protocol;
std::vector<MotorInfo> motors;
for (auto &node: cfg.getChildren()){
if (node.getNodeName() == "Ti5MotorProtocol")
@ -32,7 +33,14 @@ MotorProtocolManager::MotorProtocolManager(const XmlNode &cfg,std::shared_ptr<de
motor.limitQd = node.getAttrDefault("limitQd",3.0f);
motor.limitQLb = node.getAttrDefault("limitQLb",3.14f);
motor.limitQUb = node.getAttrDefault("limitQUb",3.14f);
motor.motorProtocol = motor_protocols_["Ti5MotorProtocol"];
//初始化参数
protocol->configPdo(motor.node_id);
protocol->configProfile(motor.node_id,2000,2000,2000);
protocol->seedNmtRequest(motor.node_id,msgs::NMT_ENTER_PRE_OPERATIONAL);
protocol->seedNmtRequest(motor.node_id,msgs::NMT_START_REMOTE_NODE);
protocol->seedSdoRequest(motor.node_id, msgs::CS_WRITE_TWO_BYTES, msgs::CONTROL_WORD_6040, msgs::SUB_INDEX_0, 0x06);
protocol->seedSdoRequest(motor.node_id, msgs::CS_WRITE_TWO_BYTES, msgs::CONTROL_WORD_6040, msgs::SUB_INDEX_0, 0x0F);
motors.emplace_back(motor);
}
}

View File

@ -23,6 +23,7 @@
#include "json/json.h"
#include "hardware_manager/hardware_manager.h"
#include <grpcpp/ext/proto_server_reflection_plugin.h>
void runServer(const XmlNode &cfg){
using namespace cmvr::device;
@ -34,6 +35,8 @@ void runServer(const XmlNode &cfg){
return;
}
try {
//启用反射
grpc::reflection::InitProtoReflectionServerBuilderPlugin();
auto hardware_cfg = cfg.getChild("HardwareManager");
HardWareManager::getInstance(hardware_cfg);
@ -43,7 +46,8 @@ void runServer(const XmlNode &cfg){
auto mmgr_cfg = cfg.getChild("MonitorManager");
MonitorManager::getInstance(mmgr_cfg);
auto grpc_cfg = cfg.getChild("gRPCServer");
auto server_cfg = cfg.getChild("Server");
auto grpc_cfg = server_cfg.getChild("gRPCServer");
string port = grpc_cfg.getAttrDefault("port", "50051");
std::string address("0.0.0.0:" + port);
@ -76,130 +80,6 @@ void runServer(const XmlNode &cfg){
}
}
int test_httpclient() {
try {
std::cout << "HTTP Client Example" << std::endl;
std::cout << "===================" << std::endl;
// 创建HTTP客户端
cmvr::HttpClient client;
// 设置基础URL - 使用Reqres.in替代JSONPlaceholder
client.setBaseUrl("https://reqres.in/api");
// 设置超时时间为15秒增加超时时间以应对网络波动
client.setTimeout(15000);
// 示例1: GET请求 - 获取用户列表
std::cout << "\n=== Example 1: GET Request (List Users) ===" << std::endl;
cmvr::HttpResponse response = client.get("/users?page=1");
std::cout << "Status: " << response.statusCode << " " << response.statusText << std::endl;
std::cout << "Content-Type: " << response.headers["Content-Type"] << std::endl;
std::cout << "Response Body: " << std::endl << response.body << std::endl;
// 示例2: POST JSON请求 - 创建用户
std::cout << "\n=== Example 2: POST JSON Request (Create User) ===" << std::endl;
// 使用JsonCpp创建JSON数据
Json::Value postData;
postData["name"] = "John Doe";
postData["job"] = "Software Engineer";
// 将JSON转换为字符串
Json::StreamWriterBuilder writer;
std::string jsonString = Json::writeString(writer, postData);
response = client.postJson("/users", {}, jsonString);
std::cout << "Status: " << response.statusCode << " " << response.statusText << std::endl;
std::cout << "Content-Type: " << response.headers["Content-Type"] << std::endl;
std::cout << "Response Body: " << std::endl << response.body << std::endl;
// 示例3: 解析JSON响应 - 获取单个用户
std::cout << "\n=== Example 3: Parsing JSON Response (Single User) ===" << std::endl;
response = client.get("/users/2");
if (response.statusCode == 200) {
// 使用JsonCpp解析JSON字符串
Json::Value user;
Json::CharReaderBuilder reader;
std::string errors;
std::istringstream stream(response.body);
bool parsingSuccessful = Json::parseFromStream(reader, stream, &user, &errors);
if (parsingSuccessful) {
Json::Value data = user["data"];
std::cout << "User ID: " << data["id"].asInt() << std::endl;
std::cout << "Email: " << data["email"].asString() << std::endl;
std::cout << "First Name: " << data["first_name"].asString() << std::endl;
std::cout << "Last Name: " << data["last_name"].asString() << std::endl;
} else {
std::cerr << "Failed to parse JSON: " << errors << std::endl;
}
}
// 示例4: PUT请求 - 更新用户
std::cout << "\n=== Example 4: PUT Request (Update User) ===" << std::endl;
Json::Value updateData;
updateData["name"] = "Jane Doe";
updateData["job"] = "Senior Software Engineer";
std::string updateJson = Json::writeString(writer, updateData);
response = client.postJson("/users/2", {}, updateJson); // Reqres.in使用POST处理PUT请求
std::cout << "Status: " << response.statusCode << " " << response.statusText << std::endl;
std::cout << "Content-Type: " << response.headers["Content-Type"] << std::endl;
std::cout << "Response Body: " << std::endl << response.body << std::endl;
// 示例5: 测试HttpBin.org - 获取请求头信息
std::cout << "\n=== Example 5: HttpBin.org (Request Headers) ===" << std::endl;
// 切换到HttpBin.org
client.setBaseUrl("https://httpbin.org");
// 添加自定义请求头
client.clearHeaders();
client.addHeader("X-Test-Header", "Hello from HttpClient");
client.addHeader("Accept", "application/json");
response = client.get("/headers");
std::cout << "Status: " << response.statusCode << " " << response.statusText << std::endl;
std::cout << "Content-Type: " << response.headers["Content-Type"] << std::endl;
std::cout << "Response Body: " << std::endl << response.body << std::endl;
// 示例6: 测试超时与错误处理
std::cout << "\n=== Example 6: Timeout & Error Handling ===" << std::endl;
// 设置较短的超时时间
client.setTimeout(2000); // 2秒超时
try {
// 请求一个会延迟响应的端点
response = client.get("/delay/5"); // 服务器会延迟5秒响应
std::cout << "Status: " << response.statusCode << " " << response.statusText << std::endl;
} catch (const cmvr::HttpException& e) {
std::cout << "Error (Expected Timeout): " << e.what() << std::endl;
}
// 恢复正常超时
client.setTimeout(15000);
} catch (const cmvr::HttpException& e) {
std::cerr << "HTTP Error: " << e.what() << std::endl;
return 1;
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}
int main(int argc, char* argv[]) {
std::string config_path;
if(argc == 1) {
@ -210,7 +90,7 @@ int main(int argc, char* argv[]) {
return 1;
}
std::string exe_dir = dirname(exe_path);
config_path = exe_dir + "/../config/cabin_robot.xml";
config_path = exe_dir + "/../config/dev_config_v2.xml";
std::cout << "Using default config path: " << config_path << std::endl;
}
else if (argc == 2){

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,357 @@
/** @file aubo_api.h
* @brief \~chinese API接口
* @brief \~english API for controlling the robot and external axis
*/
#ifndef AUBO_SDK_AUBO_API_INTERFACE_H
#define AUBO_SDK_AUBO_API_INTERFACE_H
#include <aubo/system_info.h>
#include <aubo/runtime_machine.h>
#include <aubo/register_control.h>
#include <aubo/robot_interface.h>
#include <aubo/global_config.h>
#include <aubo/math.h>
#include <aubo/socket.h>
#include <aubo/serial.h>
#include <aubo/axis_interface.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT AuboApi
{
public:
AuboApi();
virtual ~AuboApi();
/**
* \chinese
*
*
* @return MathPtr对象的指针
*
* @par Python函数原型
* getMath(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.Math
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* MathPtr ptr = rpc_cli->getMath();
* @endcode
* \endchinese
*
*\english
* Get pure mathematic related API
*
* @return Shared pointer to a Math object
*
* @par Python function prototype
* getMath(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.Math
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* MathPtr ptr = rpc_cli->getMath();
* @endcode
*\endenglish
*/
MathPtr getMath();
/**
* \chinese
*
*
* @return SystemInfoPtr对象的指针
*
* @par Python函数原型
* getSystemInfo(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.SystemInfo
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SystemInfoPtr ptr = rpc_cli->getSystemInfo();
* @endcode
* \endchinese
*
* \english
* Get system info
*
* @return Shared pointer to SystemInfo object
*
* @par Python function prototype
* getSystemInfo(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.SystemInfo
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SystemInfoPtr ptr = rpc_cli->getSystemInfo();
* @endcode
* \endenglish
*/
SystemInfoPtr getSystemInfo();
/**
* \chinese
*
*
* @return RuntimeMachinePtr对象的指针
*
* @par Python函数原型
* getRuntimeMachine(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.RuntimeMachine
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RuntimeMachinePtr ptr = rpc_cli->getRuntimeMachine();
* @endcode
* \endchinese
*
* \english
* Get runtime api
*
* @return Shared pointer to RuntimeMachine object
* Python function prototype
* getRuntimeMachine(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.RuntimeMachine
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RuntimeMachinePtr ptr = rpc_cli->getRuntimeMachine();
* @endcode
* \endenglish
*/
RuntimeMachinePtr getRuntimeMachine();
/**
* \chinese
*
*
* @return RegisterControlPtr对象的指针
*
* @par Python函数原型
* getRegisterControl(self: pyaubo_sdk.AuboApi) ->
* pyaubo_sdk.RegisterControl
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RegisterControlPtr ptr = rpc_cli->getRegisterControl();
* @endcode
* \endchinese
*
* \english
* External registers api
*
* @return Shared pointer to RegisterControl object
*
* @par Python function prototype
* getRegisterControl(self: pyaubo_sdk.AuboApi) ->
* pyaubo_sdk.RegisterControl
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RegisterControlPtr ptr = rpc_cli->getRegisterControl();
* @endcode
* \endenglish
*/
RegisterControlPtr getRegisterControl();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* getRobotNames(self: pyaubo_sdk.AuboApi) -> List[str]
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"getRobotNames","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":["rob1"]}
* \endchinese
*
* \english
* Get robot list
*
* @return robot list
*
* @par Python function prototype
* getRobotNames(self: pyaubo_sdk.AuboApi) -> List[str]
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"getRobotNames","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":["rob1"]}
* \endenglish
*/
std::vector<std::string> getRobotNames();
/**
* \chinese
* RobotInterfacePtr
*
* @param name
* @return RobotInterfacePtr对象的指针
*
* @par Python函数原型
* getRobotInterface(self: pyaubo_sdk.AuboApi, arg0: str) ->
* pyaubo_sdk.RobotInterface
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotInterfacePtr ptr = rpc_cli->getRobotInterface(robot_name);
* @endcode
* \endchinese
*
* \english
* Get RobotInterfacePtr based on name
*
* @param name Robot name
* @return Shared pointer to a RobotInterface object
*
* @par Python function prototype
* getRobotInterface(self: pyaubo_sdk.AuboApi, arg0: str) ->
* pyaubo_sdk.RobotInterface
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotInterfacePtr ptr = rpc_cli->getRobotInterface(robot_name);
* @endcode
* \endenglish
*/
RobotInterfacePtr getRobotInterface(const std::string &name);
/**
* \~chinese \~english Get external axis list
*
* @return
*/
std::vector<std::string> getAxisNames();
/**
* \chinese
*
*
* @param name
* @return
* \endchinese
*
* \english
* Get external axis interface
*
* @param name
* @return
* \endenglish
*/
AxisInterfacePtr getAxisInterface(const std::string &name);
/// \~chinese 获取独立 IO 模块接口 \~english Get independent IO module interface
/**
* \chinese
* socket
* @return SocketPtr对象的指针
*
* @par Python函数原型
* getSocket(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Socket
* @endcode
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SocketPtr ptr = rpc_cli->getSocket();
* @endcode
* \endchinese
*
* \english
* Get socket
* @return Shared pointer to a socket object
*
* @par Python function prototype
* getSocket(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Socket
* @endcode
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SocketPtr ptr = rpc_cli->getSocket();
* @endcode
* \endenglish
*/
SocketPtr getSocket();
/**
* \chinese
* @return SerialPtr对象的指针
*
* @par Python函数原型
* getSerial(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Serial
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SerialPtr ptr = rpc_cli->getSerial();
* @endcode
* \endchinese
*
* \english
* @return Shared pointer to Serial object
*
* @par Python function prototype
* getSerial(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Serial
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SerialPtr ptr = rpc_cli->getSerial();
* @endcode
* \endenglish
*/
SerialPtr getSerial();
/**
* \~chinese \~english Get syncronous move interface
*
* \~chinese @return SyncMovePtr对象的指针
* \~english @return Shared pointer to SyncMove object
*/
SyncMovePtr getSyncMove(const std::string &name);
/**
* \~chinese
* \~english Get alert interface
*
* \~chinese @return TracePtr对象的指针
* \~english @return Shared pointer of trace object
*/
TracePtr getTrace(const std::string &name);
protected:
void *d_{ nullptr };
};
using AuboApiPtr = std::shared_ptr<AuboApi>;
} // namespace common_interface
} // namespace arcs
#endif // AUBO_SDK_AUBO_API_H

View File

@ -0,0 +1,381 @@
/** @file axes.h
* @brief
*/
#ifndef AUBO_SDK_AXIS_INTERFACE_H
#define AUBO_SDK_AXIS_INTERFACE_H
#include <aubo/sync_move.h>
#include <aubo/trace.h>
namespace arcs {
namespace common_interface {
/**
* \~chinese API接口
* \~english External axis API interface
*/
class ARCS_ABI_EXPORT AxisInterface
{
public:
AxisInterface();
virtual ~AxisInterface();
/**
* \~chinese
* \~english Power on
* @return
*/
int poweronExtAxis();
/**
* \~chinese
* \~english Power off
* @return
*/
int poweroffExtAxis();
/**
* \~chinese 使
* \~english Enable
* @return
*/
int enableExtAxis();
/**
* \~chinese 姿()
* \~chinese @param pose
* \~english Set mounting pose of external axis (wrt world frame)
* \~english @param pose
* @return
*/
int setExtAxisMountingPose(const std::vector<double> &pose);
/**
* \chinese
*
* @param pos
* @param v
* @param a
* @param duration
* @return
* \endchinese
*
* \english move to pos, rotation or linear
*
* @param pos
* @param v
* @param a
* @param duration
* @return
* \endenglish
*/
int moveExtJoint(double pos, double v, double a, double duration);
/**
* \chinese
*
*
* @param v
* @param a
* @param duration
* @return
* \endchinese
*
* \english
* Set target speed, acceleration and duration
* @param v
* @param a
* @param duration
* @return
* \endenglish
*/
int speedExtJoint(double v, double a, double duration);
int stopExtJoint(double a);
/**
* \~chinese 0 1
* \~english Get external axis type: 0 for rotation, 1 for linear
* @return
*/
int getExtAxisType();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis status
*
* @return Current exteral axis status
* \endenglish
*/
AxisModeType getAxisModeType();
/**
* \chinese
* 姿
*
* @return 姿
* \endchinese
*
* \english
* Get external axis mounting pose
*
* @return External axis pose
* \endenglish
*/
std::vector<double> getExtAxisMountingPose();
/**
* \chinese
* 姿
*
* @return 姿
* \endchinese
*
* \english
* Get pose wrt mounting coordinate system, axis can be positioner or linear rail
*
* @return Pose wrt mounting coordinate system
* \endenglish
*/
std::vector<double> getExtAxisPose();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis position
*
* @return External axis position
* \endenglish
*/
double getExtAxisPosition();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis speed
*
* @return External axis speed
* \endenglish
*/
double getExtAxisVelocity();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis acceleration
*
* @return External axis acceleration
* \endenglish
*/
double getExtAxisAcceleration();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis current
*
* @return External axis current
* \endenglish
*/
double getExtAxisCurrent();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis temperature
*
* @return External axis temperature
* \endenglish
*/
double getExtAxisTemperature();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis voltage
*
* @return External axis voltage
* \endenglish
*/
double getExtAxisBusVoltage();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis current
*
* @return external axis current
* \endenglish
*/
double getExtAxisBusCurrent();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis max position
*
* @return External axis max position
* \endenglish
*/
double getExtAxisMaxPosition();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis min position
*
* @return External axis min position
* \endenglish
*/
double getExtMinPosition();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis max speed
*
* @return External axis max speed
* \endenglish
*/
double getExtAxisMaxVelocity();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis max acceleration
*
* @return External axis max acceleration
* \endenglish
*/
double getExtAxisMaxAcceleration();
/**
* \chinese
* (使)
*
* @param target_name
* @param phase
* @param err
* @return
* \endchinese
*
* \english
* Follow motion of another external axis not to be used during motion
*
* @param target_name name of target axis
* @param phase phase difference
* @param err max error when following motion
* @return
* \endenglish
*/
int followAnotherAxis(const std::string &target_name, double phase,
double err);
/**
* \~chinese @brief stopFollowAnotherAxis(使)
* \~english @brief stopFollowAnotherAxis(not to be used during motion)
* @return
*/
int stopFollowAnotherAxis();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Get external axis error code
*
* @return External axis error code
* \endenglish
*/
int getErrorCode();
/**
* \chinese
*
*
* @return
* \endchinese
*
* \english
* Reset axis error
*
* @return
* \endenglish
*/
int clearAxisError();
protected:
void *d_;
};
using AxisInterfacePtr = std::shared_ptr<AxisInterface>;
} // namespace common_interface
} // namespace arcs
#endif // AUBO_SDK_AXIS_INTERFACE_H

View File

@ -0,0 +1,114 @@
/** @file error_stack.h
* @brief
*/
#ifndef AUBO_SDK_ERROR_STACK_H
#define AUBO_SDK_ERROR_STACK_H
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <aubo/global_config.h>
// 格式化占位符,默认是 fmt 的格式
#ifndef _PH1_
#define _PH1_ "{}"
#define _PH2_ "{}"
#define _PH3_ "{}"
#define _PH4_ "{}"
#endif
namespace arcs {
namespace error_stack {
constexpr int ARCS_ABI_EXPORT codeCompose(int aa, int bb, int cccc)
{
return (int)((aa * 1000000) + (bb * 10000) + cccc);
}
constexpr int ARCS_ABI_EXPORT mod(int x)
{
return (x % 1000000);
}
#include <aubo/error_stack/hal_error.h>
#include <aubo/error_stack/rtm_error.h>
#include <aubo/error_stack/system_error.h>
#define ARCS_ERROR_CODES \
SYSTEM_ERRORS \
JOINT_ERRORS \
SAFETY_INTERFACE_BOARD_ERRORS \
RTM_ERRORS \
TOOL_ERRORS \
PEDSTRAL_ERRORS \
HARDWARE_INTERFACE_ERRORS \
_D(ARCS_MAX_ERROR_CODE, -1, "Max error code", "suggest...")
// 错误代码枚举
enum ErrorCodes
{
#define _D(n, v, s, r) n = (int)v,
ARCS_ERROR_CODES
#undef _D
};
inline int str2ErrorCode(const char *err_code_name)
{
#define _D(n, v, s, r) \
if (strcmp(#n, err_code_name) == 0) \
return v;
ARCS_ERROR_CODES
#undef _D
return ARCS_MAX_ERROR_CODE;
}
inline const char *errorCode2Str(int err_code)
{
static const char *errcode_str[] = {
#define _D(n, v, s, r) s,
ARCS_ERROR_CODES
#undef _D
};
enum arcs_index
{
#define _D(n, v, s, r) n##_INDEX,
ARCS_ERROR_CODES
#undef _D
};
int index = -1;
#define _D(n, v, s, r) \
if (err_code == v) \
index = n##_INDEX;
ARCS_ERROR_CODES
#undef _D
if (index == -1) {
index = ARCS_MAX_ERROR_CODE_INDEX;
}
return errcode_str[(unsigned)index];
}
inline std::ostream &dump(std::ostream &os)
{
#define _D(n, v, s, r) \
os << std::setw(20) << #n << "\t" << v << "\t" << s << "\t" << r \
<< std::endl;
ARCS_ERROR_CODES
#undef _D
return os;
}
} // namespace error_stack
} // namespace arcs
#endif // AUBO_SDK_ERROR_STACK_H

View File

@ -0,0 +1,164 @@
/** @file hal_error.h
* @brief
*/
#ifndef AUBO_SDK_HAL_ERROR_H
#define AUBO_SDK_HAL_ERROR_H
// 缩写说明
// JNT: joint
// PDL: pedstral
// TP: teach pendant
// COMM: communication
// ENC: encoder
// CURR: current
// POS: position
// PKG: package
// PROG: program
// clang-format off
#define JOINT_ERRORS \
_D(JOINT_ERR_OVER_CURRENET, 10001, "joint" _PH1_ " error: over current", "(a) Check for short circuit. (b) Do a Complete rebooting sequence. (c) If this happens more than two times in a row, replace joint") \
_D(JOINT_ERR_OVER_VOLTAGE, 10002, "joint" _PH1_ " error: over voltage", "(a) Do a Complete rebooting sequence. (b) Check 48 V Power supply, current distributer, energy eater and Control Board for issues") \
_D(JOINT_ERR_LOW_VOLTAGE, 10003, "joint" _PH1_ " error: low voltage", "(a) Do a Complete rebooting sequence. (b) Check for short circuit in robot arm. (c) Check 48 V Power supply, current distributer, energy eater and Control Board for issues") \
_D(JOINT_ERR_OVER_TEMP, 10004, "joint" _PH1_ " error: over temperature", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_HALL, 10005, "joint" _PH1_ " error: hall", "suggest...") \
_D(JOINT_ERR_ENCODER, 10006, "joint" _PH1_ " error: encoder", "Check encoder connections") \
_D(JOINT_ERR_ABS_ENCODER, 10007, "joint" _PH1_ " error: abs encoder", "suggest...") \
_D(JOINT_ERR_Q_CURRENT, 10008, "joint" _PH1_ " error: detect current", "suggest...") \
_D(JOINT_ERR_ENC_POLL, 10009, "joint" _PH1_ " error: encoder pollustion", "suggest...") \
_D(JOINT_ERR_ENC_Z_SIGNAL, 10010, "joint" _PH1_ " error: enocder z signal", "suggest...") \
_D(JOINT_ERR_ENC_CAL, 10011, "joint" _PH1_ " error: encoder calibrate", "suggest...") \
_D(JOINT_ERR_IMU_SENS, 10012, "joint" _PH1_ " error: IMU sensor", "suggest...") \
_D(JOINT_ERR_TEMP_SENS, 10013, "joint" _PH1_ " error: TEMP sensor", "suggest...") \
_D(JOINT_ERR_CAN_BUS, 10014, "joint" _PH1_ " error: CAN bus error", "suggest...") \
_D(JOINT_ERR_SYS_CUR, 10015, "joint" _PH1_ " error: system current error", "suggest...") \
_D(JOINT_ERR_SYS_POS, 10016, "joint" _PH1_ " error: system position error","suggest...") \
_D(JOINT_ERR_OVER_SP, 10017, "joint" _PH1_ " error: over speed","suggest...") \
_D(JOINT_ERR_OVER_ACC, 10018, "joint" _PH1_ " error: over accelerate", "suggest...") \
_D(JOINT_ERR_TRACE, 10019, "joint" _PH1_ " error: trace accuracy", "suggest...") \
_D(JOINT_ERR_TAG_POS_OVER, 10020, "joint" _PH1_ " error: target position out of range", "suggest...") \
_D(JOINT_ERR_TAG_SP_OVER, 10021, "joint" _PH1_ " error: target speed out of range", "suggest...") \
_D(JOINT_ERR_COLLISION, 10022, "joint" _PH1_ " error: collision", "suggest...") \
_D(JOINT_ERR_COMMON, 10023, "joint" _PH1_ " error: unkown error. Check communication with joint.", "suggest...") \
_D(JOINT_ERR_SWITCH_SERVO_MODE, 10024, "joint" _PH1_ " error: switch servo mode timeout.", "suggest...") \
_D(JOINT_ERR_MOTOR_STUCK, 10025, "joint" _PH1_ " error: motor stucked.", "suggest...") \
_D(JOINT_ERR_REDUCER_OVER_TEMP, 10026, "joint" _PH1_ " error: reducer over temperature", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_REDUCER_NTC, 10027, "joint" _PH1_ " error: reducer TEMP sensor failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_ABS_MULTITURN, 10028, "joint" _PH1_ " error: absolute encoder multiturn error", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_ADC_ZERO_OFFSET, 10029, "joint" _PH1_ " error: ADC zero offset failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_SHORT_CIRCUIT, 10030, "joint" _PH1_ " error: short circuit", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_PHASE_LOST, 10031, "joint" _PH1_ " error: motor phase lost", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_BRAKE, 10032, "joint" _PH1_ " error: brake failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_FIRMWARE_UPDATE, 10033, "joint" _PH1_ " error: firmware update failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_BATTERY_LOW, 10034, "joint" _PH1_ " error: battery low", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_PHASE_ALIGN, 10035, "joint" _PH1_ " error: phase align", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_CAN_HW_FAULT, 10036, "joint" _PH1_ " error: CAN bus hw fault", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_POS_DISCONTINUOUS, 10037, "joint" _PH1_ " error: target position discontinuous", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_POS_INIT, 10038, "joint" _PH1_ " error: position initiallization failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_TORQUE_SENSOR, 10039, "joint" _PH1_ " error: torqure sensor failure", "(a) Check robots environment and make sure the robot is operating within recommended limits. (b) Do a Complete rebooting sequence") \
_D(JOINT_ERR_OFFLINE, 10040, "joint" _PH1_ " error: joint may be offline", "(a) Check joint's hardware. (b) Check joint's id.") \
_D(JOINT_ERR_BOOTLOADER, 10041, "joint" _PH1_ " error: The joint is in bootloader mode. Retry firmware update. ", "suggest...") \
_D(JOINT_ERR_SLAVE_OFFLINE, 10042, "slave joint" _PH1_ " error: slave joint may be offline", "(a) Check slave joint's hardware. (b) Check slave joint's id.") \
_D(JOINT_ERR_SLAVE_BOOTLOADER, 10043, "slave joint" _PH1_ " error: The slave joint is in bootloader mode. Retry firmware update. ", "suggest...")
#define TOOL_ERRORS \
_D(TOOL_FLASH_VERIFY_FAILED, 40001, "Flash write verify failed", "suggest...") \
_D(TOOL_PROGRAM_CRC_FAILED, 40002, "Program flash checksum failed during bootloading", "suggest...") \
_D(TOOL_PROGRAM_CRC_FAILED2, 40003, "Program flash checksum failed at runtime", "suggest...") \
_D(TOOL_ID_UNDIFINED, 40004, "Tool ID is undefined", "suggest...") \
_D(TOOL_ILLEGAL_BL_CMD, 40005, "Illegal bootloader command", "suggest...") \
_D(TOOL_FW_WRONG, 40006, "Wrong firmware at the joint", "suggest...") \
_D(TOOL_HW_INVALID, 40007, "Invalid hardware revision", "suggest...") \
_D(TOOL_SHORT_CURCUIT_H, 40011, "Short circuit detected on Digital Output: " _PH1_ " high side", "suggest...") \
_D(TOOL_SHORT_CURCUIT_L, 40012, "Short circuit detected on Digital Output: " _PH1_ " low side", "suggest...") \
_D(TOOL_AVERAGE_CURR_HIGH, 40013, "10 second Average tool IO Current of " _PH1_ " A is outside of the allowed range.", "suggest...") \
_D(TOOL_POWER_PIN_OVER_CURR, 40014, "Current of " _PH1_ " A on the POWER pin is outside of the allowed range.", "suggest...") \
_D(TOOL_DOUT_PIN_OVER_CURR, 40015, "Current of " _PH1_ " A on the Digital Output pins is outside of the allowed range.", "suggest...") \
_D(TOOL_GROUND_PIN_OVER_CURR, 40016, "Current of " _PH1_ " A on the ground pin is outside of the allowed range.", "suggest...") \
_D(TOOL_RX_FRAMING, 40021, "RX framing error", "suggest...") \
_D(TOOL_RX_PARITY, 40022, "RX Parity error", "suggest...") \
_D(TOOL_48V_LOW, 40031, "48V input is too low", "suggest...") \
_D(TOOL_48V_HIGH, 40032, "48V input is too high", "suggest...") \
_D(TOOL_ERR_OFFLINE, 40033, "tool error: tool may be offline", "(a) Check tool's hardware. (b) Check joint's id.") \
_D(TOOL_ERR_BOOTLOADER, 40034, "tool error: The tool is in bootloader mode. Retry firmware update. ", "suggest...")
#define PEDSTRAL_ERRORS \
_D(PKG_LOST, 50001, "Lost package from pedestal", "suggest...") \
_D(PEDSTRAL_OFFLINE, 50002, "pedestal error: pedestal may be offline", "(a) Check pedestal's hardware. (b) Check pedestal's id.") \
_D(PEDESTAL_ERR_BOOTLOADER, 50003, "pedestal error: The pedestal is in bootloader mode. Retry firmware update. ", "suggest...")
#define SAFETY_INTERFACE_BOARD_ERRORS \
_D(IFB_ERR_ROBOTTYPE, 20001, "Robot error type!", "suggest...") \
_D(IFB_ERR_ADXL_SENS, 20002, "Acceleration sensor error!", "suggest...") \
_D(IFB_ERR_EN_LINE, 20003, "Encoder line error!", "suggest...") \
_D(IFB_ERR_ENTER_HDG_MODE, 20004, "Robot enter handguide mode!", "suggest...") \
_D(IFB_ERR_EXIT_HDG_MODE, 20005, "Robot exit handguide mode!", "suggest...") \
_D(IFB_ERR_MAC_DATA_BREAK, 20006, "MAC data break!", "suggest...") \
_D(IFB_ERR_DRV_FIRMWARE_VERSION, 20007, "Motor driver firmware version error!", "suggest...") \
_D(INIT_ERR_EN_DRV, 20008, "Motor driver enable failed!", "suggest...") \
_D(INIT_ERR_EN_AUTO_BACK, 20009, "Motor driver enable auto back failed!", "suggest...") \
_D(INIT_ERR_EN_CUR_LOOP, 20010, "Motor driver enable current loop failed!", "suggest...") \
_D(INIT_ERR_SET_TAG_CUR, 20011, "Motor driver set target current failed!", "suggest...") \
_D(INIT_ERR_RELEASE_BRAKE, 20012, "Motor driver release brake failed!", "suggest...") \
_D(INIT_ERR_EN_POS_LOOP, 20013, "Motor driver enable postion loop failed!", "suggest...") \
_D(INIT_ERR_SET_MAX_ACC, 20014, "Motor set max accelerate failed!", "suggest...") \
_D(SAFETY_ERR_PROTECTION_STOP_TIMEOUT, 20015, "Protective stop timeout!", "suggest...") \
_D(SAFETY_ERR_REDUCED_MODE_TIMEOUT, 20016, "Reduced mode timeout!", "suggest...") \
_D(SYS_ERR_MCU_COM, 20017, "Robot system error: mcu communication error!", "suggest...") \
_D(SYS_ERR_RS485_COM, 20018, "Robot system error: RS485 communication error!", "suggest...") \
_D(IFB_ERR_DISCONNECTED, 20019, "Interface board may be disconnected. Please check connection between IPC and Interface board.", "suggest...")\
_D(IFB_ERR_PAYLOAD_ERROR, 20020, "Payload error.", "suggest...") \
_D(IFB_OFFLINE, 20021, "ifaceboard error: ifaceboard may be offline", "(a) Check ifaceboard's hardware. (b) Check ifaceboard's id.") \
_D(IFB_ERR_BOOTLOADER, 20022, "ifaceboard error: The ifaceboard is in bootloader mode. Retry firmware update. ", "suggest...") \
_D(IFB_SLAVE_OFFLINE, 20023, "interface slave board error: interface slave board may be offline", "(a) Check interface slave board's hardware. (b) Check interface slave board's id.") \
_D(IFB_SLAVE_ERR_BOOTLOADER, 20024, "interface slave board error: The interface slave board is in bootloader mode. Retry firmware update. ", "suggest...")
#define HARDWARE_INTERFACE_ERRORS \
_D(HW_SCB_SETUP_FAILED, 60001, "Setup of Interface Board failed", "suggest...") \
_D(HW_PKG_CNT_DISAGEE, 60002, "Packet counter disagreements", "suggest...") \
_D(HW_SCB_DISCONNECT, 60003, "Connection to Interface Board lost", "suggest...") \
_D(HW_SCB_PKG_LOST, 60004, "Package lost from Interface Board", "suggest...") \
_D(HW_SCB_CONN_INIT_FAILED, 60005, "Ethernet connection initialization with Interface Board failed", "suggest...") \
_D(HW_LOST_JOINT_PKG, 60006, "Lost package from joint " _PH1_ "", "suggest...") \
_D(HW_LOST_TOOL_PKG, 60007, "Lost package from tool", "suggest...") \
_D(HW_JOINT_PKG_CNT_DISAGREE, 60008, "Packet counter disagreement in packet from joint " _PH1_ "", "suggest...") \
_D(HW_TOOL_PKG_CNT_DISAGREE, 60009, "Packet counter disagreement in packet from tool", "suggest...") \
_D(HW_JOINTS_FAULT, 60011, "" _PH1_ " joint entered the Fault State", "suggest...") \
_D(HW_JOINTS_VIOLATION, 60012, "" _PH1_ " joint entered the Violation State", "suggest...") \
_D(HW_TP_FAULT, 60013, "Teach Pendant entered the Fault State", "suggest...") \
_D(HW_TP_VIOLATION, 60014, "Teach Pendant entered the Violation State", "suggest...") \
_D(HW_JOINT_MV_TOO_FAR, 60021, "" _PH1_ " joint moved too far before robot entered RUNNING State", "suggest...") \
_D(HW_JOINT_STOP_NOT_FAST, 60022, "Joint Not stopping fast enough", "suggest...") \
_D(HW_JOINT_MV_LIMIT, 60023, "Joint moved more than allowable limit", "suggest...") \
_D(HW_FT_SENSOR_DATA_INVALID, 60024, "Force-Torque Sensor data invalid", "suggest...") \
_D(HW_NO_FT_SENSOR, 60025, "Force-Torque sensor is expected, but it cannot be detected", "suggest...") \
_D(HW_FT_SENSOR_NOT_CALIB, 60026, "Force-Torque sensor is detected but not calibrated", "suggest...") \
_D(HW_RELEASE_BRAKE_FAILED, 60030, "Robot was not able to brake release, see log for details", "suggest...") \
_D(HW_OVERCURR_SHUTDOWN, 60040, "Overcurrent shutdown", "suggest...") \
_D(HW_ENERGEY_SURPLUS, 60050, "Energy surplus shutdown", "suggest...") \
_D(HW_IDLE_POWER_HIGH, 60060, "Idle power consumption to high", "suggest...") \
_D(HW_ENTER_COLLISION_TIMEOUT, 60071, "Enter collision stop procedure timeout", "suggest...") \
_D(HW_POWERON_TIMEOUT, 60072, "Poweron robot timeout", "suggest...") \
_D(HW_NO_NIC_FOUND, 60073, "No network cards found.", "suggest...") \
_D(HW_IFB_NOT_FOUND, 60074, "No Interface Board found.", "suggest...") \
_D(HW_IFB_BOOTLOAD, 60075, "The Interface Board is in bootloader mode. Update firmware firstly.", "suggest...") \
_D(HW_TOOL_NOT_FOUND, 60076, "No Tool Board found.", "suggest...") \
_D(HW_BASE_NOT_FOUND, 60077, "No Base Board found.", "suggest...") \
_D(HW_BRINGUP_TIMEOUT, 60078, "Poweron robot timeout", "suggest...") \
_D(HW_COLLISION_RECOVERY_FAILED, 60079, "Collision recovery failed", "suggest...") \
_D(HW_TP_ENABLED, 60080, "Teach pendant enabled status changed to " _PH1_, "suggest...")
// clang-format on
// 定义硬件抽象层的错误代码
#define HAL_ERRORS \
JOINT_ERRORS \
SAFETY_INTERFACE_BOARD_ERRORS \
TOOL_ERRORS \
PEDSTRAL_ERRORS \
HARDWARE_INTERFACE_ERRORS
#endif // AUBO_SDK_JOINT_ERROR_H

View File

@ -0,0 +1,171 @@
/** @file rtm_error.h
* @brief
*/
#ifndef AUBO_SDK_RTM_ERROR_H
#define AUBO_SDK_RTM_ERROR_H
// clang-format off
#define RTM_ERRORS \
_D(ROBOT_BE_PULLING, 30001, "Something is pulling the robot.","Please check TCP configuration,payload and mounting settings") \
_D(PSTOP_ELBOW_POS, 30002, "Protective Stop: Elbow position close to safety plane limits.","Please move robot Elbow joint away from the safety plane") \
_D(PSTOP_STOP_TIME, 30003, "Protective Stop: Exceeding user safety settings for stopping time.","(a) Check speeds and accelerations in the program (b) Check usage of TCP,payload and CoG correctly (c) Check external equipmentactivation if correctly set") \
_D(PSTOP_STOP_DISTANCE, 30004, "Protective Stop: Exceeding user safety settings for stopping distance.","(a) Check speeds and accelerations in the program (b) Check usage of TCP,payload and CoG correctly (c) Check external equipmentactivation if correctly set") \
_D(PSTOP_CLAMP, 30005, "Protective Stop: Danger of clamping between the Robots lower arm and tool.","(a) Check speeds and accelerations in the program (b) Check usage of TCP,payload and CoG correctly (c) Check external equipmentactivation if correctly set") \
_D(PSTOP_POS_LIMIT, 30006, "Protective Stop: Position close to joint limits", "suggest...") \
_D(PSTOP_ORI_LIMIT, 30007, "Protective Stop: Tool orientation close to limits", "suggest...") \
_D(PSTOP_PLANE_LIMIT, 30008, "Protective Stop: Position close to safety plane limits", "suggest...") \
_D(PSTOP_POS_DEVIATE, 30009, "Protective Stop: Position deviates from path", "Check payload, center of gravity and acceleration settings.") \
_D(JOINT_CHK_PAYLOAD, 30010, "Joint " _PH1_ ": Check payload, center of gravity and acceleration settings. Log screen may contain additional information.", "suggest...") \
_D(PSTOP_SINGULARITY, 30011, "Protective Stop: Position in singularity.","Please use MoveJ or change the motion") \
_D(PSTOP_CANNOT_MAINTAIN, 30012, "Protective Stop: Robot cannot maintain its position, check if payload is correct", "suggest...") \
_D(PSTOP_WRONG_PAYLOAD, 30013, "Protective Stop: Wrong payload or mounting detected, or something is pushing the robot when entering Freedrive mode","Verify that the TCP configuration and mounting in the used installation is correct") \
_D(PSTOP_JOINT_COLLISION, 30014, "Protective Stop: Collision detected by joint " _PH1_, "Make sure no objects are in the path of the robot and resume the program") \
_D(PSTOP_POS_DISAGREE, 30015, "Protective stop: The robot was powered off last time due to a joint position disagreement."," (a) Verify that the robot position in the 3D graphics matches the real robot, to ensure that the encoders function before releasing the brakes. Stand back and monitor the robot performing its first program cycle as expected. (b) If the position is not correct, the robot must be repaired. In this case, click Power Off Robot. (c) If the position is correct, please tick the check box below the 3D graphics and click Robot Position Verified") \
_D(TARGET_JOINT_SPEED_EXCEED, 30016, "Target joint speed exceed limits", "suggest...") \
_D(TARGET_POS_SUDDEN_CHG, 30017, "Sudden change in target position", "suggest...") \
_D(SUDDEN_STOP, 30018, "Sudden stop."," To abort a motion, use \"stopj\" or \"stopl\" script commands to generate a smooth deceleration before using \"wait\". Avoid aborting motions between waypoints with blend”") \
_D(ROBOT_STOP_ABNORMAL, 30019, "Robot has not stopped in the allowed reaction and braking time", "suggest...") \
_D(PROG_INVALID_SETP, 30020, "Robot program resulted in invalid setpoint.", "Please review waypoints in the program") \
_D(BLEND_INVALID_SETP, 30021, "Blending failed and resulted in an invalid setpoint.", "Try changing the blend radius or contact technical support") \
_D(APPROACH_SINGULARITY, 30022, "Robot approaching singularity Acceleration threshold failed.","Review waypoints in the program, try using MoveJ instead of MoveL in the position close to singularity") \
_D(TSPEED_UNMATCH_POS, 30023, "Target speed does not match target position", "suggest...") \
_D(INCONSIS_TPOS_SPD, 30024, "Inconsistency between target position and speed", "suggest...") \
_D(JOINT_TSPD_UNMATCH_POS, 30025, "Target joint speed does not match target joint position change Joint " _PH1_ "", "suggest...") \
_D(FIELDBUS_INPUT_DISCONN, 30026, "Fieldbus input disconnected.","Please check fieldbus connections (RTDE, ModBus, EtherNet/IP and Profinet) or disable the fieldbus in the installation. Check RTDE watchdog feature. Check if a URCap is using this feature.") \
_D(OPMODE_CHANGED, 30027, "Operational mode changed: " _PH1_ "", "suggest...") \
_D(NO_KIN_CALIB, 30028, "No Kinematic Calibration found (calibration.conf file is either corrupt or missing).","A new kinematics calibration may be needed if the robot needs to improve its kinematics, otherwise, ignore this message)") \
_D(KIN_CALIB_UNMATCH_JOINT, 30029, "Kinematic Calibration for the robot does not match the joint(s).", "If moving a program from a different robot to this one, rekinematic calibrate the second robot to improve kinematics, otherwise ignore this message.") \
_D(KIN_CALIB_UNMATCH_ROBOT, 30030, "Kinematic Calibration does not match the robot.","Please check if the serial number of the robot arm matches the Control Box") \
_D(JOINT_OFFSET_CHANGED, 30031, "Large movement of the robot detected while it was powered off. The joints were moved while it was powered off, or the encoders do not function", "suggest...") \
_D(OFFSET_CHANGE_HIGH, 30032, "Change in offset is too high", "suggest...") \
_D(JOINT_SPEED_LIMIT, 30033, "Close to joint speed safety limit.", "Review program speed and acceleration") \
_D(TOOL_SPEED_LIMIT, 30034, "Close to tool speed safety limit.", "Review program speed and acceleration") \
_D(MOMENTUM_LIMIT, 30035, "Close to momentum safety limit.", "Review program speed and acceleration") \
_D(ROBOT_MV_STOP, 30036, "Robot is moving when in Stop Mode", "suggest...") \
_D(HAND_PROTECTION, 30037, "Hand protection: Tool is too close to the lower arm: " _PH1_ " meter.","(a) Check wrist position. (b) Verify mounting (c) Do a Complete rebooting sequence (d) Update software (e) Contact your local AUBO Robots service provider for assistance") \
_D(WRONG_SAFETYMODE, 30038, "Wrong safety mode: " _PH1_, "suggest...") \
_D(SAFETYMODE_CHANGED, 30039, "Safety mode changed: " _PH1_, "suggest...") \
_D(JOINT_ACC_LIMIT, 30040, "Close to joint acceleration safety limit", "suggest...") \
_D(TOOL_ACC_LIMIT, 30041, "Close to tool acceleration safety limit", "suggest...") \
_D(JOINT_TEMPERATURE_LIMIT, 30042, "Joint " _PH1_ " temperature too high(>" _PH2_ "℃)", "suggest...") \
_D(CONTROL_BOX_TEMPERATURE_LIMIT, 30043, "Control box temperature too high(>" _PH1_ "℃)", "suggest...") \
_D(ROBOT_EMERGENCY_STOP, 30044, "Robot emergency stop", "suggest...") \
_D(ROBOTMODE_CHANGED, 30045, "Robot mode changed: " _PH1_, "suggest...") \
_D(ROBOTMODE_ERROR, 30046, "Wrong robot mode: " _PH1_, "suggest...") \
_D(POSE_OUT_OF_REACH, 30047, "Target pose [" _PH1_ "] out of reach", "suggest...") \
_D(TP_PLAN_FAILED, 30048, "Trajectory plan FAILED." , "suggest...") \
_D(START_FORCE_FAILED, 30049, "Start force control failed, because force sensor does not exist." , "suggest...") \
_D(OVER_SAFE_PLANE_LIMIT,30050, _PH1_ " axis exceeds the safety plane limit (Move_type:" _PH2_ " id:" _PH3_ ").","Please move the robot to the safety plane range.") \
_D(POWERON_FAIL_VIOLATION,30051, "Failed to power on because the robot safety mode is in violation", "suggest...") \
_D(POWERON_FAIL_SYSTEMEMERGENCYSTOP, 30052, "Failed to power on because the robot safety mode is in system emergency stop", "suggest...") \
_D(POWERON_FAIL_ROBOTEMERGENCYSTOP, 30053, "Failed to power on because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(POWERON_FAIL_FAULT, 30054, "Failed to power on because the robot safety mode is in fault", "suggest...") \
_D(STARTUP_FAIL_VIOLATION, 30055, "Failed to startup because the robot safety mode is in violation", "suggest...") \
_D(STARTUP_FAIL_SYSTEMEMERGENCYSTOP, 30056, "Failed to startup because the robot safety mode is in system emergency stop", "suggest...") \
_D(STARTUP_FAIL_ROBOTEMERGENCYSTOP, 30057, "Failed to startup because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(STARTUP_FAIL_FAULT, 30058, "Failed to startup because the robot safety mode is in fault", "suggest...") \
_D(BACKDRIVE_FAIL_VIOLATION, 30059, "Failed to backdrive because the robot safety mode is in violation", "suggest...") \
_D(BACKDRIVE_FAIL_SYSTEMEMERGENCYSTOP, 30060, "Failed to backdrive because the robot safety mode is in system emergency stop", "suggest...") \
_D(BACKDRIVE_FAIL_ROBOTEMERGENCYSTOP, 30061, "Failed to backdrive because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(BACKDRIVE_FAIL_FAULT, 30062, "Failed to backdrive because the robot safety mode is in fault", "suggest...") \
_D(SETSIM_FAIL_VIOLATION, 30063, "Switch sim mode failed because the robot safety mode is in violation", "suggest...") \
_D(SETSIM_FAIL_SYSTEMEMERGENCYSTOP, 30064, "Switch sim mode failed because the robot safety mode is in system emergency stop", "suggest...") \
_D(SETSIM_FAIL_ROBOTEMERGENCYSTOP, 30065, "Switch sim mode failed because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(SETSIM_FAIL_FAULT, 30066, "Switch sim mode failed because the robot safety mode is in fault", "suggest...") \
_D(FREEDRIVE_FAIL_VIOLATION, 30067, "Enable handguide mode failed because the robot safety mode is in violation", "suggest...") \
_D(FREEDRIVE_FAIL_SYSTEMEMERGENCYSTOP, 30068, "Enable handguide mode failed because the robot safety mode is in system emergency stop", "suggest...") \
_D(FREEDRIVE_FAIL_ROBOTEMERGENCYSTOP, 30069, "Enable handguide mode failed because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(FREEDRIVE_FAIL_FAULT, 30070, "Enable handguide mode failed because the robot safety mode is in fault", "suggest...") \
_D(UPFIRMWARE_FAIL_VIOLATION, 30071, "Firmware update failed because the robot safety mode is in violation", "suggest...") \
_D(UPFIRMWARE_FAIL_SYSTEMEMERGENCYSTOP, 30072, "Firmware update failed because the robot safety mode is in system emergency stop", "suggest...") \
_D(UPFIRMWARE_FAIL_ROBOTEMERGENCYSTOP, 30073, "Firmware update failed because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(UPFIRMWARE_FAIL_FAULT, 30074, "Firmware update failed because the robot safety mode is in fault", "suggest...") \
_D(SETPERSOSTENT_FAIL_VIOLATION, 30075, "Set persistent parameter failed because the robot safety mode is in violation", "suggest...") \
_D(SETPERSOSTENT_FAIL_SYSTEMEMERGENCYSTOP, 30076, "Set persistent parameter failed because the robot safety mode is in system emergency stop", "suggest...") \
_D(SETPERSOSTENT_FAIL_ROBOTEMERGENCYSTOP, 30077, "Set persistent parameter failed because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(SETPERSOSTENT_FAIL_FAULT, 30078, "Set persistent parameter failed because the robot safety mode is in fault", "suggest...") \
_D(SETPERSOSTENT_FAIL_PARAM_ERR, 30079, "Set persistent parameter failed", "(a) Check the parameter format, whether all are floating point numbers") \
_D(ROBOT_CABLE_DISCONN, 30080, "Robot cable not connected", "(a) Make sure the cable between Control Box and Robot Arm is correctly connected and it has no damage. (b) Check for loose connections (c) Do a Complete rebooting sequence (d) Update software (e) Contact your local AUBO Robots service provider for assistance Contact your local AUBO Robots service provider for assistance.") \
_D(TP_TOO_SHORT, 30081, "The generated trajectory is ignored because it is too short", "(a) Please check if the added waypoints are coincident (b) If it is an arc movement, please check whether the three points are collinear") \
_D(INV_KIN_FAIL, 30082, "Inverse kinematics solution failed. The target pose may be in a singular position or exceed the joint limits", "(a) Change the target pose and try moving again") \
_D(FREEDRIVE_ENABLED, 30083, "Freedrive status changed to " _PH1_ "", "suggest...") \
_D(TP_INV_FAIL_REFERENCE_JOINT_OUT_OF_LIMIT, 30084, "Inverse kinematics solution failed. Reference angle [" _PH1_ "] exceeds joint limit [" _PH2_ "].", "suggest...") \
_D(TP_INV_FAIL_NO_SOLUTION, 30085, "Inverse kinematics solution failed. The reference angle [" _PH1_ "] and the target angle [" _PH2_ "] are used as parameters. there is no solution in the calculation of the inverse solution process.", "suggest...")\
_D(SERVO_FAIL_VIOLATION, 30086, "Switch servo mode failed because the robot safety mode is in violation", "suggest...") \
_D(SERVO_FAIL_SYSTEMEMERGENCYSTOP, 30087, "Switch servo mode failed because the robot safety mode is in system emergency stop", "suggest...") \
_D(SERVO_FAIL_ROBOTEMERGENCYSTOP, 30088, "Switch servo mode failed because the robot safety mode is in robot emergency stop", "Pop up the red emergency stop button on the teach pendant when the robot is in a safe range of motion") \
_D(SERVO_FAIL_FAULT, 30089, "Switch servo mode failed because the robot safety mode is in fault", "suggest...") \
_D(FREEDRIVE_FAIL_NO_RUNNING, 30090, "Enable handguide mode failed because the robot mode type is " _PH1_ "(not running)", "suggest...") \
_D(RUNTIME_MACHINE_ERROR, 30091, "The state of the running machine is " _PH1_ ", not " _PH2_ ". " _PH3_ " function execution failed because the state is wrong." , "suggest...") \
_D(RESUME_FAR_PAUSE_PT, 30092, "Cannot resume from joint position [" _PH1_ "].\\nToo far away from paused point [" _PH2_ "]." , "suggest...") \
_D(PAYLOAD_LIGHTER_ERROR, 30093, "The payload setting is too small!" , "suggest...") \
_D(PAYLOAD_OVERLOAD_ERROR, 30094, "The payload setting is too large!" , "suggest...") \
_D(PAUSE_FAIL_NOT_POSITION_PLAN_MODE, 30095, "This motion does not support the pause function. The motion is stopping." , "suggest...") \
_D(TP_PLAN_FAILED_CIRCULAR_WAYPOINTS_COINCIDE, 30096, "The planning failed because the three waypoints of the arc were determined to coincide." , "Check the circular waypoints to make sure they are different.") \
_D(SERVO_WRONG_SAFETYMODE, 30097, "Switch servo mode failed because the robot safety mode is in " _PH1_ "." , "Check the circular waypoints to make sure they are different.") \
_D(SET_PERSTPARAM_WRONG_SAFETYMODE, 30098, "Set persistent parameter failed because the robot safety mode is in " _PH1_ , "suggest...") \
_D(SET_KINPARAM_WRONG_SAFETYMODE, 30099, "Set Kinematics Compensate parameters failed because the robot safety mode is in " _PH1_ , "suggest...") \
_D(SET_ROBOT_ZERO_WRONG_SAFETYMODE, 30100, "Set current joint angles to zero failed because the robot safety mode is in " _PH1_ , "suggest...") \
_D(UPFIRMWARE_WRONG_SAFETYMODE, 30101, "Firmware update failed because the robot safety mode is in " _PH1_, "suggest...") \
_D(POWERON_WRONG_SAFETYMODE, 30102, "Failed to power on because the robot safety mode is in " _PH1_, "suggest...") \
_D(STARTUP_WRONG_SAFETYMODE, 30103, "Failed to startup because the robot safety mode is in " _PH1_, "suggest...") \
_D(BACKDRIVE_WRONG_SAFETYMODE, 30104, "Failed to backdrive because the robot safety mode is in system emergency stop", "suggest...") \
_D(SETSIM_WRONG_SAFETYMODE, 30105, "Switch sim mode failed because the robot safety mode is in violation", "suggest...") \
_D(FREEDRIVE_WRONG_SAFETYMODE, 30106, "Enable handguide mode failed because the robot safety mode is in wrong safety mode: " _PH1_, "suggest...") \
_D(TP_PLAN_FAILED_JOINT_JUMP_BIGGER, 30107, "Inverse kinematics solution failed. The target point and the current point are in different robot configuration spaces.", "Add a few more points between the target point and the current point.") \
_D(RUN_PROGRAM_FAILED, 30108, "Run program " _PH1_ " failed.", "suggset...") \
_D(FREEDRIVE_FAIL_WRONG_RTMSTATE, 30109, "Unable to enter the HandGuide mode as the robot is not currently in a stopped or paused state.", "suggset...") \
_D(SAFEGUARDSTOP_CONFIGURABLE_INPUT, 30110, "Configurable safety input is triggered.", "suggset...") \
_D(SAFEGUARDSTOP_3PE, 30111, "3PE is triggered.", "suggset...") \
_D(SAFEGUARDSTOP_SI, 30112, "SI0/SI1 is triggered.", "suggset...") \
_D(ROBOT_TYPE_CHANGED, 30200, "Robot type changed to '" _PH1_ "', and robot subtype changed to '" _PH2_ "'", "suggest...") \
_D(LINKMODE_CHANGED, 30201, "Link mode changed to " _PH1_ "", "suggest...") \
_D(ROBOT_SELF_COLLISION, 30301, "Detect risk of robot self collision", "suggest...") \
_D(CONSTANT_INVALID, 30302, "Joint torque constants are invalid. HandGuide will be disabled, and the collision protection may be triggered by mistake.", "suggest...") \
_D(GRAVITY_INVALID, 30303, "Abnormal value of gravity acceleration sensor. HandGuide will be disabled, and the collision protection may be triggered by mistake.", "suggest...") \
_D(DYNAMICS_INVALID, 30304, "Robot dynamics parameters are invalid. HandGuide will be disabled, and the collision protection may be triggered by mistake.", "suggest...") \
_D(FRICTION_INVALID, 30305, "Joint friction parameters are invalid. HandGuide will be disabled, and the collision protection may be triggered by mistake.", "suggest...") \
_D(HANDGUIDE_UNDER_DEVELOP, 30306, "Robot type of " _PH1_ " function under development. HandGuide will be disabled, and the collision protection may be triggered by mistake.", "suggest...") \
_D(SLOW_DOWN_INFO, 30307, "Slow down level changed to " _PH1_ "(" _PH2_ "%)", "suggest...") \
_D(WRONG_JOINT_DESIGNED_LIMIT, 30308, "Joint designed ranges exceeds ranges read from hardware interface.", "suggest...") \
_D(FREEDRIVE_IN_SIMULATION, 30309, "Enable handguide mode failed because the robot is in simulation mode.", "suggest...") \
_D(ROBOT_STOPPING_TIMEOUT, 30310, "Robot stopping timeout.", "suggest...") \
_D(PSTOP_INCORRECT_FORCE_OFFSET, 30311, "Protective Stop: Sudden change in force control target position. Force sensor offset may be incorrect or force sensor fault.", "suggest...") \
_D(WRONG_JOINT_SAFETY_LIMIT, 30312, "Joint safety ranges exceeds designed ranges.", "suggest...") \
_D(PSTOP_TCP_PLANE_VIOLATION, 30401, "Protective Stop: TCP position close to safety plane limits.", "suggest...") \
_D(PSTOP_ELBOW_PLANE_VIOLATION, 30402, "Protective Stop: elbow position close to safety plane limits.", "suggest...") \
_D(PSTOP_JOINT_TORQUE_VIOLATION, 30403, "Protective Stop: joint" _PH1_ " exceeds torque limit.", "suggest...") \
_D(PSTOP_JOINT_POSITION_VIOLATION, 30404, "Protective Stop: joint" _PH1_ " exceeds position limit.", "suggest...") \
_D(PSTOP_JOINT_SPEED_VIOLATION, 30405, "Protective Stop: joint" _PH1_ " exceeds speed limit.", "suggest...") \
_D(PSTOP_TCP_SPEED_VIOLATION, 30406, "Protective Stop: TCP speed close to safety limits.", "suggest...") \
_D(PSTOP_ELBOW_SPEED_VIOLATION, 30407, "Protective Stop: elbow speed close to safety limits.", "suggest...") \
_D(PSTOP_TCP_FORCE_VIOLATION, 30408, "Protective Stop: TCP foece close to safety limits.", "suggest...") \
_D(PSTOP_ELBOW_TORQUE_VIOLATION, 30409, "Protective Stop: elbow torque close to safety limits.", "suggest...") \
_D(PSTOP_POWER_VIOLATION, 30410, "Protective Stop: robot power close to safety limits.", "suggest...") \
_D(PSTOP_MOMENTUM_VIOLATION, 30411, "Protective Stop: robot momentum close to safety limits.", "suggest...") \
_D(PSTOP_TCP_CUBE_VIOLATION, 30412, "Protective Stop: TCP position close to safety cube.", "suggest...") \
_D(PSTOP_ELBOW_CUBE_VIOLATION, 30413, "Protective Stop: TCP position close to safety cube.", "suggest...") \
_D(REDUCE_ELBOW_PLANE_TRIGGER, 30414, "Reduce mode: elbow close to safety plane triggers reduction mode.", "suggest...") \
_D(REDUCE_TCP_PLANE_TRIGGER, 30415, "Reduce mode: TCP close to safety plane triggers reduction mode.", "suggest...") \
_D(PSTOP_MOVE_OUT_RANGE, 30416, "Joint " _PH1_ " has exceeded the limit, please do not continue to move out of the range", "suggest...") \
_D(RESUME_PAUSE_FAILED, 30417, "Resume Failed: Safety mode type is " _PH1_ "", "suggest...") \
_D(FIRMWARE_UPDATE_FAIL_EMERGENCYSTOP, 30418, "Failed to firmware update because the robot safety mode is in " _PH1_ , "Release emergency stop when the robot is in a safe range of motion") \
_D(TOOL_SENSOR_CHANGED, 30419, "Tool sensor type changed to " _PH1_ "", "suggest...") \
_D(TOOL_SENSOR_REMOVED, 30420, "Tool sensor is removed.", "suggest...") \
_D(CAL_TARGET_CURRENT_ERR, 30421, "The calculation of the target current failed. Please try again later.", "suggest...") \
_D(CONVEYOR_MODE_CHANGED, 30422, "Conveyor" _PH1_ ": track mode changed to " _PH2_ ", track item id is " _PH3_, "suggest...") \
_D(CONVEYOR_ENQUEUE, 30423, "Conveyor" _PH1_ ": the queue has been changed, item" _PH2_ " is enqueue", "suggest...") \
_D(CONVEYOR_DEQUEUE_FINISH, 30424, "Conveyor" _PH1_ ": the queue has been changed, item" _PH2_ " dequeue due to track finished", "suggest...") \
_D(CONVEYOR_DEQUEUE_STARTWINDOW, 30425, "Conveyor" _PH1_ ": the queue has been changed, item" _PH2_ " dequeue due to exceeds startwindow", "suggest...") \
_D(CONVEYOR_DEQUEUE_LIMIT, 30426, "Conveyor" _PH1_ ": the queue has been changed, item" _PH2_ " dequeue due to exceed limit area", "suggest...") \
_D(CONVEYOR_DEQUEUE_CLEAR, 30427, "Conveyor" _PH1_ ": item queue is cleared", "suggest...") \
_D(CONVEYOR_NEXT_TRACK, 30428, "Conveyor" _PH1_ ": item" _PH2_ " inside the start window that can be tracked ", "suggest...") \
_D(CONVEYOR_EXCEED_LIMIT, 30429, "Conveyor" _PH1_ ": item" _PH2_ " exceeds the limit area during tracking", "suggest...") \
_D(WRONG_POWER_SAFETY_LIMIT, 30430, "Robot power safety value exceeds designed value.", "suggest...") \
_D(WRONG_POWER_DESIGNED_LIMIT, 30431, "Power designed value exceeds value read from hardware interface.", "suggest...") \
_D(TOOL_SENSOR_STATUS_CHANGED, 30432, "Tool sensor status changed to " _PH1_, "suggest...")
// clang-format on
#endif // AUBO_SDK_RTM_ERROR_H

View File

@ -0,0 +1,56 @@
/** @file system_error.h
* @brief
*/
#ifndef AUBO_SDK_SYSTEM_ERROR_H
#define AUBO_SDK_SYSTEM_ERROR_H
#define SYSTEM_ERRORS \
_D(DEBUG, 0, "Debug message " _PH1_, "suggest...") \
_D(POPUP, 1, "Popup title: " _PH1_ ", msg: " _PH2_ ", mode: " _PH3_, \
"suggest...") \
_D(POPUP_DISMISS, 2, _PH1_, "suggest...") \
_D(SYSTEM_HALT, 3, _PH1_, "suggest...") \
_D(INV_ARGUMENTS, 4, "Invalid arguments.", "suggest...") \
_D(USER_NOTIFY, 5, _PH1_, "suggest...") \
_D(MODBUS_SIGNAL_CREATED, 10, "Modbus signal " _PH1_ " created.", \
"suggest...") \
_D(MODBUS_SIGNAL_REMOVED, 11, "Modbus signal " _PH1_ " removed.", \
"suggest...") \
_D(MODBUS_SIGNAL_VALUE_CHANGED, 12, \
"Modbus signal " _PH1_ " value changed to " _PH2_, "suggest...") \
_D(RUNTIME_CONTEXT, 13, \
"tid: " _PH1_ " lineno: " _PH2_ " index: " _PH3_ " comment: " _PH4_, \
"suggest...") \
_D(INTERP_CONTEXT, 14, \
"tid: " _PH1_ " lineno: " _PH2_ " index: " _PH3_ " comment: " _PH4_, \
"suggest...") \
_D(PROGRAM_LOADED, 15, "program loaded: " _PH1_, "suggest...") \
_D(TASK_DELETED, 16, "tid: " _PH1_, " was deleted") \
_D(MODBUS_SLAVE_BIT, 20, "Modbus slave address: " _PH1_ " value " _PH2_, \
"suggest...") \
_D(MODBUS_SLAVE_REG, 21, "Modbus slave address: " _PH1_ " value " _PH2_, \
"suggest...") \
_D(PNIO_SLAVE_SLOT_VALUE, 30, \
"PNIO slot: " _PH1_ " subslot " _PH2_ " index " _PH3_ " value " _PH4_, \
"suggest...") \
_D(PNIO_CONNECT_STATUS, 31, "PNIO connection status changed to " _PH1_, \
"suggest...") \
_D(PNIO_DEVICE_NAME, 32, "PNIO device name changed to " _PH1_, \
"suggest...") \
_D(PNIO_IP, 33, "PNIO ip " _PH1_ " mask " _PH2_ " gateway " _PH3_, \
"suggest...") \
_D(ICM_SERVER_STATUS, 40, " ICM server status changed to " _PH1_, \
"suggest...") \
_D(EIP_X, 50, "ICM slot: " _PH1_ " index " _PH2_ " subindex " _PH3_, \
"suggest...") \
_D(LOG_PROGRAM_SUCCESS, 100, \
"[" _PH1_ "] Load program " _PH2_ " successful", "suggest...") \
_D(LOG_PROGRAM_FAILED, 101, \
"[" _PH1_ "] Load program " _PH2_ " failed, file not found", \
"suggest...") \
_D(LOG_PROGRAM_FAILED2, 102, \
"[" _PH1_ "] Load program " _PH2_ \
" failed, configuration file (.ins) does not match", \
"suggest...")
#endif // AUBO_SDK_SYSTEM_ERROR_H

View File

@ -0,0 +1,178 @@
/*
global_config.h
this file is generated. Do not change!
*/
#ifndef ARCS_GLOBALCONFIG_H
#define ARCS_GLOBALCONFIG_H
/* #undef ARCS_BUILD_SHARED_LIBS */
/* #undef ARCS_ENABLE_THREADING_SUPPORT */
//-------------------------------------------------------------------
// Header Availability
//-------------------------------------------------------------------
/* #undef ARCS_HAVE_CXXABI_H */
//-------------------------------------------------------------------
// Version information
//-------------------------------------------------------------------
#define INTERFACE_VERSION_MAJOR 0
#define INTERFACE_VERSION_MINOR 26
#define INTERFACE_VERSION_PATCH 0
#define INTERFACE_VERSION "0.26.0"
//-------------------------------------------------------------------
// Platform defines
//-------------------------------------------------------------------
#if defined(__APPLE__)
#define ARCS_PLATFORM_APPLE
#endif
#if defined(__linux__)
#define ARCS_PLATFORM_LINUX
#endif
#if defined(_WIN32) || defined(_WIN64)
#define ARCS_PLATFORM_WINDOWS
#else
#define ARCS_PLATFORM_POSIX
#endif
/* #undef ARCS_BIG_ENDIAN */
/* #undef ARCS_LITTLE_ENDIAN */
#define ARCS_LIB_PREFIX "lib"
#define ARCS_LIB_EXT ".so"
#define ARCS_EXE_EXT ""
#ifdef NDEBUG // Defined by cmake UNLESS Debug build type is chosen
#define ARCS_LIB_POSTFIX ""
#else
#define ARCS_LIB_POSTFIX \
"" // Set in top level CMakeList.txt
#endif
#define ARCS_FUNCTION // 函数接口
#define ARCS_INSTRUCT // 指令接口
///-------------------------------------------------------------------
// Macros for import/export declarations
//-------------------------------------------------------------------
#if defined(ARCS_PLATFORM_WINDOWS)
#define ARCS_ABI_EXPORT __declspec(dllexport)
#define ARCS_ABI_IMPORT __declspec(dllimport)
#define ARCS_ABI_LOCAL
#elif defined(ARCS_HAVE_VISIBILITY_ATTRIBUTE)
#define ARCS_ABI_EXPORT __attribute__((visibility("default")))
#define ARCS_ABI_IMPORT __attribute__((visibility("default")))
#define ARCS_ABI_LOCAL __attribute__((visibility("hidden")))
#else
#define ARCS_ABI_EXPORT
#define ARCS_ABI_IMPORT
#define ARCS_ABI_LOCAL
#endif
#ifdef ARCS_BUILDING_STAGE
#define ARCS_ABI ARCS_ABI_EXPORT
#else
#define ARCS_ABI ARCS_ABI_IMPORT
#endif
//-------------------------------------------------------------------
// Macros for suppressing warnings
//-------------------------------------------------------------------
#ifdef _MSC_VER
#define ARCS_MSVC_PUSH_DISABLE_WARNING(wn) \
__pragma(warning(push)) __pragma(warning(disable : wn))
#define ARCS_MSVC_POP_WARNING __pragma(warning(pop))
#define ARCS_MSVC_DISABLE_WARNING(wn) __pragma(warning(disable : wn))
#else
#define ARCS_MSVC_PUSH_DISABLE_WARNING(wn)
#define ARCS_MSVC_POP_WARNING
#define ARCS_MSVC_DISABLE_WARNING(wn)
#endif
#ifdef __GNUC__
#define aubo_gcc_pragma_expand(x) _Pragma(#x)
#define ARCS_GCC_PUSH_DISABLE_WARNING(wn) \
_Pragma("GCC diagnostic push") \
aubo_gcc_pragma_expand(GCC diagnostic ignored "-W" #wn)
#define ARCS_GCC_POP_WARNING _Pragma("GCC diagnostic pop")
#else
#define ARCS_GCC_PUSH_DISABLE_WARNING(wn)
#define ARCS_GCC_POP_WARNING
#endif
#if defined(__GNUC__)
#define ARCS_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define ARCS_DEPRECATED __declspec(deprecated)
#else
#pragma message( \
"WARNING: You need to implement ARCS_DEPRECATED for your compiler!")
#define ARCS_DEPRECATED
#endif
// Do not warn about the usage of deprecated unsafe functions
ARCS_MSVC_DISABLE_WARNING(4996)
// Mark a variable or expression result as unused
#define ARCS_UNUSED(x) (void)(x)
//-------------------------------------------------------------------
// C++ Language features
//-------------------------------------------------------------------
/* #undef ARCS_HAVE_THREAD_LOCAL */
//-------------------------------------------------------------------
// C++ Library features
//-------------------------------------------------------------------
/* #undef ARCS_HAVE_REGEX */
//-------------------------------------------------------------------
// Hash Container
//-------------------------------------------------------------------
#define ARCS_HASH_FUNCTION_BEGIN(type) \
namespace std { \
template <> \
struct hash<type> \
{ \
std::size_t operator()(const type &arg) const \
{
#define ARCS_HASH_FUNCTION_END \
} \
} \
; \
}
//-------------------------------------------------------------------
// Utility macros
//-------------------------------------------------------------------
#define ARCS_STR_(x) #x
#define ARCS_STR(x) ARCS_STR_(x)
#define ARCS_CONCAT_(x, y) x##y
#define ARCS_CONCAT(x, y) ARCS_CONCAT_(x, y)
//-------------------------------------------------------------------
// Backwards compatibility macros
//-------------------------------------------------------------------
#if !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
#define ARCS_FUTURE_READY true
#define ARCS_FUTURE_TIMEOUT false
#else
#define ARCS_FUTURE_READY std::future_status::ready
#define ARCS_FUTURE_TIMEOUT std::future_status::timeout
#endif
#endif // ARCS_GLOBALCONFIG_H

View File

@ -0,0 +1,909 @@
/** @file math.h
* \~chinese @brief 姿
* \~english @brief Mathematic operation interface, such as euler to quaternion conversion, addition/subtraction of poses
*/
#ifndef AUBO_SDK_MATH_INTERFACE_H
#define AUBO_SDK_MATH_INTERFACE_H
#include <vector>
#include <memory>
#include <aubo/type_def.h>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT Math
{
public:
Math();
virtual ~Math();
/**
* \english
* Pose addition
*
* Both arguments contain three position parameters (x, y, z) jointly called
* P, and three rotation parameters (R_x, R_y, R_z) jointly called R. This
* function calculates the result x_3 as the addition of the given poses as
* follows:
*
* p_3.P = p_1.P + p_2.P
*
* p_3.R = p_1.R * p_2.R
*
* @param p1 Tool pose 1
* @param p2 Tool pose 2
* @return sum of position parts and product of rotation parts (pose)
*
* @par Python interface prototype
* poseAdd(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua interface prototype
* poseAdd(p1: table, p2: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseAdd","params":[[0.2, 0.5, 0.1, 1.57,
* 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.4,1.0,0.7,3.14,-0.0,0.0]}
* \endengish
*
* \chinese
* 姿
* xyzP
* R_xR_yR_zR
* p_3姿
* p_3.P = p_1.P + p_2.P,
* p_3.R = p_1.R * p_2.R
*
* @param p1 姿1pose
* @param p2 姿2pose
* @return pose
*
* @par Python函数原型
* poseAdd(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua函数原型
* poseAdd(p1: table, p2: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseAdd","params":[[0.2, 0.5, 0.1, 1.57,
* 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.4,1.0,0.7,3.14,-0.0,0.0]}
* \endchinese
*/
std::vector<double> poseAdd(const std::vector<double> &p1,
const std::vector<double> &p2);
/**
* \chinese
* 姿
*
* xyzP
* R_xR_yR_zR
* p_3姿
* p_3.P = p_1.P - p_2.P,
* p_3.R = p_1.R * p_2.R.inverse
*
* @param p1 姿1
* @param p2 姿2
* @return 姿
*
* @par Python函数原型
* poseSub(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua函数原型
* poseSub(p1: table, p2: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseSub","params":[[0.2, 0.5, 0.1, 1.57,
* 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.0,0.0,-0.5,0.0,-0.0,0.0]}
* \endchinese
*
* \english
* Pose subtraction
*
* Both arguments contain three position parameters (x, y, z) jointly called
* P, and three rotation parameters (R_x, R_y, R_z) jointly called R. This
* function calculates the result x_3 as the addition of the given poses as
* follows:
*
* p_3.P = p_1.P - p_2.P,
*
* p_3.R = p_1.R * p_2.R.inverse
*
* @param p1 tool pose 1
* @param p2 tool pose 2
* @return difference between two poses
*
* @par Python interface prototype
* poseSub(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua interface prototype
* poseSub(p1: table, p2: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseSub","params":[[0.2, 0.5, 0.1, 1.57,
* 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.0,0.0,-0.5,0.0,-0.0,0.0]}
* \endenglish
*/
std::vector<double> poseSub(const std::vector<double> &p1,
const std::vector<double> &p2);
/**
* \chinese
* 线
*
* @param p1 TCP位姿
* @param p2 TCP位姿
* @param alpha
* 0<alpha<1p1和p2两点直线的之间靠近p1端且占总路径比例为alpha的点
* alpha=0.3,p1那端30
* alpha>1,p2
* alpha<0,p1
* @return
*
* @par Python函数原型
* interpolatePose(self: pyaubo_sdk.Math, arg0: List[float], arg1:
* List[float], arg2: float) -> List[float]
*
* @par Lua函数原型
* interpolatePose(p1: table, p2: table, alpha: number) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.interpolatePose","params":[[0.2, 0.2,
* 0.4, 0, 0, 0],[0.2, 0.2, 0.6, 0, 0, 0],0.5],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.2,0.2,0.5,0.0,-0.0,0.0]}
* \endchinese
*
* \english
* Calculate linear interpolation
*
* @param p1 starting TCP pose
* @param p2 ending TCP pose
* @param alpha coefficient;
* When 0<alpha<1return a point between p1 & p2 that is closer to p1, at alpha percentage of the path
* For example when alpha=0.3,point returned is closer to p1at 30% of the total distance;
* When alpha>1, return p2
* When alpha<0,return p1
* @return interpolation result
*
* @par Python interface prototype
* interpolatePose(self: pyaubo_sdk.Math, arg0: List[float], arg1:
* List[float], arg2: float) -> List[float]
*
* @par Lua interface prototype
* interpolatePose(p1: table, p2: table, alpha: number) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.interpolatePose","params":[[0.2, 0.2,
* 0.4, 0, 0, 0],[0.2, 0.2, 0.6, 0, 0, 0],0.5],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.2,0.2,0.5,0.0,-0.0,0.0]}
* \endenglish
*
*/
std::vector<double> interpolatePose(const std::vector<double> &p1,
const std::vector<double> &p2,
double alpha);
/**
* \chinese
* 姿
*
* p_from p_from_to
* p_from
* p_from_to后的位姿
*
*
* p_from_to p_from
* 姿 p_from p_from_to
* 姿
*
* T_world->to = T_world->from * T_from->to
* T_x->to = T_x->from * T_from->to
*
* 姿姿姿姿姿
*
* B相对于A的位姿C相对于B的位姿C相对于A的位姿
* B相对于A的位姿C相对于B的位姿
* C相对于A的位姿
*
* @param pose_from 姿
* @param pose_from_to 姿姿
* @return 姿 ()
*
* @par Python函数原型
* poseTrans(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua函数原型
* poseTrans(pose_from: table, pose_from_to: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseTrans","params":[[0.2, 0.5,
* 0.1, 1.57, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.4,-0.09960164640373415,0.6004776374923573,3.14,-0.0,0.0]}
* \endchinese
*
* \english
* Pose transformation
*
* The first argument, p_from, is used to transform the second argument,
* p_from_to, and the result is then returned. This means that the result is
* the resulting pose, when starting at the coordinate system of p_from, and
* then in that coordinate system moving p_from_to.
*
* This function can be seen in two different views. Either the function
* transforms, that is translates and rotates, p_from_to by the parameters
* of p_from. Or the function is used to get the resulting pose, when first
* making a move of p_from and then from there, a move of p_from_to. If the
* poses were regarded as transformation matrices, it would look like:
*
* T_world->to = T_world->from * T_from->to
* T_x->to = T_x->from * T_from->to
*
*
* These two equations describes the foundations for pose transformation.
* Based on a starting pose and the pose transformation relative to the starting pose, we can get the target pose.
*
* For example, we know pose of B relative to A, pose of C relative to B, find pose of C relative to A.
* param 1 is pose of B relative to Aparam 2 is pose of C relative to B
* the return value is the pose of C relative to A
*
* @param pose_from starting posevector in 3D space
* @param pose_from_to pose transformation relative to starting posevector in 3D space
* @return final pose (vector in 3D space)
*
* @par Python interface prototype
* poseTrans(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
* List[float]
*
* @par Lua interface prototype
* poseTrans(pose_from: table, pose_from_to: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseTrans","params":[[0.2, 0.5,
* 0.1, 1.57, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.4,-0.09960164640373415,0.6004776374923573,3.14,-0.0,0.0]}
* \endenglish
*/
std::vector<double> poseTrans(const std::vector<double> &pose_from,
const std::vector<double> &pose_from_to);
/**
* \english
* Pose inverse transformation
*
* Given pose of C relative to A, pose of C relative to B, find pose of B relative to A.
* param 1 is pose of C relative to Aparam 2 is pose of C relative to B
* the return value is the pose of B relative to A
*
* @param pose_from starting pose
* @param pose_to_from pose transformation relative to final pose
* @return resulting pose
*
* @par Python interface prototype
* poseTransInv(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
* -> List[float]
*
* @par Lua interface prototype
* poseTransInv(pose_from: table, pose_to_from: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseTransInv","params":[[0.4, -0.0996016,
* 0.600478, 3.14, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.2,0.5000000464037341,0.10000036250764266,1.57,-0.0,0.0]}
* \endenglish
*
* \chinese
* 姿
*
* C相对于A的位姿C相对于B的位姿B相对于A的位姿
* C相对于A的位姿C相对于B的位姿
* B相对于A的位姿
*
* @param pose_from 姿
* @param pose_to_from 姿姿
* @return 姿
*
* @par Python函数原型
* poseTransInv(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
* -> List[float]
*
* @par Lua函数原型
* poseTransInv(pose_from: table, pose_to_from: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseTransInv","params":[[0.4, -0.0996016,
* 0.600478, 3.14, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.2,0.5000000464037341,0.10000036250764266,1.57,-0.0,0.0]}
* \endchinese
*/
std::vector<double> poseTransInv(const std::vector<double> &pose_from,
const std::vector<double> &pose_to_from);
/**
* \chinese
* 姿
*
* @param pose 姿
* @return 姿
*
* @par Python函数原型
* poseInverse(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua函数原型
* poseInverse(pose: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseInverse","params":[[0.2, 0.5,
* 0.1, 1.57, 0, 3.14]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.19920341988726448,-0.09960155178838484,-0.5003973704832628,
* 1.5699999989900404,-0.0015926530848129354,-3.1415913853161266]}
*
* \endchinese
*
* \english
* Get the inverse of a pose
*
* @param pose tool pose (spatial vector)
* @return inverse tool pose transformation (spatial vector)
*
* @par Python interface prototype
* poseInverse(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua interface prototype
* poseInverse(pose: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseInverse","params":[[0.2, 0.5,
* 0.1, 1.57, 0, 3.14]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.19920341988726448,-0.09960155178838484,-0.5003973704832628,
* 1.5699999989900404,-0.0015926530848129354,-3.1415913853161266]}
* \endenglish
*
*/
std::vector<double> poseInverse(const std::vector<double> &pose);
/**
* \chinese
* 姿
*
* @param p1 姿1
* @param p2 姿2
* @return 姿
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
* 0.3142, 0.0, 1.571],[0.2, 0.5, 0.6, 0, -0.172, 0.0]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0.5477225575051661}
* \endchinese
*
* \english
* Calculate distance between two poses
*
* @param p1 pose 1
* @param p2 pose 2
* @return distance between the poses
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
* 0.3142, 0.0, 1.571],[0.2, 0.5, 0.6, 0, -0.172, 0.0]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0.5477225575051661}
* \endenglish
*
*/
double poseDistance(const std::vector<double> &p1,
const std::vector<double> &p2);
/**
* \chinese
* 姿
*
* @param p1 姿1
* @param p2 姿2
* @return
* \endchinese
*
* \english
* Calculate axis-angle difference between two poses
*
* @param p1 pose 1
* @param p2 pose 2
* @return axis angle difference
* \endenglish
*/
double poseAngleDistance(const std::vector<double> &p1,
const std::vector<double> &p2);
/**
* \chinese
* 姿
*
* @param p1 姿1
* @param p2 姿2
* @param eps
* @return truefalse
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
* 0.3142, 0.0, 1.571],[0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0.0}
* \endchinese
*
* \english
* Determine if two poses are equivalent
*
* @param p1 pose 1
* @param p2 pose 2
* @param eps error margin
* @return true or false
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
* 0.3142, 0.0, 1.571],[0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0.0}
* \endenglish
*/
bool poseEqual(const std::vector<double> &p1, const std::vector<double> &p2,
double eps = 5e-5);
/**
* \chinese
* @param F_b_a_old
* @param V_in_a
* @param type
* @return
*
* @par Python函数原型
* transferRefFrame(self: pyaubo_sdk.Math, arg0: List[float], arg1:
* List[float[3]], arg2: int) -> List[float]
*
* @par Lua函数原型
* transferRefFrame(F_b_a_old: table, V_in_a: table, type: number) -> table
* \endchinese
*
* \english
* @param F_b_a_old
* @param V_in_a
* @param type
* @return
*
* @par Python interface prototype
* transferRefFrame(self: pyaubo_sdk.Math, arg0: List[float], arg1:
* List[float[3]], arg2: int) -> List[float]
*
* @par Lua interface prototype
* transferRefFrame(F_b_a_old: table, V_in_a: table, type: number) -> table
* \endenglish
*/
std::vector<double> transferRefFrame(const std::vector<double> &F_b_a_old,
const Vector3d &V_in_a, int type);
/**
* \chinese
* 姿
*
* @param pose
* @param rotv
* @return
*
* @par Python函数原型
* poseRotation(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
* -> List[float]
*
* @par Lua函数原型
* poseRotation(pose: table, rotv: table) -> table
* \endchinese
*
* \english
* Pose rotation
*
* @param pose
* @param rotv
* @return
*
* @par Python interface prototype
* poseRotation(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
* -> List[float]
*
* @par Lua interface prototype
* poseRotation(pose: table, rotv: table) -> table
* \endenglish
*/
std::vector<double> poseRotation(const std::vector<double> &pose,
const std::vector<double> &rotv);
/**
* \chinese
*
*
* @param rpy
* @return
*
* @par Python函数原型
* rpyToQuaternion(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua函数原型
* rpyToQuaternion(rpy: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.rpyToQuaternion","params":[[0.611, 0.785,
* 0.960]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.834721517970497,0.07804256900772265,0.4518931575790371,0.3048637712043723]}
* \endchinese
*
* \english
* Euler angles to quaternions
*
* @param rpy euler angles
* @return quaternions
*
* @par Python interface prototype
* rpyToQuaternion(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua interface prototype
* rpyToQuaternion(rpy: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.rpyToQuaternion","params":[[0.611, 0.785,
* 0.960]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.834721517970497,0.07804256900772265,0.4518931575790371,0.3048637712043723]}
* \endenglish
*/
std::vector<double> rpyToQuaternion(const std::vector<double> &rpy);
/**
* \chinese
*
*
* @param quat
* @return
*
* @par Python函数原型
* quaternionToRpy(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua函数原型
* quaternionToRpy(quat: table) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.quaternionToRpy","params":[[0.834722,
* 0.0780426, 0.451893, 0.304864]],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[0.6110000520523781,0.7849996877683915,0.960000543982093]}
* \endchinese
*
* \english
* Quaternions to euler angles
*
* @param quat quaternions
* @return euler angles
*
* @par Python interface prototype
* quaternionToRpy(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
*
* @par Lua interface prototype
* quaternionToRpy(quat: table) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.quaternionToRpy","params":[[0.834722,
* 0.0780426, 0.451893, 0.304864]],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[0.6110000520523781,0.7849996877683915,0.960000543982093]}
* \endenglish
*/
std::vector<double> quaternionToRpy(const std::vector<double> &quat);
/**
* \chinese
* TCP偏移
*
* 姿
*
*
* @param poses 姿
* @return TCP标定结果和标定结果是否有效
*
* @par Python函数原型
* tcpOffsetIdentify(self: pyaubo_sdk.Math, arg0: List[List[float]]) ->
* Tuple[List[float], int]
*
* @par Lua函数原型
* tcpOffsetIdentify(poses: table) -> table
* \endchinese
*
* \english
* Four point method calibration for TCP offset
*
* About a sharp point, move the robot's tcp in four different poses. Difference between each pose should be drastic.
* Result can be obtained based on these four poses
*
* @param poses combination of four different poses
* @return TCP calibration result and whether successfull
*
* @par Python interface prototype
* tcpOffsetIdentify(self: pyaubo_sdk.Math, arg0: List[List[float]]) ->
* Tuple[List[float], int]
*
* @par Lua interface prototype
* tcpOffsetIdentify(poses: table) -> table
* \endenglish
*/
ResultWithErrno tcpOffsetIdentify(
const std::vector<std::vector<double>> &poses);
/**
* \chinese
*
*
* @param poses 姿
* @param type :\n
* 0 - oxy x轴正方向 xy平面y轴正方向\n
* 1 - oxz x轴正方向 xz平面z轴正方向\n
* 2 - oyz y轴正方向 yz平面z轴正方向\n
* 3 - oyx y轴正方向 yx平面x轴正方向\n
* 4 - ozx z轴正方向 zx平面x轴正方向\n
* 5 - ozy z轴正方向 zy平面y轴正方向\n
* @return
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.calibrateCoordinate","params":[[[0.55462,0.06219,0.37175,-3.142,0.0,1.580],
* [0.63746,0.11805,0.37175,-3.142,0.0,1.580],[0.40441,0.28489,0.37174,-3.142,0.0,1.580]],0],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[[0.55462,0.06219,0.37175,-3.722688983883945e-05,-1.6940658945086007e-21,0.5932768162455785],0]}
* \endchinese
*
* \english
* Calibrate coordinate system with 3 points
*
* @param poses set of 3 poses
* @param type type:\n
* 0 - oxy origin, +x axis, xy plane (+y direction) \n
* 1 - oxz origin, +x axis, xz plane (+z direction) \n
* 2 - oyz origin, +y axis, yz plane (+z direction) \n
* 3 - oyx origin, +y axis, yx plane (+x direction) \n
* 4 - ozx origin, +z axis, zx plane (+x direction) \n
* 5 - ozy origin, +z axis, zy plane (+y direction) \n
* @return Coordinate system calibration result and whether the calibration result is valid
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.calibrateCoordinate","params":[[[0.55462,0.06219,0.37175,-3.142,0.0,1.580],
* [0.63746,0.11805,0.37175,-3.142,0.0,1.580],[0.40441,0.28489,0.37174,-3.142,0.0,1.580]],0],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[[0.55462,0.06219,0.37175,-3.722688983883945e-05,-1.6940658945086007e-21,0.5932768162455785],0]}
* \endenglish
*/
ResultWithErrno calibrateCoordinate(
const std::vector<std::vector<double>> &poses, int type);
/**
* \chinese
* ,
*
* @param p1
* @param p2
* @param p3
* @param mode mode等于1的时候姿
* mode等于0的时候姿
*
* @return
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Math.calculateCircleFourthPoint","params":[[0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424],
* [0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423],
* [0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,
* 1.570796326792422],1],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":[[0.5488696249770837,-0.031860179583911546,0.27033259504604207,-3.1415919803846903,-3.67320510285378e-06,1.570796326792423],1]}
*
* \endchinese
*
* \english
* Based on three points on an arc, calculate the position of the midpoint of the other half of the fitted circle's arc
*
* @param p1 start point of the arc
* @param p2 middle point of the arc
* @param p3 end point of the arc
* @param mode when mode = 1, need to plan for orientation around arc;
* when mode = 0, do not need to plan for orientation around arc.
* @return position of the midpoint of the other half of the fitted circle's arc and whether the result is valid.
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Math.calculateCircleFourthPoint","params":[[0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424],
* [0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423],
* [0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,
* 1.570796326792422],1],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":[[0.5488696249770837,-0.031860179583911546,0.27033259504604207,-3.1415919803846903,-3.67320510285378e-06,1.570796326792423],1]}
*
* \endenglish
*/
ResultWithErrno calculateCircleFourthPoint(const std::vector<double> &p1,
const std::vector<double> &p2,
const std::vector<double> &p3,
int mode);
/**
* \chinese
* @brief forceTrans:
* force_in_b = pose_a_in_b * force_in_a
* @param pose_a_in_b: a b 姿
* @param force_in_a: a
* @return force_in_b b
* \endchinese
*
* \english
* @brief forceTrans:
* Transform the reference frame of force and torque: force_in_b = pose_a_in_b * force_in_a
* @param pose_a_in_b: pose of frame a in frame b
* @param force_in_a: force and torque described in frame a
* @return Force_in_b, force and torque described in frame b
* \endenglish
*/
std::vector<double> forceTrans(const std::vector<double> &pose_a_in_b,
const std::vector<double> &force_in_a);
/**
* \chinese
* @brief 姿
* @param distances: N , N >=3
* @param position:
* @param radius: tcp的等效半径
* @param track_scale: , (0, 1], 1
* @return 姿
* \endchinese
*
* \english
* @brief Calculate pose increment in tool coordinate system based on sensor data
* @param distances: N distances, N >= 3
* @param position: reference height to maintain from the trajectory
* @param radius: effective radius from sensor center to tool TCP
* @param track_scale: tracking ratio, range (0, 1], 1 means faster tracking
* @return Pose increment in tool coordinate system
* \endenglish
*/
std::vector<double> getDeltaPoseBySensorDistance(
const std::vector<double> &distances, double position, double radius,
double track_scale);
/**
* \chinese
* @brief changeFTFrame:
* @param pose_a_in_b: a b 姿
* @param ft_in_a: a a
* @return ft_in_b b b
* \endchinese
*
* \english
* @brief changeFTFrame: Transform the reference frame of force and torque
* @param pose_a_in_b: pose of frame a in frame b
* @param ft_in_a: force and torque applied at point a, described in frame a
* @return ft_in_b, force and torque applied at point b, described in frame b
* \endenglish
*/
std::vector<double> deltaPoseTrans(const std::vector<double> &pose_a_in_b,
const std::vector<double> &ft_in_a);
/**
* \chinese
* @brief addDeltaPose: 姿
* @param pose_a_in_b: a b 姿
* @param v_in_b: a b
* @return pose_in_b, 姿 b
* \endchinese
*
* \english
* @brief addDeltaPose: Calculate the pose after unit time given a velocity
* @param pose_a_in_b: current pose of a relative to b
* @param v_in_b: velocity of frame a described in frame b at current time
* @return pose_in_b, pose after unit time described in frame b
* \endenglish
*/
std::vector<double> deltaPoseAdd(const std::vector<double> &pose_a_in_b,
const std::vector<double> &v_in_b);
/**
* \chinese
* @brief changePoseWithXYRef: pose_tar , pose_ref
* @param pose_tar: 姿
* @param pose_ref: 姿
* @return 姿pose_tar的 xyz z
* \endchinese
*
* \english
* @brief changePoseWithXYRef: Modify the XY axis direction of pose_tar to be as consistent as possible with pose_ref
* @param pose_tar: target pose to be modified
* @param pose_ref: reference pose
* @return Modified pose, using the xyz coordinates and z axis direction of pose_tar
* \endenglish
*/
std::vector<double> changePoseWithXYRef(
const std::vector<double> &pose_tar,
const std::vector<double> &pose_ref);
/**
* \chinese
* @brief homMatrixToPose: 姿
* @param homMatrix: 4*4 ,
* @return 姿
* \endchinese
*
* \english
* @brief homMatrixToPose: Get pose from homogeneous transformation matrix
* @param homMatrix: 4x4 homogeneous transformation matrix, input elements are arranged row-wise
* @return corresponding pose
* \endenglish
*/
std::vector<double> homMatrixToPose(const std::vector<double> &homMatrix);
/**
* \chinese
* @brief poseToHomMatrix: 姿
* @param pose: 姿
* @return ,
* \endchinese
*
* \english
* @brief poseToHomMatrix: Get homogeneous transformation matrix from pose
* @param pose: input pose
* @return output homogeneous transformation matrix, elements arranged row-wise
* \endenglish
*/
std::vector<double> poseToHomMatrix(const std::vector<double> &pose);
protected:
void *d_;
};
using MathPtr = std::shared_ptr<Math>;
} // namespace common_interface
} // namespace arcs
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,373 @@
/** @file robot_interface.h
* @brief API
*/
#ifndef AUBO_SDK_ROBOT_INTERFACE_H
#define AUBO_SDK_ROBOT_INTERFACE_H
#include <aubo/sync_move.h>
#include <aubo/trace.h>
#include <aubo/robot/motion_control.h>
#include <aubo/robot/force_control.h>
#include <aubo/robot/io_control.h>
#include <aubo/robot/robot_algorithm.h>
#include <aubo/robot/robot_state.h>
#include <aubo/robot/robot_manage.h>
#include <aubo/robot/robot_config.h>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT RobotInterface
{
public:
RobotInterface();
virtual ~RobotInterface();
/**
* \chinese
* RobotConfig接口
*
* @return RobotConfigPtr对象的指针
*
* @par Python函数原型
* getRobotConfig(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotConfig
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotConfigPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotConfig();
* @endcode
* \endchinese
* \english
* Get RobotConfig interface
*
* @return Pointer to RobotConfig object
*
* @par Python function prototype
* getRobotConfig(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotConfig
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotConfigPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotConfig();
* @endcode
* \endenglish
*/
RobotConfigPtr getRobotConfig();
/**
* \chinese
*
*
* @return MotionControlPtr对象的指针
*
* @par Python函数原型
* getMotionControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::MotionControl
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* MotionControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getMotionControl();
* @endcode
* \endchinese
* \english
* Get motion planning interface
*
* @return Pointer to MotionControl object
*
* @par Python function prototype
* getMotionControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::MotionControl
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* MotionControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getMotionControl();
* @endcode
* \endenglish
*/
MotionControlPtr getMotionControl();
/**
* \chinese
*
*
* @return ForceControlPtr对象的指针
*
* @par Python函数原型
* getForceControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::ForceControl
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* ForceControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getForceControl();
* @endcode
* \endchinese
* \english
* Get force control interface
*
* @return Pointer to ForceControl object
*
* @par Python function prototype
* getForceControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::ForceControl
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* ForceControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getForceControl();
* @endcode
* \endenglish
*/
ForceControlPtr getForceControl();
/**
* \chinese
* IO控制的接口
*
* @return IoControlPtr对象的指针
*
* @par Python函数原型
* getIoControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::IoControl
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* IoControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getIoControl();
* @endcode
* \endchinese
* \english
* Get IO control interface
*
* @return Pointer to IoControl object
*
* @par Python function prototype
* getIoControl(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::IoControl
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* IoControlPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getIoControl();
* @endcode
* \endenglish
*/
IoControlPtr getIoControl();
/**
* \chinese
*
*
* @return SyncMovePtr对象的指针
*
* @par Python函数原型
* getSyncMove(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::SyncMove
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* SyncMovePtr ptr = rpc_cli->getRobotInterface(robot_name)->getSyncMove();
* @endcode
* \endchinese
* \english
* Get synchronized motion interface
*
* @return Pointer to SyncMove object
*
* @par Python function prototype
* getSyncMove(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::SyncMove
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* SyncMovePtr ptr = rpc_cli->getRobotInterface(robot_name)->getSyncMove();
* @endcode
* \endenglish
*/
SyncMovePtr getSyncMove();
/**
* \chinese
*
*
* @return RobotAlgorithmPtr对象的指针
*
* @par Python函数原型
* getRobotAlgorithm(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotAlgorithm
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotAlgorithmPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotAlgorithm();
* @endcode
* \endchinese
* \english
* Get robot utility algorithm interface
*
* @return Pointer to RobotAlgorithm object
*
* @par Python function prototype
* getRobotAlgorithm(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotAlgorithm
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotAlgorithmPtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotAlgorithm();
* @endcode
* \endenglish
*/
RobotAlgorithmPtr getRobotAlgorithm();
/**
* \chinese
* ()
*
* @return RobotManagePtr对象的指针
*
* @par Python函数原型
* getRobotManage(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotManage
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotManagePtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotManage();
* @endcode
* \endchinese
* \english
* Get robot management interface (power on, start, stop, etc.)
*
* @return Pointer to RobotManage object
*
* @par Python function prototype
* getRobotManage(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotManage
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotManagePtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotManage();
* @endcode
* \endenglish
*/
RobotManagePtr getRobotManage();
/**
* \chinese
*
*
* @return RobotStatePtr对象的指针
*
* @par Python函数原型
* getRobotState(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotState
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotStatePtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotState();
* @endcode
* \endchinese
* \english
* Get robot state interface
*
* @return Pointer to RobotState object
*
* @par Python function prototype
* getRobotState(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::RobotState
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotStatePtr ptr =
* rpc_cli->getRobotInterface(robot_name)->getRobotState();
* @endcode
* \endenglish
*/
RobotStatePtr getRobotState();
/**
* \chinese
*
*
* @return TracePtr对象的指针
*
* @par Python函数原型
* getTrace(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::Trace
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* TracePtr ptr = rpc_cli->getRobotInterface(robot_name)->getTrace();
* @endcode
* \endchinese
* \english
* Get alarm information interface
*
* @return Pointer to Trace object
*
* @par Python function prototype
* getTrace(self: pyaubo_sdk.RobotInterface) ->
* arcs::common_interface::Trace
*
* @par C++ example
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* TracePtr ptr = rpc_cli->getRobotInterface(robot_name)->getTrace();
* @endcode
* \endenglish
*/
TracePtr getTrace();
protected:
void *d_;
};
using RobotInterfacePtr = std::shared_ptr<RobotInterface>;
} // namespace common_interface
} // namespace arcs
#endif // AUBO_SDK_ROBOT_INTERFACE_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,396 @@
/** @file serial.h
* @brief
*/
#ifndef AUBO_SDK_SERIAL_INTERFACE_H
#define AUBO_SDK_SERIAL_INTERFACE_H
#include <vector>
#include <memory>
#include <aubo/type_def.h>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT Serial
{
public:
Serial();
virtual ~Serial();
/**
* \chinese
* TCP/IP以太网通信串口
*
* @param device
* @param baud
* @param stop_bits
* @param even
* @param serial_name
* @return
*
* @par Python函数原型
* serialOpen(self: pyaubo_sdk.Serial, arg0: str, arg1: int, arg2: float,
* arg3: int, arg4: str) -> int
*
* @par Lua函数原型
* serialOpen(device: string, baud: number, stop_bits: number, even: number,
* serial_name: string) -> nil
* \endchinese
* \english
* Open TCP/IP ethernet communication serial
*
* @param device
* @param baud
* @param stop_bits
* @param even
* @param serial_name
* @return
*
* @par Python function prototype
* serialOpen(self: pyaubo_sdk.Serial, arg0: str, arg1: int, arg2: float,
* arg3: int, arg4: str) -> int
*
* @par Lua function prototype
* serialOpen(device: string, baud: number, stop_bits: number, even: number,
* serial_name: string) -> nil
* \endenglish
*/
int serialOpen(const std::string &device, int baud, float stop_bits,
int even, const std::string &serial_name = "serial_0");
/**
* \chinese
* TCP/IP串口通信
*
*
* @param serial_name
* @return
*
* @par Python函数原型
* serialClose(self: pyaubo_sdk.Serial, arg0: str) -> int
*
* @par Lua函数原型
* serialClose(serial_name: string) -> nil
* \endchinese
* \english
* Close TCP/IP serial communication
* Close down the serial connection to the server.
*
* @param serial_name
* @return
*
* @par Python function prototype
* serialClose(self: pyaubo_sdk.Serial, arg0: str) -> int
*
* @par Lua function prototype
* serialClose(serial_name: string) -> nil
* \endenglish
*/
int serialClose(const std::string &serial_name = "serial_0");
/**
* \chinese
* 30
*
* @param variable
* @param serial_name
* @return
*
* @par Python函数原型
* serialReadByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* serialReadByte(variable: string, serial_name: string) -> number
* \endchinese
* \english
* Reads a number of bytes from the serial. Bytes are in network byte
* order. A maximum of 30 values can be read in one command.
*
* @param variable
* @param serial_name
* @return
*
* @par Python function prototype
* serialReadByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* serialReadByte(variable: string, serial_name: string) -> number
* \endenglish
*/
int serialReadByte(const std::string &variable,
const std::string &serial_name = "serial_0");
/**
* \chinese
* 30
* int列表=number+1
*
* @param number
* @param variable
* @param serial_name
* @return
*
* @par Python函数原型
* serialReadByteList(self: pyaubo_sdk.Serial, arg0: int, arg1: str, arg2: str) -> int
*
* @par Lua函数原型
* serialReadByteList(number: number, variable: string, serial_name: string) -> number
* \endchinese
* \english
* Reads a number of bytes from the serial. Bytes are in network byte
* order. A maximum of 30 values can be read in one command.
* A list of numbers read (list of ints, length=number+1)
*
* @param number Number of bytes to read
* @param variable
* @param serial_name Serial port name
* @return Return value
*
* @par Python function prototype
* serialReadByteList(self: pyaubo_sdk.Serial, arg0: int, arg1: str, arg2: str) -> int
*
* @par Lua function prototype
* serialReadByteList(number: number, variable: string, serial_name: string) -> number
* \endenglish
*/
int serialReadByteList(int number, const std::string &variable,
const std::string &serial_name = "serial_0");
/**
* \chinese
*
*
*
* "prefix" "suffix"
* "prefix" "prefix"
* "suffix" "suffix"
* "noise>hello<" prefix=">" suffix="<" "hello"
* 使 "prefix" "suffix" "suffix"
* ">hello<>world<"
*
* @param variable
* @param serial_name
* @param prefix
* @param suffix
* @param interpret_escape
* @return
*
* @par Python函数原型
* serialReadString(self: pyaubo_sdk.Serial, arg0: str, arg1: str, arg2: str, arg3: str, arg4: bool) -> int
*
* @par Lua函数原型
* serialReadString(variable: string, serial_name: string, prefix: string, suffix: string, interpret_escape: boolean) -> number
* \endchinese
* \english
* Reads all data from the serial and returns the data as a string.
* Bytes are in network byte order.
*
* The optional parameters "prefix" and "suffix", can be used to express
* what is extracted from the serial. The "prefix" specifies the start
* of the substring (message) extracted from the serial. The data up to
* the end of the "prefix" will be ignored and removed from the serial.
* The "suffix" specifies the end of the substring (message) extracted
* from the serial. Any remaining data on the serial, after the "suffix",
* will be preserved. E.g. if the serial server sends a string
* "noise>hello<", the controller can receive the "hello" by calling this
* script function with the prefix=">" and suffix="<". By using the
* "prefix" and "suffix" it is also possible send multiple string to the
* controller at once, because the suffix defines where the message ends.
* E.g. sending ">hello<>world<"
*
* @param variable
* @param serial_name
* @param prefix
* @param suffix
* @param interpret_escape
* @return
*
* @par Python function prototype
* serialReadString(self: pyaubo_sdk.Serial, arg0: str, arg1: str, arg2: str, arg3: str, arg4: bool) -> int
*
* @par Lua function prototype
* serialReadString(variable: string, serial_name: string, prefix: string, suffix: string, interpret_escape: boolean) -> number
* \endenglish
*/
int serialReadString(const std::string &variable,
const std::string &serial_name = "serial_0",
const std::string &prefix = "",
const std::string &suffix = "",
bool interpret_escape = false);
/**
* \chinese
*
* <value>ASCII字符1023
*
* @param value
* @param serial_name
* @return
*
* @par Python函数原型
* serialSendByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* serialSendByte(value: string, serial_name: string) -> nil
* \endchinese
* \english
* Sends a byte to the server
* Sends the byte <value> through the serial. Expects no response. Can
* be used to send special ASCII characters; 10 is newline, 2 is start of
* text, 3 is end of text.
*
* @param value
* @param serial_name
* @return
*
* @par Python function prototype
* serialSendByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* serialSendByte(value: string, serial_name: string) -> nil
* \endenglish
*/
int serialSendByte(char value, const std::string &serial_name = "serial_0");
/**
* \chinese
* int32_t
* <value>
*
* @param value
* @param serial_name
* @return
*
* @par Python函数原型
* serialSendInt(self: pyaubo_sdk.Serial, arg0: int, arg1: str) -> int
*
* @par Lua函数原型
* serialSendInt(value: number, serial_name: string) -> nil
* \endchinese
* \english
* Sends an int (int32_t) to the server
* Sends the int <value> through the serial. Send in network byte order.
* Expects no response.
*
* @param value
* @param serial_name
* @return
*
* @par Python function prototype
* serialSendInt(self: pyaubo_sdk.Serial, arg0: int, arg1: str) -> int
*
* @par Lua function prototype
* serialSendInt(value: number, serial_name: string) -> nil
* \endenglish
*/
int serialSendInt(int value, const std::string &serial_name = "serial_0");
/**
* \chinese
*
* ASCII编码通过串口发送字符串<str>
*
* @param str
* @param serial_name
* @return
*
* @par Python函数原型
* serialSendLine(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* serialSendLine(str: string, serial_name: string) -> nil
* \endchinese
* \english
* Sends a string with a newline character to the server
* Sends the string <str> through the serial in ASCII coding, appending a newline at the end. Expects no response.
*
* @param str
* @param serial_name
* @return
*
* @par Python function prototype
* serialSendLine(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* serialSendLine(str: string, serial_name: string) -> nil
* \endenglish
*/
int serialSendLine(const std::string &str,
const std::string &serial_name = "serial_0");
/**
* \chinese
*
* ASCII编码通过串口发送字符串<str>
*
* @param str
* @param serial_name
* @return
*
* @par Python函数原型
* serialSendString(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* serialSendString(str: string, serial_name: string) -> nil
* \endchinese
* \english
* Sends a string to the server
* Sends the string <str> through the serial in ASCII coding. Expects no
* response.
*
* @param str
* @param serial_name
* @return
*
* @par Python function prototype
* serialSendString(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* serialSendString(str: string, serial_name: string) -> nil
* \endenglish
*/
int serialSendString(const std::string &str,
const std::string &serial_name = "serial_0");
/**
* \chinese
*
* @param is_check
* @param str
* @param serial_name
* @return
*
* @par Python函数原型
* serialSendAllString(self: pyaubo_sdk.Serial, arg0: bool, arg1: List[str], arg2: str) -> int
*
* @par Lua函数原型
* serialSendAllString(is_check: boolean, str: table, serial_name: string) -> nil
* \endchinese
* \english
*
* @param is_check Whether to check
* @param str Array of strings
* @param serial_name Serial port name
* @return Return value
*
* @par Python function prototype
* serialSendAllString(self: pyaubo_sdk.Serial, arg0: bool, arg1: List[str], arg2: str) -> int
*
* @par Lua function prototype
* serialSendAllString(is_check: boolean, str: table, serial_name: string) -> nil
* \endenglish
*/
int serialSendAllString(bool is_check, const std::vector<char> &str,
const std::string &serial_name = "serial_0");
protected:
void *d_;
};
using SerialPtr = std::shared_ptr<Serial>;
} // namespace common_interface
} // namespace arcs
#endif

View File

@ -0,0 +1,627 @@
/** @file socket.h
* @brief socket通信
*/
#ifndef AUBO_SDK_SOCKET_INTERFACE_H
#define AUBO_SDK_SOCKET_INTERFACE_H
#include <vector>
#include <memory>
#include <aubo/type_def.h>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT Socket
{
public:
Socket();
virtual ~Socket();
/**
* \english
* Open TCP/IP ethernet communication socket
*
* Instruction
*
* @param address
* @param port
* @param socket_name
* @return
*
* @par Python function prototype
* socketOpen(self: pyaubo_sdk.Socket, arg0: str, arg1: int, arg2: str) -> int
*
* @par Lua function prototype
* socketOpen(address: string, port: number, socket_name: string) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketOpen","params":["172.16.26.248",8000,"socket_0"],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
* TCP/IP以太网通信socket
*
*
*
* @param address
* @param port
* @param socket_name
* @return
*
* @par Python函数原型
* socketOpen(self: pyaubo_sdk.Socket, arg0: str, arg1: int, arg2: str) -> int
*
* @par Lua函数原型
* socketOpen(address: string, port: number, socket_name: string) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketOpen","params":["172.16.26.248",8000,"socket_0"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketOpen(const std::string &address, int port,
const std::string &socket_name = "socket_0");
/**
* \english
* Closes TCP/IP socket communication
* Closes down the socket connection to the server.
*
* Instruction
*
* @param socket_name
* @return
*
* @par Python function prototype
* socketClose(self: pyaubo_sdk.Socket, arg0: str) -> int
*
* @par Lua function prototype
* socketClose(socket_name: string) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketClose","params":["socket_0"],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
* TCP/IP socket
* socket
*
*
*
* @param socket_name
* @return
*
* @par Python函数原型
* socketClose(self: pyaubo_sdk.Socket, arg0: str) -> int
*
* @par Lua函数原型
* socketClose(socket_name: string) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketClose","params":["socket_0"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketClose(const std::string &socket_name = "socket_0");
/**
* \english
* Reads a number of ascii formatted floats from the socket. A maximum
* of 30 values can be read in one command.
* A list of numbers read (list of floats, length=number+1)
*
* Result will be stored in a register named reg_key. Use getFloatVec
* to retrieve data
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python function prototype
* socketReadAsciiFloat(self: pyaubo_sdk.Socket, arg0: int, arg1: str, arg2:
* str) -> int
*
* @par Lua function prototype
* socketReadAsciiFloat(number: number, variable: string, socket_name:
* string) -> number
* \endenglish
* \chinese
* socket读取指定数量的ASCII格式浮点数30
* =number+1
*
* reg_key的寄存器中使getFloatVec获取数据
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python函数原型
* socketReadAsciiFloat(self: pyaubo_sdk.Socket, arg0: int, arg1: str, arg2:
* str) -> int
*
* @par Lua函数原型
* socketReadAsciiFloat(number: number, variable: string, socket_name:
* string) -> number
* \endchinese
*/
int socketReadAsciiFloat(int number, const std::string &variable,
const std::string &socket_name = "socket_0");
/**
* \english
* Reads a number of 32 bit integers from the socket. Bytes are in
* network byte order. A maximum of 30 values can be read in one
* command.
* A list of numbers read (list of ints, length=number+1)
*
* Instruction
*
* std::vector<int>
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python function prototype
* socketReadBinaryInteger(self: pyaubo_sdk.Socket, arg0: int, arg1: str,
* arg2: str) -> int
*
* @par Lua function prototype
* socketReadBinaryInteger(number: number, variable: string, socket_name:
* string) -> number
* \endenglish
* \chinese
* socket读取指定数量的32位整数30
* =number+1
*
*
*
* std::vector<int>
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python函数原型
* socketReadBinaryInteger(self: pyaubo_sdk.Socket, arg0: int, arg1: str,
* arg2: str) -> int
*
* @par Lua函数原型
* socketReadBinaryInteger(number: number, variable: string, socket_name:
* string) -> number
* \endchinese
*/
int socketReadBinaryInteger(int number, const std::string &variable,
const std::string &socket_name = "socket_0");
/**
* \english
* Reads a number of bytes from the socket. Bytes are in network byte
* order. A maximum of 30 values can be read in one command.
* A list of numbers read (list of ints, length=number+1)
*
* Instruction
*
* std::vector<char>
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python function prototype
* socketReadByteList(self: pyaubo_sdk.Socket, arg0: int, arg1: str, arg2:
* str) -> int
*
* @par Lua function prototype
* socketReadByteList(number: number, variable: string, socket_name: string)
* -> number
* \endenglish
* \chinese
* socket读取指定数量的字节30
* =number+1
*
*
*
* std::vector<char>
*
* @param number
* @param variable
* @param socket_name
* @return
*
* @par Python函数原型
* socketReadByteList(self: pyaubo_sdk.Socket, arg0: int, arg1: str, arg2:
* str) -> int
*
* @par Lua函数原型
* socketReadByteList(number: number, variable: string, socket_name: string)
* -> number
* \endchinese
*/
int socketReadByteList(int number, const std::string &variable,
const std::string &socket_name = "socket_0");
/**
* \english
* Reads all data from the socket and returns the data as a string.
* Bytes are in network byte order.
*
* The optional parameters "prefix" and "suffix", can be used to express
* what is extracted from the socket. The "prefix" specifies the start
* of the substring (message) extracted from the socket. The data up to
* the end of the "prefix" will be ignored and removed from the socket.
* The "suffix" specifies the end of the substring (message) extracted
* from the socket. Any remaining data on the socket, after the "suffix",
* will be preserved. E.g. if the socket server sends a string
* "noise>hello<", the controller can receive the "hello" by calling this
* script function with the prefix=">" and suffix="<". By using the
* "prefix" and "suffix" it is also possible send multiple string to the
* controller at once, because the suffix defines where the message ends.
* E.g. sending ">hello<>world<"
*
* Instruction
*
* std::string
*
* @param variable
* @param socket_name
* @param prefix
* @param suffix
* @param interpret_escape
* @return
*
* @par Python function prototype
* socketReadString(self: pyaubo_sdk.Socket, arg0: str, arg1: str, arg2:
* str, arg3: str, arg4: bool) -> int
*
* @par Lua function prototype
* socketReadString(variable: string, socket_name: string, prefix: string,
* suffix: string, interpret_escape: boolean) -> number
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketReadString","params":["camera","socket_0","","",false],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
* socket读取所有数据并将其作为字符串返回
*
*
* "prefix""suffix"socket中提取的内容
* "prefix""prefix"socket中移除
* "suffix""suffix"socket中
* socket服务器发送字符串"noise>hello<"prefix=">"suffix="<""hello"
* 使"prefix""suffix""suffix"">hello<>world<"
*
*
*
* std::string
*
* @param variable
* @param socket_name
* @param prefix
* @param suffix
* @param interpret_escape
* @return
*
* @par Python函数原型
* socketReadString(self: pyaubo_sdk.Socket, arg0: str, arg1: str, arg2:
* str, arg3: str, arg4: bool) -> int
*
* @par Lua函数原型
* socketReadString(variable: string, socket_name: string, prefix: string,
* suffix: string, interpret_escape: boolean) -> number
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketReadString","params":["camera","socket_0","","",false],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketReadString(const std::string &variable,
const std::string &socket_name = "socket_0",
const std::string &prefix = "",
const std::string &suffix = "",
bool interpret_escape = false);
/**
* \english
* Reads all data from the socket and returns the data as a vector of chars.
*
* Instruction
* std::vector<char>
*
* @param variable
* @param socket_name
* @return
*
* @par Python function prototype
* socketReadAllString(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* socketReadAllString(variable: string, socket_name: string) -> number
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketReadAllString","params":["camera","socket_0"],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
* socket读取所有数据并将其作为char向量返回
*
*
* std::vector<char>
*
* @param variable
* @param socket_name
* @return
*
* @par Python函数原型
* socketReadAllString(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* socketReadAllString(variable: string, socket_name: string) -> number
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketReadAllString","params":["camera","socket_0"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketReadAllString(const std::string &variable,
const std::string &socket_name = "socket_0");
/**
* \english
* Sends a byte to the server
* Sends the byte <value> through the socket. Expects no response. Can
* be used to send special ASCII characters; 10 is newline, 2 is start of
* text, 3 is end of text.
*
* Instruction
*
* @param value
* @param socket_name
* @return
*
* @par Python function prototype
* socketSendByte(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* socketSendByte(value: string, socket_name: string) -> nil
*
* \endenglish
* \chinese
*
* socket发送字节<value>ASCII字符1023
*
*
*
* @param value
* @param socket_name
* @return
*
* @par Python函数原型
* socketSendByte(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* socketSendByte(value: string, socket_name: string) -> nil
*
* \endchinese
*/
int socketSendByte(char value, const std::string &socket_name = "socket_0");
/**
* \english
* Sends an int (int32_t) to the server
* Sends the int <value> through the socket. Send in network byte order.
* Expects no response
*
* Instruction
*
* @param value
* @param socket_name
* @return
*
* @par Python function prototype
* socketSendInt(self: pyaubo_sdk.Socket, arg0: int, arg1: str) -> int
*
* @par Lua function prototype
* socketSendInt(value: number, socket_name: string) -> nil
*
* \endenglish
* \chinese
* intint32_t
* socket发送int <value>
*
*
*
* @param value
* @param socket_name
* @return
*
* @par Python函数原型
* socketSendInt(self: pyaubo_sdk.Socket, arg0: int, arg1: str) -> int
*
* @par Lua函数原型
* socketSendInt(value: number, socket_name: string) -> nil
*
* \endchinese
*/
int socketSendInt(int value, const std::string &socket_name = "socket_0");
/**
* \english
* Sends a string with a newline character to the server
* Sends the string <str> through the socket in ASCII coding. Expects no
* response.
*
* Instruction
*
* @param str
* @param socket_name
* @return
*
* @par Python function prototype
* socketSendLine(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* socketSendLine(str: string, socket_name: string) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketSendLine","params":["abcd","socket_0"],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
* .
* socket以ASCII编码发送字符串<str>
*
*
*
* @param str
* @param socket_name
* @return
*
* @par Python函数原型
* socketSendLine(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* socketSendLine(str: string, socket_name: string) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketSendLine","params":["abcd","socket_0"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketSendLine(const std::string &str,
const std::string &socket_name = "socket_0");
/**
* \english
* Sends a string to the server
* Sends the string <str> through the socket in ASCII coding. Expects no
* response.
*
* Instruction
*
* @param str
* @param socket_name
* @return
*
* @par Python function prototype
* socketSendString(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua function prototype
* socketSendString(str: string, socket_name: string) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"Socket.socketSendString","params":["abcd","socket_0"],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
* \chinese
*
* socket以ASCII编码发送字符串<str>
*
*
*
* @param str
* @param socket_name
* @return
*
* @par Python函数原型
* socketSendString(self: pyaubo_sdk.Socket, arg0: str, arg1: str) -> int
*
* @par Lua函数原型
* socketSendString(str: string, socket_name: string) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"Socket.socketSendString","params":["abcd","socket_0"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
*/
int socketSendString(const std::string &str,
const std::string &socket_name = "socket_0");
/**
* \english
* Sends all data in the given vector of chars to the server.
*
* @param is_check Whether to check the sending status
* @param str The data to send as a vector of chars
* @param socket_name The name of the socket
* @return Status code
*
* @par Python function prototype
* socketSendAllString(self: pyaubo_sdk.Socket, arg0: bool, arg1: List[str], arg2: str) -> int
*
* @par Lua function prototype
* socketSendAllString(is_check: boolean, str: table, socket_name: string) -> nil
* \endenglish
* \chinese
* char向量中的所有数据到服务器
*
* @param is_check
* @param str char向量
* @param socket_name
* @return
*
* @par Python函数原型
* socketSendAllString(self: pyaubo_sdk.Socket, arg0: bool, arg1: List[str], arg2: str) -> int
*
* @par Lua函数原型
* socketSendAllString(is_check: boolean, str: table, socket_name: string) -> nil
* \endchinese
*/
int socketSendAllString(bool is_check, const std::vector<char> &str,
const std::string &socket_name = "socket_0");
/**
* \~chinese socket \~english Check if the socket is connected
* @brief socketHasConnected
* @param socket_name
*
* @return
*
* @par Python函数原型
* socketHasConnected(self: pyaubo_sdk.Socket, arg0: str) -> bool
*
* @par Lua函数原型
* socketHasConnected(socket_name: string) -> boolean
*/
bool socketHasConnected(const std::string &socket_name = "socket_0");
protected:
void *d_;
};
using SocketPtr = std::shared_ptr<Socket>;
} // namespace common_interface
} // namespace arcs
#endif

View File

@ -0,0 +1,980 @@
/** @file sync_move.h
* @brief
*
* 1. Independent movements
* If the different task programs, and their robots, work independently, no
* synchronization or coordination is needed. Each task program is then
* written as if it was the program for a single robot system.
*
* 2. Semi coordinated movements
* Several robots can work with the same work object, without synchronized
* movements, as long as the work object is not moving.
* A positioner can move the work object when the robots are not coordinated
* to it, and the robots can be coordinated to the work object when it is not
* moving. Switching between moving the object and coordinating the robots is
* called semi coordinated movements.
*
* 3. Coordinated synchronized movements
* Several robots can work with the same moving work object.
* The positioner or robot that holds the work object and the robots that work
* with the work object must have synchronized movements. This means that the
* RAPID task programs, that handle one mechanical unit each, execute their
* move instructions simultaneously.
*/
#ifndef AUBO_SDK_SYNC_MOVE_INTERFACE_H
#define AUBO_SDK_SYNC_MOVE_INTERFACE_H
#include <vector>
#include <unordered_set>
#include <string>
#include <memory>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
typedef std::unordered_set<std::string> TaskSet;
class ARCS_ABI_EXPORT SyncMove
{
public:
SyncMove();
virtual ~SyncMove();
/**
*\chinese
* syncMoveOn
*
* syncMoveOn syncMoveOn
*
* syncMoveOff syncMoveOn
*
* @param syncident
* @param taskset
* @return
*
* @par Python函数原型
* syncMoveOn(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) -> int
*
* @par Lua函数原型
* syncMoveOn(syncident: string, taskset: table) -> nil
* @endcoe
* \endchinese
* \english
* syncMoveOn is used to start synchronized movement mode.
*
* A syncMoveOn instruction will wait for the other task programs. When
* all task programs have reached the syncMoveOn, they will continue
* their execution in synchronized movement mode. The move instructions
* in the different task programs are executed simultaneously, until the
* instruction syncMoveOff is executed.
* A stop point must be programmed before the syncMoveOn instruction.
*
* @param syncident
* @param taskset
* @return
*
* @par Python function prototype
* syncMoveOn(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) -> int
*
* @par Lua function prototype
* syncMoveOn(syncident: string, taskset: table) -> nil
* @endcoe
* \endenglish
*/
int syncMoveOn(const std::string &syncident, const TaskSet &taskset);
/**
* \chinese
* ID
* corner zonesstop points
* ID的移动指令要么全部带有圆角区
*
* 使z10使z50
*
* @param id
* @return
*
* @par Python函数原型
* syncMoveSegment(self: pyaubo_sdk.SyncMove, arg0: int) -> bool
*
* @par Lua函数原型
* syncMoveSegment(id: number) -> boolean
* @endcoe
* \endchinese
* \english
* Set the ID for the synchronized path segment.
* In synchronized movements mode, all or none of the simultaneous move instructions must be programmed with corner zones.
* This means that move instructions with the same ID must either all have corner zones, or all have stop points.
* If a move instruction with a corner zone and a move instruction with a stop point are synchronously executed in their respective task program, an error will occur.
* Synchronously executed move instructions can have corner zones of different sizes (e.g. one uses z10 and one uses z50).
*
* @param id
* @return
*
* @par Python prototype
* syncMoveSegment(self: pyaubo_sdk.SyncMove, arg0: int) -> bool
*
* @par Lua prototype
* syncMoveSegment(id: number) -> boolean
* @endcoe
* \endenglish
*/
bool syncMoveSegment(int id);
/**
* \chinese
* syncMoveOff
*
* syncMoveOff syncMoveOff
* syncMoveOff
*
* @param syncident
* @return
*
* @par Python函数原型
* syncMoveOff(self: pyaubo_sdk.SyncMove, arg0: str) -> int
*
* @par Lua函数原型
* syncMoveOff(syncident: string) -> nil
* @endcoe
* \endchinese
* \english
* syncMoveOff is used to end synchronized movement mode.
*
* A syncMoveOff instruction will wait for the other task programs. When
* all task programs have reached the syncMoveOff, they will continue
* their execution in unsynchronized mode.
* A stop point must be programmed before the syncMoveOff instruction.
*
* @param syncident
* @return
*
* @par Python prototype
* syncMoveOff(self: pyaubo_sdk.SyncMove, arg0: str) -> int
*
* @par Lua prototype
* syncMoveOff(syncident: string) -> nil
* @endcoe
* \endenglish
*/
int syncMoveOff(const std::string &syncident);
/**
* \chinese
* syncMoveUndo 使 syncMoveUndo
*
* syncMoveUndo UNDO syncMoveUndo
*
* @return
*
* @par Python函数原型
* syncMoveUndo(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua函数原型
* syncMoveUndo() -> nil
* @endcoe
* \endchinese
* \english
* syncMoveUndo is used to turn off synchronized movements, even if not
* all the other task programs execute the syncMoveUndo instruction.
*
* syncMoveUndo is intended for UNDO handlers. When the program
* pointer is moved from the procedure, syncMoveUndo is used to turn off
* the synchronization.
*
* @return
*
* @par Python prototype
* syncMoveUndo(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua prototype
* syncMoveUndo() -> nil
* @endcoe
* \endenglish
*/
int syncMoveUndo();
/**
* \chinese
* waitSyncTasks
*
* waitSyncTasks waitSyncTasks
*
*
* @param syncident
* @param taskset
* @return
*
* @par Python函数原型
* waitSyncTasks(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) -> int
*
* @par Lua函数原型
* waitSyncTasks(syncident: string, taskset: table) -> nil
* @endcoe
* \endchinese
* \english
* waitSyncTasks is used to synchronize several task programs at a specific
* point in the program.
*
* A waitSyncTasks instruction will wait for the other task programs. When all
* task programs have reached the waitSyncTasks instruction, they will continue
* their execution.
*
* @param syncident
* @param taskset
* @return
*
* @par Python prototype
* waitSyncTasks(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) -> int
*
* @par Lua prototype
* waitSyncTasks(syncident: string, taskset: table) -> nil
* @endcoe
* \endenglish
*/
int waitSyncTasks(const std::string &syncident, const TaskSet &taskset);
/**
* \chinese
* isSyncMoveOn
*
* 使
*
* @return
*
* @par Python函数原型
* isSyncMoveOn(self: pyaubo_sdk.SyncMove) -> bool
*
* @par Lua函数原型
* isSyncMoveOn() -> boolean
* \endchinese
* \english
* isSyncMoveOn is used to tell if the mechanical unit group is in synchronized movement mode.
*
* A task that does not control any mechanical unit can find out if the mechanical units defined in the parameter Use Mechanical Unit Group are in synchronized movement mode.
*
* @return
*
* @par Python prototype
* isSyncMoveOn(self: pyaubo_sdk.SyncMove) -> bool
*
* @par Lua prototype
* isSyncMoveOn() -> boolean
* \endenglish
*/
bool isSyncMoveOn();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* syncMoveSuspend(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua函数原型
* syncMoveSuspend() -> nil
* \endchinese
* \english
* Suspend synchronized movement mode.
*
* @return
*
* @par Python prototype
* syncMoveSuspend(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua prototype
* syncMoveSuspend() -> nil
* \endenglish
*/
int syncMoveSuspend();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* syncMoveResume(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua函数原型
* syncMoveResume() -> nil
* \endchinese
* \english
* Resume synchronized movement mode.
*
* @return
*
* @par Python prototype
* syncMoveResume(self: pyaubo_sdk.SyncMove) -> int
*
* @par Lua prototype
* syncMoveResume() -> nil
* \endenglish
*/
int syncMoveResume();
/**
* \chinese
* name 姿 pose姿 ref_frame
* ref_frame
* ref_frame使 frameAttach()
*
* @param name:
* @param pose: 姿
* @param ref_frame: 姿使base
*
* @return
* \endchinese
* \english
* Add a frame with the name "name" initialized at the specified pose
* expressed in the ref_frame coordinate frame. This command only adds a
* frame to the world, it does not attach it to the ref_frame coordinate
* frame. Use frameAttach() to attach the newly added frame to ref_frame if
* desired.
*
* @param name: name of the frame to be added. The name must not be the same
* as any existing world model object (frame, axis, or axis group),
* otherwise an exception is thrown
* @param pose: initial pose of the new object
* @param ref_frame: name of the world model object whose coordinate frame
* the pose is expressed in. If nothing is provided here, the default is the
* robot base frame.
*
* @return
* \endenglish
*/
int frameAdd(const std::string &name, const std::vector<double> &pose,
const std::string &ref_name);
/**
* \chinese
* 使
*
* worldflangetcp
*
*
*
* MotionPlusparent
*
* @param child: worldflangetcp
* @param parent:
*
* @return
* \endchinese
* \english
* Attaches the child frame to the parent world model object. The relative
* transform between the parent and child will be set such that the child
* does not move in the world when the attachment occurs.
*
* The child cannot be world, flange, tcp, or the same as parent.
*
* This will fail if child or parent is not an existing frame, or this makes
* the attachments form a closed chain.
*
* If being used with the MotionPlus, the parent argument can be the name of
* an external axis or axis group.
*
* @param child: name of the frame to be attached. The name must not be
* world, flange, or tcp.
* @param parent: name of the object that the child frame will be attached
* to.
*
* @return
* \endenglish
*/
int frameAttach(const std::string &child, const std::string &parent);
/**
* \chinese
*
*
* worldbaseflangetcp
*
* world使
*
* @return
* \endchinese
* \english
* Delete all frames that have been added to the world model.
*
* The world, base, flange, and tcp frames cannot be deleted.
*
* Any frames that are attached to the deleted frames will be attached to
* the world frame with new frame offsets set such that the detached
* frames do not move in the world.
*
* @return
* \endenglish
*/
int frameDeleteAll();
/**
* \chinese
*
*
* worldbaseflangetcp
*
* world使
*
*
*
* @param name:
*
* @return
* \endchinese
* \english
* Delete the frame with name from the world model.
*
* The world, base, flange, and tcp frames cannot be deleted.
*
* Any frames that are attached to the deleted frame will be attached to the
* world frame with new frame offsets set such that the detached frame
* does not move in the world.
*
* This command will fail if the frame does not exist.
*
* @param name: name of the frame to be deleted
*
* @return
* \endenglish
*/
int frameDelete(const std::string &name);
/**
* \chinese
* name pose pose ref_name
*
* name worldflangetcp tcp 使 set_tcp()
*
* MotionPlusref_name
*
* @param name:
* @param pose:
* @param ref_name: pose base
*
* @return
* \endchinese
* \english
* Changes the placement of the coordinate frame named name to the new
* placement given by pose that is defined in the ref_name coordinate frame.
*
* This will fail if name is world, flange, tcp, or if the frame does
* not exist. Note: to move the tcp frame, use the set_tcp() command
* instead.
*
* If being used with the MotionPlus, the ref_name argument can be the name
* of an external axis or axis group.
*
* @param name: the name of the frame to move
* @param pose: the new placement
* @param ref_name: the coordinate frame that pose is expressed in. The
* default value is the robots base frame.
*
* @return
* \endenglish
*/
int frameMove(const std::string &name, const std::vector<double> &pose,
const std::string &ref_name);
/**
* \chinese
* name rel_frame 姿 ref_frame
* ref_frame name rel_frame 姿 rel_frame
*
*
*
* MotionPlus
*
* @param name:
* @param rel_frame: 姿
* @param ref_frame: 姿 rel_frame
*
* @return ref_frame name 姿
* \endchinese
* \english
* Get the pose of the name frame relative to the rel_frame frame but
* expressed in the coordinates of the ref_frame frame. If ref_frame is not
* provided, then this returns the pose of the name frame relative to and
* expressed in the same frame as rel_frame.
*
* This will fail if any arguments are not an existing frame.
*
* If being used with MotionPlus, all three arguments can also be the names
* of external axes or axis groups.
*
* @param name: name of the frame to query.
* @param rel_frame: short for relative frame is the frame where the pose
* is computed relative to
* @param ref_frame: short for reference frame is the frame to express the
* coordinates of resulting relative pose in. If this is not provided, then
* it will default to match the value of rel_frame.
*
* @return The pose of the frame expressed in the ref_frame coordinates.
* \endenglish
*/
std::vector<double> frameGetPose(const std::string &name,
const std::string &rel_frame,
const std::string &ref_frame);
/**
* \chinese
* 姿 from_frame to_frame
*
*
*
* MotionPlus
*
* @param pose: 姿
* @param from_frame:
* @param to_frame:
*
* @return to_frame pose
* \endchinese
* \english
* Convert pose from from_frame to to_frame.
*
* This will fail if either coordinate system argument is not an existing
* frame.
*
* If being used with MotionPlus, all three arguments can also be the names
* of external axes or axis groups.
*
* @param pose: pose to be converted
* @param from_frame: name of reference frame at origin of old coordinate
* system
* @param to_frame: name of reference frame at origin of new coordinate
* system
*
* @return Value of pose expressed in the coordinates of to_frame.
* \endenglish
*/
std::vector<double> frameConvertPose(const std::vector<double> &pose,
const std::string &from_frame,
const std::string &to_frame);
/**
* \chinese
*
*
* @param name:
*
* @return true false
* \endchinese
* \english
* Queries for the existence of a frame by the given name.
*
* @param name: name of the frame to be queried.
*
* @return Returns true if there is a frame by the given name, false if not.
* \endenglish
*/
bool frameExist(const std::string &name);
/**
* \chinese
* name
*
* "world"
*
* @param name:
*
* @return
* \endchinese
* \english
* Get the parent of the frame named name in the world model.
*
* If the frame is not attached to another frame, then world is the
* parent.
*
* @param name: the frame being queried
*
* @return name of the parent as a string
* \endenglish
*/
std::string frameGetParent(const std::string &name);
/**
* \chinese
*
* MotionPlus
*
* @param name:
*
* @return
* \endchinese
* \english
* Returns a list of immediate child object frame names. Parent-child
* relationships are defined by world model attachments. If being used with
* MotionPlus, the child objects may also be an axis group or an axis.
*
* @param name: the name of the parent object.
*
* @return a list of immediate child object frame names
* \endenglish
*/
std::vector<std::string> frameGetChildren(const std::string &name);
/**
* \chinese
* name ref_frame pose
*
*
*
*
*
* 6
*
* @param name:
* @param pose: 姿
* @param ref_frame (): pose "base"
*
* @return
* \endchinese
* \english
* Adds a new axis group with the given name to the world model. It is
* placed at the given pose in the reference coordinate frame defined by
* ref_frame.
*
* An axis group can only be attached to the world coordinate frame.
*
* Each axis group has a coordinate frame attached to its base, which can be
* used as an argument to other world model functions by referring the name
* of the group.
*
* At most 6 axis groups can be added to the world model.
*
* @param name: (string) Name of the axis group to add. The name cannot be
* an empty string. Names used by world model objects (e.g., frame, axis
* group, axis, etc.) must be unique.
*
* @param pose: (pose) Pose of the axis groups base, in the reference
* coordinate frame.
*
* @param ref_frame (optional): (string) Name of the reference coordinate
* frame that pose is defined in. This can be any world model entity with a
* coordinate system (e.g., frame, axis group, axis, etc.). The default
* value "base" refers to the robots base frame.
*
* @return
* \endenglish
*/
int axisGroupAdd(const std::string &name, const std::vector<double> &pose,
const std::string &ref_frame);
/**
* \chinese
*
*
*
*
*
*
* @param name:
*
* @return
* \endchinese
* \english
* Deletes the axis group with the given name from the world model.
*
* All attached axes are also disabled (if live) and deleted.
*
* This function will fail, if this axis group is under control by another function.
*
* @param name: (string) Name of the axis group to delete. Axis group with
* such name must exist.
*
* @return
* \endenglish
*/
int axisGroupDelete(const std::string &name);
/**
* \chinese
* group_name name parent pose pose 0 姿
* typev_limita_limitq_limits axis_index
* pose
*
*
* @param group_name: axis_group_add()
* @param name:
* @param parent: group_name
* @param pose: 姿type 0z type 1线z
* @param type: 0 1 线
* @param v_limit:
* @param a_limit:
* @param q_limits:
* @param axis_index:
* \endchinese
* \english
* Adds an external axis with the given name to the axis group named group_name.
* The axis is attached at the given pose in the reference coordinate frame defined by parent when its axis position is 0.
* The type, max velocity, max acceleration, position limits, and index of this axis are defined by type, v_limit, a_limit, q_limits, and axis_index, respectively.
* The pose parameter is typically obtained from a calibration process when the external axis is commissioned.
* This function will fail if this axis group is under control of another function, or if the kinematic chain created by the attachment forms a closed chain.
*
* @param group_name: Name of the axis group this new axis is added to. The axis group would have been created using axis_group_add(). Axis group with such name must exist.
* @param name: Name of the new axis. The name cannot be an empty string. Names used by world model objects (e.g., frame, axis group, axis, etc.) must be unique.
* @param parent: Name of the parent axis. If its empty or the same as group_name, the new axis will be attached to the base of the axis group. Axis with such name must exist in the axis group.
* @param pose: The zero-position pose, in the parent coordinate frame, this axis will be placed and attached to. This is the pose the axis will be (relative to its parent) when its axis position is 0. If type is 0 (rotary), then the z axis of the frame corresponds to the axis of rotation. If type is 1 (linear), then the z axis is the axis of translation.
* @param type: Axis type, 0 for rotary, 1 for linear.
* @param v_limit: Maximum velocity.
* @param a_limit: Maximum acceleration.
* @param q_limits: Position limits.
* @param axis_index: Axis index.
* \endenglish
*/
int axisGroupAddAxis(const std::string &group_name, const std::string &name,
const std::string &parent,
const std::vector<double> &pose);
/**
* \chinese
* pose
*
* 使
*
* @param name:
* @param pose (): 姿 0 姿
* \endchinese
* \english
* Updates the corresponding properties of axis with name. The pose
* parameter is typically obtained from a calibration process when the
* external axis is commissioned. See here for a guide on a basic routine
* for calibrating a single rotary axis.
*
* This function will fail, if the axis group the axis attached to is
* already being controlled by another command.
* This function will fail, if any attached axis of the axis group is live
* and enabled.
*
* @param name: (string) Name of the axis to update. Axis with such name
* must exist.
*
* @param pose (optional): (pose) New zero-position pose, in the coordinate
* frame of the parent axis (or axis group), of the axis. This is the pose
* of the axis when its axis position is 0.
* \endenglish
*/
int axisGroupUpdateAxis(const std::string &name,
const std::vector<double> &pose);
/**
* \chinese
* RTDE
*
* @param axis_name: (string)
*
* @return integer: RTDE
* \endchinese
* \english
* Returns the index of the axis with given axis_name in the RTDE target
* positions and actual positions arrays.
*
* @param axis_name: (string) Name of the axis in query.
* Axis with such name must exist.
*
* @return integer: Index of the axis in the RTDE target positions and
* actual positions arrays.
* \endenglish
*/
int axisGroupGetAxisIndex(const std::string &name);
/**
* \chinese
*
*
* @param axis_index: ()
*
* @return :
* \endchinese
* \english
* Returns the name of the axis with the given axis_index.
*
* @param axis_index: (integer) Index of the axis in query.
* Axis with such index must exist.
*
* @return string: Name of the axis.
* \endenglish
*/
std::string axisGroupGetAxisName(int index);
/**
* \chinese
*
* group_name
*
* 线
*
* @param group_name (): (string)
*
* @return Double[]:
* \endchinese
* \english
* Returns the current target positions of the axis group with group_name.
* If group_name is not provided, the target positions of all external axes
* will be returned.
*
* This function will fail, if the external axis bus is disabled.
*
* @param group_name (optional): (string) Name of the axis group in query.
* Axis group with such name must REALLY exist.
*
* @return Double[]: Target positions of the involved axes, in the order of
* their external axis indices.
* \endenglish
*/
std::vector<double> axisGroupGetTargetPositions(
const std::string &group_name);
/**
* \chinese
*
* group_name
*
* 线
*
* @param group_name (): (string)
*
* @return Double[]:
* \endchinese
* \english
* Returns the current actual positions of the axis group with group_name.
* If group_name is not provided, the actual positions of all external axes
* will be returned.
*
* This function will fail, if the external axis bus is disabled.
*
* @param group_name (optional): (string) Name of the axis group in query.
* Axis group with such name must exist.
*
* @return Double[]: Actual positions of the involved axes, in the order of
* their external axis indices.
* \endenglish
*/
std::vector<double> axisGroupGetActualPositions(
const std::string &group_name);
/**
* \chinese
* offset group_name
*
* RTDE
*
* @param group_name: (string)
*
* @param offset: (float[]) offset
*
* @return
* \endchinese
* \english
* Shifts the target and actual positions of the axis group group_name by
* the given offset.
*
* This is a software shift that happens in the controller only, it does not
* affect external axis drives. The shift is also applied to any streamed
* target and actual positions published on RTDE.
*
* @param group_name: (string) Name of the axis group to apply the offset
* positions to. Axis group with such name must exist.
*
* @param offset: (float[]) Offsets that the target and actual positions
* should be shifted by. The size of offset must match the number of axes
* attached to the given group.
*
* @return
* \endenglish
*/
int axisGroupOffsetPositions(const std::string &group_name,
const std::vector<double> &offset);
/**
* \chinese
* 线 group_name q
* a
* v
*
*
*
* @param group_name: (string)
* @param q: (float[]) 线q
* @param a: (float) (0,1]
* @param v: (float) (0,1]
*
* :
* \endchinese
* \english
* Moves the axes of axis group named group_name to new positions q, using a
* trapezoidal velocity profile. Factor a specifying the percentage of the
* max profile accelerations out of the acceleration limits of each axes.
* Factor v specifying the percentage of the max profile velocities out of
* the velocity limits of each axes.
*
* The actual accelerations and velocities are determined by the most
* constraining axis, so that all the axes complete the acceleration,
* cruise, and deceleration phases at the same time.
*
* @param group_name: (string) Name of the axis group to move.
* Axis group with such name must exist.
*
* @param q: (float[]) Target positions in rad (rotary) or in m (linear). If
* the target exceeds the position limits, then it is set to the nearest
* limit. The involved axes are ordered increasingly by their axis indices.
* The size of q must match the number of axes attached to the given group.
*
* @param a: (float) Factor specifying the max accelerations of this move
* out of the acceleration limits. a must be in range of (0,1].
*
* @param v: (float) Factor specifying the max velocities of this move out
* of the velocity limits. v must be in range of (0,1].
*
* Return: n/a
* \endenglish
*/
int axisGroupMoveJoint(const std::string &group_name,
const std::vector<double> &q, double a, double v);
/**
* \chinese
* a group_name qd t
* @param group_name: (string)
* @param qd: (float[]) qd
* @param a: (float) (0,1]
* @param t (): (float) t < 0 t 0
* \endchinese
* \english
* Accelerates the axes of axis group named group_name up to the target
* velocities qd. Factor a specifying the percentage of the max
* accelerations out of the acceleration limits of each axes. The function
* will run for a period of t seconds.
*
* @param group_name: (string) Name of the external axis group to control.
* Axis group with such name must exist.
*
* @param qd: (float[]) Target velocities for the axes in the axis group. If
* the target exceeds the velocity limits, then it is set to the limit. The
* involved axes are ordered increasingly by their axis indices. The size of
* qd must match the number of axes attached to the given group.
*
* @param a: (float) Factor specifying the max accelerations of this move
* out of the acceleration limits. a must be in range of (0,1].
*
* @param t (optional): (float) Duration in seconds before the function
* returns. If t < 0, then the function will return when the target
* velocities are reached. if t 0, then the function will return after
* this duration, regardless of what the achieved axes velocities are.
* \endenglish
*/
int axisGroupSpeedJoint(const std::string &group_name,
const std::vector<double> &qd, double a, double t);
protected:
void *d_;
};
using SyncMovePtr = std::shared_ptr<SyncMove>;
} // namespace common_interface
} // namespace arcs
#endif // AUBO_SDK_SYNC_MOVE_INTERFACE_H

View File

@ -0,0 +1,342 @@
/** @file system_info.h
* @brief
*/
#ifndef AUBO_SDK_SYSTEM_INFO_INTERFACE_H
#define AUBO_SDK_SYSTEM_INFO_INTERFACE_H
#include <stdint.h>
#include <string>
#include <memory>
#include <aubo/global_config.h>
namespace arcs {
namespace common_interface {
class ARCS_ABI_EXPORT SystemInfo
{
public:
SystemInfo();
virtual ~SystemInfo();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* getControlSoftwareVersionCode(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua函数原型
* getControlSoftwareVersionCode() -> number
*
* @par C++
* @code
* int control_version =
* rpc_cli->getSystemInfo()->getControlSoftwareVersionCode();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareVersionCode","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":28003}
*
* \endchinese
* \english
* Get the controller software version code
*
* @return Returns the controller software version code
*
* @par Python prototype
* getControlSoftwareVersionCode(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua prototype
* getControlSoftwareVersionCode() -> number
*
* @par C++ example
* @code
* int control_version =
* rpc_cli->getSystemInfo()->getControlSoftwareVersionCode();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareVersionCode","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":28003}
*
* \endenglish
*/
int getControlSoftwareVersionCode();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* getControlSoftwareFullVersion(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua函数原型
* getControlSoftwareFullVersion() -> string
*
* @par C++
* @code
* std::string control_version =
* rpc_cli->getSystemInfo()->getControlSoftwareFullVersion();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareFullVersion","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":"0.31.0-alpha.16+20alc76"}
*
* \endchinese
* \english
* Get the full controller software version
*
* @return Returns the full controller software version
*
* @par Python prototype
* getControlSoftwareFullVersion(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua prototype
* getControlSoftwareFullVersion() -> string
*
* @par C++ example
* @code
* std::string control_version =
* rpc_cli->getSystemInfo()->getControlSoftwareFullVersion();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareFullVersion","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":"0.31.0-alpha.16+20alc76"}
*
* \endenglish
*/
std::string getControlSoftwareFullVersion();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* getInterfaceVersionCode(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua函数原型
* getInterfaceVersionCode() -> number
*
* @par C++
* @code
* int interface_version =
* rpc_cli->getSystemInfo()->getInterfaceVersionCode();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getInterfaceVersionCode","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":22003}
*
* \endchinese
* \english
* Get the interface version code
*
* @return Returns the interface version code
*
* @par Python prototype
* getInterfaceVersionCode(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua prototype
* getInterfaceVersionCode() -> number
*
* @par C++ example
* @code
* int interface_version =
* rpc_cli->getSystemInfo()->getInterfaceVersionCode();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getInterfaceVersionCode","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":22003}
*
* \endenglish
*/
int getInterfaceVersionCode();
/**
* \chinese
*
*
* @return
*
* @par Python函数原型
* getControlSoftwareBuildDate(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua函数原型
* getControlSoftwareBuildDate() -> string
*
* @par C++
* @code
* std::string build_date =
* rpc_cli->getSystemInfo()->getControlSoftwareBuildDate();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareBuildDate","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":"2024-3-5 07:03:20"}
*
* \endchinese
* \english
* Get the controller software build date
*
* @return Returns the controller software build date
*
* @par Python prototype
* getControlSoftwareBuildDate(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua prototype
* getControlSoftwareBuildDate() -> string
*
* @par C++ example
* @code
* std::string build_date =
* rpc_cli->getSystemInfo()->getControlSoftwareBuildDate();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareBuildDate","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":"2024-3-5 07:03:20"}
*
* \endenglish
*/
std::string getControlSoftwareBuildDate();
/**
* \chinese
* git版本
*
* @return git版本
*
* @par Python函数原型
* getControlSoftwareVersionHash(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua函数原型
* getControlSoftwareVersionHash() -> string
*
* @par C++
* @code
* std::string git_version =
* rpc_cli->getSystemInfo()->getControlSoftwareVersionHash();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareVersionHash","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":"fa4f64a"}
*
* \endchinese
* \english
* Get the controller software git version
*
* @return Returns the controller software git version
*
* @par Python prototype
* getControlSoftwareVersionHash(self: pyaubo_sdk.SystemInfo) -> str
*
* @par Lua prototype
* getControlSoftwareVersionHash() -> string
*
* @par C++ example
* @code
* std::string git_version =
* rpc_cli->getSystemInfo()->getControlSoftwareVersionHash();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSoftwareVersionHash","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":"fa4f64a"}
*
* \endenglish
*/
std::string getControlSoftwareVersionHash();
/**
* \chinese
* ( ns )
*
* @return ( ns )
*
* @par Python函数原型
* getControlSystemTime(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua函数原型
* getControlSystemTime() -> number
*
* @par C++
* @code
* std::string system_time =
* rpc_cli->getSystemInfo()->getControlSystemTime();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSystemTime","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":9287799079682}
*
* \endchinese
* \english
* Get the system time (software start time in nanoseconds)
*
* @return Returns the system time (software start time in nanoseconds)
*
* @par Python prototype
* getControlSystemTime(self: pyaubo_sdk.SystemInfo) -> int
*
* @par Lua prototype
* getControlSystemTime() -> number
*
* @par C++ example
* @code
* std::string system_time =
* rpc_cli->getSystemInfo()->getControlSystemTime();
* @endcode
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"SystemInfo.getControlSystemTime","params":[],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":9287799079682}
*
* \endenglish
*/
uint64_t getControlSystemTime();
protected:
void *d_;
};
using SystemInfoPtr = std::shared_ptr<SystemInfo>;
} // namespace common_interface
} // namespace arcs
#endif

View File

@ -0,0 +1,231 @@
/** @file trace.h
* \~chinese @brief \~english @brief Interface for injecting logs into the controller's logging system
*/
#ifndef AUBO_SDK_TRACE_INTERFACE_H
#define AUBO_SDK_TRACE_INTERFACE_H
#include <string>
#include <vector>
#include <memory>
#include <sstream>
#include <aubo/global_config.h>
#include <aubo/type_def.h>
namespace arcs {
namespace common_interface {
/**
* \~chinese \~english provides a logging system for controller extension programs
*/
class ARCS_ABI_EXPORT Trace
{
public:
Trace();
virtual ~Trace();
/**
* \~chinese aubo_control \~english Injects alarm information into the aubo_control log
*
* TraceLevel: \n
* 0 - FATAL \n
* 1 - ERROR \n
* 2 - WARNING \n
* 3 - INFO \n
* 4 - DEBUG \n
*
* \~chinese code定义参考 error_stack \~english Code definitions refer to error_stack
*
* @param level
* @param code
* @param args
* @return
*
* \~chinese @par Python函数原型 \~english @par Python function prototype
* alarm(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
* arg1: int, arg2: List[str]) -> int
*
* \~chinese @par Lua函数原型 \~english @par Lua function prototype
* alarm(level: number, code: number, args: table) -> nil
*
* \~chinese @par JSON-RPC请求示例 \~english @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"rob1.Trace.alarm","params":["",1,["Error","Trajectory
* planning failed!","1"]],"id":1}
*
* \~chinese @par JSON-RPC响应示例 \~engish @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
*
*/
int alarm(TraceLevel level, int code,
const std::vector<std::string> &args = {});
/**
* \chinese
*
*
* @param msg
* @return
*
* @par Python函数原型
* textmsg(self: pyaubo_sdk.Trace, arg0: str) -> int
*
* @par Lua函数原型
* textmsg(msg: string) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"rob1.Trace.textmsg","params":["test"],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
* \english
* print message into log
*
* @param msg message information
* @return
*
* @par Python function prototype
* textmsg(self: pyaubo_sdk.Trace, arg0: str) -> int
*
* @par Lua function prototype
* textmsg(msg: string) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"rob1.Trace.textmsg","params":["test"],"id":1}
*
* @par JSON-RPC responose example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
*/
int textmsg(const std::string &msg);
/**
* \~chinese \~english Notify the system
*
* @param msg
* @return
*/
int notify(const std::string &msg);
/**
* \chinese
* RTDE
*
* @param level
* @param title
* @param msg
* @param mode \n
* 0: \n
* 1: \n
* 2: bool \n
* 3: int \n
* 4: double \n
* 5: string \n
* @return
*
* @par Python函数原型
* popup(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
* arg1: str, arg2: str, arg3: int) -> int
*
* @par Lua函数原型
* popup(level: number, title: string, msg: string, mode: number) -> nil
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"rob1.Trace.popup","params":["","Error","Trajectory
* planning failed!",1],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":0}
* \endchinese
* \english
* Send a popup request to the connected RTDE client
*
* @param level
* @param title
* @param msg
* @param mode mode \n
* 0: normal mode \n
* 1: blocking mode \n
* 2: input mode bool \n
* 3: input mode int \n
* 4: input mode double \n
* 5: input mode string \n
* @return
*
* @par Python function prototype
* popup(self: pyaubo_sdk.Trace, arg0: arcs::common_interface::TraceLevel,
* arg1: str, arg2: str, arg3: int) -> int
*
* @par Lua function prototype
* popup(level: number, title: string, msg: string, mode: number) -> nil
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"rob1.Trace.popup","params":["","Error","Trajectory
* planning failed!",1],"id":1}
*
* @par JSON-RPC response example
* {"id":1,"jsonrpc":"2.0","result":0}
* \endenglish
*/
int popup(TraceLevel level, const std::string &title,
const std::string &msg, int mode);
/**
* \chinese
* peek最新的 AlarmInfo()
*
* last_time设置为0时AlarmInfo
*
* @param num
* @param last_time
* @return
*
* @par Python函数原型
* peek(self: pyaubo_sdk.Trace, arg0: int, arg1: int) ->
* List[arcs::common_interface::RobotMsg]
*
* @par Lua函数原型
* peek(num: number, last_time: number) -> table
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"rob1.Trace.peek","params":[1,0],"id":1}
*
* @par JSON-RPC响应示例
* {{"id":1,"jsonrpc":"2.0","result":[{"args":["RobotModeType.Running"],
* "code":30045,"level":"INFO","source":"rob1","timestamp":5102883064300}]}
* \endchinese
* \english
* peek the latest AlarmInfo (after the last retrieval)
*
* When last_time is set as 0, retrieve all AlarmInfo
*
* @param num
* @param last_time
* @return
*
* @par Python function prototype
* peek(self: pyaubo_sdk.Trace, arg0: int, arg1: int) ->
* List[arcs::common_interface::RobotMsg]
*
* @par Lua function prototype
* peek(num: number, last_time: number) -> table
*
* @par JSON-RPC request example
* {"jsonrpc":"2.0","method":"rob1.Trace.peek","params":[1,0],"id":1}
*
* @par JSON-RPC response example
* {{"id":1,"jsonrpc":"2.0","result":[{"args":["RobotModeType.Running"],
* "code":30045,"level":"INFO","source":"rob1","timestamp":5102883064300}]}
* \endenglish
*/
RobotMsgVector peek(size_t num, uint64_t last_time = 0);
protected:
void *d_;
};
using TracePtr = std::shared_ptr<Trace>;
} // namespace common_interface
} // namespace arcs
#endif

View File

@ -0,0 +1,941 @@
/** @file type_def.h
* \~chinese @brief \~english @brief enum type definitions
*/
#ifndef AUBO_SDK_TYPE_DEF_H
#define AUBO_SDK_TYPE_DEF_H
#include <stddef.h>
#include <array>
#include <vector>
#include <memory>
#include <functional>
#include <iostream>
#include <string>
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
// clang-format off
namespace arcs {
namespace common_interface {
/// Cartesion degree of freedom, 6 for x,y,z,rx,ry,rz
#define CARTESIAN_DOF 6
#define SAFETY_PARAM_SELECT_NUM 2 ///< \~chinese 正常 + 缩减 \~english normal + reduced
#define SAFETY_PLANES_NUM 8 ///< \~chinese 安全平面的数量 \~english Number of safety planes
#define SAFETY_CUBIC_NUM 10 ///< \~chinese 安全立方体的数量 \~english Number of safety cubes
#define TOOL_CONFIGURATION_NUM 3 ///< \~chinese 工具配置数量 \~english Number of tool configurations
using Vector3d = std::array<double, 3>;
using Vector4d = std::array<double, 4>;
using Vector3f = std::array<float, 3>;
using Vector4f = std::array<float, 4>;
using Vector6f = std::array<float, 6>;
struct RobotSafetyParameterRange
{
RobotSafetyParameterRange()
{
for (int i = 0; i < SAFETY_PARAM_SELECT_NUM; i++) {
params[i].power = 0.;
params[i].momentum = 0.;
params[i].stop_time = 0.;
params[i].stop_distance = 0.;
params[i].reduced_entry_time = 0.;
params[i].reduced_entry_distance = 0.;
params[i].tcp_speed = 0.;
params[i].elbow_speed = 0.;
params[i].tcp_force = 0.;
params[i].elbow_force = 0.;
std::fill(params[i].qmin.begin(), params[i].qmin.end(), 0.);
std::fill(params[i].qmax.begin(), params[i].qmax.end(), 0.);
std::fill(params[i].qdmax.begin(), params[i].qdmax.end(), 0.);
std::fill(params[i].joint_torque.begin(),
params[i].joint_torque.end(), 0.);
params[i].tool_orientation.fill(0.);
params[i].tool_deviation = 0.;
for (int j = 0; j < SAFETY_PLANES_NUM; j++) {
params[i].planes[j].fill(0.);
params[i].restrict_elbow[j] = 0;
}
}
for (int i = 0; i < SAFETY_PLANES_NUM; i++) {
trigger_planes[i].plane.fill(0.);
trigger_planes[i].restrict_elbow = 0;
}
for (int i = 0; i < SAFETY_CUBIC_NUM; i++) {
cubic[i].orig.fill(0.);
cubic[i].size.fill(0.);
cubic[i].restrict_elbow = 0;
}
for (int i = 0; i < TOOL_CONFIGURATION_NUM; i++) {
tools[i].fill(0.);
}
tool_inclination = 0.;
tool_azimuth = 0.;
std::fill(safety_home.begin(), safety_home.end(), 0.);
safety_input_emergency_stop = 0;
safety_input_safeguard_stop = 0;
safety_input_safeguard_reset = 0;
safety_input_auto_safeguard_stop = 0;
safety_input_auto_safeguard_reset = 0;
safety_input_three_position_switch = 0;
safety_input_operational_mode = 0;
safety_input_reduced_mode = 0;
safety_input_handguide = 0;
safety_output_emergency_stop = 0;
safety_output_not_emergency_stop = 0;
safety_output_robot_moving = 0;
safety_output_robot_steady = 0;
safety_output_reduced_mode = 0;
safety_output_not_reduced_mode = 0;
safety_output_safe_home = 0;
safety_output_robot_not_stopping = 0;
safety_output_safetyguard_stop = 0;
tp_3pe_for_handguide = 1;
allow_manual_high_speed = 0;
}
uint32_t crc32{ 0 };
/// \~chinese 最多可以保存2套参数, 默认使用第 0 套参数 \~english At most 2
/// sets of parameters can be saved, default is the 0th set
struct
{
float power; ///< \~chinese 关节力矩与关节角速度的乘积之和 \~english sum of joint torques times joint angular speeds
float momentum; ///< \~chinese 机器人动量限制 \~english robot momentum limit
float stop_time; ///< \~chinese 停机时间 ms \~english stop time in milliseconds
float stop_distance; ///< \~chinese 停机距离 m \~english stop distance in meters
float reduced_entry_time; ///< \~chinese 进入缩减模式的最大时间 \~english maximum time to enter reduced mode
float reduced_entry_distance; ///< \~chinese 进入缩减模式的最大距离(可由安全平面触发) \~english maximum distance to enter reduced mode (can be triggered by safety planes)
float tcp_speed;
float elbow_speed;
float tcp_force;
float elbow_force;
std::vector<float> qmin;
std::vector<float> qmax;
std::vector<float> qdmax;
std::vector<float> joint_torque;
Vector3f tool_orientation; ///<
float tool_deviation;
Vector4f planes[SAFETY_PLANES_NUM]; /// x,y,z,displacement
int restrict_elbow[SAFETY_PLANES_NUM];
} params[SAFETY_PARAM_SELECT_NUM];
/// \~chinese 8个触发平面 \~english 8 trigger planes
struct
{
Vector4f plane; /// x,y,z,displacement
int restrict_elbow;
} trigger_planes[SAFETY_PLANES_NUM];
struct
{
Vector6f orig; ///< \~chinese 立方块的原点 (x,y,z,rx,ry,rz) \~english origin of the cubic (x,y,z,rx,ry,rz)
Vector3f size; ///< \~chinese 立方块的尺寸 (x,y,z) \~english size of the cubic (x,y,z)
int restrict_elbow;
} cubic[SAFETY_CUBIC_NUM]; ///< \~chinese 10个安全空间 \~english 10 safety spaces
/// \~chinese 3个工具 \~english 3 tools
Vector4f tools[TOOL_CONFIGURATION_NUM]; /// x,y,z,radius
float tool_inclination{
0.
}; ///< \~chinese 倾角 \~english inclination angle
float tool_azimuth{ 0. }; ///< \~chinese 方位角 \~english azimuth angle
std::vector<float> safety_home;
/// \~chinese 可配置IO的输入输出安全功能配置 \~english Configurable IO input
/// and output safety functions
uint32_t safety_input_emergency_stop;
uint32_t safety_input_safeguard_stop;
uint32_t safety_input_safeguard_reset;
uint32_t safety_input_auto_safeguard_stop;
uint32_t safety_input_auto_safeguard_reset;
uint32_t safety_input_three_position_switch;
uint32_t safety_input_operational_mode;
uint32_t safety_input_reduced_mode;
uint32_t safety_input_handguide;
uint32_t safety_output_emergency_stop;
uint32_t safety_output_not_emergency_stop;
uint32_t safety_output_robot_moving;
uint32_t safety_output_robot_steady;
uint32_t safety_output_reduced_mode;
uint32_t safety_output_not_reduced_mode;
uint32_t safety_output_safe_home;
uint32_t safety_output_robot_not_stopping;
uint32_t safety_output_safetyguard_stop;
int tp_3pe_for_handguide; ///< \~chinese 是否将示教器三档位开关作为拖动功能开关 \~english Whether to use the three-position switch of the teach pendant as a hand guiding function switch
int allow_manual_high_speed; ///< \~chinese 手动模式下允许高速运行 /~english Allow high-speed operation in manual mode
};
inline std::ostream &operator<<(std::ostream &os,
const RobotSafetyParameterRange &vd)
{
// os << (int)vd;
return os;
}
struct WObjectData
{
/// \~chinese 是否为外部工具 \~english Whether it is an external tool
bool remote_tool{ false };
/// \~chinese 工件坐标系耦合的 \~english Coupled with the workpiece
/// coordinate system
std::string attach_frame{ "" };
/// \~english User coordinate system. \~chinese 用户坐标系
/// \~chinese 如果 robhold 为 false, 那 uframe 的数值是基于 world \~english
/// If robhold is false, the values of uframe are based on world.
/// \~chinese 否则uframe 的数值是基于 flange \~english Otherwise, the
/// values of uframe are based on flange.
std::vector<double> user_coord{ std::vector<double>(6, 0) };
/// \~chinese 工件坐标系,基于 uframe \~english tool coordinate system,
/// based on uframe
std::vector<double> obj_coord{ std::vector<double>(6, 0) };
};
inline std::ostream &operator<<(std::ostream &os, WObjectData p)
{
return os;
}
/// \~chinese 接口函数返回值定义 \~english Error codes definition
///
/// \~chinese 整数为警告负数为错误0为没有错误也没有警告 \~english whole
/// number is warning, negative number is error, 0 is no error and no warning
#define ENUM_AuboErrorCodes_DECLARES \
ENUM_ITEM(AUBO_OK, 0, "Success") \
ENUM_ITEM(AUBO_BAD_STATE, 1, "State error") \
ENUM_ITEM(AUBO_QUEUE_FULL, 2, "Planning queue full") \
ENUM_ITEM(AUBO_BUSY, 3, "The previous command is executing") \
ENUM_ITEM(AUBO_TIMEOUT, 4, "Timeout") \
ENUM_ITEM(AUBO_INVL_ARGUMENT, 5, "Invalid parameters") \
ENUM_ITEM(AUBO_NOT_IMPLETEMENT, 6, "Interface not implemented") \
ENUM_ITEM(AUBO_NO_ACCESS, 7, "Cannot access") \
ENUM_ITEM(AUBO_CONN_REFUSED, 8, "Connection refused") \
ENUM_ITEM(AUBO_CONN_RESET, 9, "Connection is reset") \
ENUM_ITEM(AUBO_INPROGRESS, 10, "Execution in progress") \
ENUM_ITEM(AUBO_EIO, 11, "Input/Output error") \
ENUM_ITEM(AUBO_NOBUFFS, 12, "") \
ENUM_ITEM(AUBO_REQUEST_IGNORE, 13, "Request was ignored") \
ENUM_ITEM(AUBO_ALGORITHM_PLAN_FAILED, 14, \
"Motion planning algorithm error") \
ENUM_ITEM(AUBO_VERSION_INCOMPAT, 15, "Interface version unmatch") \
ENUM_ITEM(AUBO_DIMENSION_ERR, 16, \
"Input parameter dimension is incorrect") \
ENUM_ITEM(AUBO_SINGULAR_ERR, 17, "Input configuration may be singular") \
ENUM_ITEM(AUBO_POS_BOUND_ERR, 18, \
"Input position boundary exceeds the limit range") \
ENUM_ITEM(AUBO_INIT_POS_ERR, 19, "Initial position input is unreasonable") \
ENUM_ITEM(AUBO_ELP_SETTING_ERR, 20, "Envelope body setting error") \
ENUM_ITEM(AUBO_TRAJ_GEN_FAIL, 21, "Trajectory generation failed") \
ENUM_ITEM(AUBO_TRAJ_SELF_COLLISION, 22, "Trajectory self collision") \
ENUM_ITEM( \
AUBO_IK_NO_CONVERGE, 23, \
"Inverse kinematics computation did not converge; computation failed") \
ENUM_ITEM(AUBO_IK_OUT_OF_RANGE, 24, \
"Inverse kinematics result out of robot range") \
ENUM_ITEM(AUBO_IK_CONFIG_DISMATCH, 25, \
"Inverse kinematics input configuration contains errors") \
ENUM_ITEM(AUBO_IK_JACOBIAN_FAILED, 26, \
"The calculation of the inverse Jacobian matrix failed") \
ENUM_ITEM(AUBO_IK_NO_SOLU, 27, \
"The target point has solutions, but it has exceeded the joint " \
"limit conditions") \
ENUM_ITEM(AUBO_IK_UNKOWN_ERROR, 28, "Inverse kinematics unkown error") \
ENUM_ITEM(AUBO_MOVE_IGNORED_SERVOMODE, 29, \
"Robot is in servo mode where movement is disabled") \
ENUM_ITEM(AUBO_INST_QUEUED, 100, "Instruction pused into queue succeed") \
ENUM_ITEM(AUBO_INTERNAL_ERR, 101, "Internal error caused by alg .etc.") \
ENUM_ITEM(AUBO_BADSTATE_THREAD_DETACHED, 200, \
"Bad state: Operation not allowed on detached thread") \
ENUM_ITEM(AUBO_BADSTATE_THREAD_KILLED, 201, \
"Bad state: Operation not allowed on killed thread") \
ENUM_ITEM(AUBO_BADSTATE_TASK_NOT_FOUND, 202, \
"Bad state: Specified task id does not exist in the task queue")\
ENUM_ITEM(AUBO_BADSTATE_RTM_NOT_STARTED, 203, \
"Bad state: RuntimeMachine has not been started yet") \
ENUM_ITEM(AUBO_BADSTATE_RTM_NOT_STOPPED, 204, \
"Bad state: RuntimeMachine must be in Stopped state for this operation") \
ENUM_ITEM(AUBO_BADSTATE_RTM_NOT_PAUSED, 205, \
"Bad state: RuntimeMachine must be in Paused state for this operation") \
ENUM_ITEM(AUBO_BADSTATE_RTM_ABORTING, 206, "Bad state: RuntimeMachine is in aborting state") \
ENUM_ITEM(AUBO_BADSTATE_PSTOP, 207, "Bad state: Operation blocked by protective stop") \
ENUM_ITEM(AUBO_BADSTATE_ROBOT_ESTOP, 208, "Bad state: Robot emergency stop triggered") \
ENUM_ITEM(AUBO_BADSTATE_SYSTEM_ESTOP, 209, "Bad state: System emergency stop triggered") \
ENUM_ITEM(AUBO_BADSTATE_INVALID_ROBOT_MODE, 210, \
"Bad state: Robot is not in required operation mode") \
ENUM_ITEM(AUBO_BADSTATE_INVALID_SAFETY_MODE, 211, \
"Bad state: Robot is not in required safety mode") \
ENUM_ITEM(AUBO_BADSTATE_ROBOT_NOT_RUNNING, 212, \
"Bad state: Robot must be in Running mode for this operation") \
ENUM_ITEM(AUBO_BADSTATE_ROBOT_NOT_POWERED_OFF, 213, \
"Bad state: Robot must be in PowerOff mode for this operation") \
ENUM_ITEM(AUBO_BADSTATE_SERIAL_OPEN_FAILED, 214, "Bad state: Failed to open serial device") \
ENUM_ITEM(AUBO_BADSTATE_SERIAL_NOT_A_TERMINAL, 215, \
"Bad state: Specified device is not a terminal") \
ENUM_ITEM(AUBO_BADSTATE_SERIAL_CONFIG_FAILED, 216, \
"Bad state: Failed to configure serial port parameters") \
ENUM_ITEM(AUBO_BADSTATE_KINEMATICS_COMPENSATE_FAILED, 217, \
"Bad state: Failed to set kinematics compensation parameters") \
ENUM_ITEM(AUBO_BADSTATE_ROBOT_NOT_STEADY, 218, "Bad state: Robot is not in steady state") \
ENUM_ITEM(AUBO_BADSTATE_FREE_DRIVE_ACTIVE, 219, "Bad state: Free-drive mode is active") \
ENUM_ITEM(AUBO_BADSTATE_FORCE_CTRL_ACTIVE, 220, "Bad state: Force control mode is active") \
ENUM_ITEM(AUBO_BADSTATE_SIMULATION_MODE_ACTIVE, 221, \
"Bad state: Operation not allowed in simulation mode") \
ENUM_ITEM(AUBO_ERR_UNKOWN, 99999, "Unkown error occurred.")
/**
* The RuntimeState enum
*
*/
#define ENUM_RuntimeState_DECLARES \
ENUM_ITEM(Running, 0, "正在运行中") \
ENUM_ITEM(Retracting, 1, "倒退") \
ENUM_ITEM(Pausing, 2, "暂停中") \
ENUM_ITEM(Paused, 3, "暂停状态") \
ENUM_ITEM(Stepping, 4, "单步执行中") \
ENUM_ITEM(Stopping, 5, "受控停止中(保持原有轨迹)") \
ENUM_ITEM(Stopped, 6, "已停止") \
ENUM_ITEM(Aborting, 7, "停止(最大速度关节运动停机)")
/**
* \chinese
* @brief The RobotModeType enum
*
*
* \endchinese
*
* \english
* @brief The RobotModeType enum
*
* Hardware related
* \endenglish
*/
#define ENUM_RobotModeType_DECLARES \
ENUM_ITEM(NoController, -1, "提供给示教器使用的, 如果aubo_control进程崩溃则会显示为NoController") \
ENUM_ITEM(Disconnected, 0, "没有连接到机械臂本体(控制器与接口板断开连接或是 EtherCAT 等总线断开)") \
ENUM_ITEM(ConfirmSafety, 1, "正在进行安全配置, 断电状态下进行") \
ENUM_ITEM(Booting, 2, "机械臂本体正在上电初始化") \
ENUM_ITEM(PowerOff, 3, "机械臂本体处于断电状态") \
ENUM_ITEM(PowerOn, 4, "机械臂本体上电成功, 刹车暂未松开(抱死), 关节初始状态未获取") \
ENUM_ITEM(Idle, 5, "机械臂上电成功, 刹车暂未松开(抱死), 电机不通电, 关节初始状态获取完成") \
ENUM_ITEM(BrakeReleasing, 6, "机械臂上电成功, 刹车正在松开") \
ENUM_ITEM(BackDrive, 7, "反向驱动:刹车松开, 电机不通电") \
ENUM_ITEM(Running, 8, "机械臂刹车松开, 运行模式, 控制权由硬件移交给软件") \
ENUM_ITEM(Maintaince, 9, "维护模式: 包括固件升级、参数写入等") \
ENUM_ITEM(Error, 10, "") \
ENUM_ITEM(PowerOffing, 11, "机械臂本体处于断电过程中")
#define ENUM_SafetyModeType_DECLARES \
ENUM_ITEM(Undefined, 0, "安全状态待定") \
ENUM_ITEM(Normal, 1, "正常运行模式") \
ENUM_ITEM(ReducedMode, 2, "缩减运行模式") \
ENUM_ITEM(Recovery, 3, "启动时如果在安全限制之外, 机器人将进入recovery模式") \
ENUM_ITEM(Violation, 4, "超出安全限制(根据安全配置, 例如速度超限等)") \
ENUM_ITEM(ProtectiveStop, 5, "软件触发的停机(保持轨迹, 不抱闸, 不断电)") \
ENUM_ITEM(SafeguardStop, 6, "IO触发的防护停机不保持轨迹, 抱闸, 不断电)") \
ENUM_ITEM(SystemEmergencyStop,7, "系统急停:急停信号由外部输入(可配置输入), 不对外输出急停信号") \
ENUM_ITEM(RobotEmergencyStop, 8, "机器人急停:控制柜急停输入或者示教器急停按键触发, 对外输出急停信号") \
ENUM_ITEM(Fault, 9, "机械臂硬件故障或者系统故障")
//ValidateJointId
/**
* \chinese
* ISO 10218-1:2011(E) 5.7
* Automatic: In automatic mode, the robot shall execute the task programme and
* the safeguarding measures shall be functioning. Automatic operation shall be
* prevented if any stop condition is detected. Switching from this mode shall
* result in a stop.
* \endchinese
* \english
* Based on ISO 10218-1:2011(E) Section 5.7
* Automatic: In automatic mode, the robot shall execute the task programme and
* the safeguarding measures shall be functioning. Automatic operation shall be
* prevented if any stop condition is detected. Switching from this mode shall
* result in a stop.
* \endenglish
*/
#define ENUM_OperationalModeType_DECLARES \
ENUM_ITEM(Disabled, 0, "禁用模式: 不使用 Operational Mode") \
ENUM_ITEM(Automatic, 1, "自动模式: 机器人正常工作模式, 运行速度不会被限制 (auto mode: robot normal operation, speed will not be limited)") \
ENUM_ITEM(Manual, 2, "手动模式: 机器人编程示教模式(T1), 机器人运行速度将会被限制或者机器人程序校验模式(T2) (manual mode: robot programming teaching mode (T1), robot running speed will be limited or robot program verification mode (T2)") \
/**
* \~chinese , \~english Robot control mode, the final control object
*/
#define ENUM_RobotControlModeType_DECLARES \
ENUM_ITEM(Unknown, 0, "未知的控制模式 (unknown control mode)") \
ENUM_ITEM(Position, 1, "位置控制 movej (position control)") \
ENUM_ITEM(Speed, 2, "速度控制 speedj/speedl (speed control)") \
ENUM_ITEM(Servo, 3, "位置控制 servoj (position control)") \
ENUM_ITEM(Freedrive, 4, "拖动示教 freedrive_mode") \
ENUM_ITEM(Force, 5, "末端力控 force_mode") \
ENUM_ITEM(Torque, 6, "关节力矩控制 (joint torque control)") \
ENUM_ITEM(Collision, 7, "碰撞模式 (collision mode)") \
#define ENUM_JointServoModeType_DECLARES \
ENUM_ITEM(Unknown, -1, "未知") \
ENUM_ITEM(Open, 0, "开环模式 (open loop mode)") \
ENUM_ITEM(Current, 1, "电流伺服模式 (current servo mode)") \
ENUM_ITEM(Velocity, 2, "速度伺服模式 (speed servo mode)") \
ENUM_ITEM(Position, 3, "位置伺服模式 (position servo mode)") \
ENUM_ITEM(Torque, 4, "力矩伺服模式 (torque servo mode)") \
#define ENUM_JointStateType_DECLARES \
ENUM_ITEM(Poweroff, 0, "节点未连接到接口板或者已经断电 (node not conected to interface board or already powered off)") \
ENUM_ITEM(Idle, 2, "节点空闲 (node idle)") \
ENUM_ITEM(Fault, 3, "节点错误, 节点停止伺服运动, 刹车抱死 (node error, node stopped servo move, brake engaged)") \
ENUM_ITEM(Running, 4, "节点伺服 (node servo)") \
ENUM_ITEM(Bootload, 5, "节点bootloader状态, 暂停一切通讯 (node bootloader state, pause all communication)") \
#define ENUM_StandardInputAction_DECLARES \
ENUM_ITEM(Default, 0, "无触发") \
ENUM_ITEM(Handguide, 1, "拖动示教,高电平触发") \
ENUM_ITEM(GoHome, 2, "运动到工程初始位姿,高电平触发") \
ENUM_ITEM(StartProgram, 3, "开始工程,上升沿触发") \
ENUM_ITEM(StopProgram, 4, "停止工程,上升沿触发") \
ENUM_ITEM(PauseProgram, 5, "暂停工程,上升沿触发") \
ENUM_ITEM(PopupDismiss, 6, "消除弹窗,上升沿触发") \
ENUM_ITEM(PowerOn, 7, "机器人上电/松刹车,上升沿触发") \
ENUM_ITEM(PowerOff, 8, "机器人抱死刹车/断电,上升沿触发") \
ENUM_ITEM(ResumeProgram, 9, "恢复工程,上升沿触发") \
ENUM_ITEM(SlowDown1, 10, "机器人减速触发1高电平触发") \
ENUM_ITEM(SlowDown2, 11, "机器人减速触发2高电平触发") \
ENUM_ITEM(SafeStop, 12, "安全停止,高电平触发") \
ENUM_ITEM(RunningGuard, 13, "信号,高电平有效") \
ENUM_ITEM(MoveToFirstPoint, 14, "运动到工程初始位姿,高电平触发") \
ENUM_ITEM(xSlowDown1, 15, "机器人减速触发1低电平触发") \
ENUM_ITEM(xSlowDown2, 16, "机器人减速触发2低电平触发") \
ENUM_ITEM(ConveyorTrack, 17, "传送带检测到物品触发,高电平触发") \
ENUM_ITEM(xConveyorTrack, 18, "传送带检测到物品触发,低电平触发") \
ENUM_ITEM(UnlockProtectiveStop, 19, "解除保护性停止,上升沿触发") \
ENUM_ITEM(ArbitraryResumeProgram , 20, "恢复工程,不检查当前位置和暂停点之间的距离,上升沿触发")
#define ENUM_StandardOutputRunState_DECLARES \
ENUM_ITEM(None, 0, "标准输出状态未定义") \
ENUM_ITEM(StopLow, 1, "低电平指示工程停止") \
ENUM_ITEM(StopHigh, 2, "高电平指示机器人停止") \
ENUM_ITEM(RunningHigh, 3, "指示工程正在运行") \
ENUM_ITEM(PausedHigh, 4, "指示工程已经暂停") \
ENUM_ITEM(AtHome, 5, "高电平指示机器人正在拖动") \
ENUM_ITEM(Handguiding, 6, "高电平指示机器人正在拖动") \
ENUM_ITEM(PowerOn, 7, "高电平指示机器人已经上电") \
ENUM_ITEM(RobotEmergencyStop, 8, "高电平指示机器人急停按下") \
ENUM_ITEM(SystemEmergencyStop, 9, "高电平指示外部输入系统急停按下") \
ENUM_ITEM(InternalEmergencyStop, 8, "高电平指示机器人急停按下") \
ENUM_ITEM(ExternalEmergencyStop, 9, "高电平指示外部输入系统急停按下") \
ENUM_ITEM(SystemError, 10, "系统错误,包括故障、超限、急停、安全停止、防护停止 ") \
ENUM_ITEM(NotSystemError, 11, "无系统错误,包括普通模式、缩减模式和恢复模式 ") \
ENUM_ITEM(RobotOperable, 12, "机器人可操作,机器人上电且松刹车了 ") \
ENUM_ITEM(OperationalMode, 13, "高电平指示自动模式,低电平指示手动模式") \
ENUM_ITEM(SafeguardStop, 14, "高电平指示处于安全停止状态") \
ENUM_ITEM(ProtectiveStop, 15, "高电平指示处于防护停止状态")
#define ENUM_SafetyInputAction_DECLARES \
ENUM_ITEM(Unassigned, 0, "安全输入未分配动作") \
ENUM_ITEM(EmergencyStop, 1, "安全输入触发急停") \
ENUM_ITEM(SafeguardStop, 2, "安全输入触发防护停止, 边沿触发") \
ENUM_ITEM(SafeguardReset, 3, "安全输入触发防护重置, 边沿触发") \
ENUM_ITEM(ThreePositionSwitch, 4, "3档位使能开关") \
ENUM_ITEM(OperationalMode, 5, "切换自动模式和手动模式") \
ENUM_ITEM(HandGuide, 6, "拖动示教") \
ENUM_ITEM(ReducedMode, 7, "安全参数切换1(缩减模式)序号越低优先级越高三路输出都无效时选用第0组安全参数") \
ENUM_ITEM(AutomaticModeSafeguardStop, 8, "自动模式下防护停机输入(需要配置三档位使能设备)") \
ENUM_ITEM(AutomaticModeSafeguardReset, 9, "自动模式下上升沿触发防护重置(需要配置三档位使能设备)")
#define ENUM_SafetyOutputRunState_DECLARES \
ENUM_ITEM(Unassigned, 0, "安全输出未定义") \
ENUM_ITEM(SystemEmergencyStop, 1, "输出高当有机器人急停输入或者急停按键被按下") \
ENUM_ITEM(NotSystemEmergencyStop, 2, "输出低当有机器人急停输入或者急停按键被按下") \
ENUM_ITEM(RobotMoving, 3, "输出高当有关节运动速度超过 0.1rad/s") \
ENUM_ITEM(RobotNotMoving, 4, "输出高当所有的关节运动速度不超过 0.1rad/s") \
ENUM_ITEM(ReducedMode, 5, "输出高当机器人处于缩减模式") \
ENUM_ITEM(NotReducedMode, 6, "输出高当机器人不处于缩减模式") \
ENUM_ITEM(SafeHome, 7, "输出高当机器人已经处于安全Home位姿") \
ENUM_ITEM(RobotNotStopping, 8, "输出低当机器人正在急停或者安全停止中")
#define ENUM_PayloadIdentifyMoveAxis_DECLARES \
ENUM_ITEM(Joint_2_6, 0,"第2和6关节运动") \
ENUM_ITEM(Joint_3_6, 1,"第3和6关节运动") \
ENUM_ITEM(Joint_4_6, 2,"第4和6关节运动") \
ENUM_ITEM(Joint_4_5_6, 3,"第4、5、6关节运动") \
#define ENUM_EnvelopingShape_DECLARES \
ENUM_ITEM(Cube, 1,"立方体") \
ENUM_ITEM(Column, 2,"柱状体") \
ENUM_ITEM(Stl, 3,"以STL文件的形式描述负载碰撞集合体")
#define ENUM_TaskFrameType_DECLARES \
ENUM_ITEM(NONE, 0,"") \
ENUM_ITEM(POINT_FORCE, 1, "力控坐标系发生变换, 使得力控参考坐标系的y轴沿着机器人TCP指向力控所选特征的原点, x和z轴取决于所选特征的原始方向" \
"力控坐标系发生变换, 使得力控参考坐标系的y轴沿着机器人TCP指向力控所选特征的原点, x和z轴取决于所选特征的原始方向" \
"机器人TCP与所选特征的起点之间的距离至少为10mm" \
"优先选择X轴, 为所选特征的X轴在力控坐标系Y轴垂直平面上的投影, 如果所选特征的X轴与力控坐标系的Y轴平行, " \
"通过类似方法确定力控坐标系Z轴, Y-X或者Y-Z轴确定之后, 通过右手法则确定剩下的轴") \
ENUM_ITEM(FRAME_FORCE, 2,"力控坐标系不发生变换 SIMPLE_FORC") \
ENUM_ITEM(MOTION_FORCE, 3,"力控坐标系发生变换, 使得力控参考坐标系的x轴为机器人TCP速度在所选特征x-y平面上的投影y轴将垂直于机械臂运动, 并在所选特征的x-y平面内")\
ENUM_ITEM(TOOL_FORCE, 4,"以工具末端坐标系作为力控参考坐标系")
#ifdef ERROR
#undef ERROR
#endif
#define ENUM_TraceLevel_DECLARES \
ENUM_ITEM(FATAL, 0, "") \
ENUM_ITEM(ERROR, 1, "") \
ENUM_ITEM(WARNING, 2, "") \
ENUM_ITEM(INFO, 3, "") \
ENUM_ITEM(DEBUG, 4, "")
#define ENUM_AxisModeType_DECLARES \
ENUM_ITEM(NoController, -1, "提供给示教器使用的, 如果aubo_control进程崩溃则会显示为NoController") \
ENUM_ITEM(Disconnected, 0, "未连接") \
ENUM_ITEM(PowerOff, 1, "断电") \
ENUM_ITEM(BrakeReleasing, 2, "刹车松开中") \
ENUM_ITEM(Idle, 3, "空闲") \
ENUM_ITEM(Running, 4, "运行中") \
ENUM_ITEM(Fault, 5, "错误状态")
#define ENUM_SafeguedStopType_DECLARES \
ENUM_ITEM(None, 0, "无安全停止") \
ENUM_ITEM(SafeguedStopIOInput, 1, "安全停止(IO输入)") \
ENUM_ITEM(SafeguedStop3PE, 2, "安全停止(三态开关)") \
ENUM_ITEM(SafeguedStopOperational, 3, "安全停止(操作模式)")
#define ENUM_RobotEmergencyStopType_DECLARES \
ENUM_ITEM(RobotEmergencyStopNone, 0, "无紧急停止") \
ENUM_ITEM(RobotEmergencyStopControlBox, 1, "紧急停止(控制柜急停)") \
ENUM_ITEM(RobotEmergencyStopTeachPendant, 2, "紧急停止(示教器急停)") \
ENUM_ITEM(RobotEmergencyStopHandle, 3, "紧急停止(手柄急停)") \
ENUM_ITEM(RobotEmergencyStopEI, 4, "紧急停止(固定IO急停)")
#define ENUM_ITEM(c, n, ...) c = n,
enum AuboErrorCodes : int
{
ENUM_AuboErrorCodes_DECLARES
};
enum class RuntimeState : int
{
ENUM_RuntimeState_DECLARES
};
enum class RobotModeType : int
{
ENUM_RobotModeType_DECLARES
};
enum class AxisModeType : int
{
ENUM_AxisModeType_DECLARES
};
/**
* \~chinese : \~english Safety Mode
*
*/
enum class SafetyModeType : int
{
ENUM_SafetyModeType_DECLARES
};
/**
* \~chinese \~english Operational Mode
*/
enum class OperationalModeType : int
{
ENUM_OperationalModeType_DECLARES
};
/**
* \~chinese \~english Robot Control Mode
*/
enum class RobotControlModeType : int
{
ENUM_RobotControlModeType_DECLARES
};
/**
* \~chinese \~english Joint Servo Mode
*/
enum class JointServoModeType : int
{
ENUM_JointServoModeType_DECLARES
};
/**
* \~chinese \~english Joint State
*/
enum class JointStateType : int
{
ENUM_JointStateType_DECLARES
};
/**
* \~chinese \~english Standard Output Run State
*/
enum class StandardOutputRunState : int
{
ENUM_StandardOutputRunState_DECLARES
};
/**
* @brief The StandardInputAction enum
*/
enum class StandardInputAction : int
{
ENUM_StandardInputAction_DECLARES
};
enum class SafetyInputAction : int
{
ENUM_SafetyInputAction_DECLARES
};
enum class SafetyOutputRunState : int
{
ENUM_SafetyOutputRunState_DECLARES
};
enum TaskFrameType
{
ENUM_TaskFrameType_DECLARES
};
enum EnvelopingShape : int
{
ENUM_EnvelopingShape_DECLARES
};
enum PayloadIdentifyMoveAxis : int
{
ENUM_PayloadIdentifyMoveAxis_DECLARES
};
enum TraceLevel
{
ENUM_TraceLevel_DECLARES
};
enum SafeguedStopType : int
{
ENUM_SafeguedStopType_DECLARES
};
enum RobotEmergencyStopType : int
{
ENUM_RobotEmergencyStopType_DECLARES
};
#undef ENUM_ITEM
#define DECL_TO_STRING_FUNC(ENUM) \
inline std::string toString(ENUM v) \
{ \
using T = ENUM; \
std::string name = #ENUM "."; \
ENUM_##ENUM##_DECLARES \
\
return #ENUM ".Unkown"; \
} \
inline std::ostream &operator<<(std::ostream &os, ENUM v) \
{ \
os << toString(v); \
return os; \
}
#define ENUM_ITEM(c, n, ...) \
if (v == T::c) { \
return name + #c; \
}
DECL_TO_STRING_FUNC(RuntimeState)
DECL_TO_STRING_FUNC(RobotModeType)
DECL_TO_STRING_FUNC(AxisModeType)
DECL_TO_STRING_FUNC(SafetyModeType)
DECL_TO_STRING_FUNC(OperationalModeType)
DECL_TO_STRING_FUNC(RobotControlModeType)
DECL_TO_STRING_FUNC(JointServoModeType)
DECL_TO_STRING_FUNC(JointStateType)
DECL_TO_STRING_FUNC(StandardInputAction)
DECL_TO_STRING_FUNC(StandardOutputRunState)
DECL_TO_STRING_FUNC(SafetyInputAction)
DECL_TO_STRING_FUNC(SafetyOutputRunState)
DECL_TO_STRING_FUNC(TaskFrameType)
DECL_TO_STRING_FUNC(TraceLevel)
#undef ENUM_ITEM
enum class ForceControlState
{
Stopped,
Starting,
Stropping,
Running
};
enum class RefFrameType
{
None, ///
Tool, ///< \~chinese 工具坐标系 \~english Tool coordinate system
Path, ///< \~chinese 轨迹坐标系 \~english Trajectory coordinate system
Base ///< \~chinese 基坐标系 \~english Base coordinate system
};
/// \~chinese 圆周运动参数定义 \~english Circular motion parameters definition
struct CircleParameters
{
std::vector<double> pose_via; ///< \~chinese 圆周运动途中点的位姿 \~english Pose of the intermediate point in circular motion
std::vector<double> pose_to; ///< \~chinese 圆周运动结束点的位姿 \~english Pose of the end point in circular motion
double a; ///< \~chinese 加速度, 单位: m/s^2 \~english Acceleration, unit: m/s^2
double v; ///< \~chinese 速度,单位: m/s \~english Speed, unit: m/s
double blend_radius; ///< \~chinese 交融半径,单位: m \~english Blending radius, unit: m
double duration; ///< \~chinese 运行时间,单位: s \~english Running time, unit: s
double helix;
double spiral;
double direction;
int loop_times; ///< \~chinese 暂不支持 \~english Currently not supported
};
inline std::ostream &operator<<(std::ostream &os, CircleParameters p)
{
return os;
}
struct SpiralParameters
{
std::vector<double> frame; ///< \~chinese 参考点,螺旋线的中心点和参考坐标系 \~english Reference point, the center point of the spiral and the reference coordinate system
int plane; ///< \~chinese 参考平面选择 0-XY 1-YZ 2-ZX \~english Reference plane selection 0-XY 1-YZ 2-ZX
double angle; ///< \~chinese 转动的角度,如果为正数,机器人逆时针旋转 \~english The angle of rotation, if positive, the robot rotates counterclockwise
double spiral; ///< \~chinese 正数外扩 \~english Positive outward
double helix; ///< \~chinese 正数上升 \~english Positive upward
};
inline std::ostream &operator<<(std::ostream &os, SpiralParameters p)
{
return os;
}
struct Enveloping
{
EnvelopingShape shape; // \~chinese 包络体形状 \~english Enveloping shape
std::vector<double> ep_args; // \~chinese 包络体组合shape为None或Stl时无需对ep_args赋值; \~english Enveloping combination, when shape is None or Stl, no need to assign value to ep_args.
// \~chinese shape为Cube时ep_args有9个元素分别为xmin,xmax,ymin,ymax,zmin,zmax,rx,ry,rz; \~english When shape is Cube, ep_args has 9 elements, which are xmin, xmax, ymin, ymax, zmin, zmax, rx, ry, rz;
// \~chinese shape为Column时ep_args有5个元素分别为radius,height,rx,ry,rz; \~english When shape is Column, ep_args has 5 elements, which are radius, height, rx, ry, rz;
std::string stl_path; // \~chinese stl的路径(绝对路径)stl文件需为二进制文件, \~english Path of the stl file (absolute path), the stl file must be a binary file, \~chinese shape设置为Stl时此项生效 \~english When shape is set to Stl, this item takes effect
};
inline std::ostream &operator<<(std::ostream &os, Enveloping p)
{
return os;
}
/// \~chinese 用于负载辨识的轨迹配置 \~english Trajectory configuration for
/// payload identification
struct TrajConfig
{
std::vector<Enveloping> envelopings; // \~chinese 包络体组合 \~english Enveloping combination
PayloadIdentifyMoveAxis move_axis; // \~chinese 运动的轴(ID), 下标从0开始 \~english Axis of movement (ID), index starts from 0
std::vector<double> init_joint; // \~chinese 关节初始位置 \~english Initial joint positions
std::vector<double> upper_joint_bound; // \~chinese 运动轴上限 \~english Upper joint limits
std::vector<double> lower_joint_bound; // \~chinese 运动轴下限 \~english Lower joint limits
std::vector<double> max_velocity; // \~chinese 关节运动的最大速度默认值为 3.0 \~english Maximum joint velocities, default value is 3.0
std::vector<double> max_acceleration; // \~chinese 关节运动的最大加速度默认值为 5.0 \~english Maximum joint accelerations, default value is 5.0
};
inline std::ostream &operator<<(std::ostream &os, TrajConfig p)
{
return os;
}
// result with error code
using ResultWithErrno = std::tuple<std::vector<double>, int>;
using ResultWithErrno1 = std::tuple<std::vector<std::vector<double>>, int>;
// mass, cog, aom, inertia
using Payload = std::tuple<double, std::vector<double>, std::vector<double>,
std::vector<double>>;
// force_offset, com, mass, angle
using ForceSensorCalibResult =
std::tuple<std::vector<double>, std::vector<double>, double,
std::vector<double>>;
// force_offset, com, mass, angle error
using ForceSensorCalibResultWithError =
std::tuple<std::vector<double>, std::vector<double>, double,
std::vector<double>, double>;
// \~chinese 动力学模型m,d,k \~english Dynamics model m, d, k
using DynamicsModel =
std::tuple<std::vector<double>, std::vector<double>, std::vector<double>>;
// double xmin;
// double xmax;
// double ymin;
// double ymax;
// double zmin;
// double zmax;
using Box = std::vector<double>;
// double xcbottom;
// double ycbottom;
// double zcbottom;
// double height;
// double radius;
using Cylinder = std::vector<double>;
// double xc;
// double yc;
// double radius;
using Sphere = std::vector<double>;
struct RobotMsg
{
uint64_t timestamp; ///< \~chinese 时间戳,即系统时间 \~english Timestamp,
///< i.e., system time
TraceLevel level; ///< \~chinese 日志等级 \~english Log level
int code; ///< \~chinese 错误码 \~english Error code
std::string
source; ///< \~chinese 发送消息的机器人别名 alias \~english Alias of the
///< robot sending the message
///< \~chinese 可在 /root/arcs_ws/config/aubo_control.conf
///< \~english Can be found in
///< /root/arcs_ws/config/aubo_control.conf
///< \~chinese 配置文件中查到机器人的alias \~english The robot's
///< alias can be found in the configuration file
///< /root/arcs_ws/config/aubo_control.conf
std::vector<std::string> args; ///< \~chinese 机器人参数 \~english Robot parameters
};
using RobotMsgVector = std::vector<RobotMsg>;
/// \~chinese RTDE菜单 \~english RTDE menu
struct RtdeRecipe
{
bool to_server; ///< \~chinese 输入/输出 \~english Input/Output
int chanel; ///< \~chinese 通道 \~english Channel
double frequency; ///< \~chinese 更新频率 \~english Update frequency
int trigger; ///< \~chinese 触发方式(该功能暂未实现): 0 - 周期; 1 - 变化
///< \~english Trigger method (this feature is not yet
///< implemented): 0 - Periodic; 1 - Change
std::vector<std::string> segments; ///< \~chinese 字段列表 \~english segment list
};
/// \~chinese 异常类型 \~english Error type
enum error_type
{
parse_error = -32700, ///< \~chinese 解析错误 \~english Parse error
invalid_request = -32600, ///< \~chinese 无效请求 \~english Invalid request
method_not_found = -32601, ///< \~chinese 方法未找到 \~english Method not found
invalid_params = -32602, ///< \~chinese 无效参数 \~english Invalid parameters
internal_error = -32603, ///< \~chinese 内部错误 \~english Internal error
server_error, ///< \~chinese 服务器错误 \~english Server error
invalid ///< \~chinese 无效 \~english Invalid
};
/// \~chinese 异常码 \~english Exception code
enum ExceptionCode
{
EC_DISCONNECTED = -1, ///< \~chinese 断开连接 \~english Disconnected
EC_NOT_LOGINED = -2, ///< \~chinese 未登录 \~english Not logged in
EC_INVAL_SOCKET = -3, ///< \~chinese 无效套接字 \~english Invalid socket
EC_REQUEST_BUSY = -4, ///< \~chinese 请求繁忙 \~english Request busy
EC_SEND_FAILED = -5, ///< \~chinese 发送失败 \~english Send failed
EC_RECV_TIMEOUT = -6, ///< \~chinese 接收超时 \~english Receive timeout
EC_RECV_ERROR = -7, ///< \~chinese 接收错误 \~english Receive error
EC_PARSE_ERROR = -8, ///< \~chinese 解析错误 \~english Parse error
EC_INVALID_REQUEST = -9, ///< \~chinese 无效请求 \~english Invalid request
EC_METHOD_NOT_FOUND = -10, ///< \~chinese 方法未找到 \~english Method not found
EC_INVALID_PARAMS = -11, ///< \~chinese 无效参数 \~english Invalid parameters
EC_INTERNAL_ERROR = -12, ///< \~chinese 内部错误 \~english Internal error
EC_SERVER_ERROR = -13, ///< \~chinese 服务器错误 \~english Server error
EC_INVALID = -14 ///< \~chinese 无效 \~english Invalid
};
/// \~chinese 自定义异常类 AuboException \~english Custom exception class
/// AuboException
class AuboException : public std::exception
{
public:
AuboException(int code, const std::string &prefix,
const std::string &message) noexcept
: code_(code), message_(prefix + "-" + message)
{
}
AuboException(int code, const std::string &message) noexcept
: code_(code), message_(message)
{
}
error_type type() const
{
if (code_ >= -32603 && code_ <= -32600) {
return static_cast<error_type>(code_);
} else if (code_ >= -32099 && code_ <= -32000) {
return server_error;
} else if (code_ == -32700) {
return parse_error;
}
return invalid;
}
int code() const { return code_; }
const char *what() const noexcept override { return message_.c_str(); }
private:
int code_; ///< \~chinese 异常码 \~english Exception code
std::string message_; ///< \~chinese 异常消息 \~chinese Exception message
};
inline const char *returnValue2Str(int retval)
{
static const char *retval_str[] = {
#define ENUM_ITEM(n, v, s) s,
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
};
enum arcs_index
{
#define ENUM_ITEM(n, v, s) n##_INDEX,
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
};
int index = -1;
#define ENUM_ITEM(n, v, s) \
if (abs(retval) == v) \
index = n##_INDEX;
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
if (index == -1)
{
index = AUBO_ERR_UNKOWN_INDEX;
}
return retval_str[(unsigned)index];
}
} // namespace common_interface
} // namespace arcs
#endif
// clang-format on
#if defined ENABLE_JSON_TYPES
#include "bindings/jsonrpc/json_types.h"
#endif

View File

@ -0,0 +1,53 @@
#ifndef AUBO_SDK_Math_C_H
#define AUBO_SDK_Math_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int poseAdd(MATH_HANDLER h, const double *p1, const double *p2,
double *result);
ARCS_ABI int poseSub(MATH_HANDLER h, const double *p1, const double *p2,
double *result);
ARCS_ABI int interpolatePose(MATH_HANDLER h, const double *p1, const double *p2,
double alpha, double *result);
ARCS_ABI int poseTrans(MATH_HANDLER h, const double *pose_from,
const double *pose_from_to, double *result);
ARCS_ABI int poseTransInv(MATH_HANDLER h, const double *pose_from,
const double *pose_to_from, double *result);
ARCS_ABI int poseInverse(MATH_HANDLER h, const double *pose, double *result);
ARCS_ABI double poseDistance(MATH_HANDLER h, const double *p1,
const double *p2);
ARCS_ABI double poseAngleDistance(MATH_HANDLER h, const double *p1,
const double *p2);
ARCS_ABI BOOL poseEqual(MATH_HANDLER h, const double *p1, const double *p2,
double eps);
ARCS_ABI int transferRefFrame(MATH_HANDLER h, const double *F_b_a_old,
Vector3d_C V_in_a, int type, double *result);
ARCS_ABI int poseRotation(MATH_HANDLER h, const double *pose,
const double *rotv, double *result);
ARCS_ABI int rpyToQuaternion(MATH_HANDLER h, const double *rpy, double *result);
ARCS_ABI int quaternionToRpy(MATH_HANDLER h, const double *quant,
double *result);
ARCS_ABI int tcpOffsetIdentify(MATH_HANDLER h, const double *poses, int rows,
double *result);
ARCS_ABI int calibrateCoordinate(MATH_HANDLER h, const double *poses, int rows,
int type, double *result);
ARCS_ABI int calculateCircleFourthPoint(MATH_HANDLER h, const double *p1,
const double *p2, const double *p3,
int mode, double *result);
ARCS_ABI int forceTrans(MATH_HANDLER h, const double *pose_a_in_b,
const double *force_in_a, double *result);
ARCS_ABI int getDeltaPoseBySensorDistance(MATH_HANDLER h,
const double *distances,
double position, double radius,
double track_scale, double *result);
ARCS_ABI int deltaPoseTrans(MATH_HANDLER h, const double *pose_a_in_b,
const double *ft_in_a, double *result);
ARCS_ABI int deltaPoseAdd(MATH_HANDLER h, const double *pose_a_in_b,
const double *v_in_b, double *result);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,120 @@
#ifndef AUBO_SDK_RegisterControl_C_H
#define AUBO_SDK_RegisterControl_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI BOOL getBoolInput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setBoolInput(REGISTER_CONTROL_HANDLER h, uint32_t address,
BOOL value);
ARCS_ABI int getInt32Input(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setInt32Input(REGISTER_CONTROL_HANDLER h, uint32_t address,
int value);
ARCS_ABI float getFloatInput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setFloatInput(REGISTER_CONTROL_HANDLER h, uint32_t address,
float value);
ARCS_ABI double getDoubleInput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setDoubleInput(REGISTER_CONTROL_HANDLER h, uint32_t address,
double value);
ARCS_ABI BOOL getBoolOutput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setBoolOutput(REGISTER_CONTROL_HANDLER h, uint32_t address,
BOOL value);
ARCS_ABI int getInt32Output(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setInt32Output(REGISTER_CONTROL_HANDLER h, uint32_t address,
int value);
ARCS_ABI float getFloatOutput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setFloatOutput(REGISTER_CONTROL_HANDLER h, uint32_t address,
float value);
ARCS_ABI double getDoubleOutput(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setDoubleOutput(REGISTER_CONTROL_HANDLER h, uint32_t address,
double value);
ARCS_ABI int16_t getInt16Register(REGISTER_CONTROL_HANDLER h, uint32_t address);
ARCS_ABI int setInt16Register(REGISTER_CONTROL_HANDLER h, uint32_t address,
int16_t value);
ARCS_ABI BOOL variableUpdated(REGISTER_CONTROL_HANDLER h, const char *key,
uint64_t since);
ARCS_ABI BOOL hasNamedVariable(REGISTER_CONTROL_HANDLER h, const char *key);
ARCS_ABI int getNamedVariableType(REGISTER_CONTROL_HANDLER h, const char *key,
char *result);
ARCS_ABI BOOL getBool(REGISTER_CONTROL_HANDLER h, const char *key,
BOOL default_value);
ARCS_ABI int setBool(REGISTER_CONTROL_HANDLER h, const char *key, BOOL value);
ARCS_ABI int getVecChar(REGISTER_CONTROL_HANDLER h, const char *key,
const char *default_value, char *result, int sz);
ARCS_ABI int setVecChar(REGISTER_CONTROL_HANDLER h, const char *key,
const char *value, int sz);
ARCS_ABI int getInt32(REGISTER_CONTROL_HANDLER h, const char *key,
int default_value);
ARCS_ABI int setInt32(REGISTER_CONTROL_HANDLER h, const char *key, int value);
ARCS_ABI int getVecInt32(REGISTER_CONTROL_HANDLER h, const char *key,
int32_t *default_value, int *result);
ARCS_ABI int setVecInt32(REGISTER_CONTROL_HANDLER h, const char *key,
int32_t *value);
ARCS_ABI float getFloat(REGISTER_CONTROL_HANDLER h, const char *key,
float default_value);
ARCS_ABI int setFloat(REGISTER_CONTROL_HANDLER h, const char *key, float value);
ARCS_ABI int getVecFloat(REGISTER_CONTROL_HANDLER h, const char *key,
const float *default_value, float *result);
ARCS_ABI int setVecFloat(REGISTER_CONTROL_HANDLER h, const char *key,
const float *value);
ARCS_ABI double getDouble(REGISTER_CONTROL_HANDLER h, const char *key,
double default_value);
ARCS_ABI int setDouble(REGISTER_CONTROL_HANDLER h, const char *key,
double value);
ARCS_ABI int getVecDouble(REGISTER_CONTROL_HANDLER h, const char *key,
const double *default_value, double *result);
ARCS_ABI int setVecDouble(REGISTER_CONTROL_HANDLER h, const char *key,
const double *value);
ARCS_ABI int getString(REGISTER_CONTROL_HANDLER h, const char *key,
const char *default_value, char *result);
ARCS_ABI int setString(REGISTER_CONTROL_HANDLER h, const char *key,
const char *value);
ARCS_ABI int clearNamedVariable(REGISTER_CONTROL_HANDLER h, const char *key);
ARCS_ABI int setWatchDog(REGISTER_CONTROL_HANDLER h, const char *key,
double timeout, int action);
ARCS_ABI int getWatchDogAction(REGISTER_CONTROL_HANDLER h, const char *key);
ARCS_ABI int getWatchDogTimeout(REGISTER_CONTROL_HANDLER h, const char *key);
ARCS_ABI int modbusAddSignal(REGISTER_CONTROL_HANDLER h,
const char *device_info, int slave_number,
int signal_address, int signal_type,
const char *signal_name, BOOL sequential_mode);
ARCS_ABI int modbusDeleteSignal(REGISTER_CONTROL_HANDLER h,
const char *signal_name);
ARCS_ABI int modbusDeleteAllSignals(REGISTER_CONTROL_HANDLER h);
ARCS_ABI int modbusGetSignalStatus(REGISTER_CONTROL_HANDLER h,
const char *signal_name);
ARCS_ABI int modbusGetSignalNames(REGISTER_CONTROL_HANDLER h, char **result);
ARCS_ABI int modbusGetSignalTypes(REGISTER_CONTROL_HANDLER h, int *result);
ARCS_ABI int modbusGetSignalValues(REGISTER_CONTROL_HANDLER h, int *result);
ARCS_ABI int modbusGetSignalErrors(REGISTER_CONTROL_HANDLER h, int *result);
ARCS_ABI int modbusSendCustomCommand(REGISTER_CONTROL_HANDLER h, const char *IP,
int slave_number, int function_code,
uint8_t *data, int sz);
ARCS_ABI int modbusSetDigitalInputAction(REGISTER_CONTROL_HANDLER h,
const char *robot_name,
const char *signal_name,
StandardInputAction_C action);
ARCS_ABI int modbusSetOutputRunstate(REGISTER_CONTROL_HANDLER h,
const char *robot_name,
const char *signal_name,
StandardOutputRunState_C runstate);
ARCS_ABI int modbusSetOutputSignal(REGISTER_CONTROL_HANDLER h,
const char *signal_name, uint16_t value);
ARCS_ABI int modbusSetOutputSignalPulse(REGISTER_CONTROL_HANDLER h,
const char *signal_name, uint16_t value,
double duration);
ARCS_ABI int modbusSetSignalUpdateFrequency(REGISTER_CONTROL_HANDLER h,
const char *signal_name,
int update_frequency);
ARCS_ABI int modbusGetSignalIndex(REGISTER_CONTROL_HANDLER h,
const char *signal_name);
ARCS_ABI int modbusGetSignalError(REGISTER_CONTROL_HANDLER h,
const char *signal_name);
ARCS_ABI int getModbusDeviceStatus(REGISTER_CONTROL_HANDLER h,
const char *device_name);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,78 @@
#ifndef AUBO_SDK_ForceControl_C_H
#define AUBO_SDK_ForceControl_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int fcEnable(FORCE_CONTROL_HANDLER h);
ARCS_ABI int fcDisable(FORCE_CONTROL_HANDLER h);
ARCS_ABI BOOL isFcEnabled(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setTargetForce(FORCE_CONTROL_HANDLER h, const double *feature,
const uint8_t *compliance, const double *wrench,
const double *limits, TaskFrameType_C type);
ARCS_ABI int setDynamicModel(FORCE_CONTROL_HANDLER h, const double *m,
const double *d, const double *k);
ARCS_ABI DynamicsModel_C getDynamicModel(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setDynamicModelContact(FORCE_CONTROL_HANDLER h,
const double *env_stiff,
const double *damp_scale,
const double *stiff_scale);
ARCS_ABI int setCondForce(FORCE_CONTROL_HANDLER h, const double *min,
const double *max, BOOL outside, double timeout);
ARCS_ABI int setCondOrient(FORCE_CONTROL_HANDLER h, const double *frame,
double max_angle, double max_rot, BOOL outside,
double timeout);
ARCS_ABI int setCondPlane(FORCE_CONTROL_HANDLER h, const double *plane,
double timeout);
ARCS_ABI int setCondCylinder(FORCE_CONTROL_HANDLER h, const double *axis,
double radius, BOOL outside, double timeout);
ARCS_ABI int setCondSphere(FORCE_CONTROL_HANDLER h, const double *center,
double radius, BOOL outside, double timeout);
ARCS_ABI int setCondTcpSpeed(FORCE_CONTROL_HANDLER h, const double *min,
const double *max, BOOL outside, double timeout);
ARCS_ABI int setCondActive(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setCondDistance(FORCE_CONTROL_HANDLER h, double distance,
double timeout);
ARCS_ABI int setCondAdvanced(FORCE_CONTROL_HANDLER h, const char *type,
const double *args, double timeout);
ARCS_ABI BOOL isCondFullfiled(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setSupvForce(FORCE_CONTROL_HANDLER h, const double *min,
const double *max);
ARCS_ABI int setSupvOrient(FORCE_CONTROL_HANDLER h, const double *frame,
double max_angle, double max_rot, BOOL outside);
ARCS_ABI int setSupvPosBox(FORCE_CONTROL_HANDLER h, const double *frame,
const double *box);
ARCS_ABI int setSupvPosCylinder(FORCE_CONTROL_HANDLER h, const double *frame,
const double *cylinder);
ARCS_ABI int setSupvPosSphere(FORCE_CONTROL_HANDLER h, const double *frame,
const double *sphere);
ARCS_ABI int setSupvReoriSpeed(FORCE_CONTROL_HANDLER h,
const double *speed_limit, BOOL outside,
double timeout);
ARCS_ABI int setSupvTcpSpeed(FORCE_CONTROL_HANDLER h, const double *speed_limit,
BOOL outside, double timeout);
ARCS_ABI int setLpFilter(FORCE_CONTROL_HANDLER h, const double *cutoff_freq);
ARCS_ABI int resetLpFilter(FORCE_CONTROL_HANDLER h);
ARCS_ABI int speedChangeTune(FORCE_CONTROL_HANDLER h, int speed_levels,
double speed_ratio_min);
ARCS_ABI int speedChangeEnable(FORCE_CONTROL_HANDLER h, double ref_force);
ARCS_ABI int speedChangeDisable(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setDamping(FORCE_CONTROL_HANDLER h, const double *damping,
double ramp_time);
ARCS_ABI int resetDamping(FORCE_CONTROL_HANDLER h);
ARCS_ABI int softFloatEnable(FORCE_CONTROL_HANDLER h);
ARCS_ABI int softFloatDisable(FORCE_CONTROL_HANDLER h);
ARCS_ABI BOOL isSoftFloatEnabled(FORCE_CONTROL_HANDLER h);
ARCS_ABI int setSoftFloatParams(FORCE_CONTROL_HANDLER h, BOOL joint_space,
const uint8_t *select,
const double *stiff_percent,
const double *stiff_damp_ratio,
const double *force_threshold,
const double *force_limit);
ARCS_ABI int toolContact(FORCE_CONTROL_HANDLER h, const uint8_t *direction);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,113 @@
#ifndef AUBO_SDK_IoControl_C_H
#define AUBO_SDK_IoControl_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int getStandardDigitalInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getToolDigitalInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getConfigurableDigitalInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getStandardDigitalOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getToolDigitalOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int setToolIoInput(IO_CONTROL_HANDLER h, int index, BOOL input);
ARCS_ABI BOOL isToolIoInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int getConfigurableDigitalOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getStandardAnalogInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getToolAnalogInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getStandardAnalogOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getToolAnalogOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int setDigitalInputActionDefault(IO_CONTROL_HANDLER h);
ARCS_ABI int setStandardDigitalInputAction(IO_CONTROL_HANDLER h, int index,
StandardInputAction_C action);
ARCS_ABI int setToolDigitalInputAction(IO_CONTROL_HANDLER h, int index,
StandardInputAction_C action);
ARCS_ABI int setConfigurableDigitalInputAction(IO_CONTROL_HANDLER h, int index,
StandardInputAction_C action);
ARCS_ABI StandardInputAction_C
getStandardDigitalInputAction(IO_CONTROL_HANDLER h, int index);
ARCS_ABI StandardInputAction_C getToolDigitalInputAction(IO_CONTROL_HANDLER h,
int index);
ARCS_ABI StandardInputAction_C
getConfigurableDigitalInputAction(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int setDigitalOutputRunstateDefault(IO_CONTROL_HANDLER h);
ARCS_ABI int setStandardDigitalOutputRunstate(
IO_CONTROL_HANDLER h, int index, StandardOutputRunState_C runstate);
ARCS_ABI int setToolDigitalOutputRunstate(IO_CONTROL_HANDLER h, int index,
StandardOutputRunState_C runstate);
ARCS_ABI int setConfigurableDigitalOutputRunstate(
IO_CONTROL_HANDLER h, int index, StandardOutputRunState_C runstate);
ARCS_ABI StandardOutputRunState_C
getStandardDigitalOutputRunstate(IO_CONTROL_HANDLER h, int index);
ARCS_ABI StandardOutputRunState_C
getToolDigitalOutputRunstate(IO_CONTROL_HANDLER h, int index);
ARCS_ABI StandardOutputRunState_C
getConfigurableDigitalOutputRunstate(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int setStandardAnalogOutputRunstate(IO_CONTROL_HANDLER h, int index,
StandardOutputRunState_C runstate);
ARCS_ABI int setToolAnalogOutputRunstate(IO_CONTROL_HANDLER h, int index,
StandardOutputRunState_C runstate);
ARCS_ABI StandardOutputRunState_C
getStandardAnalogOutputRunstate(IO_CONTROL_HANDLER h, int index);
ARCS_ABI StandardOutputRunState_C
getToolAnalogOutputRunstate(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int setStandardAnalogInputDomain(IO_CONTROL_HANDLER h, int index,
int domain);
ARCS_ABI int setToolAnalogInputDomain(IO_CONTROL_HANDLER h, int index,
int domain);
ARCS_ABI int getStandardAnalogInputDomain(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int getToolAnalogInputDomain(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int setStandardAnalogOutputDomain(IO_CONTROL_HANDLER h, int index,
int domain);
ARCS_ABI int setToolAnalogOutputDomain(IO_CONTROL_HANDLER h, int index,
int domain);
ARCS_ABI int setToolVoltageOutputDomain(IO_CONTROL_HANDLER h, int domain);
ARCS_ABI int getToolVoltageOutputDomain(IO_CONTROL_HANDLER h);
ARCS_ABI int getStandardAnalogOutputDomain(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int getToolAnalogOutputDomain(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int setStandardDigitalOutput(IO_CONTROL_HANDLER h, int index,
BOOL value);
ARCS_ABI int setStandardDigitalOutputPulse(IO_CONTROL_HANDLER h, int index,
BOOL value, double duration);
ARCS_ABI int setToolDigitalOutput(IO_CONTROL_HANDLER h, int index, BOOL value);
ARCS_ABI int setToolDigitalOutputPulse(IO_CONTROL_HANDLER h, int index,
BOOL value, double duration);
ARCS_ABI int setConfigurableDigitalOutput(IO_CONTROL_HANDLER h, int index,
BOOL value);
ARCS_ABI int setConfigurableDigitalOutputPulse(IO_CONTROL_HANDLER h, int index,
BOOL value, double duration);
ARCS_ABI int setStandardAnalogOutput(IO_CONTROL_HANDLER h, int index,
double value);
ARCS_ABI int setToolAnalogOutput(IO_CONTROL_HANDLER h, int index, double value);
ARCS_ABI BOOL getStandardDigitalInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getStandardDigitalInputs(IO_CONTROL_HANDLER h);
ARCS_ABI BOOL getToolDigitalInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getToolDigitalInputs(IO_CONTROL_HANDLER h);
ARCS_ABI BOOL getConfigurableDigitalInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getConfigurableDigitalInputs(IO_CONTROL_HANDLER h);
ARCS_ABI double getStandardAnalogInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI double getToolAnalogInput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI BOOL getStandardDigitalOutput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getStandardDigitalOutputs(IO_CONTROL_HANDLER h);
ARCS_ABI BOOL getToolDigitalOutput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getToolDigitalOutputs(IO_CONTROL_HANDLER h);
ARCS_ABI BOOL getConfigurableDigitalOutput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI uint32_t getConfigurableDigitalOutputs(IO_CONTROL_HANDLER h);
ARCS_ABI double getStandardAnalogOutput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI double getToolAnalogOutput(IO_CONTROL_HANDLER h, int index);
ARCS_ABI int getStaticLinkInputNum(IO_CONTROL_HANDLER h);
ARCS_ABI int getStaticLinkOutputNum(IO_CONTROL_HANDLER h);
ARCS_ABI uint32_t getStaticLinkInputs(IO_CONTROL_HANDLER h);
ARCS_ABI uint32_t getStaticLinkOutputs(IO_CONTROL_HANDLER h);
ARCS_ABI BOOL hasEncoderSensor(IO_CONTROL_HANDLER h);
ARCS_ABI int setEncDecoderType(IO_CONTROL_HANDLER h, int type, int range_id);
ARCS_ABI int setEncTickCount(IO_CONTROL_HANDLER h, int tick);
ARCS_ABI int getEncDecoderType(IO_CONTROL_HANDLER h);
ARCS_ABI int getEncTickCount(IO_CONTROL_HANDLER h);
ARCS_ABI int unwindEncDeltaTickCount(IO_CONTROL_HANDLER h, int delta_count);
ARCS_ABI BOOL getToolButtonStatus(IO_CONTROL_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,154 @@
#ifndef AUBO_SDK_MotionControl_C_H
#define AUBO_SDK_MotionControl_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI double getEqradius(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setEqradius(MOTION_CONTROL_HANDLER h, double eqradius);
ARCS_ABI double getSpeedFraction(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setSpeedFraction(MOTION_CONTROL_HANDLER h, double fraction);
ARCS_ABI int speedFractionCritical(MOTION_CONTROL_HANDLER h, BOOL enable);
ARCS_ABI BOOL isSpeedFractionCritical(MOTION_CONTROL_HANDLER h);
ARCS_ABI BOOL isBlending(MOTION_CONTROL_HANDLER h);
ARCS_ABI int pathOffsetEnable(MOTION_CONTROL_HANDLER h);
ARCS_ABI int pathOffsetSet(MOTION_CONTROL_HANDLER h, const double *offset,
int type);
ARCS_ABI int pathOffsetDisable(MOTION_CONTROL_HANDLER h);
ARCS_ABI int jointOffsetEnable(MOTION_CONTROL_HANDLER h);
ARCS_ABI int jointOffsetSet(MOTION_CONTROL_HANDLER h, const double *offset,
int type);
ARCS_ABI int jointOffsetDisable(MOTION_CONTROL_HANDLER h);
ARCS_ABI int getTrajectoryQueueSize(MOTION_CONTROL_HANDLER h);
ARCS_ABI int getQueueSize(MOTION_CONTROL_HANDLER h);
ARCS_ABI int getExecId(MOTION_CONTROL_HANDLER h);
ARCS_ABI double getDuration(MOTION_CONTROL_HANDLER h, int id);
ARCS_ABI double getMotionLeftTime(MOTION_CONTROL_HANDLER h, int id);
ARCS_ABI double getProgress(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setWorkObjectHold(MOTION_CONTROL_HANDLER h,
const char *module_name,
const double *mounting_pose);
ARCS_ABI char *getWorkObjectHold(MOTION_CONTROL_HANDLER h);
ARCS_ABI int getPauseJointPositions(MOTION_CONTROL_HANDLER h, double *result);
ARCS_ABI int setServoMode(MOTION_CONTROL_HANDLER h, BOOL enable);
ARCS_ABI BOOL isServoModeEnabled(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setServoModeSelect(MOTION_CONTROL_HANDLER h, int mode);
ARCS_ABI int getServoModeSelect(MOTION_CONTROL_HANDLER h);
ARCS_ABI int servoJoint(MOTION_CONTROL_HANDLER h, const double *q, double a,
double v, double t, double lookahead_time, double gain);
ARCS_ABI int servoCartesian(MOTION_CONTROL_HANDLER h, const double *pose,
double a, double v, double t, double lookahead_time,
double gain);
ARCS_ABI int servoJointWithAxes(MOTION_CONTROL_HANDLER h, const double *q,
const double *extq, double a, double v,
double t, double lookahead_time, double gain);
ARCS_ABI int servoCartesianWithAxes(MOTION_CONTROL_HANDLER h,
const double *pose, const double *extq,
double a, double v, double t,
double lookahead_time, double gain);
ARCS_ABI int trackJoint(MOTION_CONTROL_HANDLER h, const double *q, double t,
double smooth_scale, double delay_sacle);
ARCS_ABI int trackCartesian(MOTION_CONTROL_HANDLER h, const double *pose,
double t, double smooth_scale, double delay_sacle);
ARCS_ABI int followJoint(MOTION_CONTROL_HANDLER h, const double *q);
ARCS_ABI int followLine(MOTION_CONTROL_HANDLER h, const double *pose);
ARCS_ABI int speedJoint(MOTION_CONTROL_HANDLER h, const double *qd, double a,
double t);
ARCS_ABI int resumeSpeedJoint(MOTION_CONTROL_HANDLER h, const double *qd,
double a, double t);
ARCS_ABI int speedLine(MOTION_CONTROL_HANDLER h, const double *xd, double a,
double t);
ARCS_ABI int resumeSpeedLine(MOTION_CONTROL_HANDLER h, const double *xd,
double a, double t);
ARCS_ABI int moveSpline(MOTION_CONTROL_HANDLER h, const double *q, double a,
double v, double duration);
ARCS_ABI int moveJoint(MOTION_CONTROL_HANDLER h, const double *q, double a,
double v, double blend_radius, double duration);
ARCS_ABI int resumeMoveJoint(MOTION_CONTROL_HANDLER h, const double *q,
double a, double v, double duration);
ARCS_ABI int moveLine(MOTION_CONTROL_HANDLER h, const double *pose, double a,
double v, double blend_radius, double duration);
ARCS_ABI int moveProcess(MOTION_CONTROL_HANDLER h, const double *pose, double a,
double v, double blend_radius);
ARCS_ABI int resumeMoveLine(MOTION_CONTROL_HANDLER h, const double *pose,
double a, double v, double duration);
ARCS_ABI int moveCircle(MOTION_CONTROL_HANDLER h, const double *via_pose,
const double *end_pose, double a, double v,
double blend_radius, double duration);
ARCS_ABI int setCirclePathMode(MOTION_CONTROL_HANDLER h, int mode);
ARCS_ABI int moveCircle2(MOTION_CONTROL_HANDLER h,
const CircleParameters_C *param);
ARCS_ABI int pathBufferAlloc(MOTION_CONTROL_HANDLER h, const char *name,
int type, int size);
ARCS_ABI int pathBufferAppend(MOTION_CONTROL_HANDLER h, const char *name,
const double *waypoints, int rows);
ARCS_ABI int pathBufferEval(MOTION_CONTROL_HANDLER h, const char *name,
const double *a, const double *v, double t);
ARCS_ABI BOOL pathBufferValid(MOTION_CONTROL_HANDLER h, const char *name);
ARCS_ABI int pathBufferFree(MOTION_CONTROL_HANDLER h, const char *name);
ARCS_ABI int pathBufferList(MOTION_CONTROL_HANDLER h, char **result);
ARCS_ABI int movePathBuffer(MOTION_CONTROL_HANDLER h, const char *name);
ARCS_ABI int moveIntersection(MOTION_CONTROL_HANDLER h, const double *poses,
int rows, double a, double v,
double main_pipe_radius, double sub_pipe_radius,
double normal_distance, double normal_alpha);
ARCS_ABI int stopJoint(MOTION_CONTROL_HANDLER h, double acc);
ARCS_ABI int resumeStopJoint(MOTION_CONTROL_HANDLER h, double acc);
ARCS_ABI int stopLine(MOTION_CONTROL_HANDLER h, double acc, double acc_rot);
ARCS_ABI int resumeStopLine(MOTION_CONTROL_HANDLER h, double acc,
double acc_rot);
ARCS_ABI int weaveStart(MOTION_CONTROL_HANDLER h, const char *params);
ARCS_ABI int weaveEnd(MOTION_CONTROL_HANDLER h);
ARCS_ABI int storePath(MOTION_CONTROL_HANDLER h, BOOL keep_sync);
ARCS_ABI int stopMove(MOTION_CONTROL_HANDLER h, BOOL quick, BOOL all_tasks);
ARCS_ABI int startMove(MOTION_CONTROL_HANDLER h);
ARCS_ABI int clearPath(MOTION_CONTROL_HANDLER h);
ARCS_ABI int restoPath(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setFuturePointSamplePeriod(MOTION_CONTROL_HANDLER h,
double sample_time);
ARCS_ABI int getFuturePathPointsJoint(MOTION_CONTROL_HANDLER h,
double **result);
ARCS_ABI int conveyorTrackCircle(MOTION_CONTROL_HANDLER h, int encoder_id,
const double *center, BOOL rotate_tool);
ARCS_ABI int conveyorTrackLine(MOTION_CONTROL_HANDLER h, int encoder_id,
const double *direction);
ARCS_ABI int conveyorTrackStop(MOTION_CONTROL_HANDLER h, int encoder_id,
double a);
ARCS_ABI int setConveyorTrackEncoder(MOTION_CONTROL_HANDLER h, int encoder_id,
int tick_per_meter);
ARCS_ABI int setConveyorTrackLimit(MOTION_CONTROL_HANDLER h, int encoder_id,
double limit);
ARCS_ABI int setConveyorTrackStartWindow(MOTION_CONTROL_HANDLER h,
int encoder_id, double window_min,
double window_max);
ARCS_ABI int setConveyorTrackSensorOffset(MOTION_CONTROL_HANDLER h,
int encoder_id, double offset);
ARCS_ABI int setConveyorTrackSyncSeparation(MOTION_CONTROL_HANDLER h,
int encoder_id, double distance,
double time);
ARCS_ABI int setConveyorTrackCompensate(MOTION_CONTROL_HANDLER h,
int encoder_id, double comp);
ARCS_ABI BOOL isConveyorTrackSync(MOTION_CONTROL_HANDLER h, int encoder_id);
ARCS_ABI BOOL isConveyorTrackExceed(MOTION_CONTROL_HANDLER h, int encoder_id);
ARCS_ABI int getConveyorTrackQueue(MOTION_CONTROL_HANDLER h, int encoder_id,
double *result);
ARCS_ABI int getConveyorTrackNextItem(MOTION_CONTROL_HANDLER h, int encoder_id);
ARCS_ABI int conveyorTrackCreatItem(MOTION_CONTROL_HANDLER h, int encoder_id,
int item_id, const double *offset);
ARCS_ABI BOOL hasItemOnConveyorToTrack(MOTION_CONTROL_HANDLER h,
int encoder_id);
ARCS_ABI BOOL conveyorTrackSwitch(MOTION_CONTROL_HANDLER h, int encoder_id);
ARCS_ABI int conveyorTrackClearItems(MOTION_CONTROL_HANDLER h, int encoder_id);
ARCS_ABI int moveSpiral(MOTION_CONTROL_HANDLER h,
const SpiralParameters_C *param, double blend_radius,
double v, double a, double t);
ARCS_ABI int pathOffsetLimits(MOTION_CONTROL_HANDLER h, double v, double a);
ARCS_ABI int pathOffsetCoordinate(MOTION_CONTROL_HANDLER h, int ref_coord);
ARCS_ABI int getLookAheadSize(MOTION_CONTROL_HANDLER h);
ARCS_ABI int setLookAheadSize(MOTION_CONTROL_HANDLER h, int size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,69 @@
#ifndef AUBO_SDK_RobotAlgorithm_C_H
#define AUBO_SDK_RobotAlgorithm_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI ForceSensorCalibResult_C
calibrateTcpForceSensor(ROBOT_ALGORITHM_HANDLER h, const double *forces,
int forces_rows, const double *poses, int poses_rows);
ARCS_ABI ForceSensorCalibResult_C
calibrateTcpForceSensor2(ROBOT_ALGORITHM_HANDLER h, const double *forces,
int forces_rows, const double *poses, int poses_rows);
ARCS_ABI int payloadIdentify(ROBOT_ALGORITHM_HANDLER h,
const char *data_no_payload,
const char *data_with_payload);
ARCS_ABI int payloadIdentify1(ROBOT_ALGORITHM_HANDLER h, const char *file_name);
ARCS_ABI int payloadCalculateFinished(ROBOT_ALGORITHM_HANDLER h);
ARCS_ABI Payload_C getPayloadIdentifyResult(ROBOT_ALGORITHM_HANDLER h);
ARCS_ABI int generatePayloadIdentifyTraj(ROBOT_ALGORITHM_HANDLER h,
const char *name,
const TrajConfig_C *traj_config);
ARCS_ABI int payloadIdentifyTrajGenFinished(ROBOT_ALGORITHM_HANDLER h);
ARCS_ABI BOOL frictionModelIdentify(ROBOT_ALGORITHM_HANDLER h, const double *q,
int q_rows, const double *qd, int qd_rows,
const double *qdd, int qdd_rows,
const double *temp, int temp_rows);
ARCS_ABI int calibWorkpieceCoordinatePara(ROBOT_ALGORITHM_HANDLER h,
const double *q, int q_rows, int type,
double *result);
ARCS_ABI int forwardDynamics(ROBOT_ALGORITHM_HANDLER h, const double *q,
const double *torqs, double *result);
ARCS_ABI int forwardKinematics(ROBOT_ALGORITHM_HANDLER h, const double *q,
double *result);
ARCS_ABI int forwardToolKinematics(ROBOT_ALGORITHM_HANDLER h, const double *q,
double *result);
ARCS_ABI int forwardDynamics1(ROBOT_ALGORITHM_HANDLER h, const double *q,
const double *torqs, const double *tcp_offset,
double *result);
ARCS_ABI int forwardKinematics1(ROBOT_ALGORITHM_HANDLER h, const double *q,
const double *tcp_offset, double *result);
ARCS_ABI int inverseKinematics(ROBOT_ALGORITHM_HANDLER h, const double *qnear,
const double *pose, double *result);
ARCS_ABI int inverseKinematicsAll(ROBOT_ALGORITHM_HANDLER h, const double *pose,
double **result);
ARCS_ABI int inverseKinematics1(ROBOT_ALGORITHM_HANDLER h, const double *qnear,
const double *pose, const double *tcp_offset,
double *result);
ARCS_ABI int inverseKinematicsAll1(ROBOT_ALGORITHM_HANDLER h,
const double *pose, const double *tcp_offset,
double **result);
ARCS_ABI int inverseToolKinematics(ROBOT_ALGORITHM_HANDLER h,
const double *qnear, const double *pose,
double *result);
ARCS_ABI int inverseToolKinematicsAll(ROBOT_ALGORITHM_HANDLER h,
const double *pose, double **result);
ARCS_ABI int pathMovej(ROBOT_ALGORITHM_HANDLER h, const double *q1, double r1,
const double *q2, double r2, double d, double **result);
ARCS_ABI int pathBlend3Points(ROBOT_ALGORITHM_HANDLER h, int type,
const double *q_start, const double *q_via,
const double *q_to, double r, double d,
double **result);
ARCS_ABI int calcJacobian(ROBOT_ALGORITHM_HANDLER h, const double *q,
BOOL base_or_end, double *result);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,92 @@
#ifndef AUBO_SDK_RobotConfig_C_H
#define AUBO_SDK_RobotConfig_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int getDof(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int getName(ROBOT_CONFIG_HANDLER h, char *result);
ARCS_ABI double getCycletime(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setSlowDownFraction(ROBOT_CONFIG_HANDLER h, int level,
double fraction);
ARCS_ABI double getSlowDownFraction(ROBOT_CONFIG_HANDLER h, int level);
ARCS_ABI int getRobotType(ROBOT_CONFIG_HANDLER h, char *result);
ARCS_ABI int getRobotSubType(ROBOT_CONFIG_HANDLER h, char *result);
ARCS_ABI int getControlBoxType(ROBOT_CONFIG_HANDLER h, char *result);
ARCS_ABI double getDefaultToolAcc(ROBOT_CONFIG_HANDLER h);
ARCS_ABI double getDefaultToolSpeed(ROBOT_CONFIG_HANDLER h);
ARCS_ABI double getDefaultJointAcc(ROBOT_CONFIG_HANDLER h);
ARCS_ABI double getDefaultJointSpeed(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setMountingPose(ROBOT_CONFIG_HANDLER h, const double *pose);
ARCS_ABI int getMountingPose(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int setCollisionLevel(ROBOT_CONFIG_HANDLER h, int level);
ARCS_ABI int getCollisionLevel(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setCollisionStopType(ROBOT_CONFIG_HANDLER h, int type);
ARCS_ABI int getCollisionStopType(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setHomePosition(ROBOT_CONFIG_HANDLER h, const double *positions);
ARCS_ABI int getHomePosition(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int setFreedriveDamp(ROBOT_CONFIG_HANDLER h, const double *damp);
ARCS_ABI int getFreedriveDamp(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getTcpForceSensorNames(ROBOT_CONFIG_HANDLER h, char **result);
ARCS_ABI int selectTcpForceSensor(ROBOT_CONFIG_HANDLER h, const char *name);
ARCS_ABI BOOL hasTcpForceSensor(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setTcpForceOffset(ROBOT_CONFIG_HANDLER h,
const double *force_offset);
ARCS_ABI int getTcpForceOffset(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getBaseForceSensorNames(ROBOT_CONFIG_HANDLER h, char **result);
ARCS_ABI int selectBaseForceSensor(ROBOT_CONFIG_HANDLER h, const char *name);
ARCS_ABI BOOL hasBaseForceSensor(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setBaseForceOffset(ROBOT_CONFIG_HANDLER h,
const double *force_offset);
ARCS_ABI int getBaseForceOffset(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int setPersistentParameters(ROBOT_CONFIG_HANDLER h, const char *param);
ARCS_ABI int setKinematicsCompensate(ROBOT_CONFIG_HANDLER h,
const DHParam_C *param);
ARCS_ABI int setHardwareCustomParameters(ROBOT_CONFIG_HANDLER h,
const char *param);
ARCS_ABI int getHardwareCustomParameters(ROBOT_CONFIG_HANDLER h,
const char *param, char *result);
ARCS_ABI int setRobotZero(ROBOT_CONFIG_HANDLER h);
ARCS_ABI DHParam_C *getKinematicsParam(ROBOT_CONFIG_HANDLER h, BOOL real);
ARCS_ABI DHComp_C *getKinematicsCompensate(ROBOT_CONFIG_HANDLER h,
double ref_temperature);
ARCS_ABI uint32_t getSafetyParametersCheckSum(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int confirmSafetyParameters(
ROBOT_CONFIG_HANDLER h, const RobotSafetyParameterRange_C *parameters);
ARCS_ABI uint32_t calcSafetyParametersCheckSum(
ROBOT_CONFIG_HANDLER h, const RobotSafetyParameterRange_C *parameters);
ARCS_ABI int getJointMaxPositions(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getJointMinPositions(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getJointMaxSpeeds(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getJointMaxAccelerations(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getTcpMaxSpeeds(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getTcpMaxAccelerations(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI BOOL toolSpaceInRange(ROBOT_CONFIG_HANDLER h, const double *pose);
ARCS_ABI int setPayload(ROBOT_CONFIG_HANDLER h, double m, const double *cog,
const double *aom, const double *inertia);
ARCS_ABI Payload_C getPayload(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int getTcpOffset(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getGravity(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int setGravity(ROBOT_CONFIG_HANDLER h, const double *gravity);
ARCS_ABI int setTcpOffset(ROBOT_CONFIG_HANDLER h, const double *offset);
ARCS_ABI int setToolInertial(ROBOT_CONFIG_HANDLER h, double m,
const double *com, const double *inertial);
ARCS_ABI int firmwareUpdate(ROBOT_CONFIG_HANDLER h, const char *fw);
ARCS_ABI double getFirmwareUpdateProcess(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int setTcpForceSensorPose(ROBOT_CONFIG_HANDLER h,
const double *sensor_pose);
ARCS_ABI int getTcpForceSensorPose(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getLimitJointMaxPositions(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getLimitJointMinPositions(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getLimitJointMaxSpeeds(ROBOT_CONFIG_HANDLER h, double *result);
ARCS_ABI int getLimitJointMaxAccelerations(ROBOT_CONFIG_HANDLER h,
double *result);
ARCS_ABI double getLimitTcpMaxSpeed(ROBOT_CONFIG_HANDLER h);
ARCS_ABI SafeguedStopType_C getSafeguardStopType(ROBOT_CONFIG_HANDLER h);
ARCS_ABI int getSafeguardStopSource(ROBOT_CONFIG_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,22 @@
#ifndef AUBO_SDK_RobotInterface_C_H
#define AUBO_SDK_RobotInterface_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI ROBOT_CONFIG_HANDLER robot_getRobotConfig(ROBOT_HANDLER robot);
ARCS_ABI MOTION_CONTROL_HANDLER robot_getMotionControl(ROBOT_HANDLER robot);
ARCS_ABI FORCE_CONTROL_HANDLER robot_getForceControl(ROBOT_HANDLER robot);
ARCS_ABI IO_CONTROL_HANDLER robot_getIoControl(ROBOT_HANDLER robot);
ARCS_ABI SYNC_MOVE_HANDLER robot_getSyncMove(ROBOT_HANDLER robot);
ARCS_ABI ROBOT_ALGORITHM_HANDLER robot_getRobotAlgorithm(ROBOT_HANDLER robot);
ARCS_ABI ROBOT_MANAGE_HANDLER robot_getRobotManage(ROBOT_HANDLER robot);
ARCS_ABI ROBOT_STATE_HANDLER robot_getRobotState(ROBOT_HANDLER robot);
ARCS_ABI TRACE_HANDLER robot_getTrace(ROBOT_HANDLER robot);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,38 @@
#ifndef AUBO_SDK_RobotManage_C_H
#define AUBO_SDK_RobotManage_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int poweron(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int startup(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int poweroff(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int backdrive(ROBOT_MANAGE_HANDLER h, BOOL enable);
ARCS_ABI int freedrive(ROBOT_MANAGE_HANDLER h, BOOL enable);
ARCS_ABI int handguideMode(ROBOT_MANAGE_HANDLER h, int32_t *freeAxes,
const double *feature);
ARCS_ABI int exitHandguideMode(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int getHandguideStatus(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int getHandguideTrigger(ROBOT_MANAGE_HANDLER h);
ARCS_ABI BOOL isHandguideEnabled(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int setSim(ROBOT_MANAGE_HANDLER h, BOOL enable);
ARCS_ABI int setOperationalMode(ROBOT_MANAGE_HANDLER h,
OperationalModeType_C mode);
ARCS_ABI OperationalModeType_C getOperationalMode(ROBOT_MANAGE_HANDLER h);
ARCS_ABI RobotControlModeType_C getRobotControlMode(ROBOT_MANAGE_HANDLER h);
ARCS_ABI BOOL isSimulationEnabled(ROBOT_MANAGE_HANDLER h);
ARCS_ABI BOOL isFreedriveEnabled(ROBOT_MANAGE_HANDLER h);
ARCS_ABI BOOL isBackdriveEnabled(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int setUnlockProtectiveStop(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int startRecord(ROBOT_MANAGE_HANDLER h, const char *file_name);
ARCS_ABI int stopRecord(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int pauseRecord(ROBOT_MANAGE_HANDLER h, BOOL pause);
ARCS_ABI int restartInterfaceBoard(ROBOT_MANAGE_HANDLER h);
ARCS_ABI int setLinkModeEnable(ROBOT_MANAGE_HANDLER h, BOOL enable);
ARCS_ABI BOOL isLinkModeEnabled(ROBOT_MANAGE_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,73 @@
#ifndef AUBO_SDK_RobotState_C_H
#define AUBO_SDK_RobotState_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI RobotModeType_C getRobotModeType(ROBOT_STATE_HANDLER h);
ARCS_ABI SafetyModeType_C getSafetyModeType(ROBOT_STATE_HANDLER h);
ARCS_ABI BOOL isPowerOn(ROBOT_STATE_HANDLER h);
ARCS_ABI BOOL isSteady(ROBOT_STATE_HANDLER h);
ARCS_ABI BOOL isCollisionOccurred(ROBOT_STATE_HANDLER h);
ARCS_ABI BOOL isWithinSafetyLimits(ROBOT_STATE_HANDLER h);
ARCS_ABI int getTcpPose(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getActualTcpOffset(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTargetTcpPose(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getToolPose(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpSpeed(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpForce(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getElbowPosistion(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getElbowVelocity(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getBaseForce(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpTargetPose(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpTargetSpeed(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpTargetForce(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointState(ROBOT_STATE_HANDLER h, JointStateType_C *result);
ARCS_ABI int getJointServoMode(ROBOT_STATE_HANDLER h,
JointServoModeType_C *result);
ARCS_ABI int getJointPositions(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointPositionsHistory(ROBOT_STATE_HANDLER h, int steps,
double *result);
ARCS_ABI int getJointSpeeds(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointAccelerations(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTorqueSensors(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointContactTorques(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getBaseForceSensor(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getTcpForceSensors(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointCurrents(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointVoltages(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTemperatures(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointUniqueIds(ROBOT_STATE_HANDLER h, char **result);
ARCS_ABI int getJointFirmwareVersions(ROBOT_STATE_HANDLER h, int *result);
ARCS_ABI int getJointHardwareVersions(ROBOT_STATE_HANDLER h, int *result);
ARCS_ABI int getMasterBoardUniqueId(ROBOT_STATE_HANDLER h, char *result);
ARCS_ABI int getMasterBoardFirmwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getMasterBoardHardwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getSlaveBoardUniqueId(ROBOT_STATE_HANDLER h, char *result);
ARCS_ABI int getSlaveBoardFirmwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getSlaveBoardHardwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getToolUniqueId(ROBOT_STATE_HANDLER h, char *result);
ARCS_ABI int getToolFirmwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getToolHardwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getToolCommMode(ROBOT_STATE_HANDLER h);
ARCS_ABI int getPedestalUniqueId(ROBOT_STATE_HANDLER h, char *result);
ARCS_ABI int getPedestalFirmwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getPedestalHardwareVersion(ROBOT_STATE_HANDLER h);
ARCS_ABI int getJointTargetPositions(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTargetSpeeds(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTargetAccelerations(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTargetTorques(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI int getJointTargetCurrents(ROBOT_STATE_HANDLER h, double *result);
ARCS_ABI double getControlBoxTemperature(ROBOT_STATE_HANDLER h);
ARCS_ABI double getControlBoxHumidity(ROBOT_STATE_HANDLER h);
ARCS_ABI double getMainVoltage(ROBOT_STATE_HANDLER h);
ARCS_ABI double getMainCurrent(ROBOT_STATE_HANDLER h);
ARCS_ABI double getRobotVoltage(ROBOT_STATE_HANDLER h);
ARCS_ABI double getRobotCurrent(ROBOT_STATE_HANDLER h);
ARCS_ABI int getSlowDownLevel(ROBOT_STATE_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,171 @@
/** @file rpc.h
* @brief RPC模块的交互
*/
#ifndef AUBO_SDK_RPC_H
#define AUBO_SDK_RPC_H
#include <memory>
#include <aubo/aubo_api.h>
#include <aubo/global_config.h>
namespace arcs {
namespace aubo_sdk {
using namespace arcs::common_interface;
/// RPC客户端
class ARCS_ABI RpcClient : public AuboApi
{
public:
enum Event
{
Connected = 0,
Disconnected = 1,
};
/**
* @brief RpcClient
* @param mode 0-TCP 1-UDS
*/
RpcClient(int mode = 0);
~RpcClient();
/**
*
*
* \n
* Aubo SDK
*
* Aubo SDK
*
* @note setLogHandler函数要放在即将触发的日志之前
*
*
* @param handler \n
* : \n
* void handler(int level, const char* filename, int line, const
* std::string& message) \n
* level \n
* &nbsp; 0: LOGLEVEL_FATAL \n
* &nbsp; 1: LOGLEVEL_ERROR \n
* &nbsp; 2: LOGLEVEL_WARNING \n
* &nbsp; 3: LOGLEVEL_INFO \n
* &nbsp; 4: LOGLEVEL_DEBUG \n
* &nbsp; 5: LOGLEVEL_BACKTRACE \n
* filename \n
* line \n
* message \n
* @return
*/
void setLogHandler(
std::function<void(int /*level*/, const char * /*filename*/,
int /*line*/, const std::string & /*message*/)>
handler);
/**
* RPC服务
*
* @param ip IP地址
* @param port RPC的端口号是30004
* @param ip和port为空时unix domain sockets通讯方式
* @retval 0 RPC连接成功
* @retval -8 RPC连接失败RPC连接被拒绝
* @retval -15 RPC连接失败SDK版本与Server版本不兼容
*/
int connect(const std::string &ip = "", int port = 0);
/**
* RPC连接
*
* @retval 0
* @retval -1
*/
int disconnect();
/**
* RPC
*
* @retval true RPC
* @retval false RPC
*/
bool hasConnected() const;
/**
*
*
* @param usrname
* @param passwd
* @return 0
*/
int login(const std::string &usrname, const std::string &passwd);
/**
*
*
* @return 0
*/
int logout();
/**
*
*
* @retval true
* @retval false
*/
bool hasLogined();
/**
* RPC请求超时时间
*
* @param timeout ms
* @return 0
*/
int setRequestTimeout(int timeout = 100);
/**
*
*
* @param cb
* @return
*/
int setEventHandler(std::function<void(int /*event*/)> cb);
/**
*
*
* @param enable
* @return
*/
int setExceptionFree(bool enable);
/**
*
*
* @return
*/
int errorCode() const;
/**
*
*
* @return
*/
int shutdown();
};
using RpcClientPtr = std::shared_ptr<RpcClient>;
} // namespace aubo_sdk
} // namespace arcs
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI arcs::aubo_sdk::RpcClient *createRpcClient(int mode = 0);
ARCS_ABI void destroyRpcClient(arcs::aubo_sdk::RpcClient *cli);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,321 @@
/** @file rpc_c.h
* @brief RPC模块的交互
*/
#ifndef AUBO_SDK_RPC_C_H
#define AUBO_SDK_RPC_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
enum Event
{
Event_Connected = 0,
Event_Disconnected = 1,
};
ARCS_ABI RPC_HANDLER rpc_create_client(int mode = 0);
ARCS_ABI void rpc_destroy_client(RPC_HANDLER cli);
/**
*
*
* \n
* Aubo SDK
*
* Aubo SDK
*
* @note setLogHandler函数要放在即将触发的日志之前
*
*
* @param handler \n
* : \n
* void handler(int level, const char* filename, int line, const
* std::string& message) \n
* level \n
* &nbsp; 0: LOGLEVEL_FATAL \n
* &nbsp; 1: LOGLEVEL_ERROR \n
* &nbsp; 2: LOGLEVEL_WARNING \n
* &nbsp; 3: LOGLEVEL_INFO \n
* &nbsp; 4: LOGLEVEL_DEBUG \n
* &nbsp; 5: LOGLEVEL_BACKTRACE \n
* filename \n
* line \n
* message \n
* @return
*/
ARCS_ABI void rpc_setLogHandler(RPC_HANDLER cli, LOG_HANDLER handler);
/**
* RPC服务
*
* @param ip IP地址
* @param port RPC的端口号是30004
* @param ip和port为空时unix domain sockets通讯方式
* @retval 0 RPC连接成功
* @retval -8 RPC连接失败RPC连接被拒绝
* @retval -15 RPC连接失败SDK版本与Server版本不兼容
*/
ARCS_ABI int rpc_connect(RPC_HANDLER cli, const char *ip = "", int port = 0);
/**
* RPC连接
*
* @retval 0
* @retval -1
*/
ARCS_ABI int rpc_disconnect(RPC_HANDLER cli);
/**
* RPC
*
* @retval true RPC
* @retval false RPC
*/
ARCS_ABI bool rpc_hasConnected(RPC_HANDLER cli);
/**
*
*
* @param usrname
* @param passwd
* @return 0
*/
ARCS_ABI int rpc_login(RPC_HANDLER cli, const char *usrname,
const char *passwd);
/**
*
*
* @return 0
*/
ARCS_ABI int rpc_logout(RPC_HANDLER cli);
/**
*
*
* @retval true
* @retval false
*/
ARCS_ABI bool rpc_hasLogined(RPC_HANDLER cli);
/**
* RPC请求超时时间
*
* @param timeout ms
* @return 0
*/
ARCS_ABI int rpc_setRequestTimeout(RPC_HANDLER cli, int timeout = 10);
/**
*
*
* @param cb
* @return
*/
ARCS_ABI int rpc_setEventHandler(RPC_HANDLER cli, EVENT_CALLBACK cb);
/**
*
*
* @param enable
* @return
*/
ARCS_ABI int rpc_set_exception_free(RPC_HANDLER cli, bool enable);
/**
*
*
* @return
*/
ARCS_ABI int rpc_errorCode(RPC_HANDLER cli);
/**
*
*
* @return
*/
ARCS_ABI int rpc_shutdown(RPC_HANDLER cli);
/**
*
*
* @return MathPtr对象的指针
*
* @par Python函数原型
* getMath(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.Math
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* MathPtr ptr = rpc_cli->getMath();
* @endcode
*
*/
ARCS_ABI MATH_HANDLER rpc_getMath(RPC_HANDLER cli);
/**
*
*
* @return SystemInfoPtr对象的指针
*
* @par Python函数原型
* getSystemInfo(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.SystemInfo
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SystemInfoPtr ptr = rpc_cli->getSystemInfo();
* @endcode
*
*/
ARCS_ABI SYSTEM_INFO_HANDLER rpc_getSystemInfo(RPC_HANDLER cli);
/**
*
*
* @return RuntimeMachinePtr对象的指针
*
* @par Python函数原型
* getRuntimeMachine(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.RuntimeMachine
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RuntimeMachinePtr ptr = rpc_cli->getRuntimeMachine();
* @endcode
*
*/
ARCS_ABI RUNTIME_MACHINE_HANDLER rpc_getRuntimeMachine(RPC_HANDLER cli);
/**
*
*
* @return RegisterControlPtr对象的指针
*
* @par Python函数原型
* getRegisterControl(self: pyaubo_sdk.AuboApi) ->
* pyaubo_sdk.RegisterControl
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* RegisterControlPtr ptr = rpc_cli->getRegisterControl();
* @endcode
*
*/
ARCS_ABI REGISTER_CONTROL_HANDLER rpc_getRegisterControl(RPC_HANDLER cli);
/**
*
*
* @return
*
* @par Python函数原型
* getRobotNames(self: pyaubo_sdk.AuboApi) -> List[str]
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* @endcode
*
* @par JSON-RPC请求示例
* {"jsonrpc":"2.0","method":"getRobotNames","params":[],"id":1}
*
* @par JSON-RPC响应示例
* {"id":1,"jsonrpc":"2.0","result":["rob1"]}
*
*/
ARCS_ABI int rpc_getRobotNames(RPC_HANDLER cli, char **names);
/**
* RobotInterfacePtr
*
* @param name
* @return RobotInterfacePtr对象的指针
*
* @par Python函数原型
* getRobotInterface(self: pyaubo_sdk.AuboApi, arg0: str) ->
* pyaubo_sdk.RobotInterface
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* auto robot_name = rpc_cli->getRobotNames().front();
* RobotInterfacePtr ptr = rpc_cli->getRobotInterface(robot_name);
* @endcode
*
*/
ARCS_ABI ROBOT_HANDLER rpc_getRobotInterface(RPC_HANDLER cli, const char *name);
/**
*
*
* @return
*/
ARCS_ABI int rpc_getAxisNames(RPC_HANDLER cli, char **names);
/**
*
*
* @param name
* @return
*/
ARCS_ABI AXIS_HANDLER rpc_getAxisInterface(RPC_HANDLER cli, const char *name);
/// 获取独立 IO 模块接口
/**
* socket
* @return SocketPtr对象的指针
*
* @par Python函数原型
* getSocket(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Socket
* @endcode
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SocketPtr ptr = rpc_cli->getSocket();
* @endcode
*
*/
ARCS_ABI SOCKET_HANDLER rpc_getSocket(RPC_HANDLER cli);
/**
*
* @return SerialPtr对象的指针
*
* @par Python函数原型
* getSerial(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Serial
*
* @par C++
* @code
* auto rpc_cli = std::make_shared<RpcClient>();
* SerialPtr ptr = rpc_cli->getSerial();
* @endcode
*/
ARCS_ABI SERIAL_HANDLER rpc_getSerial(RPC_HANDLER cli);
/**
*
*
* @return SyncMovePtr对象的指针
*/
ARCS_ABI SYNC_MOVE_HANDLER rpc_getSyncMove(RPC_HANDLER cli, const char *name);
/**
*
*
* @return TracePtr对象的指针
*/
ARCS_ABI TRACE_HANDLER rpc_getTrace(RPC_HANDLER cli, const char *name);
#ifdef __cplusplus
}
#endif
#endif // #define AUBO_SDK_RPC_C_H

View File

@ -0,0 +1,302 @@
/** @file rtde.h
* @brief RPC模块的交互
*/
#ifndef AUBO_SDK_RTDE_H
#define AUBO_SDK_RTDE_H
#include <string>
#include <vector>
#include <functional>
#include <memory>
#include <map>
#include <unordered_map>
#include <aubo/type_def.h>
#include <aubo/global_config.h>
namespace arcs {
namespace aubo_sdk {
class RtdeClient;
/// 向输出数据中增加
class ARCS_ABI OutputBuilder
{
public:
OutputBuilder();
~OutputBuilder();
OutputBuilder &push(int val);
OutputBuilder &push(double val);
OutputBuilder &push(const std::vector<double> &val);
OutputBuilder &push(const std::tuple<int, bool> &val);
OutputBuilder &push(int16_t &val);
OutputBuilder &push(const std::vector<int16_t> &val);
OutputBuilder &push(const std::vector<int> &val);
OutputBuilder &push(const std::string &val);
OutputBuilder &push(char val);
OutputBuilder &push(const common_interface::RtdeRecipe &val);
private:
friend RtdeClient;
class Impl;
Impl *impl;
};
/// 解析输入
class ARCS_ABI InputParser
{
public:
InputParser();
~InputParser();
bool popBool();
int popInt32();
int64_t popInt64();
int16_t popInt16();
double popDouble();
char popChar();
std::vector<int> popVectorInt();
std::vector<int16_t> popVectorInt16();
std::vector<double> popVectorDouble();
std::vector<std::vector<double>> popVectorVectorDouble();
std::vector<common_interface::JointStateType> popVectorJointStateType();
common_interface::RobotModeType popRobotModeType();
common_interface::OperationalModeType popOperationalModeType();
common_interface::SafetyModeType popSafetyModeType();
common_interface::RuntimeState popRuntimeState();
common_interface::RobotMsgVector popRobotMsgVector();
common_interface::Payload popPayload();
private:
friend RtdeClient;
class Impl;
Impl *impl;
};
/// RTDE客户端
class ARCS_ABI RtdeClient
{
public:
enum Event
{
Connected,
Disconnected,
};
/**
* RTDE客户端初始化
*
* @param mode 0 tcp通讯 1 uds通讯
*/
RtdeClient(int mode = 0);
~RtdeClient();
/**
*
*
* \n
* Aubo SDK
*
* Aubo SDK
*
* @note setLogHandler函数要放在即将触发的日志之前
*
*
* @param handler \n
* : \n
* void handler(int level, const char* filename, int line, const
* std::string& message) \n
* level \n
* &nbsp; 0: LOGLEVEL_FATAL \n
* &nbsp; 1: LOGLEVEL_ERROR \n
* &nbsp; 2: LOGLEVEL_WARNING \n
* &nbsp; 3: LOGLEVEL_INFO \n
* &nbsp; 4: LOGLEVEL_DEBUG \n
* &nbsp; 5: LOGLEVEL_BACKTRACE \n
* filename \n
* line \n
* message \n
* @return
*/
void setLogHandler(
std::function<void(int /*level*/, const char * /*filename*/,
int /*line*/, const std::string & /*message*/)>
handler);
/**
*
*
* @param ip IP地址
* @param port RTDE 30010
* @retval 0
* @retval 1
* @retval -1
*/
int connect(const std::string &ip = "", int port = 0);
/**
* socket
*
* @retval true socket
* @retval false socket
*/
bool hasConnected() const;
/**
* socket
*
* @param callback
* @retval true socket
* @retval false socket
*/
bool hasConnected1(std::function<void(bool)> callback);
/**
*
*
* @param usrname
* @param passwd
* @retval 0
* @retval -1
*/
int login(const std::string &usrname, const std::string &passwd);
/**
*
*
* @retval true
* @retval false
*/
bool hasLogined();
/**
*
*
* @return 0
*/
int logout();
/**
*
*
* @retval 0
* @retval -1
*/
int disconnect();
/**
*
*
* @return
*/
int getProtocolVersion();
/**
*
*
* @return
*/
std::map<std::string, int> getInputMaps();
/**
*
*
* @return
*/
std::map<std::string, int> getOutputMaps();
/**
*
*
* @param to_server
* true false
* @param names
* @param freq
* @param expected_chanel
* 0~99
*
* @retval expected_chanel参数的值
* @retval -1
*/
int setTopic(bool to_server, const std::vector<std::string> &names,
double freq, int expected_chanel);
/**
*
*
* @param to_server
* true false
* @param chanel
* @retval 0
* @retval 1
*/
int removeTopic(bool to_server, int chanel);
/**
*
*
* @return
*/
std::unordered_map<int, common_interface::RtdeRecipe>
getRegisteredInputRecipe();
/**
*
*
* @return
*/
std::unordered_map<int, common_interface::RtdeRecipe>
getRegisteredOutputRecipe();
/**
* subscribe from output
*
* @param chanel
* @param callback \n
*
* void callback(InputParser &parser)
* @return 0
*/
int subscribe(int chanel, std::function<void(InputParser &)> callback);
/**
* publish to input
*
* @param chanel
* @param callback \n
*
* void callback(OutputBuilder &builder)
* @retval 0
* @retval -1
*/
int publish(int chanel, std::function<void(OutputBuilder &)> callback);
/**
*
*
* @param cb
* @return
*/
int setEventHandler(std::function<void(int /*event*/)> cb);
private:
class Impl;
Impl *impl;
};
using RtdeClientPtr = std::shared_ptr<RtdeClient>;
} // namespace aubo_sdk
} // namespace arcs
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI arcs::aubo_sdk::RtdeClient *createRtdeClient(int mode = 0);
ARCS_ABI void destroyRtdeClient(arcs::aubo_sdk::RtdeClient *cli);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,180 @@
#ifndef AUBO_SDK_RTDE_C_H
#define AUBO_SDK_RTDE_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief RTDE
*
* @param mode 0 TCP 1 UDS
* @return RTDE NULL
*/
ARCS_ABI RTDE_HANDLE rtde_create_client(int mode);
/**
* @brief RTDE
*
* @param cli RTDE
*/
ARCS_ABI void rtde_destroy_client(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @param handler
*/
ARCS_ABI void rtde_setLogHandler(RTDE_HANDLE cli,
void (*handler)(int level,
const char *filename, int line,
const char *message));
/**
* @brief
*
* @param cli RTDE
* @param ip IP NULL 使
* @param port 0 使
* @return 0 -1
*/
ARCS_ABI int rtde_connect(RTDE_HANDLE cli, const char *ip, int port);
/**
* @brief
*
* @param cli RTDE
* @return true false
*/
ARCS_ABI bool rtde_hasConnected(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @param username
* @param password
* @return 0 -1
*/
ARCS_ABI int rtde_login(RTDE_HANDLE cli, const char *username,
const char *password);
/**
* @brief
*
* @param cli RTDE
* @return true false
*/
ARCS_ABI bool rtde_hasLogined(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @return 0
*/
ARCS_ABI int rtde_logout(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @return 0 -1
*/
ARCS_ABI int rtde_disconnect(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @return
*/
ARCS_ABI int rtde_getProtocolVersion(RTDE_HANDLE cli);
/**
* @brief
*
* @param cli RTDE
* @param to_server true false
*
* @param names
* @param freq
* @param expected_chanel
* @return -1
*/
ARCS_ABI int rtde_setTopic(RTDE_HANDLE cli, bool to_server, const char *names,
double freq, int expected_chanel);
/**
* @brief
*
* @param cli RTDE
* @param to_server
* @param chanel
* @return 0 -1
*/
ARCS_ABI int rtde_removeTopic(RTDE_HANDLE cli, bool to_server, int chanel);
/**
* @brief
*
* @param cli RTDE
* @param chanel
* @param callback
* @return 0 -1
*/
ARCS_ABI int rtde_subscribe(RTDE_HANDLE cli, int chanel,
void (*callback)(void *parser));
/**
* @brief
*
* @param cli RTDE
* @param chanel
* @param callback
* @return 0 -1
*/
ARCS_ABI int rtde_publish(RTDE_HANDLE cli, int chanel,
void (*callback)(void *builder));
// OutputBuilder
ARCS_ABI int rtde_pushInt(OUTPUT_BUILDER_HANDLE builder, int val);
ARCS_ABI int rtde_pushDouble(OUTPUT_BUILDER_HANDLE builder, double val);
ARCS_ABI int rtde_pushVectorDouble(OUTPUT_BUILDER_HANDLE builder, const double* val, int size);
ARCS_ABI int rtde_pushTupleIntBool(OUTPUT_BUILDER_HANDLE builder, int first, bool second);
ARCS_ABI int rtde_pushInt16(OUTPUT_BUILDER_HANDLE builder, int16_t val);
ARCS_ABI int rtde_pushVectorInt16(OUTPUT_BUILDER_HANDLE builder, const int16_t* val, int size);
ARCS_ABI int rtde_pushVectorInt(OUTPUT_BUILDER_HANDLE builder, const int* val, int size);
ARCS_ABI int rtde_pushString(OUTPUT_BUILDER_HANDLE builder, const char* val);
ARCS_ABI int rtde_pushChar(OUTPUT_BUILDER_HANDLE builder, char val);
ARCS_ABI int rtde_pushRtdeRecipe(OUTPUT_BUILDER_HANDLE builder, const struct RtdeRecipe_C* val);
// InputParser
ARCS_ABI bool rtde_popBool(INPUT_PARSER_HANDLE parser);
ARCS_ABI int32_t rtde_popInt32(INPUT_PARSER_HANDLE parser);
ARCS_ABI int64_t rtde_popInt64(INPUT_PARSER_HANDLE parser);
ARCS_ABI int16_t rtde_popInt16(INPUT_PARSER_HANDLE parser);
ARCS_ABI double rtde_popDouble(INPUT_PARSER_HANDLE parser);
ARCS_ABI char rtde_popChar(INPUT_PARSER_HANDLE parser);
ARCS_ABI int rtde_popVectorInt(INPUT_PARSER_HANDLE* parser, int* data, int size);
ARCS_ABI int rtde_popVectorInt16(INPUT_PARSER_HANDLE parser, int16_t* data, int size);
ARCS_ABI int rtde_popVectorDouble(INPUT_PARSER_HANDLE parser, double* data, int size);
ARCS_ABI int rtde_popVectorVectorDouble(INPUT_PARSER_HANDLE parser, double*** data, int rows, int cols);
ARCS_ABI JointStateType_C rtde_popVectorJointStateType(INPUT_PARSER_HANDLE parser);
ARCS_ABI RobotModeType_C rtde_popRobotModeType(INPUT_PARSER_HANDLE parser);
ARCS_ABI OperationalModeType_C rtde_popOperationalModeType(INPUT_PARSER_HANDLE parser);
ARCS_ABI SafetyModeType_C rtde_popSafetyModeType(INPUT_PARSER_HANDLE parser);
ARCS_ABI RuntimeState_C rtde_popRuntimeState(INPUT_PARSER_HANDLE parser);
ARCS_ABI int rtde_popRobotMsgVector(INPUT_PARSER_HANDLE parser, struct RobotMsgVector_C* robot_msg_vec);
ARCS_ABI int rtde_popPayload(INPUT_PARSER_HANDLE parser, struct Payload_C* payload);
#ifdef __cplusplus
}
#endif
#endif // AUBO_SDK_RTDE_C_H

View File

@ -0,0 +1,60 @@
#ifndef AUBO_SDK_RuntimeMachine_C_H
#define AUBO_SDK_RuntimeMachine_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int newTask(RUNTIME_MACHINE_HADNLER h, BOOL daemon);
ARCS_ABI int deleteTask(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int detachTask(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI BOOL isTaskAlive(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int nop(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int switchTask(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int setLabel(RUNTIME_MACHINE_HADNLER h, int tid, const char *lineno);
ARCS_ABI int setPlanContext(RUNTIME_MACHINE_HADNLER h, int tid, int lineno,
const char *comment);
ARCS_ABI int gotoLine(RUNTIME_MACHINE_HADNLER h, int lineno);
ARCS_ABI int getAdvancePlanContext(RUNTIME_MACHINE_HADNLER h, int tid,
struct PlanContext_C *result);
ARCS_ABI int getAdvancePtr(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int getMainPtr(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int getInterpPtr(RUNTIME_MACHINE_HADNLER h, int tid);
ARCS_ABI int getPlanContext(RUNTIME_MACHINE_HADNLER h, int tid,
struct PlanContext_C *result);
ARCS_ABI int getExecutionStatus(RUNTIME_MACHINE_HADNLER h,
struct ExecutionStatus_C *result);
ARCS_ABI int getExecutionStatus1(RUNTIME_MACHINE_HADNLER h,
struct ExecutionStatus1_C *result);
ARCS_ABI int loadProgram(RUNTIME_MACHINE_HADNLER h, const char *program);
ARCS_ABI int runProgram(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int start(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int stop(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int abort1(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int pause(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int step(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int setResumeWait(RUNTIME_MACHINE_HADNLER h, BOOL wait);
ARCS_ABI int resume(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI RuntimeState_C getStatus(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI RuntimeState_C getRuntimeState(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int setBreakPoint(RUNTIME_MACHINE_HADNLER h, int lineno);
ARCS_ABI int removeBreakPoint(RUNTIME_MACHINE_HADNLER h, int lineno);
ARCS_ABI int clearBreakPoints(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int timerStart(RUNTIME_MACHINE_HADNLER h, const char *name);
ARCS_ABI int timerStop(RUNTIME_MACHINE_HADNLER h, const char *name);
ARCS_ABI int timerReset(RUNTIME_MACHINE_HADNLER h, const char *name);
ARCS_ABI int timerDelete(RUNTIME_MACHINE_HADNLER h, const char *name);
ARCS_ABI double getTimer(RUNTIME_MACHINE_HADNLER h, const char *name);
ARCS_ABI int triggBegin(RUNTIME_MACHINE_HADNLER h, double distance,
double delay);
ARCS_ABI int triggEnd(RUNTIME_MACHINE_HADNLER h);
ARCS_ABI int triggInterrupt(RUNTIME_MACHINE_HADNLER h, double distance,
double delay);
ARCS_ABI int getTriggInterrupts(RUNTIME_MACHINE_HADNLER h, int *result);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,209 @@
/** @file script.h
* @brief SCRIPT模块的交互
*/
#ifndef AUBO_SDK_SCRIPT_H
#define AUBO_SDK_SCRIPT_H
#include <string>
#include <memory>
#include <functional>
#include <aubo/global_config.h>
namespace arcs {
namespace aubo_sdk {
class ScriptWriter
{
public:
virtual ~ScriptWriter() = default;
virtual ScriptWriter &append(const std::string &line) = 0;
virtual ScriptWriter &append(const char *buf, size_t len) = 0;
virtual ScriptWriter &moveJoint() = 0;
virtual ScriptWriter &moveLine() = 0;
virtual ScriptWriter &ifCondition() = 0;
virtual ScriptWriter &elseCondition() = 0;
virtual ScriptWriter &elseIfCondition() = 0;
virtual ScriptWriter &whileCondition() = 0;
virtual ScriptWriter &end() = 0;
};
/// SCRIPT客户端
class ARCS_ABI ScriptClient
{
public:
enum Event
{
Connected,
Disconnected,
};
ScriptClient(int mode = 0);
~ScriptClient();
/**
*
*
* \n
* Aubo SDK
*
* Aubo SDK
*
* @note setLogHandler函数要放在即将触发的日志之前
*
*
* @param handler \n
* : \n
* void handler(int level, const char* filename, int line, const
* std::string& message) \n
* level \n
* &nbsp; 0: LOGLEVEL_FATAL \n
* &nbsp; 1: LOGLEVEL_ERROR \n
* &nbsp; 2: LOGLEVEL_WARNING \n
* &nbsp; 3: LOGLEVEL_INFO \n
* &nbsp; 4: LOGLEVEL_DEBUG \n
* &nbsp; 5: LOGLEVEL_BACKTRACE \n
* filename \n
* line \n
* message \n
* @return
*/
void setLogHandler(
std::function<void(int /*level*/, const char * /*filename*/,
int /*line*/, const std::string & /*message*/)>
handler);
/**
*
*
* @param ip IP地址
* @param port SCRIPT端口号为30004
* @retval 0
* @retval 1
* @retval -1
*/
int connect(const std::string &ip = "", int port = 0);
/**
*
*
* @retval true
* @retval false
*/
bool hasConnected() const;
/**
*
*
* @param usrname
* @param passwd
* @retval 0
* @retval -1
*/
int login(const std::string &usrname, const std::string &passwd);
/**
*
*
* @retval true
* @retval false
*/
bool hasLogined();
/**
*
*
* @return 0
*/
int logout();
/**
*
*
* @retval 0
* @retval -1
*/
int disconnect();
/**
*
*
*
*
* @param path
* @retval 0
* @retval -1
*/
int sendFile(const std::string &path);
/**
*
*
*
*
* @param script
* @retval 0
* @retval -1
*/
int sendString(const std::string &script);
/**
* 使ScriptWriter构建服务器脚本
*
* @param chunck_name
* @param cb
* @retval 0
* @retval -1
*/
int send(const std::string &chunck_name,
std::function<int(ScriptWriter &)> cb);
/**
*
*
* @param cb
* @return 0
*/
int subscribeVariableUpdate(
std::function<void(const std::string &, const std::string &)> cb);
/**
*
*
* @param cb
* @return 0
*/
ARCS_DEPRECATED int subscribeScriptError(
std::function<void(const std::string &)> cb);
int subscribeScriptError2(
std::function<void(const std::string &, const std::string &)> cb);
/**
*
*
* @param cb
* @return
*/
int setEventHandler(std::function<void(int /*event*/)> cb);
private:
class Impl;
Impl *impl;
};
using ScriptClientPtr = std::shared_ptr<ScriptClient>;
} // namespace aubo_sdk
} // namespace arcs
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI arcs::aubo_sdk::ScriptClient *createScriptClient(int mode = 0);
ARCS_ABI void destroyScriptClient(arcs::aubo_sdk::ScriptClient *cli);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,32 @@
#ifndef AUBO_SDK_Serial_C_H
#define AUBO_SDK_Serial_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int serialOpen(SERIAL_HANDLER h, const char *device, int baud,
float stop_bits, int even, const char *serial_name);
ARCS_ABI int serialClose(SERIAL_HANDLER h, const char *serial_name);
ARCS_ABI int serialReadByte(SERIAL_HANDLER h, const char *variable,
const char *serial_name);
ARCS_ABI int serialReadByteList(SERIAL_HANDLER h, int number,
const char *variable, const char *serial_name);
ARCS_ABI int serialReadString(SERIAL_HANDLER h, const char *variable,
const char *serial_name, const char *prefix,
const char *suffix, BOOL interpret_escape);
ARCS_ABI int serialSendByte(SERIAL_HANDLER h, char value,
const char *serial_name);
ARCS_ABI int serialSendInt(SERIAL_HANDLER h, int value,
const char *serial_name);
ARCS_ABI int serialSendLine(SERIAL_HANDLER h, const char *str,
const char *serial_name);
ARCS_ABI int serialSendString(SERIAL_HANDLER h, const char *str,
const char *serial_name);
ARCS_ABI int serialSendAllString(SERIAL_HANDLER h, BOOL is_check,
const char *str, const char *serial_name);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,38 @@
#ifndef AUBO_SDK_Socket_C_H
#define AUBO_SDK_Socket_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int socketOpen(SOCKET_HANDLER h, const char *address, int port,
const char *socket_name);
ARCS_ABI int socketClose(SOCKET_HANDLER h, const char *socket_name);
ARCS_ABI int socketReadAsciiFloat(SOCKET_HANDLER h, int number,
const char *variable,
const char *socket_name);
ARCS_ABI int socketReadBinaryInteger(SOCKET_HANDLER h, int number,
const char *variable,
const char *socket_name);
ARCS_ABI int socketReadByteList(SOCKET_HANDLER h, int number,
const char *variable, const char *socket_name);
ARCS_ABI int socketReadString(SOCKET_HANDLER h, const char *variable,
const char *socket_name, const char *prefix,
const char *suffix, BOOL interpret_escape);
ARCS_ABI int socketReadAllString(SOCKET_HANDLER h, const char *variable,
const char *socket_name);
ARCS_ABI int socketSendByte(SOCKET_HANDLER h, char value,
const char *socket_name);
ARCS_ABI int socketSendInt(SOCKET_HANDLER h, int value,
const char *socket_name);
ARCS_ABI int socketSendLine(SOCKET_HANDLER h, const char *str,
const char *socket_name);
ARCS_ABI int socketSendString(SOCKET_HANDLER h, const char *str,
const char *socket_name);
ARCS_ABI int socketSendAllString(SOCKET_HANDLER h, BOOL is_check,
const char *str, const char *socket_name);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,22 @@
#ifndef AUBO_SDK_SyncMove_C_H
#define AUBO_SDK_SyncMove_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int syncMoveOn(SYNC_MOVE_HANDLER h, const char *syncident,
const char **taskset);
ARCS_ABI BOOL syncMoveSegment(SYNC_MOVE_HANDLER h, int id);
ARCS_ABI int syncMoveOff(SYNC_MOVE_HANDLER h, const char *syncident);
ARCS_ABI int syncMoveUndo(SYNC_MOVE_HANDLER h);
ARCS_ABI int waitSyncTasks(SYNC_MOVE_HANDLER h, const char *syncident,
const char **taskset);
ARCS_ABI BOOL isSyncMoveOn(SYNC_MOVE_HANDLER h);
ARCS_ABI int syncMoveSuspend(SYNC_MOVE_HANDLER h);
ARCS_ABI int syncMoveResume(SYNC_MOVE_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,18 @@
#ifndef AUBO_SDK_SystemInfo_C_H
#define AUBO_SDK_SystemInfo_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int getControlSoftwareVersionCode(SYSTEM_INFO_HANDLER h);
ARCS_ABI int getControlSoftwareFullVersion(SYSTEM_INFO_HANDLER h, char *result);
ARCS_ABI int getInterfaceVersionCode(SYSTEM_INFO_HANDLER h);
ARCS_ABI int getControlSoftwareBuildDate(SYSTEM_INFO_HANDLER h, char *result);
ARCS_ABI int getControlSoftwareVersionHash(SYSTEM_INFO_HANDLER h, char *result);
ARCS_ABI uint64_t getControlSystemTime(SYSTEM_INFO_HANDLER h);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,20 @@
#ifndef AUBO_SDK_Trace_C_H
#define AUBO_SDK_Trace_C_H
#include <aubo_sdk/type_def_c.h>
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int alarm(TRACE_HANDLER h, TraceLevel_C level, int code,
const char **args);
ARCS_ABI int popup(TRACE_HANDLER h, TraceLevel_C level, const char *title,
const char *msg, int mode);
ARCS_ABI int textmsg(TRACE_HANDLER h, const char *msg);
ARCS_ABI int notify(TRACE_HANDLER h, const char *msg);
ARCS_ABI int peek(TRACE_HANDLER h, uint64_t num, uint64_t last_time,
struct RobotMsg_C *result);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,750 @@
#ifndef AUBO_SDK_TYPE_DEF_C_H
#define AUBO_SDK_TYPE_DEF_C_H
#include <stdint.h>
#include <string.h>
#include <aubo/global_config.h>
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
/// Cartesion degree of freedom, 6 for x,y,z,rx,ry,rz
#define CARTESIAN_DOF 6
#define SAFETY_PARAM_SELECT_NUM 2 /// normal + reduced
#define SAFETY_PLANES_NUM 8 /// 安全平面的数量
#define SAFETY_CUBIC_NUM 10 /// 安全立方体的数量
#define TOOL_CONFIGURATION_NUM 3 /// 工具配置数量
#define MAX_DOF 7 /// 工具配置数量
#define TRUE 1
#define FALSE 0
typedef uint8_t BOOL;
typedef double Vector3d_C[3];
typedef double Vector4d_C[4];
typedef float Vector3f_C[3];
typedef float Vector4f_C[4];
typedef float Vector6f_C[6];
typedef void *RPC_HANDLER;
typedef void *RTDE_HANDLE;
typedef void *INPUT_PARSER_HANDLE;
typedef void *OUTPUT_BUILDER_HANDLE;
typedef void *MATH_HANDLER;
typedef void *SYSTEM_INFO_HANDLER;
typedef void *RUNTIME_MACHINE_HANDLER;
typedef void *REGISTER_CONTROL_HANDLER;
typedef void *RUNTIME_MACHINE_HADNLER;
typedef void *ROBOT_HANDLER;
typedef void *AXIS_HANDLER;
typedef void *SOCKET_HANDLER;
typedef void *SERIAL_HANDLER;
typedef void *SYNC_MOVE_HANDLER;
typedef void *TRACE_HANDLER;
typedef void *FORCE_CONTROL_HANDLER;
typedef void *IO_CONTROL_HANDLER;
typedef void *MOTION_CONTROL_HANDLER;
typedef void *ROBOT_ALGORITHM_HANDLER;
typedef void *ROBOT_MANAGE_HANDLER;
typedef void *ROBOT_CONFIG_HANDLER;
typedef void *ROBOT_STATE_HANDLER;
typedef void (*LOG_HANDLER)(int /*level*/, const char * /*filename*/,
int /*line*/, const char * /*message*/);
typedef void (*EVENT_CALLBACK)(int /*event*/);
struct RobotSafetyParameterRange_C
{
uint32_t crc32{ 0 };
/// 最多可以保存2套参数, 默认使用第 0 套参数
struct
{
float power; ///< sum of joint torques times joint angular speeds
float momentum; ///< 机器人动量限制
float stop_time; ///< 停机时间 ms
float stop_distance; ///< 停机距离 m
float reduced_entry_time; ///< 进入缩减模式的最大时间
float
reduced_entry_distance; ///< 进入缩减模式的最大距离(可由安全平面触发)
float tcp_speed;
float elbow_speed;
float tcp_force;
float elbow_force;
float qmin[MAX_DOF];
float qmax[MAX_DOF];
float qdmax[MAX_DOF];
float joint_torque[MAX_DOF];
Vector3f_C tool_orientation; ///<
float tool_deviation;
Vector4f_C planes[SAFETY_PLANES_NUM]; /// x,y,z,displacement
int restrict_elbow[SAFETY_PLANES_NUM];
} params[SAFETY_PARAM_SELECT_NUM];
/// 8个触发平面
struct
{
Vector4f_C plane; /// x,y,z,displacement
int restrict_elbow;
} trigger_planes[SAFETY_PLANES_NUM];
struct
{
Vector6f_C orig; ///< 立方块的原点 (x,y,z,rx,ry,rz)
Vector3f_C size; ///< 立方块的尺寸 (x,y,z)
int restrict_elbow;
} cubic[SAFETY_CUBIC_NUM]; ///< 10个安全空间
/// 3个工具
Vector4f_C tools[TOOL_CONFIGURATION_NUM]; /// x,y,z,radius
float tool_inclination{ 0. }; ///< 倾角
float tool_azimuth{ 0. }; ///< 方位角
float safety_home[MAX_DOF];
/// 可配置IO的输入输出安全功能配置
uint32_t safety_input_emergency_stop;
uint32_t safety_input_safeguard_stop;
uint32_t safety_input_safeguard_reset;
uint32_t safety_input_auto_safeguard_stop;
uint32_t safety_input_auto_safeguard_reset;
uint32_t safety_input_three_position_switch;
uint32_t safety_input_operational_mode;
uint32_t safety_input_reduced_mode;
uint32_t safety_input_handguide;
uint32_t safety_output_emergency_stop;
uint32_t safety_output_not_emergency_stop;
uint32_t safety_output_robot_moving;
uint32_t safety_output_robot_steady;
uint32_t safety_output_reduced_mode;
uint32_t safety_output_not_reduced_mode;
uint32_t safety_output_safe_home;
uint32_t safety_output_robot_not_stopping;
uint32_t safety_output_safetyguard_stop;
int tp_3pe_for_handguide; ///< 是否将示教器三档位开关作为拖动功能开关
int allow_manual_high_speed; ///< 手动模式下允许高速运行
};
inline void RobotSafetyParameterRange_init(
struct RobotSafetyParameterRange_C *range)
{
memset(range, 0, sizeof(struct RobotSafetyParameterRange_C));
range->tp_3pe_for_handguide = 1;
}
struct WObjectData_C
{
/// 是否为外部工具
bool remote_tool;
/// 工件坐标系耦合的
char attach_frame[100];
/// 用户坐标系
/// 如果 robhold 为 false, 那 uframe 的数值是基于 world
/// 否则uframe 的数值是基于 flange
double user_coord[6];
/// 工件坐标系,基于 uframe
double obj_coord[6];
};
/// 接口函数返回值定义
///
/// 整数为警告负数为错误0为没有错误也没有警告
#define ENUM_AuboErrorCodes_DECLARES \
ENUM_ITEM(AUBO_OK, 0, "Success") \
ENUM_ITEM(AUBO_BAD_STATE, 1, "State error") \
ENUM_ITEM(AUBO_QUEUE_FULL, 2, "Planning queue full") \
ENUM_ITEM(AUBO_BUSY, 3, "The previous command is executing") \
ENUM_ITEM(AUBO_TIMEOUT, 4, "Timeout") \
ENUM_ITEM(AUBO_INVL_ARGUMENT, 5, "Invalid parameters") \
ENUM_ITEM(AUBO_NOT_IMPLETEMENT, 6, "Interface not implemented") \
ENUM_ITEM(AUBO_NO_ACCESS, 7, "Cannot access") \
ENUM_ITEM(AUBO_CONN_REFUSED, 8, "Connection refused") \
ENUM_ITEM(AUBO_CONN_RESET, 9, "Connection is reset") \
ENUM_ITEM(AUBO_INPROGRESS, 10, "Execution in progress") \
ENUM_ITEM(AUBO_EIO, 11, "Input/Output error") \
ENUM_ITEM(AUBO_NOBUFFS, 12, "") \
ENUM_ITEM(AUBO_REQUEST_IGNORE, 13, "Request was ignored") \
ENUM_ITEM(AUBO_ALGORITHM_PLAN_FAILED, 14, \
"Motion planning algorithm error") \
ENUM_ITEM(AUBO_VERSION_INCOMPAT, 15, "Interface version unmatch") \
ENUM_ITEM(AUBO_DIMENSION_ERR, 16, \
"Input parameter dimension is incorrect") \
ENUM_ITEM(AUBO_SINGULAR_ERR, 17, "Input configuration may be singular") \
ENUM_ITEM(AUBO_POS_BOUND_ERR, 18, \
"Input position boundary exceeds the limit range") \
ENUM_ITEM(AUBO_INIT_POS_ERR, 19, "Initial position input is unreasonable") \
ENUM_ITEM(AUBO_ELP_SETTING_ERR, 20, "Envelope body setting error") \
ENUM_ITEM(AUBO_TRAJ_GEN_FAIL, 21, "Trajectory generation failed") \
ENUM_ITEM(AUBO_TRAJ_SELF_COLLISION, 22, "Trajectory self collision") \
ENUM_ITEM( \
AUBO_IK_NO_CONVERGE, 23, \
"Inverse kinematics computation did not converge; computation failed") \
ENUM_ITEM(AUBO_IK_OUT_OF_RANGE, 24, \
"Inverse kinematics result out of robot range") \
ENUM_ITEM(AUBO_IK_CONFIG_DISMATCH, 25, \
"Inverse kinematics input configuration contains errors") \
ENUM_ITEM(AUBO_IK_JACOBIAN_FAILED, 26, \
"The calculation of the inverse Jacobian matrix failed") \
ENUM_ITEM(AUBO_IK_NO_SOLU, 27, \
"The target point has solutions, but it has exceeded the joint " \
"limit conditions") \
ENUM_ITEM(AUBO_IK_UNKOWN_ERROR, 28, "Inverse kinematics unkown error") \
ENUM_ITEM(AUBO_ERR_UNKOWN, 99999, "Unkown error occurred.")
// clang-format off
/**
* The RuntimeState enum
*
*/
#define ENUM_RuntimeState_DECLARES \
ENUM_ITEM(Running, 0, "正在运行中") \
ENUM_ITEM(Retracting, 1, "倒退") \
ENUM_ITEM(Pausing, 2, "暂停中") \
ENUM_ITEM(Paused, 3, "暂停状态") \
ENUM_ITEM(Stepping, 4, "单步执行中") \
ENUM_ITEM(Stopping, 5, "受控停止中(保持原有轨迹)") \
ENUM_ITEM(Stopped, 6, "已停止") \
ENUM_ITEM(Aborting, 7, "停止(最大速度关节运动停机)")
/**
* @brief The RobotModeType enum
*
*
*/
#define ENUM_RobotModeType_DECLARES \
ENUM_ITEM(NoController, -1, "提供给示教器使用的, 如果aubo_control进程崩溃则会显示为NoController") \
ENUM_ITEM(Disconnected, 0, "没有连接到机械臂本体(控制器与接口板断开连接或是 EtherCAT 等总线断开)") \
ENUM_ITEM(ConfirmSafety, 1, "正在进行安全配置, 断电状态下进行") \
ENUM_ITEM(Booting, 2, "机械臂本体正在上电初始化") \
ENUM_ITEM(PowerOff, 3, "机械臂本体处于断电状态") \
ENUM_ITEM(PowerOn, 4, "机械臂本体上电成功, 刹车暂未松开(抱死), 关节初始状态未获取") \
ENUM_ITEM(Idle, 5, "机械臂上电成功, 刹车暂未松开(抱死), 电机不通电, 关节初始状态获取完成") \
ENUM_ITEM(BrakeReleasing, 6, "机械臂上电成功, 刹车正在松开") \
ENUM_ITEM(BackDrive, 7, "反向驱动:刹车松开, 电机不通电") \
ENUM_ITEM(Running, 8, "机械臂刹车松开, 运行模式, 控制权由硬件移交给软件") \
ENUM_ITEM(Maintaince, 9, "维护模式: 包括固件升级、参数写入等") \
ENUM_ITEM(Error, 10, "") \
ENUM_ITEM(PowerOffing, 11, "机械臂本体处于断电过程中")
#define ENUM_SafetyModeType_DECLARES \
ENUM_ITEM(Undefined, 0, "安全状态待定") \
ENUM_ITEM(Normal, 1, "正常运行模式") \
ENUM_ITEM(ReducedMode, 2, "缩减运行模式") \
ENUM_ITEM(Recovery, 3, "启动时如果在安全限制之外, 机器人将进入recovery模式") \
ENUM_ITEM(Violation, 4, "超出安全限制(根据安全配置, 例如速度超限等)") \
ENUM_ITEM(ProtectiveStop, 5, "软件触发的停机(保持轨迹, 不抱闸, 不断电)") \
ENUM_ITEM(SafeguardStop, 6, "IO触发的防护停机不保持轨迹, 抱闸, 不断电)") \
ENUM_ITEM(SystemEmergencyStop,7, "系统急停:急停信号由外部输入(可配置输入), 不对外输出急停信号") \
ENUM_ITEM(RobotEmergencyStop, 8, "机器人急停:控制柜急停输入或者示教器急停按键触发, 对外输出急停信号") \
ENUM_ITEM(Fault, 9, "机械臂硬件故障或者系统故障")
//ValidateJointId
/**
* ISO 10218-1:2011(E) 5.7
* Automatic: In automatic mode, the robot shall execute the task programme and
* the safeguarding measures shall be functioning. Automatic operation shall be
* prevented if any stop condition is detected. Switching from this mode shall
* result in a stop.
*/
#define ENUM_OperationalModeType_DECLARES \
ENUM_ITEM(Disabled, 0, "禁用模式: 不使用Operational Mode") \
ENUM_ITEM(Automatic, 1, "自动模式: 机器人正常工作模式, 运行速度不会被限制") \
ENUM_ITEM(Manual, 2, "手动模式: 机器人编程示教模式(T1), 机器人运行速度将会被限制或者机器人程序校验模式(T2)")
/**
* ,
*/
#define ENUM_RobotControlModeType_DECLARES \
ENUM_ITEM(Unknown, 0, "未知的控制模式") \
ENUM_ITEM(Position, 1, "位置控制 movej") \
ENUM_ITEM(Speed, 2, "速度控制 speedj/speedl") \
ENUM_ITEM(Servo, 3, "位置控制 servoj") \
ENUM_ITEM(Freedrive, 4, "拖动示教 freedrive_mode") \
ENUM_ITEM(Force, 5, "末端力控 force_mode") \
ENUM_ITEM(Torque, 6, "关节力矩控制") \
ENUM_ITEM(Collision, 7, "碰撞模式")
#define ENUM_JointServoModeType_DECLARES \
ENUM_ITEM(Unknown, -1, "未知") \
ENUM_ITEM(Open, 0, "开环模式") \
ENUM_ITEM(Current, 1, "电流伺服模式") \
ENUM_ITEM(Velocity, 2, "速度伺服模式") \
ENUM_ITEM(Position, 3, "位置伺服模式") \
ENUM_ITEM(Torque, 4, "力矩伺服模式")
#define ENUM_JointStateType_DECLARES \
ENUM_ITEM(Poweroff, 0, "节点未连接到接口板或者已经断电") \
ENUM_ITEM(Idle, 2, "节点空闲") \
ENUM_ITEM(Fault, 3, "节点错误, 节点停止伺服运动, 刹车抱死") \
ENUM_ITEM(Running, 4, "节点伺服") \
ENUM_ITEM(Bootload, 5, "节点bootloader状态, 暂停一切通讯")
#define ENUM_StandardInputAction_DECLARES \
ENUM_ITEM(Default, 0, "无触发") \
ENUM_ITEM(Handguide, 1, "拖动示教,高电平触发") \
ENUM_ITEM(GoHome, 2, "运动到工程初始位姿,高电平触发") \
ENUM_ITEM(StartProgram, 3, "开始工程,上升沿触发") \
ENUM_ITEM(StopProgram, 4, "停止工程,上升沿触发") \
ENUM_ITEM(PauseProgram, 5, "暂停工程,上升沿触发") \
ENUM_ITEM(PopupDismiss, 6, "消除弹窗,上升沿触发") \
ENUM_ITEM(PowerOn, 7, "机器人上电/松刹车,上升沿触发") \
ENUM_ITEM(PowerOff, 8, "机器人抱死刹车/断电,上升沿触发") \
ENUM_ITEM(ResumeProgram, 9, "恢复工程,上升沿触发") \
ENUM_ITEM(SlowDown1, 10, "机器人减速触发1高电平触发") \
ENUM_ITEM(SlowDown2, 11, "机器人减速触发2高电平触发") \
ENUM_ITEM(SafeStop, 12, "安全停止,高电平触发") \
ENUM_ITEM(RunningGuard, 13, "信号,高电平有效") \
ENUM_ITEM(MoveToFirstPoint, 14, "运动到工程初始位姿,高电平触发") \
ENUM_ITEM(xSlowDown1, 15, "机器人减速触发1低电平触发") \
ENUM_ITEM(xSlowDown2, 16, "机器人减速触发2低电平触发") \
ENUM_ITEM(ConveyorTrack, 17, "传送带检测到物品触发,高电平触发") \
ENUM_ITEM(xConveyorTrack, 18, "传送带检测到物品触发,低电平触发")
#define ENUM_StandardOutputRunState_DECLARES \
ENUM_ITEM(None, 0, "标准输出状态未定义") \
ENUM_ITEM(StopLow, 1, "低电平指示工程停止") \
ENUM_ITEM(StopHigh, 2, "高电平指示机器人停止") \
ENUM_ITEM(RunningHigh, 3, "指示工程正在运行") \
ENUM_ITEM(PausedHigh, 4, "指示工程已经暂停") \
ENUM_ITEM(AtHome, 5, "高电平指示机器人正在拖动") \
ENUM_ITEM(Handguiding, 6, "高电平指示机器人正在拖动") \
ENUM_ITEM(PowerOn, 7, "高电平指示机器人已经上电") \
ENUM_ITEM(RobotEmergencyStop, 8, "高电平指示机器人急停按下") \
ENUM_ITEM(SystemEmergencyStop, 9, "高电平指示外部输入系统急停按下") \
ENUM_ITEM(InternalEmergencyStop, 8, "高电平指示机器人急停按下") \
ENUM_ITEM(ExternalEmergencyStop, 9, "高电平指示外部输入系统急停按下") \
ENUM_ITEM(SystemError, 10, "系统错误,包括故障、超限、急停、安全停止、防护停止 ") \
ENUM_ITEM(NotSystemError, 11, "无系统错误,包括普通模式、缩减模式和恢复模式 ") \
ENUM_ITEM(RobotOperable, 12, "机器人可操作,机器人上电且松刹车了 ")
#define ENUM_SafetyInputAction_DECLARES \
ENUM_ITEM(Unassigned, 0, "安全输入未分配动作") \
ENUM_ITEM(EmergencyStop, 1, "安全输入触发急停") \
ENUM_ITEM(SafeguardStop, 2, "安全输入触发防护停止, 边沿触发") \
ENUM_ITEM(SafeguardReset, 3, "安全输入触发防护重置, 边沿触发") \
ENUM_ITEM(ThreePositionSwitch, 4, "3档位使能开关") \
ENUM_ITEM(OperationalMode, 5, "切换自动模式和手动模式") \
ENUM_ITEM(HandGuide, 6, "拖动示教") \
ENUM_ITEM(ReducedMode, 7, "安全参数切换1(缩减模式)序号越低优先级越高三路输出都无效时选用第0组安全参数") \
ENUM_ITEM(AutomaticModeSafeguardStop, 8, "自动模式下防护停机输入(需要配置三档位使能设备)") \
ENUM_ITEM(AutomaticModeSafeguardReset, 9, "自动模式下上升沿触发防护重置(需要配置三档位使能设备)")
#define ENUM_SafetyOutputRunState_DECLARES \
ENUM_ITEM(Unassigned, 0, "安全输出未定义") \
ENUM_ITEM(SystemEmergencyStop, 1, "输出高当有机器人急停输入或者急停按键被按下") \
ENUM_ITEM(NotSystemEmergencyStop, 2, "输出低当有机器人急停输入或者急停按键被按下") \
ENUM_ITEM(RobotMoving, 3, "输出高当有关节运动速度超过 0.1rad/s") \
ENUM_ITEM(RobotNotMoving, 4, "输出高当所有的关节运动速度不超过 0.1rad/s") \
ENUM_ITEM(ReducedMode, 5, "输出高当机器人处于缩减模式") \
ENUM_ITEM(NotReducedMode, 6, "输出高当机器人不处于缩减模式") \
ENUM_ITEM(SafeHome, 7, "输出高当机器人已经处于安全Home位姿") \
ENUM_ITEM(RobotNotStopping, 8, "输出低当机器人正在急停或者安全停止中")
#define ENUM_PayloadIdentifyMoveAxis_DECLARES \
ENUM_ITEM(Joint_2_6, 0,"第2和6关节运动") \
ENUM_ITEM(Joint_3_6, 1,"第3和6关节运动") \
ENUM_ITEM(Joint_4_6, 2,"第4和6关节运动") \
ENUM_ITEM(Joint_4_5_6, 3,"第4、5、6关节运动") \
#define ENUM_EnvelopingShape_DECLARES \
ENUM_ITEM(Cube, 1,"立方体") \
ENUM_ITEM(Column, 2,"柱状体") \
ENUM_ITEM(Stl, 3,"以STL文件的形式描述负载碰撞集合体")
#define ENUM_TaskFrameType_DECLARES \
ENUM_ITEM(NONE, 0,"") \
ENUM_ITEM(POINT_FORCE, 1, "力控坐标系发生变换, 使得力控参考坐标系的y轴沿着机器人TCP指向力控所选特征的原点, x和z轴取决于所选特征的原始方向" \
"力控坐标系发生变换, 使得力控参考坐标系的y轴沿着机器人TCP指向力控所选特征的原点, x和z轴取决于所选特征的原始方向" \
"机器人TCP与所选特征的起点之间的距离至少为10mm" \
"优先选择X轴, 为所选特征的X轴在力控坐标系Y轴垂直平面上的投影, 如果所选特征的X轴与力控坐标系的Y轴平行, " \
"通过类似方法确定力控坐标系Z轴, Y-X或者Y-Z轴确定之后, 通过右手法则确定剩下的轴") \
ENUM_ITEM(FRAME_FORCE, 2,"力控坐标系不发生变换 SIMPLE_FORC") \
ENUM_ITEM(MOTION_FORCE, 3,"力控坐标系发生变换, 使得力控参考坐标系的x轴为机器人TCP速度在所选特征x-y平面上的投影y轴将垂直于机械臂运动, 并在所选特征的x-y平面内")\
ENUM_ITEM(TOOL_FORCE, 4,"以工具末端坐标系作为力控参考坐标系")
#ifdef ERROR
#undef ERROR
#endif
#define ENUM_TraceLevel_DECLARES \
ENUM_ITEM(FATAL, 0, "") \
ENUM_ITEM(ERROR, 1, "") \
ENUM_ITEM(WARNING, 2, "") \
ENUM_ITEM(INFO, 3, "") \
ENUM_ITEM(DEBUG, 4, "")
#define ENUM_AxisModeType_DECLARES \
ENUM_ITEM(NoController, -1, "提供给示教器使用的, 如果aubo_control进程崩溃则会显示为NoController") \
ENUM_ITEM(Disconnected, 0, "未连接") \
ENUM_ITEM(PowerOff, 1, "断电") \
ENUM_ITEM(BrakeReleasing, 2, "刹车松开中") \
ENUM_ITEM(Idle, 3, "空闲") \
ENUM_ITEM(Running, 4, "运行中") \
ENUM_ITEM(Fault, 5, "错误状态")
#define ENUM_SafeguedStopType_DECLARES \
ENUM_ITEM(None, 0, "无安全停止") \
ENUM_ITEM(SafeguedStopIOInput, 1, "安全停止(IO输入)") \
ENUM_ITEM(SafeguedStop3PE, 2, "安全停止(三态开关)") \
ENUM_ITEM(SafeguedStopOperational, 3, "安全停止(操作模式)")
// clang-format on
#define ENUM_ITEM(c, n, ...) c = n,
enum AuboErrorCodes_C : int
{
ENUM_AuboErrorCodes_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) RuntimeState_##c = n,
enum RuntimeState_C : int
{
ENUM_RuntimeState_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) RobotModeType_##c = n,
enum RobotModeType_C : int
{
ENUM_RobotModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) AxisModeType_##c = n,
enum AxisModeType_C : int
{
ENUM_AxisModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) SafetyModeType_##c = n,
enum SafetyModeType_C : int
{
ENUM_SafetyModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) OperationalModeType_##c = n,
enum OperationalModeType_C : int
{
ENUM_OperationalModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) RobotControlModeType_##c = n,
enum RobotControlModeType_C : int
{
ENUM_RobotControlModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) JointServoModeType_##c = n,
enum JointServoModeType_C : int
{
ENUM_JointServoModeType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) JointStateType_##c = n,
enum JointStateType_C : int
{
ENUM_JointStateType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) StandardOutputRunState_##c = n,
enum StandardOutputRunState_C : int
{
ENUM_StandardOutputRunState_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) StandardInputAction_##c = n,
enum StandardInputAction_C : int
{
ENUM_StandardInputAction_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) SafetyInputAction_##c = n,
enum SafetyInputAction_C : int
{
ENUM_SafetyInputAction_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) SafetyOutputRunState_##c = n,
enum SafetyOutputRunState_C : int
{
ENUM_SafetyOutputRunState_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) TaskFrameType_##c = n,
enum TaskFrameType_C
{
ENUM_TaskFrameType_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) EnvelopingShape_##c = n,
enum EnvelopingShape_C : int
{
ENUM_EnvelopingShape_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) PayloadIdentifyMoveAxis_##c = n,
enum PayloadIdentifyMoveAxis_C : int
{
ENUM_PayloadIdentifyMoveAxis_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) TraceLevel_##c = n,
enum TraceLevel_C
{
ENUM_TraceLevel_DECLARES
};
#undef ENUM_ITEM
#define ENUM_ITEM(c, n, ...) SafeguedStopType_##c = n,
enum SafeguedStopType_C : int
{
ENUM_SafeguedStopType_DECLARES
};
#undef ENUM_ITEM
enum ForceControlState_C
{
ForceControlState_Stopped,
ForceControlState_Starting,
ForceControlState_Stropping,
ForceControlState_Running
};
enum RefFrameType_C
{
RefFrameType_None, ///
RefFrameType_Tool, ///< 工具坐标系
RefFrameType_Path, ///< 轨迹坐标系
RefFrameType_Base ///< 基坐标系
};
/// 圆周运动参数定义
struct CircleParameters_C
{
double pose_via[6]; ///< 圆周运动途中点的位姿
double pose_to[6]; ///< 圆周运动结束点的位姿
double a; ///< 加速度, 单位: m/s^2
double v; ///< 速度,单位: m/s
double blend_radius; ///< 交融半径,单位: m
double duration; ///< 运行时间,单位: s
double helix;
double spiral;
double direction;
int loop_times; ///< 暂不支持
};
struct SpiralParameters_C
{
double frame[6]; ///< 参考点,螺旋线的中心点和参考坐标系
int plane; ///< 参考平面选择 0-XY 1-YZ 2-ZX
double angle; ///< 转动的角度,如果为正数,机器人逆时针旋转
double spiral; ///< 正数外扩
double helix; ///< 正数上升
};
struct Enveloping_C
{
EnvelopingShape_C shape; // 包络体形状
double ep_args
[6]; // 包络体组合shape为None或Stl时无需对ep_args赋值;
// shape为Cube时ep_args有9个元素分别为xmin,xmax,ymin,ymax,zmin,zmax,rx,ry,rz;
// shape为Column时ep_args有5个元素分别为radius,height,rx,ry,rz;
char stl_path[100]; // stl的路径(绝对路径)stl文件需为二进制文件,
// shape设置为Stl时此项生效
};
/// 用于负载辨识的轨迹配置
struct TrajConfig_C
{
Enveloping_C *envelopings; // 包络体组合
PayloadIdentifyMoveAxis_C move_axis; // 运动的轴(ID), 下标从0开始
double init_joint[MAX_DOF]; // 关节初始位置
double upper_joint_bound[MAX_DOF]; // 运动轴上限
double lower_joint_bound[MAX_DOF]; // 运动轴下限
double max_velocity; // 关节运动的最大速度默认值为 3.0
double max_acceleration; // 关节运动的最大加速度默认值为 5.0
};
struct DHParam_C
{
double theta[6];
double beta[6];
double d[6];
double a[6];
double alpha[6];
};
struct DHComp_C
{
double theta_comp[6];
double beta_comp[6];
double d_comp[6];
double a_comp[6];
double alpha_comp[6];
};
struct Payload_C
{
double mass;
double cog[3];
double aom[3];
double inertia[6];
};
struct PlanContext_C
{
int tid;
int lineno;
char comment[100];
};
struct ExecutionStatus_C
{
char name[100];
char status[100];
};
struct ExecutionStatus1_C
{
char name[100];
char status[100];
int retval;
};
struct UpdateProcess_C
{
char name[100];
int process;
};
struct WorkObjectHold_C
{
char module_name[100];
double mounting_pose[][6];
};
struct ForceSensorCalibResult_C
{
double force_offset[6];
double com[3];
double mass;
double angle[6];
};
// 动力学模型m,d,k
struct DynamicsModel_C
{
double m[6];
double d[6];
double k[6];
};
struct RobotMsg_C
{
uint64_t timestamp; ///< 时间戳,即系统时间
TraceLevel_C level; ///< 日志等级
int code; ///< 错误码
char source[100]; ///< 发送消息的机器人别名 alias
///< 可在 /root/arcs_ws/config/aubo_control.conf
///< 配置文件中查到机器人的alias
char** args; ///< 机器人参数(指针数组)
int args_count; ///< 参数数量
};
struct RobotMsgVector_C
{
struct RobotMsg_C *data; // 数组指针
int size; // 数组元素个数
} ;
/// RTDE菜单
struct RtdeRecipe_C
{
bool to_server; ///< 输入/输出
int chanel; ///< 通道
double frequency; ///< 更新频率
int trigger; ///< 触发方式(该功能暂未实现): 0 - 周期; 1 - 变化
char **segments; ///< 字段列表
int segments_count; ///< 字段数量
};
/// 异常类型
enum error_type_C
{
parse_error = -32700, ///< 解析错误
invalid_request = -32600, ///< 无效请求
method_not_found = -32601, ///< 方法未找到
invalid_params = -32602, ///< 无效参数
internal_error = -32603, ///< 内部错误
server_error, ///< 服务器错误
invalid ///< 无效
};
/// 异常码
enum ExceptionCode_C
{
EC_DISCONNECTED = -1, ///< 断开连接
EC_NOT_LOGINED = -2, ///< 未登录
EC_INVAL_SOCKET = -3, ///< 无效套接字
EC_REQUEST_BUSY = -4, ///< 请求繁忙
EC_SEND_FAILED = -5, ///< 发送失败
EC_RECV_TIMEOUT = -6, ///< 接收超时
EC_RECV_ERROR = -7, ///< 接收错误
EC_PARSE_ERROR = -8, ///< 解析错误
EC_INVALID_REQUEST = -9, ///< 无效请求
EC_METHOD_NOT_FOUND = -10, ///< 方法未找到
EC_INVALID_PARAMS = -11, ///< 无效参数
EC_INTERNAL_ERROR = -12, ///< 内部错误
EC_SERVER_ERROR = -13, ///< 服务器错误
EC_INVALID = -14 ///< 无效
};
inline const char *returnValue2Str(int retval)
{
static const char *retval_str[] = {
#define ENUM_ITEM(n, v, s) s,
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
};
enum arcs_index_C
{
#define ENUM_ITEM(n, v, s) n##_INDEX,
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
};
int index = -1;
#define ENUM_ITEM(n, v, s) \
if (retval == v) \
index = n##_INDEX;
ENUM_AuboErrorCodes_DECLARES
#undef ENUM_ITEM
if (index == -1)
{
index = AUBO_ERR_UNKOWN;
}
return retval_str[(unsigned)index];
}
#endif // AUBO_SDK_TYPE_DEF_C_H

View File

@ -0,0 +1,65 @@
#ifndef ARCS_RESEARCH_INTERFACE_ROBOT_H
#define ARCS_RESEARCH_INTERFACE_ROBOT_H
#include <functional>
#include <atomic>
#include <aubo/global_config.h>
#include <research_interface/rci_types.h>
#include <stdexcept>
#include "aubo_sdk/rpc.h"
namespace arcs {
namespace research_interface {
struct JointPositions
{
JointPositions() {}
JointPositions(const std::array<double, 7> &joint_positions)
: q(joint_positions)
{
}
JointPositions(std::initializer_list<double> joint_positions)
{
if (joint_positions.size() != q.size()) {
throw std::invalid_argument(
"Invalid number of elements in joint_positions.");
}
std::copy(joint_positions.begin(), joint_positions.end(), q.begin());
}
std::array<double, 7> q{};
bool finished{ false };
};
class ARCS_ABI Robot
{
public:
Robot(const std::string &ip, int port = 30030);
~Robot();
// 启动机器人
int startup();
int setControlPeriod(int period = 5000);
int movej(const JointPositions &jnt_pos);
// 位置控制
void control(
std::function<JointPositions(const RobotState &, double duration)>
control_callback,
bool limit_rate = false, double cutoff_frequency = 100,
bool loop = false);
// 实时读取机器人的状态
void read(std::function<bool(const RobotState &)> read_callback);
protected:
void *d_{ nullptr };
bool init_{ false };
};
} // namespace research_interface
} // namespace arcs
#endif

View File

@ -0,0 +1,477 @@
#ifndef AUBO_SCOPE_REALTIME_ROBOT_STATE_H
#define AUBO_SCOPE_REALTIME_ROBOT_STATE_H
#include <QObject>
#include <mutex>
#include <aubo_sdk/rpc.h>
#include <aubo_sdk/rtde.h>
namespace arcs {
namespace aubo_sdk {
using namespace common_interface;
struct RobotInfo
{
std::string robot_type_;
std::string robot_subtype_;
std::string cb_type_;
int dof_{ 6 };
Payload actual_payload_{ 0., std::vector<double>(3, 0.),
std::vector<double>(3, 0.),
std::vector<double>(9, 0.) };
std::vector<double> actual_q_{ std::vector<double>(6, 0.) };
std::vector<double> actual_current_{ std::vector<double>(6, 0.) };
std::vector<double> actual_TCP_pose_{ std::vector<double>(6, 0.) };
std::vector<double> actual_TCP_speed_{ std::vector<double>(6, 0.) };
std::vector<double> actual_tool_pose_{ std::vector<double>(6, 0.) };
std::vector<double> actual_tcp_force_{ std::vector<double>(6, 0.) };
std::vector<double> actual_tcp_force_sensor_{ std::vector<double>(6, 0.) };
std::vector<double> joint_voltages_{ std::vector<double>(6, 0.) };
std::vector<double> joint_temperatures_{ std::vector<double>(6, 0.) };
std::vector<JointStateType> joint_mode_{ std::vector<JointStateType>(
6, JointStateType::Idle) };
RobotModeType robot_mode_{ RobotModeType::NoController };
SafetyModeType safety_mode_{ SafetyModeType::Normal };
OperationalModeType operational_mode_{ OperationalModeType::Disabled };
bool link_mode_{ false };
bool freedrive_enabled_{ false };
double actual_main_voltage_{ 0 };
double actual_robot_voltage_{ 0 };
double actual_robot_current_{ 0 };
double cb_temperature_{ 0 };
double cb_humidity_{ 0 };
int collision_level_{ 0 };
int slow_down_level_{ 0 };
std::string tool_uuid_;
std::string mb_uuid_;
std::string sb_uuid_;
std::string pedestal_uuid_;
std::vector<std::string> joint_uuids_;
std::string hardware_interface_verion_{ "" };
std::vector<int> joint_fw_;
std::vector<int> joint_hw_;
int tool_fw_;
int tool_hw_;
int m_ifb_fw_;
int m_ifb_hw_;
int s_ifb_fw_;
int s_ifb_hw_;
int pedestal_fw_;
int pedestal_hw_;
int standardDigitalInputNum_{ 0 };
int toolDigitalInputNum_{ 0 };
int configurableDigitalInputNum_{ 0 };
int standardDigitalOutputNum_{ 0 };
int toolDigitalOutputNum_{ 0 };
int configurableDigitalOutputNum_{ 0 };
int standardAnalogInputNum_{ 0 };
int toolAnalogInputNum_{ 0 };
int standardAnalogOutputNum_{ 0 };
int toolAnalogOutputNum_{ 0 };
int staticLinkInputNum_{ 0 };
int staticLinkOutputNum_{ 0 };
std::unordered_map<std::string, std::vector<double>> dh_;
std::unordered_map<std::string, std::vector<double>> threory_dh_;
std::vector<bool> standard_digital_input_data_{ std::vector<bool>(64,
false) };
std::vector<bool> tool_digital_input_data_{ std::vector<bool>(64, false) };
std::vector<bool> configurable_digital_input_data_{ std::vector<bool>(
64, false) };
std::vector<bool> link_digital_input_data_{ std::vector<bool>(64, false) };
std::vector<bool> standard_digital_output_data_{ std::vector<bool>(64,
false) };
std::vector<bool> tool_digital_output_data_{ std::vector<bool>(64, false) };
std::vector<bool> configurable_digital_output_data_{ std::vector<bool>(
64, false) };
std::vector<bool> link_digital_output_data_{ std::vector<bool>(64, false) };
std::vector<double> standard_analog_input_data_;
std::vector<double> tool_analog_input_data_;
std::vector<double> standard_analog_output_data_;
std::vector<double> tool_analog_output_data_;
std::vector<std::string> joints_model_type_;
std::vector<double> joint_max_positions_{ std::vector<double>(6, 0.) };
std::vector<double> joint_min_positions_{ std::vector<double>(6, 0.) };
std::vector<double> joint_max_speeds_{ std::vector<double>(6, 0.) };
std::vector<double> joint_max_accelerations_{ std::vector<double>(6, 0.) };
std::vector<double> tcp_max_speeds_{ std::vector<double>(6, 0.) };
std::vector<double> tcp_max_accelerations_{ std::vector<double>(6, 0.) };
std::vector<double> gravity_{ std::vector<double>{ 0, 0, -9.81 } };
bool simulation_enabled_{ false };
double speed_fraction_{ 0 };
quint32 handle_io_status_{ 0 };
};
class ARCS_ABI RealtimeRobotState : public QObject
{
Q_OBJECT
friend class RobotProxy;
public:
RealtimeRobotState(RpcClientPtr client, RtdeClientPtr rtde);
~RealtimeRobotState();
int updateRobotInformationOnLogin();
int updateRobotInformationOnPoweron(int robot_index = -1);
int updateHDParamOnRobotTypeChanged(int robot_index = -1);
std::vector<std::string> getRobotNames() const;
int getLineNumber();
/// 弃用,只能返回主线程号
ARCS_DEPRECATED int getThreadID();
RuntimeState getRuntimeState();
int getDof();
bool isSimulationEnabled();
double getSpeedFraction();
std::string getRobotType() const;
std::string getRobotSubType() const;
std::string getControlBoxType() const;
OperationalModeType getOperationalMode() const;
bool isLinkModeEnabled() const;
bool isFreedriveEnabled() const;
int getSlowDownLevel() const;
int updateOperationMode(int robot_index);
int updateIsLinkModeEnabled(int robot_index);
// 获取机器人的模式状态
RobotModeType getRobotModeType();
// 获取安全模式
SafetyModeType getSafetyModeType();
// 获取TCP的位姿
std::vector<double> getTcpPose();
// 获取工具端的位姿不带TCP偏移
std::vector<double> getToolPose();
// 获取TCP速度
std::vector<double> getTcpSpeed();
// 获取TCP的力/力矩
std::vector<double> getTcpForce();
std::vector<double> getTcpForce(const std::vector<double> &pose);
std::vector<double> getTcpForceSensor();
// 获取肘部的位置
std::vector<double> getElbowPosistion();
// 获取肘部速度
std::vector<double> getElbowVelocity();
// 获取基座力/力矩
std::vector<double> getBaseForce();
// 获取TCP目标位姿
std::vector<double> getTcpTargetPose();
// 获取TCP目标速度
std::vector<double> getTcpTargetSpeed();
// 获取TCP目标力/力矩
std::vector<double> getTcpTargetForce();
// 获取机械臂关节标志接口
std::vector<JointStateType> getJointState();
// 获取关节的伺服状态
std::vector<JointServoModeType> getJointServoMode();
// 获取实际负载
Payload getPayload();
// 获取机械臂关节角度接口
std::vector<double> getJointPositions();
// 获取机械臂关节速度接口
std::vector<double> getJointSpeeds();
// 获取机械臂关节加速度接口
std::vector<double> getJointAccelerations();
// 获取机械臂关节力矩接口
std::vector<double> getJointTorqueSensors();
// 获取底座力传感器读数
std::vector<double> getBaseForceSensor();
// 获取TCP力传感器读数
std::vector<double> getTcpForceSensors();
// 获取机械臂关节电流接口
std::vector<double> getJointCurrents();
// 获取机械臂关节电压接口
std::vector<double> getJointVoltages();
// 获取机械臂关节温度接口
std::vector<double> getJointTemperatures();
// 获取关节固件版本
std::vector<int> getJointFirmwareVersions();
// 获取关节硬件版本
std::vector<int> getJointHardwareVersions();
std::string getToolUniqueId();
std::string getMasterBoardUniqueId();
std::string getSlaveBoardUniqueId();
std::string getPedestalUniqueId();
std::vector<std::string> getJointUniqueIds();
// 获取新老协议区分
std::string getHardwareInterfaceVersion();
// 获取 MasterBoard 固件版本
int getMasterBoardFirmwareVersion();
// 获取 MasterBoard 硬件版本
int getMasterBoardHardwareVersion();
// 获取 SlaveBoard 固件版本
int getSlaveBoardFirmwareVersion();
// 获取 SlaveBoard 硬件版本
int getSlaveBoardHardwareVersion();
// 获取工具端固件版本
int getToolFirmwareVersion();
// 获取工具端硬件版本
int getToolHardwareVersion();
// 获取 Pedestal 固件版本
int getPedestalFirmwareVersion();
// 获取 Pedestal 硬件版本
int getPedestalHardwareVersion();
// 获取机械臂关节目标位置角度接口
std::vector<double> getJointTargetPositions();
// 获取机械臂关节目标速度
std::vector<double> getJointTargetSpeeds();
// 获取机械臂关节目标加速度
std::vector<double> getJointTargetAccelerations();
// 获取机械臂关节目标力矩
std::vector<double> getJointTargetTorques();
// 获取机械臂关节目标电流
std::vector<double> getJointTargetCurrents();
// 获取关节最大位置(物理极限)
std::vector<double> getJointMaxPositions();
// 获取关节最小位置(物理极限)
std::vector<double> getJointMinPositions();
// 获取关节最大速度(物理极限)
std::vector<double> getJointMaxSpeeds();
// 获取关节最大加速度(物理极限)
std::vector<double> getJointMaxAccelerations();
// 获取TCP最大速度物理极限
std::vector<double> getTcpMaxSpeeds();
// 获取TCP最大加速度物理极限
std::vector<double> getTcpMaxAccelerations();
// 获取控制柜温度
double getControlBoxTemperature();
// 获取控制柜湿度
double getControlBoxHumidity();
// 获取母线电压
double getMainVoltage();
// 获取母线电流
double getMainCurrent();
int getCollisionLevel();
// 获取机器人电压
double getRobotVoltage();
// 获取机器人电流
double getRobotCurrent();
// 获取手柄 IO 状态
uint32_t getHandleIoStatus();
int getStandardDigitalInputNum();
int getToolDigitalInputNum();
int getConfigurableDigitalInputNum();
int getStandardDigitalOutputNum();
int getToolDigitalOutputNum();
int getConfigurableDigitalOutputNum();
int getStandardAnalogInputNum();
int getToolAnalogInputNum();
int getStandardAnalogOutputNum();
int getToolAnalogOutputNum();
SafetyInputAction getConfigurableInputAction(int index);
SafetyOutputRunState getConfigurableOutputRunstate(int index);
int setStandardDigitalInputAction(int index, StandardInputAction action);
int setToolDigitalInputAction(int index, StandardInputAction action);
int setConfigurableDigitalInputAction(int index,
StandardInputAction action);
StandardInputAction getStandardDigitalInputAction(int index);
StandardInputAction getToolDigitalInputAction(int index);
StandardInputAction getConfigurableDigitalInputAction(int index);
int setStandardDigitalOutputRunstate(int index,
StandardOutputRunState runstate);
int setToolDigitalOutputRunstate(int index,
StandardOutputRunState runstate);
int setConfigurableDigitalOutputRunstate(int index,
StandardOutputRunState runstate);
StandardOutputRunState getStandardDigitalOutputRunstate(int index);
StandardOutputRunState getToolDigitalOutputRunstate(int index);
StandardOutputRunState getConfigurableDigitalOutputRunstate(int index);
int setStandardAnalogOutputRunstate(int index,
StandardOutputRunState runstate);
int setToolAnalogOutputRunstate(int index, StandardOutputRunState runstate);
StandardOutputRunState getStandardAnalogOutputRunstate(int index);
StandardOutputRunState getToolAnalogOutputRunstate(int index);
int setStandardAnalogInputDomain(int index, int domain);
int setToolAnalogInputDomain(int index, int domain);
int getStandardAnalogInputDomain(int index);
int getToolAnalogInputDomain(int index);
int setStandardAnalogOutputDomain(int index, int domain);
int setToolAnalogOutputDomain(int index, int domain);
int getStandardAnalogOutputDomain(int index);
int getToolAnalogOutputDomain(int index);
int setStandardDigitalOutput(int index, bool value);
int setToolDigitalOutput(int index, bool value);
int setConfigurableDigitalOutput(int index, bool value);
int setStandardAnalogOutput(int index, double value);
int setToolAnalogOutput(int index, double value);
bool getStandardDigitalInput(int index);
bool getToolDigitalInput(int index);
bool getConfigurableDigitalInput(int index);
bool getStandardDigitalOutput(int index);
bool getToolDigitalOutput(int index);
bool getConfigurableDigitalOutput(int index);
double getStandardAnalogInput(int index);
double getToolAnalogInput(int index);
double getStandardAnalogOutput(int index);
double getToolAnalogOutput(int index);
int getStaticLinkInputNum();
int getStaticLinkOutputNum();
bool getStaticLinkInput(int index);
bool getStaticLinkOutput(int index);
int configSubscribe();
int selectRobot(int index);
void reset();
void updateModbusSignalNames();
void addModbusSignalName(const std::string &name);
void removeModbusSignalName(const std::string &name);
std::vector<std::string> getModbusSignalNames() const;
std::vector<int> getModbusSignalValues() const;
std::vector<int> getModbusSignalErrors() const;
std::vector<double> getGravity();
std::unordered_map<std::string, std::vector<double>> getRealDHParam();
std::unordered_map<std::string, std::vector<double>> getTheoryDHParam();
int updateGravity(int robot_index);
int startTrackRecord(
const std::function<void(const std::vector<double> & /*q*/,
const std::vector<double> & /*pose*/)> &cb,
double interval = 0.1);
int stopTrackRecord();
// 获取关节类型
std::vector<std::string> getJointsModelType();
signals:
void interfaceBoardVersionInfoUpdated(int robot_index);
void jointVersionInfoUpdated(int robot_index);
void runtimeStateChanged(arcs::common_interface::RuntimeState state);
void safetyModeChanged(int robot_index,
arcs::common_interface::SafetyModeType mode);
void robotModeChanged(int robot_index,
arcs::common_interface::RobotModeType mode);
private:
RpcClientPtr rpc_client_{ nullptr };
RtdeClientPtr rtde_client_{ nullptr };
mutable std::mutex rtde_mtx_;
std::vector<std::string> names_;
std::string name_;
int robot_index_{ -1 };
int tid_{ -1 };
int line_{ -1 };
RuntimeState runtime_state_{ RuntimeState::Stopped };
std::vector<int> modbus_signals_;
std::vector<int> modbus_signals_errors_;
std::vector<std::string> modbus_names_;
RobotInfo info_[4];
std::function<void(const std::vector<double> &,
const std::vector<double> &)>
track_record_callback_;
int track_record_sample_cnt_{ 0 };
int track_record_sample_index_{ 0 };
};
using RealtimeRobotStatePtr = std::shared_ptr<RealtimeRobotState>;
} // namespace aubo_sdk
} // namespace arcs
#endif

View File

@ -0,0 +1,276 @@
#ifndef AUBO_SCOPE_ROBOT_PROXY_H
#define AUBO_SCOPE_ROBOT_PROXY_H
#include <memory>
#include <vector>
#include <string>
#include <shared_mutex>
#include <QObject>
#include <QMutex>
#include <QMap>
#include <aubo/aubo_api.h>
#include <robot_proxy/realtime_robot_state.h>
namespace arcs {
namespace aubo_sdk {
class RtdeClient;
class ScriptClient;
class RpcClient;
using RtdeClientPtr = std::shared_ptr<RtdeClient>;
using ScriptClientPtr = std::shared_ptr<ScriptClient>;
using RpcClientPtr = std::shared_ptr<RpcClient>;
using arcs::common_interface::ForceControlPtr;
using arcs::common_interface::IoControlPtr;
using arcs::common_interface::MotionControlPtr;
using arcs::common_interface::RegisterControlPtr;
using arcs::common_interface::RobotAlgorithmPtr;
using arcs::common_interface::RobotConfigPtr;
using arcs::common_interface::RobotInterfacePtr;
using arcs::common_interface::RobotManagePtr;
using arcs::common_interface::RobotStatePtr;
using arcs::common_interface::RuntimeMachinePtr;
using arcs::common_interface::SyncMovePtr;
using arcs::common_interface::SystemInfoPtr;
using arcs::common_interface::TracePtr;
using RobotInterface = common_interface::RobotInterface;
/**
*
*/
class ARCS_ABI RobotProxy : public QObject
{
Q_OBJECT
public:
RobotProxy(QObject *parent = NULL);
~RobotProxy();
/// 获取当前机器人的名称
QString getRobotName() const;
/// 获取当前机器人在所有机器人中的索引
int getRobotIndex() const;
/// 获取所有机器人的名字
std::vector<std::string> getRobotNames();
/// 连接到当前机器人
int connect(const QString &ip, int port);
/// 连接到当前机器人
int nonblock_connect(const QString &ip, int port,
std::function<void(bool)> cb);
int nonblock_connect2(const QString &ip, int port,
std::function<void(int)> cb);
/// 登录到当前机器人
int login(const QString &usrname, const QString &passwd);
/// 断开与机器人的连接,如果不指定名称,则断开当前选中的机器人
int disconnectFromServer();
/// 机器人是否已经连接,如果不指定名称,则断开当前选中的机器人
bool hasConnected();
/// 机器人是否已经登录,如果不指定名称,则断开当前选中的机器人
bool hasLogined();
/// 发送脚本程序到当前机器人
int sendScript(const std::string &script);
/// 获取当前机器人的脚本程序
std::string getScript() const;
/// 使用 RealtimeRobotState 中的 getRealDHParam getTheoryDHParam 替代
ARCS_DEPRECATED std::unordered_map<std::string, std::vector<double>> getDH(
bool real = true);
SystemInfoPtr getSystemInfo();
RuntimeMachinePtr getRuntimeMachine();
RegisterControlPtr getRegisterControl();
/// 获取RobotConfig接口
RobotConfigPtr getRobotConfig();
/// 获取运动规划接口
MotionControlPtr getMotionControl();
/// 获取力控接口
ForceControlPtr getForceControl();
/// 获取IO控制的接口
IoControlPtr getIoControl();
/// 获取同步运动接口
SyncMovePtr getSyncMove();
/// 获取机器人实用算法接口
RobotAlgorithmPtr getRobotAlgorithm();
/// 获取机器人管理接口(上电、启动、停止等)
RobotManagePtr getRobotManage();
/// 获取机器人状态接口
RobotStatePtr getRobotState();
RealtimeRobotStatePtr getRealTimeState();
/// 获取告警信息接口
TracePtr getTrace();
/// 根据机器人名字获取机器人接口
RobotInterfacePtr getRobotInterface(const std::string &name);
/// 切换机器人
int selectRobot(int index);
aubo_sdk::RpcClientPtr getRpcClient();
aubo_sdk::RtdeClientPtr getRtdeClient();
aubo_sdk::ScriptClientPtr getScriptClient();
/// 通过错误码获取消息文本
QString getErrorCodeMsg(int code);
/// 获取 ICM 连接状态
bool icmIsConnected();
/// 获取 Profinet 地址表数据
std::vector<std::vector<uint8_t>> getPnAddressData();
signals:
// FIXME: 断开连接和登出的信号需要从 RobotProxy 类主动发出
/// 建立连接的信号
void connected(const QString &ip, int port);
/// 断开连接的信号
void disconnected();
/// 登录或者登出
void logined(bool has_login);
/// 弹窗信号
void popup(int robot_index, int level, const QString &title,
const QString &msg, int mode);
/// 解除弹窗信号
void popupDismiss(const QString &src);
/// 从控制器层上传的系统关机信号
void systemHalt(const QString &src);
/// 已弃用,推荐使用下面的重载函数
ARCS_DEPRECATED void scriptError(const QString &);
/// aubo_control 报错
void scriptError(int lineno, const QString &error);
/// 脚本运行报错
void scriptError2(const QString &, const QString &);
/// 脚本运行时里面的变量发生变化
void variableUpdate(const QString &, const QString &);
/// 运行时状态发生变化
void runtimeStateChanged(arcs::common_interface::RuntimeState state);
/// 拖动示教器使能状态切换
void freedriveEnabled(int robot_index, bool enabled);
/// 接收到机器人控制端消息
void robotMessageRecieved(int robot_index, QString src, int level, int code,
const QString &msg);
void robotMessageRecieved(int robot_index, const QString &src, int level,
const RobotMsg &msg);
/// 操作模式切换
void operationalModeChanged(
int robot_index, arcs::common_interface::OperationalModeType mode);
/// 联动模式切换
void linkModeChanged(int robot_index, bool enable);
/// 安全模式切换
void safetyModeChanged(int robot_index,
arcs::common_interface::SafetyModeType mode);
/// 机器人状态切换
void robotModeChanged(int robot_index,
arcs::common_interface::RobotModeType mode);
/// 机器人型号切换
void robotTypeChanged(const QString &type, const QString &subtype);
/// 缓速切换
void slowDownChanged(int robot_index, int level);
/// 运行时上下文更新
void runtimeContextUpdated(int tid, int lineno, int index,
const QString &comment);
void interpContextUpdated(int tid, int lineno, int index,
const QString &comment);
void taskDeleted(int tid);
/// ICM 插件状态变化
void icmStatusChanged(bool status);
/// PNIO 从站数据变化
void pnioDeviceChanged(const QString &name);
void pnioNetworkChanged(const QString &ip, const QString &subnet_mask,
const QString &gateway);
/// 示教器启用状态变化
void teachPendantEnabledChanged(bool status);
/// Modbus master
void modbusSignalCreated(const QString &name);
void modbusSignalRemoved(const QString &name);
void jointMovedDuringPoweroff(int robot_index);
void robotCollisionOccurred(int robot_index, const QString &msg);
void robotToolSensorChanged(int robot_index, const QString &sensor_id);
void robotToolSensorRemoved(int robot_index);
void robotToolSensorStatusChanged(int robot_index, bool status);
void programLoaded(int robot_index, const QString &program);
private:
RobotInterfacePtr currentRobotRpcInterface();
void robotMessageCallback(InputParser &parser);
void sendDisconnectedSignal();
void initPNCacheData();
void pnValueChanged(const std::vector<std::string> &data);
private:
QString name_;
int robot_index_{ -1 };
std::vector<std::string> robot_names_;
std::string ip_;
int port_;
aubo_sdk::RpcClientPtr rpc_client_{ nullptr };
aubo_sdk::RtdeClientPtr rtde_client_{ nullptr };
aubo_sdk::ScriptClientPtr script_client_{ nullptr };
RealtimeRobotStatePtr rt_state_{ nullptr };
bool initiallized_{ false };
QMap<int, QString> script_;
bool icm_connected_{ false };
bool pn_connected_{ false };
// Profinet 地址表数据
std::shared_mutex mtx_pn_address_;
std::vector<std::vector<uint8_t>> cache_pn_address_;
};
using RobotProxyPtr = std::shared_ptr<RobotProxy>;
} // namespace aubo_sdk
} // namespace arcs
Q_DECLARE_METATYPE(arcs::aubo_sdk::RobotProxyPtr)
#endif

View File

@ -0,0 +1,103 @@
#ifndef ROBOTIOMATETYPE_H
#define ROBOTIOMATETYPE_H
//接口板用户DI 名称定义
#define UESR_IO_DI_00_NAME "U_DI_00"
#define UESR_IO_DI_01_NAME "U_DI_01"
#define UESR_IO_DI_02_NAME "U_DI_02"
#define UESR_IO_DI_03_NAME "U_DI_03"
#define UESR_IO_DI_04_NAME "U_DI_04"
#define UESR_IO_DI_05_NAME "U_DI_05"
#define UESR_IO_DI_06_NAME "U_DI_06"
#define UESR_IO_DI_07_NAME "U_DI_07"
#define UESR_IO_DI_10_NAME "U_DI_10"
#define UESR_IO_DI_11_NAME "U_DI_11"
#define UESR_IO_DI_12_NAME "U_DI_12"
#define UESR_IO_DI_13_NAME "U_DI_13"
#define UESR_IO_DI_14_NAME "U_DI_14"
#define UESR_IO_DI_15_NAME "U_DI_15"
#define UESR_IO_DI_16_NAME "U_DI_16"
#define UESR_IO_DI_17_NAME "U_DI_17"
//接口板用户DI 地址定义
#define UESR_IO_DI_00_ADDR 0X24
#define UESR_IO_DI_01_ADDR 0X25
#define UESR_IO_DI_02_ADDR 0X26
#define UESR_IO_DI_03_ADDR 0X27
#define UESR_IO_DI_04_ADDR 0X28
#define UESR_IO_DI_05_ADDR 0X29
#define UESR_IO_DI_06_ADDR 0X2A
#define UESR_IO_DI_07_ADDR 0X2B
#define UESR_IO_DI_10_ADDR 0X2C
#define UESR_IO_DI_11_ADDR 0X2D
#define UESR_IO_DI_12_ADDR 0X2E
#define UESR_IO_DI_13_ADDR 0X2F
#define UESR_IO_DI_14_ADDR 0X30
#define UESR_IO_DI_15_ADDR 0X31
#define UESR_IO_DI_16_ADDR 0X32
#define UESR_IO_DI_17_ADDR 0X33
//接口板用户DO 名称定义
#define UESR_IO_DO_00_NAME "U_DO_00"
#define UESR_IO_DO_01_NAME "U_DO_01"
#define UESR_IO_DO_02_NAME "U_DO_02"
#define UESR_IO_DO_03_NAME "U_DO_03"
#define UESR_IO_DO_04_NAME "U_DO_04"
#define UESR_IO_DO_05_NAME "U_DO_05"
#define UESR_IO_DO_06_NAME "U_DO_06"
#define UESR_IO_DO_07_NAME "U_DO_07"
#define UESR_IO_DO_10_NAME "U_DO_10"
#define UESR_IO_DO_11_NAME "U_DO_11"
#define UESR_IO_DO_12_NAME "U_DO_12"
#define UESR_IO_DO_13_NAME "U_DO_13"
#define UESR_IO_DO_14_NAME "U_DO_14"
#define UESR_IO_DO_15_NAME "U_DO_15"
#define UESR_IO_DO_16_NAME "U_DO_16"
#define UESR_IO_DO_17_NAME "U_DO_17"
//接口板用户DO 地址定义
#define UESR_IO_DO_00_ADDR 0X20
#define UESR_IO_DO_01_ADDR 0X21
#define UESR_IO_DO_02_ADDR 0X22
#define UESR_IO_DO_03_ADDR 0X23
#define UESR_IO_DO_04_ADDR 0X24
#define UESR_IO_DO_05_ADDR 0X25
#define UESR_IO_DO_06_ADDR 0X26
#define UESR_IO_DO_07_ADDR 0X27
#define UESR_IO_DO_10_ADDR 0X28
#define UESR_IO_DO_11_ADDR 0X29
#define UESR_IO_DO_12_ADDR 0X2A
#define UESR_IO_DO_13_ADDR 0X2B
#define UESR_IO_DO_14_ADDR 0X2C
#define UESR_IO_DO_15_ADDR 0X2D
#define UESR_IO_DO_16_ADDR 0X2E
#define UESR_IO_DO_17_ADDR 0X2F
//接口板用户AI 名称定义
#define UESR_IO_AI_00_NAME "VI0"
#define UESR_IO_AI_01_NAME "VI1"
#define UESR_IO_AI_02_NAME "VI2"
#define UESR_IO_AI_03_NAME "VI3"
//接口板用户AI 地址定义
#define UESR_IO_AI_00_ADDR 0X00
#define UESR_IO_AI_01_ADDR 0X01
#define UESR_IO_AI_02_ADDR 0X02
#define UESR_IO_AI_03_ADDR 0X03
//接口板用户AI 名称定义
#define UESR_IO_AO_00_NAME "VO0"
#define UESR_IO_AO_01_NAME "VO1"
#define UESR_IO_AO_02_NAME "VO2"
#define UESR_IO_AO_03_NAME "VO3"
//接口板用户AI 地址定义
#define UESR_IO_AO_00_ADDR 0X00
#define UESR_IO_AO_01_ADDR 0X01
#define UESR_IO_AO_02_ADDR 0X02
#define UESR_IO_AO_03_ADDR 0X03
#endif // ROBOTIOMATETYPE_H

1583
third_party/AuboSdk/linux/include/rsdef.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
#ifndef RSERRORS_H
#define RSERRORS_H
/*robot service errors*/
#define RSERR_BASE 1000
#define RSERR_SUCC 0
#define RSERR_NOT_ENOUGH_RSHD_BUFFER RSERR_BASE + 1
#define RSERR_RSHD_NO_FOUND RSERR_BASE + 2
#define RSERR_PARAMETER_ERROR RSERR_BASE + 3
#define RSERR_CREATE_THREAD_ERROR RSERR_BASE + 4
#endif // RSERRORS_H

View File

@ -0,0 +1,125 @@
#ifndef RSPIDCFG_H
#define RSPIDCFG_H
#include "rstype.h"
#include "AuboRobotMetaType.h"
using namespace aubo_robot_namespace;
typedef struct
{
JointCommonData data[ARM_DOF];
} RobotJointCommonData;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief
* @param rshd
* @param data
* @return
*/
int rs_get_joint_common_data(RSHD rshd, RobotJointCommonData &data);
/**
* @brief P
* @param joint_id ID1~6)
* @param P P
* @return
*/
int rs_set_current_ip(RSHD rshd, int joint_id, uint16 P);
/**
* @brief I
* @param joint_id ID1~6)
* @param I I
* @return
*/
int rs_set_current_ii(RSHD rshd, int joint_id, uint16 I);
/**
* @brief D
* @param joint_id ID1~6)
* @param D D
* @return
*/
int rs_set_current_id(RSHD rshd, int joint_id, uint16 D);
/**
* @brief P
* @param joint_id ID1~6)
* @param P P
* @return
*/
int rs_set_speed_p(RSHD rshd, int joint_id, uint16 P);
/**
* @brief I
* @param joint_id ID1~6)
* @param I I
* @return
*/
int rs_set_speed_i(RSHD rshd, int joint_id, uint16 I);
/**
* @brief D
* @param joint_id ID1~6)
* @param D D
* @return
*/
int rs_set_speed_d(RSHD rshd, int joint_id, uint16 D);
/**
* @brief DS
* @param joint_id ID1~6)
* @param DS DS
* @return
*/
int rs_set_speed_ds(RSHD rshd, int joint_id, uint16 DS);
/**
* @brief P
* @param joint_id ID1~6)
* @param P P
* @return
*/
int rs_set_pos_p(RSHD rshd, int joint_id, uint16 P);
/**
* @brief I
* @param joint_id ID1~6)
* @param I I
* @return
*/
int rs_set_pos_i(RSHD rshd, int joint_id, uint16 I);
/**
* @brief D
* @param joint_id ID1~6)
* @param D D
* @return
*/
int rs_set_pos_d(RSHD rshd, int joint_id, uint16 D);
/**
* @brief DS
* @param joint_id ID1~6)
* @param DS DS
* @return
*/
int rs_set_pos_ds(RSHD rshd, int joint_id, uint16 DS);
/**
* @brief PID参数到关节flash
* @param rshd
* @param joint_id
* @return
*/
int rs_joint_save_data_flash(RSHD rshd, int joint_id);
#ifdef __cplusplus
}
#endif
#endif // RSPIDCFG_H

View File

@ -0,0 +1,29 @@
#ifndef RSTYPE_H
#define RSTYPE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/* General types */
typedef uint8_t boolean;
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
typedef float float32;
typedef double float64;
typedef uint16_t RSHD; // robot servcie handle
#ifdef __cplusplus
}
#endif
#endif // RSTYPE_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,329 @@
// 力控相关的工艺封装接口
#ifndef AUBO_SDK_SKILL_INTERFACE_H
#define AUBO_SDK_SKILL_INTERFACE_H
#include <chrono>
#include <atomic>
#include <shared_mutex>
#include <aubo/aubo_api.h>
using namespace arcs::common_interface;
namespace arcs {
namespace aubo_sdk {
class RtdeClient;
class RpcClient;
using RtdeClientPtr = std::shared_ptr<RtdeClient>;
using RpcClientPtr = std::shared_ptr<RpcClient>;
class GuideTrajMove;
using GuideTrajMovePtr = std::shared_ptr<GuideTrajMove>;
class ARCS_ABI ForceControl
{
public:
enum ForceStage
{
TOUCH = 1, // 接近
SEARCH = 2, // 搜孔
INSERT = 3, // 插孔
CONSTANT = 4, // 恒力
}; // enum ForceStage
enum StateCode
{
// 失败状态码
TimeOut = -100, // 超时
Search_MaxForce = -4, // 搜孔达到最大力
Insert_MaxForce = -3, // 插入达到最大力
Constant_NotTouch = -2, // 恒力过程中未接触
Touch_Distance = -1, // 超出探寻距离
Running = 0, // 力控执行中
// 成功状态码
Touch_Succeed = 1, // 接触成功
Insert_Succeed = 2, // 插孔成功
Search_Succeed = 3, // 搜孔成功
Constant_Succeed = 4, // 接触成功
}; // StateCode
// 轨迹类型
enum GuideTrajType
{
NONE = 0, // 无参考轨迹
LINE1 = 1, // 直线 speedLine
LINE2 = 2, // 直线 moveLine
SPIRAL = 3, // 螺旋线
WEAVE = 4, // 摆线
};
// 螺旋线平面
enum class SpiralPlane
{
xy = 0,
yz = 1,
zx = 2
};
// 螺旋线轨迹参数
struct SpiralTrajParams
{
double step = 0.0; // 圈数
double direction = -1; // 旋转方向 -1顺时针旋转1逆时针旋转
SpiralPlane plane = SpiralPlane::xy; // 参考平面选择
double spiral = 0.0; // 螺旋线外扩
double helix = 0.0; // 螺旋上升 m
double radius = 0.0; // 第一圈半径 m
};
// 摆线方向
enum class WeaveSelect
{
x = 1,
y = 2,
z = 3,
rx = 4,
ry = 5,
rz = 6
};
// 摆线轨迹参数
struct WeaveTrajParams
{
double step = 0.0; // 周期
double amplitude = 0.0; // 幅度
WeaveSelect direction = WeaveSelect::x; // 方向
double hold_distance = 0.0; // 保持距离 m
double angle = 0.0; // 角度
double type; // 类型
};
// 插孔方向
enum class InsertSelect
{
x = 1,
y = 2,
z = 3,
};
// 插孔参数
struct InsertParams
{
InsertSelect insert_select = InsertSelect::z; // 插入方向,可选x\y\z
double hole_diameter = 0.0; // 轴孔直径 m
double insert_max_speed = 0.01; // 插入速度限制 m/s
double insert_time = 1000; // 插入时间限制 ms
GuideTrajType guide_traj_type = NONE; // 主动轨迹类型
std::vector<double> insert_max_force = {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
}; // 最大力限制
double insert_max_depth = 0.01; // 插入距离限制 m
double insert_guide_force = 10; // 插入引导力
// 力控调节参数
std::vector<double> insert_damp_scale = {
0.5, 0.5, 0.5, 0.5, 0.5, 0.5
};
std::vector<double> insert_stiff_scale = {
0.5, 0.5, 0.5, 0.5, 0.5, 0.5
};
SpiralTrajParams spiral_param; // 螺旋轨迹参数
WeaveTrajParams weave_param; // 摆动轨迹参数
};
// 搜孔平面
enum class SearchPlane
{
yz = 1,
xz = 2,
xy = 3
};
// 搜孔参数
struct SearchParams
{
SearchPlane search_plane = SearchPlane::xy; // 搜孔平面
double hole_diameter = 0.0; // 轴孔直径 m
double search_range = 0.1; // 搜孔范围
double search_time = 1000; // 搜孔时间限制 ms
GuideTrajType guide_traj_type = NONE; // 搜孔过程主动轨迹类型
double search_max_force = 10; // 最大力限制
double search_guide_force = 1; // 搜孔引导力
// 力控调节参数
std::vector<double> search_damp_scale = {
0.5, 0.5, 0.5, 0.5, 0.5, 0.5
};
std::vector<double> search_stiff_scale = {
0.5, 0.5, 0.5, 0.5, 0.5, 0.5
};
SpiralTrajParams spiral_param;
WeaveTrajParams weave_param;
};
struct ConstantParams
{
TaskFrameType frame_type = MOTION_FORCE;
std::vector<double> feature = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
std::vector<bool> compliance = { true, true, true, true, true, true };
std::vector<double> wrench = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
// 力控调节参数
std::vector<double> env_stiff = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
std::vector<double> damp_scale = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
std::vector<double> stiff_scale = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
std::vector<double> contact_threshold = {
1.0, 1.0, 1.0, 0.2, 0.2, 0.2
}; // 接触判断阈值
double constant_time = 5000; // 默认5s
};
struct TouchParams
{
TaskFrameType frame_type = TOOL_FORCE;
std::vector<double> feature = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
std::vector<bool> compliance = { true, true, true, true, true, true };
std::vector<double> wrench = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
std::vector<double> env_stiff = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
// std::vector<double> damp_scale = { 0.5, 0.5, 0.5, 0.5, 0.5,
// 0.5 };
std::vector<double> stiff_scale = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
std::vector<double> speed = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
double distance = 0.0;
double touch_time = 1000; // 默认5s
};
ForceControl(const RpcClientPtr rpc, const RtdeClientPtr rtde);
~ForceControl();
/**
* @brief
*
* @return 0
*/
std::vector<double> getTaskForce(const TaskFrameType &type,
const std::vector<double> &feature);
// 接近
int fcTouch(const TouchParams &param);
// 恒力
int fcConstant(const ConstantParams &param);
// 插入
int fcInsert(const InsertParams &param);
// 搜孔
int fcSearch(const SearchParams &param);
// 等待力控结束
int fcWaitCondition();
int fcExit();
// 注册状态回调函数
void registerStateCallBack(std::function<void(int state)> func);
private:
// 注册实时状态订阅
void subscribeRealtimeState();
// 力控过程监控线程
void monitor();
// 超时监控
void timeoutMonitor();
// 距离监控
void distanceMonitor();
// 单方向距离监控
void signalDistanceMonitor();
// 力监控
void forceMonitor();
// 接触监控
void contactMonitor();
private:
RpcClientPtr rpc_;
RtdeClientPtr rtde_;
std::atomic_bool is_exit_;
std::atomic_bool is_stop_;
std::mutex monitor_thread_mutex_;
std::condition_variable monitor_cond_;
std::thread *monitor_thread_ptr_;
// 用于恒力和接近之间的切换
std::atomic_bool last_is_contact_;
// 记录当前参数
std::shared_mutex mutex_;
TaskFrameType frame_type_;
std::vector<double> feature_;
ForceStage cur_process_type_;
std::vector<bool> compliance_;
std::vector<double> env_stiff_;
std::vector<double> damp_scale_;
std::vector<double> stiff_scale_;
std::vector<double> wrench_;
std::vector<double> start_tcp_pose_; // 开始力控位姿
double distance_; // 力控执行距离
double direction_; // 搜孔/插孔方向
std::chrono::steady_clock::time_point start_time_; // 开启力控时间点
double interval_; // 超时间隔
// 参考轨迹运行
GuideTrajMovePtr guide_traj_move_;
// 状态回调函数
std::atomic<StateCode> state_code_ = Running;
std::function<void(int state)> func_;
// RTDE相关
std::shared_mutex rtde_mutex_;
std::vector<double> actual_tcp_pose_;
std::vector<double> actual_tcp_speed_;
std::vector<double> actual_tcp_force_;
std::vector<double> actual_tcp_force_sensor_;
}; // namespace aubo_sdk
class GuideTrajMove
{
public:
GuideTrajMove(const RpcClientPtr rpc);
~GuideTrajMove();
void speedLine(const std::vector<double> &speed, const double &time);
void moveLine(const std::vector<double> &target_pose, const double &speed);
void moveSpiral(const ForceControl::SpiralTrajParams &spiral_param);
void moveWeave(const ForceControl::WeaveTrajParams &weave_param,
const int &move_direction);
void stop();
private:
int waitArrival();
RpcClientPtr rpc_;
std::atomic_bool is_exit_;
std::atomic_bool is_stop_;
std::mutex thread_mutex_;
std::condition_variable cond_;
std::thread thread_;
ForceControl::GuideTrajType traj_type_ = ForceControl::NONE;
};
} // namespace aubo_sdk
} // namespace arcs
#endif // AUBO_SDK_SKILL_INTERFACE_H

View File

@ -0,0 +1,194 @@
#ifndef AUBO_SDK_ForceControl_C_H
#define AUBO_SDK_ForceControl_C_H
#include <aubo_sdk/type_def_c.h>
enum ForceStage_C
{
TOUCH = 1, // 接近
SEARCH = 2, // 搜孔
INSERT = 3, // 插孔
CONSTANT = 4, // 恒力
}; // enum ForceStage
enum StateCode_C
{
// 失败状态码
TimeOut = -100, // 超时
Search_MaxForce = -4, // 搜孔达到最大力
Insert_MaxForce = -3, // 插入达到最大力
Constant_NotTouch = -2, // 恒力过程中未接触
Touch_Distance = -1, // 超出探寻距离
Running = 0, // 力控执行中
// 成功状态码
Touch_Succeed = 1, // 接触成功
Insert_Succeed = 2, // 插孔成功
Search_Succeed = 3, // 搜孔成功
Constant_Succeed = 4, // 接触成功
}; // StateCode
// 轨迹类型
enum GuideTrajType_C
{
NONE = 0, // 无参考轨迹
LINE1 = 1, // 直线 speedLine
LINE2 = 2, // 直线 moveLine
SPIRAL = 3, // 螺旋线
WEAVE = 4, // 摆线
};
// 螺旋线平面
enum class SpiralPlane_C
{
xy = 0,
yz = 1,
zx = 2
};
// 螺旋线轨迹参数
struct SpiralTrajParams_C
{
double step = 0.0; // 圈数
double direction = -1; // 旋转方向 -1顺时针旋转1逆时针旋转
SpiralPlane_C plane = SpiralPlane_C::xy; // 参考平面选择
double spiral = 0.0; // 螺旋线外扩
double helix = 0.0; // 螺旋上升 m
double radius = 0.0; // 第一圈半径 m
};
// 摆线方向
enum class WeaveSelect_C
{
x = 1,
y = 2,
z = 3,
rx = 4,
ry = 5,
rz = 6
};
// 摆线轨迹参数
struct WeaveTrajParams_C
{
double step = 0.0; // 周期
double amplitude = 0.0; // 幅度
WeaveSelect_C direction = WeaveSelect_C::x; // 方向
double hold_distance = 0.0; // 保持距离 m
double angle = 0.0; // 角度
double type; // 类型
};
// 插孔方向
enum class InsertSelect_C
{
x = 1,
y = 2,
z = 3,
};
// 插孔参数
struct InsertParams_C
{
InsertSelect_C insert_select = InsertSelect_C::z; // 插入方向,可选x\y\z
double hole_diameter = 0.0; // 轴孔直径 m
double insert_max_speed = 0.01; // 插入速度限制 m/s
double insert_time = 1000; // 插入时间限制 ms
GuideTrajType_C guide_traj_type = NONE; // 主动轨迹类型
double insert_max_force[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; // 最大力限制
double insert_max_depth = 0.01; // 插入距离限制 m
double insert_guide_force = 10; // 插入引导力
// 力控调节参数
double insert_damp_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
double insert_stiff_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
SpiralTrajParams_C spiral_param; // 螺旋轨迹参数
WeaveTrajParams_C weave_param; // 摆动轨迹参数
};
// 搜孔平面
enum class SearchPlane_C
{
yz = 1,
xz = 2,
xy = 3
};
// 搜孔参数
struct SearchParams_C
{
SearchPlane_C search_plane = SearchPlane_C::xy; // 搜孔平面
double hole_diameter = 0.0; // 轴孔直径 m
double search_range = 0.1; // 搜孔范围
double search_time = 1000; // 搜孔时间限制 ms
GuideTrajType_C guide_traj_type = NONE; // 搜孔过程主动轨迹类型
double search_max_force = 10; // 最大力限制
double search_guide_force = 1; // 搜孔引导力
// 力控调节参数
double search_damp_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
double search_stiff_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
SpiralTrajParams_C spiral_param;
WeaveTrajParams_C weave_param;
};
struct ConstantParams_C
{
TaskFrameType_C frame_type = TaskFrameType_MOTION_FORCE;
double feature[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
bool compliance[6] = { true, true, true, true, true, true };
double wrench[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
// 力控调节参数
double env_stiff[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
double damp_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
double stiff_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
double contact_threshold[6] = {
1.0, 1.0, 1.0, 0.2, 0.2, 0.2
}; // 接触判断阈值
double constant_time = 5000; // 默认5s
};
struct TouchParams_C
{
TaskFrameType_C frame_type = TaskFrameType_TOOL_FORCE;
double feature[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
bool compliance[6] = { true, true, true, true, true, true };
double wrench[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
double env_stiff[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
// std::vector<double> damp_scale = { 0.5, 0.5, 0.5, 0.5, 0.5,
// 0.5 };
double stiff_scale[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
double speed[6] = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
double distance = 0.0;
double touch_time = 1000; // 默认5s
};
#ifdef __cplusplus
extern "C" {
#endif
ARCS_ABI int getTaskForce(FORCE_CONTROL_HANDLER h, TaskFrameType_C type,
const double *feature, double *result);
ARCS_ABI int fcTouch(FORCE_CONTROL_HANDLER h, const TouchParams_C &param);
ARCS_ABI int fcConstant(FORCE_CONTROL_HANDLER h, const ConstantParams_C &param);
ARCS_ABI int fcInsert(FORCE_CONTROL_HANDLER h, const InsertParams_C &param);
ARCS_ABI int fcSearch(FORCE_CONTROL_HANDLER h, const SearchParams_C &param);
ARCS_ABI int fcWaitCondition(FORCE_CONTROL_HANDLER h);
ARCS_ABI int fcExit(FORCE_CONTROL_HANDLER h);
// ARCS_ABI void registerStateCallBack(std::function<void(int state)> func);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,135 @@
#ifndef AUBO_SDK_FORCE_CONTROL_TYPE_CONVERT_C_H
#define AUBO_SDK_FORCE_CONTROL_TYPE_CONVERT_C_H
#include <skill_interface/force_control.h>
#include <skill_interface/force_control_c.h>
// 用于将SpiralTrajParams_C转化为SpiralTrajParams
inline arcs::aubo_sdk::ForceControl::SpiralTrajParams convertToSpiralTrajParams(
const SpiralTrajParams_C &source)
{
arcs::aubo_sdk::ForceControl::SpiralTrajParams result;
result.step = source.step;
result.direction = source.direction;
result.plane = (arcs::aubo_sdk::ForceControl::SpiralPlane)source.plane;
result.spiral = source.spiral;
result.helix = source.helix;
result.radius = source.radius;
return result;
}
// 用于将WeaveTrajParams_C转化为WeaveTrajParams
inline arcs::aubo_sdk::ForceControl::WeaveTrajParams convertToWeaveTrajParams(
const WeaveTrajParams_C &source)
{
arcs::aubo_sdk::ForceControl::WeaveTrajParams result;
result.step = source.step;
result.amplitude = source.amplitude;
result.direction =
(arcs::aubo_sdk::ForceControl::WeaveSelect)source.direction;
result.hold_distance = source.hold_distance;
result.angle = source.angle;
result.type = source.type;
return result;
}
// 用于将TouchParams_C转化为TouchParams
inline arcs::aubo_sdk::ForceControl::TouchParams convertToTouchParams(
const TouchParams_C &source)
{
arcs::aubo_sdk::ForceControl::TouchParams result;
result.frame_type =
(arcs::common_interface::TaskFrameType)source.frame_type;
for (int i = 0; i < 6; i++) {
result.feature[i] = source.feature[i];
result.compliance[i] = source.compliance[i];
result.wrench[i] = source.wrench[i];
result.env_stiff[i] = source.env_stiff[i];
result.stiff_scale[i] = source.stiff_scale[i];
result.speed[i] = source.speed[i];
}
result.distance = source.distance;
result.touch_time = source.touch_time;
return result;
}
inline arcs::aubo_sdk::ForceControl::ConstantParams convertToConstantParams(
const ConstantParams_C &source)
{
arcs::aubo_sdk::ForceControl::ConstantParams result;
result.frame_type =
(arcs::common_interface::TaskFrameType)source.frame_type;
for (int i = 0; i < 6; i++) {
result.feature[i] = source.feature[i];
result.compliance[i] = source.compliance[i];
result.wrench[i] = source.wrench[i];
result.env_stiff[i] = source.env_stiff[i];
result.damp_scale[i] = source.damp_scale[i];
result.stiff_scale[i] = source.stiff_scale[i];
result.contact_threshold[i] = source.contact_threshold[i];
} // 接触判断阈值
result.constant_time = source.constant_time; // 默认5sams result;
return result;
}
inline arcs::aubo_sdk::ForceControl::InsertParams convertToInsertParams(
const InsertParams_C &source)
{
arcs::aubo_sdk::ForceControl::InsertParams result;
result.insert_select =
(arcs::aubo_sdk::ForceControl::InsertSelect)source.insert_select;
result.hole_diameter = source.hole_diameter;
result.insert_max_speed = source.insert_max_speed;
result.insert_time = source.insert_time;
result.guide_traj_type =
(arcs::aubo_sdk::ForceControl::GuideTrajType)source.guide_traj_type;
result.insert_max_depth = source.insert_max_depth;
result.insert_guide_force = source.insert_guide_force;
for (int i = 0; i < 6; i++) {
result.insert_max_force[i] = source.insert_max_force[i];
result.insert_damp_scale[i] = source.insert_damp_scale[i];
result.insert_stiff_scale[i] = source.insert_stiff_scale[i];
}
result.spiral_param = convertToSpiralTrajParams(source.spiral_param);
result.weave_param = convertToWeaveTrajParams(source.weave_param);
return result;
}
// 用于将SearchParams_C转化为SearchParams
inline arcs::aubo_sdk::ForceControl::SearchParams convertToSearchParams(
const SearchParams_C &source)
{
arcs::aubo_sdk::ForceControl::SearchParams result;
result.search_plane =
(arcs::aubo_sdk::ForceControl::SearchPlane)source.search_plane;
result.hole_diameter = source.hole_diameter;
result.search_range = source.search_range;
result.search_time = source.search_time;
result.guide_traj_type =
(arcs::aubo_sdk::ForceControl::GuideTrajType)source.guide_traj_type;
result.search_max_force = source.search_max_force;
result.search_guide_force = source.search_guide_force;
for (int i = 0; i < 6; i++) {
result.search_damp_scale[i] = source.search_damp_scale[i];
result.search_stiff_scale[i] = source.search_stiff_scale[i];
}
result.spiral_param = convertToSpiralTrajParams(source.spiral_param);
result.weave_param = convertToWeaveTrajParams(source.weave_param);
return result;
}
#endif

View File

@ -0,0 +1,11 @@
include(CMakeFindDependencyMacro)
# Config使
# set(my-config-var )
# 使find_package
# find_dependency(MYDEP REQUIRED)
# Any extra setup
# Add the targets file
include("${CMAKE_CURRENT_LIST_DIR}/aubo_sdkTargets.cmake")

View File

@ -0,0 +1,48 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "0.26.0")
if (PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
# if the installed project requested no architecture check, don't perform the check
if("FALSE")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -0,0 +1,29 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Debug".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "aubo_sdk::aubo_sdk" for configuration "Debug"
set_property(TARGET aubo_sdk::aubo_sdk APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(aubo_sdk::aubo_sdk PROPERTIES
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/libaubo_sdkd.so"
IMPORTED_SONAME_DEBUG "libaubo_sdkd.so"
)
list(APPEND _IMPORT_CHECK_TARGETS aubo_sdk::aubo_sdk )
list(APPEND _IMPORT_CHECK_FILES_FOR_aubo_sdk::aubo_sdk "${_IMPORT_PREFIX}/lib/libaubo_sdkd.so" )
# Import target "aubo_sdk::robot_proxy" for configuration "Debug"
set_property(TARGET aubo_sdk::robot_proxy APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(aubo_sdk::robot_proxy PROPERTIES
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/librobot_proxyd.so"
IMPORTED_SONAME_DEBUG "librobot_proxyd.so"
)
list(APPEND _IMPORT_CHECK_TARGETS aubo_sdk::robot_proxy )
list(APPEND _IMPORT_CHECK_FILES_FOR_aubo_sdk::robot_proxy "${_IMPORT_PREFIX}/lib/librobot_proxyd.so" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View File

@ -0,0 +1,29 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "aubo_sdk::aubo_sdk" for configuration "Release"
set_property(TARGET aubo_sdk::aubo_sdk APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(aubo_sdk::aubo_sdk PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libaubo_sdk.so"
IMPORTED_SONAME_RELEASE "libaubo_sdk.so"
)
list(APPEND _IMPORT_CHECK_TARGETS aubo_sdk::aubo_sdk )
list(APPEND _IMPORT_CHECK_FILES_FOR_aubo_sdk::aubo_sdk "${_IMPORT_PREFIX}/lib/libaubo_sdk.so" )
# Import target "aubo_sdk::robot_proxy" for configuration "Release"
set_property(TARGET aubo_sdk::robot_proxy APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(aubo_sdk::robot_proxy PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/librobot_proxy.so"
IMPORTED_SONAME_RELEASE "librobot_proxy.so"
)
list(APPEND _IMPORT_CHECK_TARGETS aubo_sdk::robot_proxy )
list(APPEND _IMPORT_CHECK_FILES_FOR_aubo_sdk::robot_proxy "${_IMPORT_PREFIX}/lib/librobot_proxy.so" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View File

@ -0,0 +1,114 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6...3.18)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget aubo_sdk::aubo_sdk aubo_sdk::common_interface aubo_sdk::robot_proxy)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target aubo_sdk::aubo_sdk
add_library(aubo_sdk::aubo_sdk SHARED IMPORTED)
set_target_properties(aubo_sdk::aubo_sdk PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "aubo_sdk::common_interface"
)
# Create imported target aubo_sdk::common_interface
add_library(aubo_sdk::common_interface INTERFACE IMPORTED)
set_target_properties(aubo_sdk::common_interface PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
# Create imported target aubo_sdk::robot_proxy
add_library(aubo_sdk::robot_proxy SHARED IMPORTED)
set_target_properties(aubo_sdk::robot_proxy PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "aubo_sdk::aubo_sdk;Qt5::Core"
)
if(CMAKE_VERSION VERSION_LESS 3.0.0)
message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
endif()
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/aubo_sdkTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More