1 Commits

Author SHA1 Message Date
zj
52beefcb70 手臂控制测试版本 2025-09-23 18:03:03 +08:00
665 changed files with 13896 additions and 901343 deletions

View File

@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**",
"/usr/local/include",
"/usr/local/etherlab/include",
"~/ros2_humble/src/**",
"/opt/ros/humble/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}

View File

@@ -1,6 +1,87 @@
{
"files.associations": {
"map": "cpp",
"unordered_map": "cpp",
"string": "cpp",
"vector": "cpp",
"dense": "cpp",
"core": "cpp",
"cholesky": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"set": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"source_location": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"cmath": "cpp"
"scoped_allocator": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}

View File

@@ -302,6 +302,8 @@ CallbackReturn EthercatDriver::on_activate(
}
// start EC and wait until state operative
control_frequency_=100.0f;
std::cout<<"force set freq"<<std::endl;
master_.setCtrlFrequency(control_frequency_);
std::cout << "DRV: ----------abc-------------" << master_.getInterval() << std::endl;
for (auto i = 0ul; i < ec_modules_.size(); i++) {

View File

@@ -239,9 +239,7 @@ uint16_t EcCiA402Drive::transition(DeviceState state, uint16_t control_word)
case STATE_FAULT_REACTION_ACTIVE: // -> STATE_FAULT (automatic)
return control_word;
case STATE_FAULT: // -> STATE_SWITCH_ON_DISABLED
// std::cout << "EcCiA402Drive: Fault detected. Resetting drive." << std::endl;
if (auto_fault_reset_ || fault_reset_) {
// if (false || fault_reset_) {
fault_reset_ = false;
return (control_word & 0b11111111) | 0b10000000; // automatic reset
} else {

View File

@@ -83,7 +83,9 @@ public:
void setCtrlFrequency(double frequency)
{
std::cout << "set control frequency to " << frequency << std::endl;
interval_ = 1000000000.0 / frequency;
std::cout << "new interval_ " << interval_<< std::endl;
}
uint32_t getInterval() {return interval_;}

View File

@@ -1,6 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 1000 # Hz
update_rate: 100 # Hz
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
@@ -20,16 +20,6 @@ controller_manager:
# - position
# joints:
# - joint_1
# - joint_2
# - joint_3
# - joint_4
# - joint_5
# - joint_6
# - joint_7
# - joint_8
# - joint_9
# - joint_10
# - joint_11
gpio_command_controller:
ros__parameters:

View File

@@ -2,7 +2,7 @@
vendor_id: 0x5a65726f
product_id: 0x00029252
assign-activate: 0x0300 #DC synch register
auto_fault_reset: false
auto_fault_reset: true
auto_enable_set: false
# sdo: # sdo data to be transferred at drive startup

View File

@@ -3,7 +3,7 @@
<!-- 公共参数定义(一次修改,全局生效) -->
<xacro:property name="master_id" value="0" />
<xacro:property name="control_frequency" value="1000" />
<xacro:property name="control_frequency" value="100" />
<xacro:property name="ec_plugin" value="ethercat_generic_plugins/EcCiA402Drive" />
<xacro:property name="alias" value="0" />
<xacro:property name="mode_of_operation" value="8" />

View File

@@ -89,11 +89,11 @@ def generate_launch_description():
arguments=["gpio_command_controller", "-c", "/controller_manager"],
)
trajectory_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["trajectory_controller", "-c", "/controller_manager"],
)
# trajectory_controller_spawner = Node(
# package="controller_manager",
# executable="spawner",
# arguments=["trajectory_controller", "-c", "/controller_manager"],
# )
# velocity_controller_spawner = Node(
# package="controller_manager",
@@ -111,7 +111,6 @@ def generate_launch_description():
control_node,
robot_state_pub_node,
joint_state_broadcaster_spawner,
# trajectory_controller_spawner,
gpio_controller_spawner,
]

View File

@@ -59,21 +59,9 @@ class JoyControlNode(Node):
if msg.buttons[0] == 1:
command = 'A'
self.command_publisher.publish(String(data=command))
elif msg.buttons[1] == 1:
if msg.buttons[1] == 1:
command = 'B'
self.command_publisher.publish(String(data=command))
elif msg.buttons[2] == 1:
command = 'X'
self.command_publisher.publish(String(data=command))
elif msg.buttons[3] == 1:
command = 'Y'
self.command_publisher.publish(String(data=command))
elif msg.buttons[4] == 1:
command = 'LB'
self.command_publisher.publish(String(data=command))
elif msg.buttons[5] == 1:
command = 'RB'
self.command_publisher.publish(String(data=command))
# 处理摇杆死区0.1
deadzone = 0.1
@@ -92,14 +80,6 @@ class JoyControlNode(Node):
if msg.axes[1] != self.previous_axes[1] and msg.axes[1] < - deadzone :
command = '后退'
self.command_publisher.publish(String(data=command))
if msg.axes[6] != self.previous_axes[6] and msg.axes[6] > deadzone :
command = '抬手'
self.command_publisher.publish(String(data=command))
if msg.axes[6] != self.previous_axes[6] and msg.axes[6] < - deadzone :
command = '放手'
self.command_publisher.publish(String(data=command))
if msg.axes[7] != self.previous_axes[7] and msg.axes[7] > deadzone :
command = '上升'
@@ -109,8 +89,8 @@ class JoyControlNode(Node):
command = '下降'
self.command_publisher.publish(String(data=command))
if msg.axes[0] != self.previous_axes[0] or msg.axes[1] != self.previous_axes[1] or msg.axes[7] != self.previous_axes[7] or msg.axes[6] != self.previous_axes[6]:
if msg.axes[0] == 0.0 and msg.axes[1] == 0.0 and msg.axes[7] == 0.0 and msg.axes[6] == 0.0:
if msg.axes[0] != self.previous_axes[0] or msg.axes[1] != self.previous_axes[1] or msg.axes[7] != self.previous_axes[7]:
if msg.axes[0] == 0.0 and msg.axes[1] == 0.0 and msg.axes[7] == 0.0:
command = '停止'
self.command_publisher.publish(String(data=command))
@@ -129,4 +109,4 @@ def main(args=None):
if __name__ == '__main__':
main()

View File

@@ -31,10 +31,6 @@ namespace robot_control
bool Stop(std::vector<double>& joint_positions, double dt);
bool MoveUp(std::vector<double>& joint_positions, double dt);
bool MoveDown(std::vector<double>& joint_positions, double dt);
void UpdateJointStates(const std::vector<double>& joint_positions, const std::vector<double>& joint_velocities, const std::vector<double>& joint_torques);
bool IsMoving();

View File

@@ -16,8 +16,6 @@ namespace robot_control
TURNING_RIGHT, // 右转
MOVING_UP, // 上升(腰部)
MOVING_DOWN, // 下降(腰部)
ARM_MOVING_UP, // 手臂上升
ARM_MOVING_DOWN, // 手臂下降
HOME_MOVING // 回零
};
@@ -32,8 +30,6 @@ namespace robot_control
RIGHT, // 右转
UP, // 上升
DOWN, // 下降
HAND_UP, // 手臂上升
HAND_DOWN, // 手臂下降
STOP, // 停止
ARM_GRAB, // 手臂抓取
GO_HOME, // 关节回零

View File

@@ -45,26 +45,26 @@ namespace robot_control
arm_length_l2_ = 0.219;
// 轮子速度参数
max_linear_speed_x_ = 100;
max_linear_speed_x_ = 10;
max_linear_speed_z_ = 10;
max_angular_speed_z_ = 50;
// 关节速度参数
max_joint_velocity_ = 5; // 10 度/秒
max_joint_acceleration_ = 25; // 10 度/秒^2
max_joint_velocity_ = 10; // 10 度/秒
max_joint_acceleration_ = 100; // 10 度/秒^2
// 初始化关节索引
wheel_joint_indices_ = {0, 1};
pitch_body_indices_ = {8};
right_leg_joint_indices_ = {9};
left_leg_joint_indices_ = {10};
right_arm_joint_indices_ = {0, 1, 2, 3};
left_arm_joint_indices_ = {4, 5, 6, 7};
total_joints_ = 11 ; //left_arm_joint_indices_.size() + right_arm_joint_indices_.size() + pitch_body_indices_.size() + left_leg_joint_indices_.size() + right_leg_joint_indices_.size();
wheel_joint_indices_ = {0, 1, 2, 3};
pitch_body_indices_ = {0};
right_leg_joint_indices_ = {1};
left_leg_joint_indices_ = {2};
right_arm_joint_indices_ = {3, 4, 5, 6};
left_arm_joint_indices_ = {7, 8, 9, 10};
total_joints_ = 11 ; //left_arm_joint_indices_.size() + right_arm_joint_indices_.size() + pitch_body_indices_.size() + left_leg_joint_indices_.size() + right_leg_joint_indices_.size();
// 初始化关节方向
wheel_joint_directions_ = {-1, 1};
wheel_joint_directions_ = {1, -1, 1, -1};
left_arm_joint_directions_ = {1, 1, 1, 1};
right_arm_joint_directions_ = {1, 1, 1, 1};
pitch_body_directions_ = {1};
@@ -152,8 +152,6 @@ namespace robot_control
pulse_to_radian_ = 2.0 * M_PI / 524288.0;
radian_to_pulse_ = 524288.0 / (2.0 * M_PI);
jog_step_size_ = 10 * pulse_to_degree_;
serial_port_ = "/dev/ttyUSB0";
baud_rate_ = 115200;
@@ -212,7 +210,6 @@ namespace robot_control
double max_joint_velocity_;
double max_joint_acceleration_;
double jog_step_size_;
// 运动状态
std::vector<double> joint_positions_; // 关节位置(弧度)

View File

@@ -26,19 +26,12 @@ namespace robot_control
void TurnRight();
void MoveUp(double dt);
void MoveDown(double dt);
void ArmMoveUp(double dt);
void ArmMoveDown(double dt);
bool Stop(double dt);
bool GoHome(double dt);
void JogAxis(int axis, int dir);
// void ArmGrab(double dt);
void UpdateInitCommand();
// 机器人关节指令
std_msgs::msg::Float64MultiArray GetJointCommands();
std_msgs::msg::Float64MultiArray GetJointInitCommands();
void CheckJointLimits(std_msgs::msg::Float64MultiArray& jointCommands);
void UpdateJointStates(const sensor_msgs::msg::JointState::SharedPtr msg);
@@ -73,10 +66,6 @@ namespace robot_control
sensor_msgs::msg::JointState jointStates_;
std_msgs::msg::Float64MultiArray jointCommands_;
std_msgs::msg::Float64MultiArray jointCommandsInit_;
void AssignTempValues();
void UpdateJointCommands();
};

View File

@@ -36,9 +36,7 @@ namespace robot_control
// 状态转换为字符串
std::string StateToString(RobotState state) const;
void EnableRobot(double value);
void ResetFault(double value);
int motor_dst(std::string name,double dst);//add by hehe
void EnableRobot();
private:
rclcpp::Publisher<trajectory_msgs::msg::JointTrajectory>::SharedPtr cmdPub_;
@@ -64,20 +62,10 @@ namespace robot_control
bool isPaused_;
bool isFinished_;
bool isRobotEnabled_;
bool isFaultReset_;
bool isJogMode_;
bool enableCommandExecuted_;
// bool resetFault_;
int jogDirection_;
int jogIndex_;
double jogValue_;
//add by hehe
std::unordered_map<std::string,double> curMap_;
std::unordered_map<std::string,double> dstMap_;
control_msgs::msg::DynamicInterfaceGroupValues posMsg_;
sensor_msgs::msg::JointState curJointSta_;
//add by hehe end
// 状态转换表
std::map<std::pair<RobotState, ControlCommand>, RobotState> transitionTable_;
@@ -100,4 +88,4 @@ namespace robot_control
} // namespace robot_control
#endif // ROBOT_FSM_H
#endif // ROBOT_FSM_H

View File

@@ -10,7 +10,7 @@ namespace robot_control
class RS485Driver
{
public:
RS485Driver(size_t max_motors = 2);
RS485Driver(size_t max_motors = 4);
~RS485Driver();
// 打开串口
@@ -45,8 +45,6 @@ namespace robot_control
bool is_open_;
struct termios original_termios_;
size_t max_motors_;
size_t control_index_;
// 转换波特率
speed_t convertBaudRate(int baud_rate);

View File

@@ -20,9 +20,7 @@ namespace robot_control
void setLinearAngularSpeed(double linearSpeed, double angularSpeed);
bool ExecuteCommand();
double GetLinearSpeed() {return linearSpeed_;}
void ExecuteCommand();
private:

View File

@@ -121,46 +121,6 @@ bool ArmControl::MoveToTargetJoint(std::vector<double>& joint_positions, const s
return false;
}
bool ArmControl::MoveUp(std::vector<double>& joint_positions, double dt)
{
if (!is_moving_)
{
for (size_t i = 0; i < joint_position_.size(); i++)
{
if (joint_directions_[i] == 1)
{
joint_position_desired_[i] = joint_position_[i] + 20;
}
else
{
joint_position_desired_[i] = joint_position_[i] - 20;
}
}
}
return MoveToTargetJoint(joint_positions, joint_position_desired_, dt);
}
bool ArmControl::MoveDown(std::vector<double>& joint_positions, double dt)
{
if (!is_moving_)
{
for (size_t i = 0; i < joint_position_.size(); i++)
{
if (joint_directions_[i] == 1)
{
joint_position_desired_[i] = joint_position_[i] - 20;
}
else
{
joint_position_desired_[i] = joint_position_[i] + 20;
}
}
}
return MoveToTargetJoint(joint_positions, joint_position_desired_, dt);
}
bool ArmControl::GoHome(std::vector<double>& joint_positions, double dt)
{
bool all_joints_at_home = true; // 标记是否所有关节都在零点
@@ -235,7 +195,9 @@ bool ArmControl::Stop(std::vector<double>& joint_positions, double dt)
if (is_moving_ && !is_stopping_)
{
is_stopping_ = true;
std::cout << "arm control stop1" << std::endl;
trapezoidalTrajectory_->StopCalculate();
std::cout << "arm control stop2" << std::endl;
stopDurationTime_ = 0.0;
}

View File

@@ -108,11 +108,11 @@ bool LegControl::MoveUp(std::vector<double>& joint_positions, double dt)
{
if (joint_directions_[i] == 1)
{
joint_position_desired_[i] = joint_position_[i] + 20;
joint_position_desired_[i] = maxLimits_[i];
}
else
{
joint_position_desired_[i] = joint_position_[i] - 20;
joint_position_desired_[i] = minLimits_[i];
}
}
}
@@ -128,11 +128,11 @@ bool LegControl::MoveDown(std::vector<double>& joint_positions, double dt)
{
if (joint_directions_[i] == 1)
{
joint_position_desired_[i] = joint_position_[i] - 20;
joint_position_desired_[i] = minLimits_[i];
}
else
{
joint_position_desired_[i] = joint_position_[i] + 20;
joint_position_desired_[i] = maxLimits_[i];
}
}
}

View File

@@ -21,7 +21,6 @@ void RobotControlManager::init()
for (size_t i = 0; i < motionParams_.total_joints_; i++)
{
jointCommands_.data.push_back(0.0);
jointCommandsInit_.data.push_back(0.0);
}
leftArmController_ = new ArmControl(
@@ -113,31 +112,6 @@ Float64MultiArray RobotControlManager::GetJointCommands()
return tempValues;
}
Float64MultiArray RobotControlManager::GetJointInitCommands()
{
Float64MultiArray tempValues;
tempValues.data.resize(motionParams_.total_joints_);
// Convert the joint commands to motor values and limit to encoder range
for (size_t i = 0; i < jointCommandsInit_.data.size(); i++)
{
double angle = jointCommandsInit_.data[i];
double normalizedAngle = fmod(angle, 360.0);
// 计算原始脉冲值
double pulseValue = normalizedAngle * motionParams_.degree_to_pulse_;
tempValues.data[i] = pulseValue;
}
return tempValues;
}
void RobotControlManager::UpdateInitCommand()
{
jointCommandsInit_ = jointCommands_;
}
void RobotControlManager::CheckJointLimits(Float64MultiArray &tempJointValues)
{
@@ -165,7 +139,8 @@ bool isAllTrueManual(const std::vector<bool>& vec) {
return true; // 所有元素都是 true
}
bool isValueSet = false;
bool isPrint = false;
void RobotControlManager::UpdateJointStates(const sensor_msgs::msg::JointState::SharedPtr msg)
{
jointStates_ = *msg;
@@ -175,66 +150,36 @@ void RobotControlManager::UpdateJointStates(const sensor_msgs::msg::JointState::
for (size_t i = 0; i < motionParams_.total_joints_; i++)
{
std::string joint_name = jointStates_.name[i];
int index = -1;
size_t underscore_pos = joint_name.find_last_of('_');
if (underscore_pos != std::string::npos && underscore_pos < joint_name.size() - 1)
{
std::string num_str = joint_name.substr(underscore_pos + 1);
jointPositions_[i] = jointStates_.position[i] * motionParams_.pulse_to_degree_; // convert to degree
jointVelocities_[i] = jointStates_.velocity[i] * motionParams_.pulse_to_degree_;
jointEfforts_[i] = 0.0; //jointStates_.effort[i] ; // TODO: check the factory
try
{
index = std::stoi(num_str) - 1;
}
catch (const std::invalid_argument& e)
{
std::cerr << "关节名称 " << joint_name << " 格式错误:下划线后非数字" << std::endl;
}
}
if (index != -1 && index < motionParams_.total_joints_)
{
jointPositions_[index] = jointStates_.position[i] * motionParams_.pulse_to_degree_;
jointVelocities_[index] = jointStates_.velocity[i] * motionParams_.pulse_to_degree_;
jointEfforts_[index] = 0.0;
}
// else do not update.
}
// TODO: This block can be deleted
for (size_t i = 0; i < motionParams_.total_joints_; i++)
{
if(!jointInited_[i])
{
if(jointPositions_[i] != 0)
jointCommands_.data[i] = jointStates_.position[i]* motionParams_.pulse_to_degree_;
if(jointCommands_.data[i] != 0)
{
jointInited_[i] = true;
}
}
}
static int count = 0;
if (isAllTrueManual(jointInited_) && !isValueSet)
if (isAllTrueManual(jointInited_) && !isPrint)
{
if (count > 5000)
isPrint = true;
std::cout << "All joints are initialized" << std::endl;
for (size_t i = 0; i < motionParams_.total_joints_; i++)
{
jointCommands_.data = jointPositions_;
jointCommandsInit_.data = jointPositions_;
isValueSet = true;
count = 0;
std::cout << "Joint commands set to joint positions" << std::endl;
std::cout << "All joints are initialized" << std::endl;
for (size_t i = 0; i < motionParams_.total_joints_; i++)
{
std::cout << "Joint positions: " << i + 1 << " " << jointCommands_.data[i] << std::endl;
}
std::cout << "Joint positions: " << i + 1 << " " << jointCommands_.data[i] << std::endl;
}
count++;
}
// Update the arm controller
size_t armJointSize = motionParams_.left_arm_joint_indices_.size();
std::vector<double> armPositions(jointPositions_.begin() + motionParams_.left_arm_joint_indices_[0], jointPositions_.begin() + motionParams_.left_arm_joint_indices_[0] + armJointSize);
@@ -280,96 +225,85 @@ void RobotControlManager::MoveBackward()
void RobotControlManager::TurnLeft()
{
wheelController_ -> setLinearAngularSpeed(0.0, motionParams_.max_angular_speed_z_);
wheelController_ -> setLinearAngularSpeed(0.0, - motionParams_.max_angular_speed_z_);
wheelController_ -> ExecuteCommand();
}
void RobotControlManager::TurnRight()
{
wheelController_ -> setLinearAngularSpeed(0.0, - motionParams_.max_angular_speed_z_);
wheelController_ -> setLinearAngularSpeed(0.0, motionParams_.max_angular_speed_z_);
wheelController_ -> ExecuteCommand();
}
bool executeFinished = true;
bool RobotControlManager::Stop(double dt)
{
double currentSpeed = wheelController_ -> GetLinearSpeed();
bool wheelStopped = abs(currentSpeed) > 0 ? false : true;
if(executeFinished)
{
double tempSpeed = 0.0;
if(currentSpeed < -1.0)
{
tempSpeed = currentSpeed + 1.0;
}
else if(currentSpeed > 5.0)
{
tempSpeed = currentSpeed - 1.0;
}
wheelController_ -> setLinearAngularSpeed(tempSpeed, 0.0);
// std::cout << "set speed : " << tempSpeed << std::endl;
}
executeFinished = wheelController_ -> ExecuteCommand();
AssignTempValues();
wheelController_ -> setLinearAngularSpeed(0.0, 0.0);
wheelController_ -> ExecuteCommand();
bool leftLegStopped = leftLegController_->Stop(tempLeftLegCmd, dt);
bool rightLegStopped = rightLegController_->Stop(tempRightLegCmd, dt);
bool leftArmStopped = leftArmController_->Stop(tempLeftArmCmd, dt);
bool rightArmStopped = rightArmController_->Stop(tempRightArmCmd, dt);
UpdateJointCommands();
return leftLegStopped && rightLegStopped && leftArmStopped && rightArmStopped && wheelStopped && executeFinished;
bool rightLegStopped = rightLegController_->Stop(tempRightLegCmd, dt);
bool leftArmStopped = leftArmController_->Stop(tempLeftArmCmd, dt);
bool rightArmStopped = rightArmController_->Stop(tempRightArmCmd, dt);
for (size_t i = 0; i < motionParams_.left_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.left_leg_joint_indices_[i]] = tempLeftLegCmd[i];
}
for (size_t i = 0; i < motionParams_.right_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.right_leg_joint_indices_[i]] = tempRightLegCmd[i];
}
//TODO: there is no data from arm
// for (size_t i = 0; i < motionParams_.left_arm_joint_indices_.size(); i++)
// {
// jointCommands_.data[motionParams_.left_arm_joint_indices_[i]] = motionParams_.left_arm_joint_directions_[i] * tempLeftArmCmd[i];
// }
// for (size_t i = 0; i < motionParams_.right_arm_joint_indices_.size(); i++)
// {
// jointCommands_.data[motionParams_.right_arm_joint_indices_[i]] = motionParams_.right_arm_joint_directions_[i] * tempRightArmCmd[i];
// }
return leftLegStopped && rightLegStopped && leftArmStopped && rightArmStopped;
}
void RobotControlManager::MoveUp(double dt)
{
AssignTempValues();
leftLegController_ -> MoveUp(tempLeftLegCmd, dt);
rightLegController_ -> MoveUp(tempRightLegCmd, dt);
wheelController_-> setLinearAngularSpeed(5.0, 0.0); //TODO: value need to be changed
wheelController_ -> ExecuteCommand();
UpdateJointCommands();
for (size_t i = 0; i < motionParams_.left_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.left_leg_joint_indices_[i]] = tempLeftLegCmd[i];
}
for (size_t i = 0; i < motionParams_.right_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.right_leg_joint_indices_[i]] = tempRightLegCmd[i];
}
}
void RobotControlManager::MoveDown(double dt)
{
AssignTempValues();
leftLegController_ -> MoveDown(tempLeftLegCmd, dt);
rightLegController_ -> MoveDown(tempRightLegCmd, dt);
wheelController_-> setLinearAngularSpeed(-5.0, 0.0); //TODO: value need to be changed
wheelController_ -> ExecuteCommand();
UpdateJointCommands();
}
void RobotControlManager::ArmMoveUp(double dt)
{
AssignTempValues();
leftArmController_ -> MoveUp(tempLeftArmCmd, dt);
rightArmController_ -> MoveUp(tempRightArmCmd, dt);
UpdateJointCommands();
}
void RobotControlManager::ArmMoveDown(double dt)
{
AssignTempValues();
leftArmController_ -> MoveDown(tempLeftArmCmd, dt);
rightArmController_ -> MoveDown(tempRightArmCmd, dt);
UpdateJointCommands();
for (size_t i = 0; i < motionParams_.left_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.left_leg_joint_indices_[i]] = tempLeftLegCmd[i];
}
for (size_t i = 0; i < motionParams_.right_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.right_leg_joint_indices_[i]] = tempRightLegCmd[i];
}
}
bool RobotControlManager::GoHome(double dt)
@@ -412,59 +346,3 @@ bool RobotControlManager::GoHome(double dt)
return robotHomed_[0] && robotHomed_[1];// && homeFinished[2] && homeFinished[3];
}
void RobotControlManager::JogAxis(int axis, int direction)
{
if(axis < 0 || axis > motionParams_.total_joints_)
{
return;
}
jointCommands_.data[axis] += direction * motionParams_.jog_step_size_;
}
void RobotControlManager::AssignTempValues()
{
tempLeftArmCmd.resize(motionParams_.left_arm_joint_indices_.size());
tempRightArmCmd.resize(motionParams_.right_arm_joint_indices_.size());
tempLeftLegCmd.resize(motionParams_.left_leg_joint_indices_.size());
tempRightLegCmd.resize(motionParams_.right_leg_joint_indices_.size());
for (size_t i = 0; i < motionParams_.left_arm_joint_indices_.size(); i++)
{
tempLeftArmCmd[i] = jointCommands_.data[motionParams_.left_arm_joint_indices_[i]];
}
for (size_t i = 0; i < motionParams_.right_arm_joint_indices_.size(); i++)
{
tempRightArmCmd[i] = jointCommands_.data[motionParams_.right_arm_joint_indices_[i]];
}
for (size_t i = 0; i < motionParams_.left_leg_joint_indices_.size(); i++)
{
tempLeftLegCmd[i] = jointCommands_.data[motionParams_.left_leg_joint_indices_[i]];
}
for (size_t i = 0; i < motionParams_.right_leg_joint_indices_.size(); i++)
{
tempRightLegCmd[i] = jointCommands_.data[motionParams_.right_leg_joint_indices_[i]];
}
}
void RobotControlManager::UpdateJointCommands()
{
// TODO: first joint will conflict with righ arm, so we start from the second one
for (size_t i = 1; i < motionParams_.left_arm_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.left_arm_joint_indices_[i]] = tempLeftArmCmd[i];
}
for (size_t i = 1; i < motionParams_.right_arm_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.right_arm_joint_indices_[i]] = tempRightArmCmd[i];
}
for (size_t i = 0; i < motionParams_.left_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.left_leg_joint_indices_[i]] = tempLeftLegCmd[i];
}
for (size_t i = 0; i < motionParams_.right_leg_joint_indices_.size(); i++)
{
jointCommands_.data[motionParams_.right_leg_joint_indices_[i]] = tempRightLegCmd[i];
}
}

View File

@@ -14,12 +14,9 @@ RobotFsm::RobotFsm() : Node("robot_Fsm_node")
previousState_ = RobotState::INIT;
isRobotEnabled_ = false;
isFaultReset_ = false;
isJogMode_ = false;
enableCommandExecuted_ = false;
jogDirection_ = 0;
jogIndex_ = 5; //default axis 6
// 初始化数据文件(设置路径,确保目录存在)
data_file_path_ = "/home/demo/ros2_joint_data.txt"; // 数据保存路径
fs::path file_path(data_file_path_);
@@ -60,9 +57,8 @@ RobotFsm::RobotFsm() : Node("robot_Fsm_node")
lastTime_ = this->now(); // 初始化时间
// 创建定时器每10ms执行一次控制逻辑频率100Hz
controlTimer_ = this->create_wall_timer(std::chrono::milliseconds(1),std::bind(&RobotFsm::ControlLoop, this)); // 绑定到新的控制函数);
curMap_.clear();
dstMap_.clear();
controlTimer_ = this->create_wall_timer(std::chrono::milliseconds(10),std::bind(&RobotFsm::ControlLoop, this)); // 绑定到新的控制函数);
std::cout << "RobotFsm Node is created finished!" << std::endl;
}
@@ -74,34 +70,14 @@ RobotFsm::~RobotFsm()
std::cout << "Robot controller stopped." << std::endl;
}
void PrintMessage(control_msgs::msg::DynamicInterfaceGroupValues msg) {
std::cout << "publish joint trajectory" << std::endl;
std::cout << msg.header.stamp.sec << std::endl;
std::cout << msg.header.stamp.nanosec << std::endl;
std::cout << msg.header.frame_id << std::endl;
for (size_t i = 0; i < msg.interface_groups.size(); i++)
{
std::cout << msg.interface_groups[i] << std::endl;
}
for (size_t i = 0; i < msg.interface_values.size(); i++)
{
std::cout << msg.interface_values[i].interface_names[0];
std::cout << msg.interface_values[i].values[0] << std::endl;
}
}
void RobotFsm::JointStatesCallback(const sensor_msgs::msg::JointState::SharedPtr msg)
{
if (!msg) { // 检查消息是否有效
std::cout << "get null joint states!" << std::endl;
return;
}
for(size_t i=0; i < msg-> name.size();i++)
{
curMap_[msg->name[i]] = msg->position[i];
}
// 更新机器人状态
robotControlManager_.UpdateJointStates(msg);
}
@@ -148,32 +124,11 @@ void RobotFsm::JoyCommandCallback(const std_msgs::msg::String::SharedPtr msg) {
// 解析消息内容
std::string command = msg->data;
static std::string last_msg="";
if(last_msg!=command)
last_msg=command;
else
return;
if (command == "前进") {
if (isJogMode_ && jogDirection_ == 0)
{
jogIndex_ ++;
std::cout << "switch to jog axis: " << jogIndex_ + 1 << std::endl;
}
else
{
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::FORWARD);
}
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::FORWARD);
}
else if (command == "后退") {
if (isJogMode_ && jogDirection_ == 0)
{
jogIndex_ --;
std::cout << "switch to jog axis: " << jogIndex_ + 1 << std::endl;
}
else
{
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::BACKWARD);
}
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::BACKWARD);
}
else if (command == "左转") {
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::LEFT);
@@ -182,129 +137,57 @@ void RobotFsm::JoyCommandCallback(const std_msgs::msg::String::SharedPtr msg) {
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::RIGHT);
}
else if (command == "上升") {
if (isJogMode_)
{
jogDirection_ = 1;
std::cout << "jog axis in positive direction: " << jogIndex_ + 1 << std::endl;
}
else
{
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::UP);
}
jogDirection_ = 1;
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::UP);
}
else if (command == "下降") {
if (isJogMode_)
{
jogDirection_ = -1;
std::cout << "jog axis in negative direction: " << jogIndex_ + 1 << std::endl;
}
else
{
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::DOWN);
}
}
else if (command == "抬手") {
if (!isJogMode_)
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::HAND_UP);
}
else if (command == "放手") {
if (!isJogMode_)
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::HAND_DOWN);
jogDirection_ = -1;
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::DOWN);
}
else if (command == "停止") {
if (isJogMode_)
{
jogDirection_ = 0;
std::cout << "jog axis stopped: " << jogIndex_ + 1 << std::endl;
}
else
{
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::STOP);
}
jogDirection_ = 0;
inputDevices_[InputType::JOY]->SetCommand(ControlCommand::STOP);
}
else if (command == "A") {
if (enableCommandExecuted_)
{
enableCommandExecuted_ = false;
EnableRobot(0);
std::cout<<"enable all motor"<<std::endl;
}
}
else if (command == "Y") {
ResetFault(1);
std::cout<<"reset fault"<<std::endl;
}
else if (command == "X") {
ResetFault(0);
std::cout<<"reset fault"<<std::endl;
// TODO: need to be checked.
// inputDevices_[InputType::JOY]->SetCommand(ControlCommand::GO_HOME);
}
else if (command == "B") {
if (!enableCommandExecuted_)
{
enableCommandExecuted_ = true;
EnableRobot(1);
std::cout<<"enable all motor"<<std::endl;
EnableRobot();
}
}
else if (command == "LB")
{
isJogMode_ = true;
std::cout << "jog mode enabled" << std::endl;
}
else if (command == "RB")
{
isJogMode_ = false;
std::cout << "jog mode disabled" << std::endl;
}
else {
RCLCPP_WARN(this->get_logger(), "未知的命令: %s", command.c_str());
}
}
void RobotFsm::ResetFault(double value)
void RobotFsm::EnableRobot()
{
control_msgs::msg::DynamicInterfaceGroupValues enableMsg;
for (size_t i = 0; i < robotControlManager_.GetMotionParameters().total_joints_; i++)
{
std::string tempInterfaceGroup = "joint_" + std::to_string(i+1);
enableMsg.interface_groups.push_back(tempInterfaceGroup);
control_msgs::msg::DynamicInterfaceGroupValues enableMsg;
control_msgs::msg::InterfaceValue tempValue;
tempValue.interface_names = {"reset_fault"};
tempValue.values = {value};
enableMsg.interface_values.push_back(tempValue);
}
PrintMessage(enableMsg);
gpioPub_->publish(enableMsg);
if (value == 1)
{
std::cout << "Fault reset" << std::endl;
isFaultReset_ = true;
}
}
void RobotFsm::EnableRobot(double value)
{
control_msgs::msg::DynamicInterfaceGroupValues enableMsg;
for (size_t i = 0; i < robotControlManager_.GetMotionParameters().total_joints_; i++)
{
std::string tempInterfaceGroup = "joint_" + std::to_string(i+1);
enableMsg.interface_groups.push_back(tempInterfaceGroup);
control_msgs::msg::InterfaceValue tempValue;
tempValue.interface_names = {"enable"};
tempValue.values = {value};
tempValue.values = {1};
enableMsg.interface_values.push_back(tempValue);
std::cout << "Enable robot " << i + 1 << std::endl;
gpioPub_->publish(enableMsg);
sleep(1);
}
gpioPub_->publish(enableMsg);
isRobotEnabled_ = value == 1? true: false;
sleep(2);
isRobotEnabled_ = true;
}
void RobotFsm::VoiceCommandCallback(const std_msgs::msg::String::SharedPtr msg) {
@@ -350,8 +233,6 @@ void RobotFsm::InitTransitionTable() {
transitionTable_[{RobotState::TURNING_RIGHT, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::MOVING_UP, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::MOVING_DOWN, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::ARM_MOVING_UP, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::ARM_MOVING_DOWN, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::HOME_MOVING, ControlCommand::STOP}] = RobotState::STOPPING;
transitionTable_[{RobotState::STOPPED, ControlCommand::FORWARD}] = RobotState::MOVING_FORWARD;
@@ -360,8 +241,6 @@ void RobotFsm::InitTransitionTable() {
transitionTable_[{RobotState::STOPPED, ControlCommand::RIGHT}] = RobotState::TURNING_RIGHT;
transitionTable_[{RobotState::STOPPED, ControlCommand::UP}] = RobotState::MOVING_UP;
transitionTable_[{RobotState::STOPPED, ControlCommand::DOWN}] = RobotState::MOVING_DOWN;
transitionTable_[{RobotState::STOPPED, ControlCommand::HAND_UP}] = RobotState::ARM_MOVING_UP;
transitionTable_[{RobotState::STOPPED, ControlCommand::HAND_DOWN}] = RobotState::ARM_MOVING_DOWN;
transitionTable_[{RobotState::STOPPED, ControlCommand::GO_HOME}] = RobotState::HOME_MOVING;
transitionTable_[{RobotState::INIT, ControlCommand::FORWARD}] = RobotState::MOVING_FORWARD;
@@ -370,8 +249,6 @@ void RobotFsm::InitTransitionTable() {
transitionTable_[{RobotState::INIT, ControlCommand::RIGHT}] = RobotState::TURNING_RIGHT;
transitionTable_[{RobotState::INIT, ControlCommand::UP}] = RobotState::MOVING_UP;
transitionTable_[{RobotState::INIT, ControlCommand::DOWN}] = RobotState::MOVING_DOWN;
transitionTable_[{RobotState::INIT, ControlCommand::HAND_UP}] = RobotState::ARM_MOVING_UP;
transitionTable_[{RobotState::INIT, ControlCommand::HAND_DOWN}] = RobotState::ARM_MOVING_DOWN;
transitionTable_[{RobotState::INIT, ControlCommand::GO_HOME}] = RobotState::HOME_MOVING;
}
@@ -381,30 +258,10 @@ void RobotFsm::AddInputDevice(InputType type, std::unique_ptr<InputDevice> devic
std::cout << "Added input device: " << inputDevices_[type]->GetDeviceName() << std::endl;
}
int RobotFsm::motor_dst(std::string name,double dst){
double val=curMap_[name];
double diff=dst-val;
double tempJointValue=0;
float delta=0.0;
if(diff>600){
delta=120.0;
tempJointValue=val+delta;
}else if(diff<-600){
delta=-120.0;
tempJointValue=val+delta;
}else{
return 0;
}
posMsg_.interface_groups.push_back(name);
control_msgs::msg::InterfaceValue tempValue;
tempValue.interface_names = {"position"};
tempValue.values = {tempJointValue};
posMsg_.interface_values.push_back(tempValue);
return 0;
}
// 状态机主循环
void RobotFsm::ControlLoop() {
// 检查所有输入设备
ControlCommand cmd = ControlCommand::NONE;
for (const auto& [type, device] : inputDevices_) {
@@ -466,38 +323,39 @@ void RobotFsm::Publish_joint_trajectory()
void RobotFsm::Gpio_publish_joint_trajectory()
{
// jog
if (isJogMode_)
static size_t jointIndex = 5;
static auto jointValue = robotControlManager_.GetJointCommands().data;
static double jogValue = jointValue[jointIndex -1];
std::cout << jogValue << std::endl;
if (true)
{
robotControlManager_.JogAxis(jogIndex_, jogDirection_);
auto cmd_msg = robotControlManager_.GetJointCommands();
data_file_ << 0;
// 2. 保存整个数组数据到txt文件
if (data_file_.is_open()) {
for (const auto& val : cmd_msg.data) {
data_file_ << "," << val; // 用逗号分隔每个元素
}
data_file_ << std::endl; // 换行
data_file_.flush(); // 强制刷新
}
control_msgs::msg::DynamicInterfaceGroupValues positionMsg;
for (size_t i = 0; i < robotControlManager_.GetMotionParameters().total_joints_; i++)
{
std::string tempInterfaceGroup = "joint_" + std::to_string(i+1);
std::string tempInterfaceGroup = "joint_" + std::to_string(i + 1);
positionMsg.interface_groups.push_back(tempInterfaceGroup);
double tempJointValue;
if (i + 1 == jointIndex)
{
jogValue = jogValue + jogDirection_ * 10;
tempJointValue = jogValue;
}
else
{
tempJointValue = jointValue[i];
}
control_msgs::msg::InterfaceValue tempValue;
tempValue.interface_names = {"position"};
tempValue.values = {cmd_msg.data[i]};
tempValue.values = {tempJointValue};
positionMsg.interface_values.push_back(tempValue);
}
// PrintMessage(positionMsg);
// 发布消息
gpioPub_->publish(positionMsg);
}
else
@@ -529,7 +387,7 @@ void RobotFsm::Gpio_publish_joint_trajectory()
}
// 发布消息
gpioPub_->publish(positionMsg);
//gpioPub_->publish(positionMsg);
}
}
@@ -580,12 +438,7 @@ void RobotFsm::ExecuteStateAction(double dt) {
break;
case RobotState::MOVING_DOWN:
robotControlManager_.MoveDown(dt);
break;
case RobotState::ARM_MOVING_UP:
robotControlManager_.ArmMoveUp(dt);
break;
case RobotState::ARM_MOVING_DOWN:
robotControlManager_.ArmMoveDown(dt);
// 发送下降命令
break;
case RobotState::HOME_MOVING:
if(robotControlManager_.GoHome(dt))
@@ -609,10 +462,8 @@ std::string RobotFsm::StateToString(RobotState state) const {
case RobotState::TURNING_LEFT: return "TURNING_LEFT";
case RobotState::TURNING_RIGHT: return "TURNING_RIGHT";
case RobotState::MOVING_UP: return "MOVING_UP";
case RobotState::ARM_MOVING_UP: return "ARM_MOVING_UP";
case RobotState::ARM_MOVING_DOWN: return "ARM_MOVING_DOWN";
case RobotState::MOVING_DOWN: return "MOVING_DOWN";
case RobotState::HOME_MOVING: return "HOME_MOVING";
default: return "UNKNOWN";
}
}
}

View File

@@ -47,7 +47,7 @@ namespace robot_control
RS485Driver::RS485Driver(size_t maxMotors) : max_motors_(maxMotors), serial_port_(-1), is_open_(false)
{
control_index_ = 0;
}
RS485Driver::~RS485Driver()
@@ -339,70 +339,35 @@ namespace robot_control
std::vector<uint8_t> command;
if (i < 5)
{
control_index_ = 1;
// 限制速度范围
int32_t clamped_speed = speeds[control_index_ - 1];
if (clamped_speed > 1000) clamped_speed = 1000;
if (clamped_speed < -1000) clamped_speed = -1000;
// 限制速度范围
int32_t clamped_speed = speeds[i - 1];
if (clamped_speed > 1000) clamped_speed = 1000;
if (clamped_speed < -1000) clamped_speed = -1000;
uint8_t high_byte = (clamped_speed >> 8) & 0xFF; // 高8位
uint8_t low_byte = clamped_speed & 0xFF; // 低8位
uint8_t high_byte = (clamped_speed >> 8) & 0xFF; // 高8位
uint8_t low_byte = clamped_speed & 0xFF; // 低8位
command.push_back(i);
command.push_back(CONTROL_CMD);
command.push_back(high_byte);
command.push_back(low_byte);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
command.push_back(DEFAULT_TIME);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
command.push_back(2);
command.push_back(CONTROL_CMD);
command.push_back(high_byte);
command.push_back(low_byte);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
command.push_back(DEFAULT_TIME);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
unsigned char crc8 = CRC8_Table(command.data(), 9);
command.push_back(crc8);
// 发送命令
success = sendData(command);
// std::cout << "已发送命令到电机 " << static_cast<int>(control_index_) << ", 速度: " << clamped_speed << std::endl;
}
else if ( i > 5)
{
control_index_ = 2;
// 限制速度范围
int32_t clamped_speed = speeds[control_index_ - 1];
if (clamped_speed > 1000) clamped_speed = 1000;
if (clamped_speed < -1000) clamped_speed = -1000;
uint8_t high_byte = (clamped_speed >> 8) & 0xFF; // 高8位
uint8_t low_byte = clamped_speed & 0xFF; // 低8位
command.push_back(3);
command.push_back(CONTROL_CMD);
command.push_back(high_byte);
command.push_back(low_byte);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
command.push_back(DEFAULT_TIME);
command.push_back(ZERO_CMD);
command.push_back(ZERO_CMD);
unsigned char crc8 = CRC8_Table(command.data(), 9);
command.push_back(crc8);
// 发送命令
success = sendData(command);
// std::cout << "已发送命令到电机 " << static_cast<int>(control_index_) << ", 速度: " << clamped_speed << std::endl;
}
unsigned char crc8 = CRC8_Table(command.data(), 9);
command.push_back(crc8);
// 发送命令
success = sendData(command);
std::cout << "已发送命令到电机 " << static_cast<int>(i) << ", 速度: " << clamped_speed << std::endl;
++i;
// std::cout << "i = " << static_cast<int>(i) << std::endl;
if (i > 8)
if (i > max_motors_)
{
i = 1;
return success;

View File

@@ -60,7 +60,9 @@ namespace robot_control
int32_t rightOmega = rightSpeed;
wheelSpeed_[0] = wheelDirection_[0] * leftOmega; // left_wheel1
wheelSpeed_[1] = wheelDirection_[1] * rightOmega; // right_wheel
wheelSpeed_[1] = wheelDirection_[1] * rightOmega; // right_wheel1
wheelSpeed_[2] = wheelDirection_[2] * leftOmega; // left_wheel2
wheelSpeed_[3] = wheelDirection_[3] * rightOmega; // right_wheel2
}
@@ -92,7 +94,7 @@ namespace robot_control
}
}
bool WheelControl::ExecuteCommand()
void WheelControl::ExecuteCommand()
{
CalculateWheelSpeeds();
@@ -104,8 +106,6 @@ namespace robot_control
previousWheelSpeed_ = wheelSpeed_;
}
}
return isSendFinished_;
}
}

View File

@@ -0,0 +1,24 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/src/**",
"${workspaceFolder}/include/",
"${workspaceFolder}/install/**",
"/usr/include/**",
"/usr/local/include",
"/usr/local/etherlab/include",
"~/ros2_humble/src/**",
"/opt/ros/humble/**",
"/opt/ros/humble/include/graph_msgs/"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}

87
HiveCoreR1/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,87 @@
{
"files.associations": {
"map": "cpp",
"unordered_map": "cpp",
"string": "cpp",
"vector": "cpp",
"dense": "cpp",
"core": "cpp",
"cholesky": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"set": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"source_location": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"scoped_allocator": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}

View File

@@ -0,0 +1,32 @@
#ifndef ARM_DEFINE_H
#define ARM_DEFINE_H
#define USED_ARM_DOF (6)
#define MAX_ARM_GOAL_COUNT 16
typedef enum {
ARM_COMMAND_TYPE_ANGLE_STEP_ON = 0,
ARM_COMMAND_TYPE_POSE_STEP_ON,
ARM_COMMAND_TYPE_ANGLE_DIRECT_MOVE,
ARM_COMMAND_TYPE_POSE_DIRECT_MOVE,
ARM_COMMAND_TYPE_ERR
} ArmCommandTypeE;
typedef enum {
POSE_POSITION_X = 0,
POSE_POSITION_Y,
POSE_POSITION_Z,
POSE_EULER_ROLL,
POSE_EULER_PITCH,
POSE_EULER_YAW,
POSE_DIMENSION, // should be 6
} PoseDimensionE;
typedef enum {
LEFT_ARM = 0,
RIGHT_ARM,
ARM_ID_ERR
} ArmIdE;
#endif // ARM_DEFINE_H

View File

@@ -9,7 +9,7 @@ extern "C" {
#include <stdbool.h>
#include <stdarg.h>
#define ARM_DOF 6
#define ARM_DOF 7
#define M_PI 3.14159265358979323846
#define RM_MOVE_NBLOCK 0 ///<机械臂运动设置,非阻塞模式

BIN
HiveCoreR1/lib/api_cpp.dll Normal file

Binary file not shown.

BIN
HiveCoreR1/lib/api_cpp.lib Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.10)
project(arm_description)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(urdf REQUIRED)
find_package(xacro REQUIRED)
install(
DIRECTORY launch urdf meshes # 安装 launch、urdf、meshes 目录
DESTINATION share/${PROJECT_NAME}
)
ament_package()

View File

@@ -0,0 +1,92 @@
# 导入 ROS 2 launch 相关模块
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch.actions import OpaqueFunction
import os
'''
def get_new_body_part(context, part_name):
# 这里可以根据需要返回不同的部件配置
package_share = FindPackageShare(package='arm_description').perform(context)
# 构建URDF文件的实际路径
urdf_path = PathJoinSubstitution(
[package_share, 'urdf', part_name + '.urdf'] # 替换为你的URDF路径
).perform(context)
# 读取URDF文件内容
with open(urdf_path, 'r') as f:
urdf_content = f.read()
# 创建机器人状态发布器节点
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name=part_name + '_state_publisher',
parameters=[{part_name + '_description': urdf_content}],
remappings=[('/joint_states', '/' + part_name + '_joint_states')]
)
return robot_state_publisher
'''
def load_urdf(context, *args, **kwargs):
nodeList = []
# 获取包的共享目录路径(解析为实际字符串)
package_share = FindPackageShare(package='arm_description').perform(context)
# 构建URDF文件的实际路径
urdf_path = PathJoinSubstitution(
[package_share, 'urdf', 'rm_65_b_description.urdf'] # 替换为你的URDF路径
).perform(context)
# 读取URDF文件内容
with open(urdf_path, 'r') as f:
urdf_content = f.read()
# 创建机器人状态发布器节点
robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{'robot_description': urdf_content}]
)
nodeList.append(robot_state_publisher)
'''
# nodeList.append(get_new_body_part(context, 'rm_65_b'))
nodeList.append(get_new_body_part(context, 'robot'))
nodeList.append(get_new_body_part(context, 'leftarm'))
nodeList.append(get_new_body_part(context, 'rightarm'))
'''
'''joint_state_gui = Node(
package='joint_state_publisher_gui',
executable='joint_state_publisher_gui',
)
nodeList.append(joint_state_gui)'''
# 创建RViz节点可选
rviz_node = Node(
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=[
'-d', os.path.join(
FindPackageShare('arm_description').find('arm_description'),
'launch', 'robot_view.rviz' # 保存的RViz配置文件路径
)
],
parameters=[{
# 这里可以设置一些RViz参数
}]
)
nodeList.append(rviz_node)
return nodeList
def generate_launch_description():
return LaunchDescription([
OpaqueFunction(function=load_urdf)
])

View File

@@ -6,13 +6,9 @@ Panels:
Expanded:
- /Global Options1
- /Status1
- /Grid1
- /RobotModel1
- /RobotModel1/Description Topic1
- /TF1
- /TF1/Frames1
Splitter Ratio: 0.5
Tree Height: 719
Tree Height: 549
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
@@ -69,61 +65,86 @@ Visualization Manager:
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
LeftLink1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
LeftLink2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
LeftLink3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
LeftLink4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
LeftLink5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
LeftLink6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Link Tree Style: Links in Alphabetic Order
RightLink1:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
RightLink2:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
RightLink3:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
RightLink4:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
RightLink5:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
RightLink6:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
base_link:
Alpha: 1
Show Axes: false
Show Trail: false
camera_bottom_screw_frame:
Value: true
base_link_leftarm:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_color_frame:
base_link_rightarm:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_color_optical_frame:
world:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_depth_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_depth_optical_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_left_ir_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_left_ir_optical_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_right_ir_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_right_ir_optical_frame:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Mass Properties:
Inertia: false
Mass: false
@@ -132,60 +153,6 @@ Visualization Manager:
Update Interval: 0
Value: true
Visual Enabled: true
- Class: rviz_default_plugins/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: false
base_link:
Value: true
camera_bottom_screw_frame:
Value: false
camera_color_frame:
Value: true
camera_color_optical_frame:
Value: false
camera_depth_frame:
Value: true
camera_depth_optical_frame:
Value: false
camera_left_ir_frame:
Value: true
camera_left_ir_optical_frame:
Value: false
camera_link:
Value: true
camera_right_ir_frame:
Value: true
camera_right_ir_optical_frame:
Value: false
Marker Scale: 0.05000000074505806
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
base_link:
camera_link:
camera_bottom_screw_frame:
camera_color_frame:
{}
camera_color_optical_frame:
{}
camera_depth_frame:
{}
camera_depth_optical_frame:
{}
camera_left_ir_frame:
{}
camera_left_ir_optical_frame:
{}
camera_right_ir_frame:
{}
camera_right_ir_optical_frame:
{}
Update Interval: 0
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
@@ -232,7 +199,7 @@ Visualization Manager:
Views:
Current:
Class: rviz_default_plugins/Orbit
Distance: 0.20926910638809204
Distance: 10
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
@@ -247,18 +214,18 @@ Visualization Manager:
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.6903989315032959
Pitch: 0.785398006439209
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 0.778578519821167
Yaw: 0.785398006439209
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1016
Height: 846
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000002070000035afc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000035a000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000035afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000035a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073a0000003efc0100000002fb0000000800540069006d006501000000000000073a000002fb00fffffffb0000000800540069006d00650100000000000004500000000000000000000004180000035a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd000000040000000000000156000002b0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002b0000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002b0fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000002b0000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b0000002fb00fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
@@ -267,6 +234,6 @@ Window Geometry:
collapsed: false
Views:
collapsed: false
Width: 1850
X: 70
Y: 27
Width: 1200
X: 1192
Y: 203

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,16 +1,18 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>orbbec_description</name>
<name>arm_description</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="jian.dong@pobox.com">toosimple</maintainer>
<license>Apache-2.0</license>
<maintainer email="zj@todo.todo">zj</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<depend>urdf</depend>
<depend>xacro</depend>
<depend>robot_state_publisher</depend>
<depend>rviz2</depend>
<export>
<build_type>ament_cmake</build_type>

View File

@@ -0,0 +1,402 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="base_link" />
<link
name="base_link_leftarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 -1.57" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="left_arm_joint" type="fixed">
<origin
xyz="0.1255 0 0.42"
rpy="0 1.5708 0" />
<parent
link="base_link" />
<child
link="base_link_leftarm" />
</joint>
<link
name="LeftLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_leftarm" />
<child
link="LeftLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="LeftLink1" />
<child
link="LeftLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="LeftLink2" />
<child
link="LeftLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="LeftLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink3" />
<child
link="LeftLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="LeftLink4" />
<child
link="LeftLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink5" />
<child
link="LeftLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
</robot>

View File

@@ -0,0 +1,402 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="base_link" />
<link
name="base_link_rightarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 -1.57" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="right_arm_joint" type="fixed">
<origin
xyz="-0.1255 0 0.42"
rpy="0 -1.5708 0" />
<parent
link="base_link" />
<child
link="base_link_rightarm" />
</joint>
<link
name="RightLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_rightarm" />
<child
link="RightLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="RightLink1" />
<child
link="RightLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="RightLink2" />
<child
link="RightLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="RightLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="RightLink3" />
<child
link="RightLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="RightLink4" />
<child
link="RightLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="RightLink5" />
<child
link="RightLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
</robot>

View File

@@ -0,0 +1,827 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="world" />
<link
name="base_link">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
</collision>
</link>
<joint name="world_to_base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
</joint>
<link
name="base_link_leftarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 -1.57" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="left_arm_joint" type="fixed">
<origin
xyz="0.1255 0 0.42"
rpy="0 1.5708 0" />
<parent
link="base_link" />
<child
link="base_link_leftarm" />
</joint>
<link
name="LeftLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_leftarm" />
<child
link="LeftLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="LeftLink1" />
<child
link="LeftLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="LeftLink2" />
<child
link="LeftLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="LeftLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink3" />
<child
link="LeftLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="LeftLink4" />
<child
link="LeftLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink5" />
<child
link="LeftLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
<link
name="base_link_rightarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 -1.57" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 -1.57" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="right_arm_joint" type="fixed">
<origin
xyz="-0.1255 0 0.42"
rpy="0 -1.5708 0" />
<parent
link="base_link" />
<child
link="base_link_rightarm" />
</joint>
<link
name="RightLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_rightarm" />
<child
link="RightLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="RightLink1" />
<child
link="RightLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="RightLink2" />
<child
link="RightLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="RightLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="RightLink3" />
<child
link="RightLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="RightLink4" />
<child
link="RightLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="RightLink5" />
<child
link="RightLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
</robot>

View File

@@ -0,0 +1,827 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="world" />
<link
name="base_link">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
</collision>
</link>
<joint name="world_to_base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
</joint>
<link
name="base_link_leftarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 0" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="left_arm_joint" type="fixed">
<origin
xyz="0.1255 0 0.42"
rpy="0 1.5708 -1.5708" />
<parent
link="base_link" />
<child
link="base_link_leftarm" />
</joint>
<link
name="LeftLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_leftarm" />
<child
link="LeftLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="LeftLink1" />
<child
link="LeftLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="LeftLink2" />
<child
link="LeftLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="LeftLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink3" />
<child
link="LeftLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="LeftLink4" />
<child
link="LeftLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink5" />
<child
link="LeftLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
<link
name="base_link_rightarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 0" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="right_arm_joint" type="fixed">
<origin
xyz="-0.1255 0 0.42"
rpy="0 -1.5708 -1.5708" />
<parent
link="base_link" />
<child
link="base_link_rightarm" />
</joint>
<link
name="RightLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_rightarm" />
<child
link="RightLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="RightLink1" />
<child
link="RightLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="RightLink2" />
<child
link="RightLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="RightLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="RightLink3" />
<child
link="RightLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="RightLink4" />
<child
link="RightLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="RightLink5" />
<child
link="RightLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
</robot>

View File

@@ -0,0 +1,8 @@
Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity
base_link,-0.00043233,-3.2765E-05,0.059942,0,0,0,0.84108,0.0017261,2.4864E-06,-3.6752E-05,0.0017099,1.7199E-06,0.00090404,0,0,0,0,0,0,package://arm_description/meshes/base_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/base_link.STL,,____1-1,baselink,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
Link1,1.4691E-07,0.021109,-0.025186,0,0,0,0.59356,0.0012661,-1.2313E-08,-1.0057E-08,0.0011817,-0.00021122,0.00056135,0,0,0,0,0,0,package://arm_description/meshes/Link1.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link1.STL,,____2-1,Link1,axis1,joint1,revolute,0,0,0.2405,0,0,0,base_link,0,0,-1,100,1,-3.107,3.107,,,,,,,,
Link2,0.15226,4.2545E-07,-0.0062026,0,0,0,0.86418,0.00063253,-8.795E-09,0.00042163,0.0020527,2.3725E-09,0.0019528,0,0,0,0,0,0,package://arm_description/meshes/Link2.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link2.STL,,____3-1;____4-1,Link2,axis2,joint2,revolute,0,0,0,1.5708,-1.5708,0,Link1,0,0,1,100,1,-2.269,2.269,,,,,,,,
Link3,4.7938E-06,-0.059593,0.010569,0,0,0,0.28965,0.00063737,-5.9726E-08,-3.3299E-08,0.00015649,-0.00014461,0.00061418,0,0,0,0,0,0,package://arm_description/meshes/Link3.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link3.STL,,____5-1,Link3,axis3,joint3,revolute,0.256,0,0,0,0,1.5708,Link2,0,0,1,100,1,-2.356,2.356,,,,,,,,
Link4,1.0293E-06,-0.018042,-0.021539,0,0,0,0.23942,0.00028594,2.854E-09,-1.9592E-09,0.00026273,4.4237E-05,0.00011989,0,0,0,0,0,0,package://arm_description/meshes/Link4.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link4.STL,,____6-1,Link4,axis4,joint4,revolute,0,-0.21,0,1.5708,0,0,Link3,0,0,1,100,1,-3.107,3.107,,,,,,,,
Link5,3.4528E-06,-0.059382,0.0073678,0,0,0,0.21879,0.00035053,-3.165E-08,-1.7434E-08,0.00010492,-7.824E-05,0.00033447,0,0,0,0,0,0,package://arm_description/meshes/Link5.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link5.STL,,____7-1,Link5,axis5,joint5,revolute,0,0,0,-1.5708,0,0,Link4,0,0,1,100,1,-2.234,2.234,,,,,,,,
Link6,0.00081643,1.3288E-05,-0.012705,0,0,0,0.065035,2.1143E-05,-2.2878E-08,-2.5601E-08,1.811E-05,-1.0178E-08,3.19E-05,0,0,0,0,0,0,package://arm_description/meshes/Link6.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://arm_description/meshes/Link6.STL,,__________ ______-1,Link6,axis6,joint6,revolute,0,-0.144,0,1.5708,0,0,Link5,0,0,1,100,1,-6.283,6.283,,,,,,,,
1 Link Name Center of Mass X Center of Mass Y Center of Mass Z Center of Mass Roll Center of Mass Pitch Center of Mass Yaw Mass Moment Ixx Moment Ixy Moment Ixz Moment Iyy Moment Iyz Moment Izz Visual X Visual Y Visual Z Visual Roll Visual Pitch Visual Yaw Mesh Filename Color Red Color Green Color Blue Color Alpha Collision X Collision Y Collision Z Collision Roll Collision Pitch Collision Yaw Collision Mesh Filename Material Name SW Components Coordinate System Axis Name Joint Name Joint Type Joint Origin X Joint Origin Y Joint Origin Z Joint Origin Roll Joint Origin Pitch Joint Origin Yaw Parent Joint Axis X Joint Axis Y Joint Axis Z Limit Effort Limit Velocity Limit Lower Limit Upper Calibration rising Calibration falling Dynamics Damping Dynamics Friction Safety Soft Upper Safety Soft Lower Safety K Position Safety K Velocity
2 base_link -0.00043233 -3.2765E-05 0.059942 0 0 0 0.84108 0.0017261 2.4864E-06 -3.6752E-05 0.0017099 1.7199E-06 0.00090404 0 0 0 0 0 0 package://arm_description/meshes/base_link.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/base_link.STL ____1-1 baselink 0 0 0 0 0 0 0 0 0
3 Link1 1.4691E-07 0.021109 -0.025186 0 0 0 0.59356 0.0012661 -1.2313E-08 -1.0057E-08 0.0011817 -0.00021122 0.00056135 0 0 0 0 0 0 package://arm_description/meshes/Link1.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link1.STL ____2-1 Link1 axis1 joint1 revolute 0 0 0.2405 0 0 0 base_link 0 0 -1 100 1 -3.107 3.107
4 Link2 0.15226 4.2545E-07 -0.0062026 0 0 0 0.86418 0.00063253 -8.795E-09 0.00042163 0.0020527 2.3725E-09 0.0019528 0 0 0 0 0 0 package://arm_description/meshes/Link2.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link2.STL ____3-1;____4-1 Link2 axis2 joint2 revolute 0 0 0 1.5708 -1.5708 0 Link1 0 0 1 100 1 -2.269 2.269
5 Link3 4.7938E-06 -0.059593 0.010569 0 0 0 0.28965 0.00063737 -5.9726E-08 -3.3299E-08 0.00015649 -0.00014461 0.00061418 0 0 0 0 0 0 package://arm_description/meshes/Link3.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link3.STL ____5-1 Link3 axis3 joint3 revolute 0.256 0 0 0 0 1.5708 Link2 0 0 1 100 1 -2.356 2.356
6 Link4 1.0293E-06 -0.018042 -0.021539 0 0 0 0.23942 0.00028594 2.854E-09 -1.9592E-09 0.00026273 4.4237E-05 0.00011989 0 0 0 0 0 0 package://arm_description/meshes/Link4.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link4.STL ____6-1 Link4 axis4 joint4 revolute 0 -0.21 0 1.5708 0 0 Link3 0 0 1 100 1 -3.107 3.107
7 Link5 3.4528E-06 -0.059382 0.0073678 0 0 0 0.21879 0.00035053 -3.165E-08 -1.7434E-08 0.00010492 -7.824E-05 0.00033447 0 0 0 0 0 0 package://arm_description/meshes/Link5.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link5.STL ____7-1 Link5 axis5 joint5 revolute 0 0 0 -1.5708 0 0 Link4 0 0 1 100 1 -2.234 2.234
8 Link6 0.00081643 1.3288E-05 -0.012705 0 0 0 0.065035 2.1143E-05 -2.2878E-08 -2.5601E-08 1.811E-05 -1.0178E-08 3.19E-05 0 0 0 0 0 0 package://arm_description/meshes/Link6.STL 0.79216 0.81961 0.93333 1 0 0 0 0 0 0 package://arm_description/meshes/Link6.STL __________ ______-1 Link6 axis6 joint6 revolute 0 -0.144 0 1.5708 0 0 Link5 0 0 1 100 1 -6.283 6.283

View File

@@ -0,0 +1,827 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="world" />
<link
name="base_link">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
</collision>
</link>
<joint name="world_to_base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
</joint>
<link
name="base_link_leftarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 0" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="left_arm_joint" type="fixed">
<origin
xyz="-0.1255 0 0.42"
rpy="-1.5708 0 1.5708" />
<parent
link="base_link" />
<child
link="base_link_leftarm" />
</joint>
<link
name="LeftLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_leftarm" />
<child
link="LeftLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="LeftLink1" />
<child
link="LeftLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="LeftLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="LeftLink2" />
<child
link="LeftLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="LeftLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink3" />
<child
link="LeftLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="LeftLink4" />
<child
link="LeftLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="LeftLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="left_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="LeftLink5" />
<child
link="LeftLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
<link
name="base_link_rightarm">
<inertial>
<origin
xyz="-0.000433277303987328 -3.54664423471128E-05 0.0599427668933796"
rpy="0 0 0" />
<mass
value="0.841070778135659" />
<inertia
ixx="0.0017261110801622"
ixy="2.52746264980217E-06"
ixz="-3.67690303614961E-05"
iyy="0.00170987405835604"
iyz="1.67996364994424E-06"
izz="0.000904023422915791" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<joint name="right_arm_joint" type="fixed">
<origin
xyz="0.1255 0 0.42"
rpy="1.5708 0 1.5708" />
<parent
link="base_link" />
<child
link="base_link_rightarm" />
</joint>
<link
name="RightLink1">
<inertial>
<origin
xyz="1.2226305431569E-08 0.0211079974844683 -0.0251854220842269"
rpy="0 0 0" />
<mass
value="0.593563443690403" />
<inertia
ixx="0.00126614120341847"
ixy="-1.294980943835E-08"
ixz="-9.80120923066996E-09"
iyy="0.00118168178300364"
iyz="-0.00021121727444415"
izz="0.00056135241627747" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link1.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint1"
type="revolute">
<origin
xyz="0 0 0.2405"
rpy="0 0 0" />
<parent
link="base_link_rightarm" />
<child
link="RightLink1" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink2">
<inertial>
<origin
xyz="0.152256463426163 4.75383656106654E-07 -0.00620260383607792"
rpy="0 0 0" />
<mass
value="0.864175046869043" />
<inertia
ixx="0.00089150298478414"
ixy="-2.23268489334765E-08"
ixz="0.00156246461035015"
iyy="0.00733754343083901"
iyz="6.28110889329165E-09"
izz="0.00697869103915473" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link2.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint2"
type="revolute">
<origin
xyz="0 0 0"
rpy="1.5708 -1.5708 0" />
<parent
link="RightLink1" />
<child
link="RightLink2" />
<axis
xyz="0 0 1" />
<limit
lower="-2.268"
upper="2.268"
effort="60"
velocity="3.14" />
</joint>
<link
name="RightLink3">
<inertial>
<origin
xyz="5.05312670989961E-06 -0.0595925663694732 0.010569069212336"
rpy="0 0 0" />
<mass
value="0.289633681624654" />
<inertia
ixx="0.00063737100450158"
ixy="-7.05261293649751E-08"
ixz="-3.86643272239426E-08"
iyy="0.00015648388095025"
iyz="-0.00014461035994916"
izz="0.000614178164773085" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link3.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint3"
type="revolute">
<origin
xyz="0.256 0 0"
rpy="0 0 1.5708" />
<parent
link="RightLink2" />
<child
link="RightLink3" />
<axis
xyz="0 0 1" />
<limit
lower="-2.355"
upper="2.355"
effort="30"
velocity="3.92" />
</joint>
<link
name="RightLink4">
<inertial>
<origin
xyz="1.15516617405898E-06 -0.0180424468598241 -0.0215394748352687"
rpy="0 0 0" />
<mass
value="0.239419768320061" />
<inertia
ixx="0.000285938919722783"
ixy="3.07101359163101E-09"
ixz="-2.21994118981953E-09"
iyy="0.000262727540304212"
iyz="4.4236583260078E-05"
izz="0.000119888082791859" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link4.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint4"
type="revolute">
<origin
xyz="0 -0.21 0"
rpy="1.5708 0 0" />
<parent
link="RightLink3" />
<child
link="RightLink4" />
<axis
xyz="0 0 1" />
<limit
lower="-3.1"
upper="3.1"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink5">
<inertial>
<origin
xyz="3.19794786262152E-06 -0.0593808368101458 0.00736804250989326"
rpy="0 0 0" />
<mass
value="0.218799761431678" />
<inertia
ixx="0.000350540363914072"
ixy="-3.41781619975602E-08"
ixz="-1.77056457224373E-08"
iyy="0.000104927867487581"
iyz="-7.82431228461971E-05"
izz="0.000334482418423629" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link5.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint5"
type="revolute">
<origin
xyz="0 0 0"
rpy="-1.5708 0 0" />
<parent
link="RightLink4" />
<child
link="RightLink5" />
<axis
xyz="0 0 1" />
<limit
lower="-2.233"
upper="2.233"
effort="10"
velocity="3.92" />
</joint>
<link
name="RightLink6">
<inertial>
<origin
xyz="0.000714234511756999 -0.000396718732824521 -0.0126723660946126"
rpy="0 0 0" />
<mass
value="0.0649018034311231" />
<inertia
ixx="2.02766547502765E-05"
ixy="-1.32505200276849E-06"
ixz="-2.5845091522508E-08"
iyy="1.87986725225022E-05"
iyz="3.39471452125439E-09"
izz="3.17885459163081E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://arm_description/meshes/link6.STL" />
</geometry>
</collision>
</link>
<joint
name="right_joint6"
type="revolute">
<origin
xyz="0 -0.144 0"
rpy="1.5708 0 0" />
<parent
link="RightLink5" />
<child
link="RightLink6" />
<axis
xyz="0 0 1" />
<limit
lower="-6.28"
upper="6.28"
effort="10"
velocity="3.92" />
</joint>
</robot>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<robot
name="arm_description">
<link name="world" />
<link
name="base_link">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<box size="0.251 0.1 1.0"/>
</geometry>
</collision>
</link>
<joint name="world_to_base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
</joint>
</robot>

View File

@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.8)
project(arm_keyboard_input)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
add_compile_options(-g)
include_directories(
include
../../include
${EIGEN3_INCLUDE_DIRS} # 引入Eigen3的头文件路径
)
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
# 设置源文件
set(SOURCES
src/arm_keyboard_node.cpp
)
add_executable(keyBoardInputer ${SOURCES})
ament_target_dependencies(keyBoardInputer rclcpp std_msgs)
install(TARGETS
keyBoardInputer
DESTINATION lib/${PROJECT_NAME})
ament_package()

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,19 @@
#ifndef ARM_KEYBOARD_NODE_HPP
#define ARM_KEYBOARD_NODE_HPP
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/float64_multi_array.hpp"
#include "arm_define.h"
#include "rm_define.h"
class ArmKeyboardNode: public rclcpp::Node
{
public:
ArmKeyboardNode();
~ArmKeyboardNode();
static rclcpp::Publisher<std_msgs::msg::Float64MultiArray>::SharedPtr leftArmAimPub_;
static rclcpp::Publisher<std_msgs::msg::Float64MultiArray>::SharedPtr rightArmAimPub_;
std::atomic<bool> exit_flag;
};
#endif // ARM_KEYBOARD_NODE_HPP

View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>arm_keyboard_input</name>
<version>0.0.0</version>
<description>arm_keyboard_input</description>
<maintainer email="zj@todo.todo">zj</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>std_msgs</depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -0,0 +1,98 @@
#include <thread>
#include <sstream>
#include <iostream>
#include <chrono>
#include <mutex>
#include <string>
#include "arm_keyboard_node.hpp"
rclcpp::Publisher<std_msgs::msg::Float64MultiArray>::SharedPtr ArmKeyboardNode::leftArmAimPub_;
rclcpp::Publisher<std_msgs::msg::Float64MultiArray>::SharedPtr ArmKeyboardNode::rightArmAimPub_;
std::thread inputThread_;
std::mutex armAimMutex_;
static void ListenInputThread(std::shared_ptr<ArmKeyboardNode> armNode) {
std::string line;
auto message = std_msgs::msg::Float64MultiArray();
message.data.resize(ARM_DOF);
while (rclcpp::ok()) {
std::cout << "请输入: 整数(0(退出)/1(左臂)/2(右臂)),6个float,用','分割,以';'结尾:" << std::endl;
std::getline(std::cin, line, ';');
std::istringstream ss(line);
std::string token;
int mode;
float values[USED_ARM_DOF];
bool valid = true;
// 解析整数
if (!std::getline(ss, token, ',')) { valid = false; }
else {
try {
mode = std::stoi(token);
if (mode != 0 && mode != 1 && mode != 2) valid = false;
} catch (...) { valid = false; }
}
// 解析6个float
for (int i = 0; i < USED_ARM_DOF && valid; ++i) {
if (!std::getline(ss, token, ',')) { valid = false; break; }
try {
values[i] = std::stof(token);
} catch (...) { valid = false; }
}
if (mode == 0) {
std::cout << "退出输入监听线程。" << std::endl;
armNode->exit_flag = true;
break;
}
if (valid) {
std::lock_guard<std::mutex> lock(armAimMutex_);
for (int i = 0; i < USED_ARM_DOF && i < ARM_DOF; ++i) {
message.data[i] = values[i];
}
if (mode == 1) {
armNode->leftArmAimPub_->publish(message);
} else if (mode == 2) {
armNode->rightArmAimPub_->publish(message);
}
} else {
std::cout << "输入格式错误,请重试。" << std::endl;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
ArmKeyboardNode::ArmKeyboardNode() : Node("arm_keyboard_node")
{
leftArmAimPub_ = this->create_publisher<std_msgs::msg::Float64MultiArray>("left_arm_command", 10);
rightArmAimPub_ = this->create_publisher<std_msgs::msg::Float64MultiArray>("right_arm_command", 10);
exit_flag = false;
}
ArmKeyboardNode::~ArmKeyboardNode()
{
if (inputThread_.joinable()) {
inputThread_.join(); // 或 join(),视你的需求
}
rightArmAimPub_.reset();
leftArmAimPub_.reset();
}
int main(int argc, char *argv[])
{
rclcpp::init(argc, argv);
rclcpp::Node::SharedPtr node = std::make_shared<ArmKeyboardNode>();
std::shared_ptr<ArmKeyboardNode> armNode = std::dynamic_pointer_cast<ArmKeyboardNode>(node);
// 启动输入监听线程
inputThread_ = std::thread(ListenInputThread, armNode);
while (rclcpp::ok() && !armNode->exit_flag) {
rclcpp::spin_some(node); // 处理所有待处理的事件
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // 短暂休眠降低CPU占用
}
rclcpp::shutdown();
return 0;
}

View File

@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.8)
project(common_action_interface)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"action/Arm.action"
)
ament_package()

View File

@@ -0,0 +1,14 @@
int8 body_id
int8 data_type
int16 data_length
int64 command_id
float64[] data_array
---
int64 start_time
int64 end_time
---
int64 command_id
int16 int_lenth
int16 float_length
int32[] int_data_array
float64[] float_data_array

View File

@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>common_action_interface</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="zj@todo.todo">zj</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<depend>action_msgs</depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.8)
project(common_msg)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/ArmCommnd.msg"
)
ament_package()

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,5 @@
int8 body_id
int8 data_type
int16 data_length
int32 command_id
float64[] data_array

View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>common_msg</name>
<version>0.0.0</version>
<description>common_msg</description>
<maintainer email="zj@todo.todo">zj</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -1,42 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(img_dev)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(message_filters REQUIRED)
find_package(realsense2_camera_msgs REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/ImgMsg.msg"
DEPENDENCIES sensor_msgs
)
include_directories(
include
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_cpp
)
add_executable(img_dev_node src/main.cpp src/img_dev_node.cpp)
add_dependencies(img_dev_node ${PROJECT_NAME}__rosidl_typesupport_cpp)
target_link_libraries(img_dev_node
${PROJECT_NAME}__rosidl_typesupport_cpp
${PROJECT_NAME}__rosidl_typesupport_c
message_filters::message_filters
)
ament_target_dependencies(img_dev_node rclcpp sensor_msgs realsense2_camera_msgs)
install(TARGETS img_dev_node DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY msg/ DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch/ DESTINATION share/${PROJECT_NAME}/launch})
ament_export_dependencies(rosidl_default_runtime)
ament_package()

View File

@@ -1,56 +0,0 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include<array>
using namespace std;
namespace img_dev{
class ImgCfg{
public:
ImgCfg() = default;
ImgCfg(const string& source, const string& type,const string& position,const string& c_img_topic, const string& d_img_topic){
this->source = source;
this->type = type;
this->position = position;
this->c_img_topic = c_img_topic;
this->d_img_topic = d_img_topic;
this->k_arr.clear();
this->d_arr.clear();
this->arr_copy=0;
};
ImgCfg(const ImgCfg& other) = default;
ImgCfg(ImgCfg&& other) = default;
ImgCfg& operator=(const ImgCfg& other) = default;
ImgCfg& operator=(ImgCfg&& other) = default;
string str() const{
return "soure:"+source+",topic:"+c_img_topic+"&"+d_img_topic;
}
string getColorTopic() const{
return c_img_topic;
}
string getDepthTopic() const{
return d_img_topic;
}
string getPosition() const{
return position;
}
string getType() const{
return type;
}
string getSource() const{
return source;
}
int arr_copy;
vector<double> k_arr;
vector<double> d_arr;
private:
string source;
string position;
string type;
string c_img_topic;
string d_img_topic;
};
}

View File

@@ -1,20 +0,0 @@
#pragma once
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/image.hpp>
#include "message_filters/subscriber.h"
#include "message_filters/time_synchronizer.h"
#include "message_filters/sync_policies/approximate_time.hpp"
#include "img_dev/msg/img_msg.hpp"
using namespace std;
namespace img_dev{
class ImageSubscriber : public rclcpp::Node {
public:
ImageSubscriber() ;
void pub_msg(const sensor_msgs::msg::Image& c_img,const sensor_msgs::msg::Image& d_img,const ImgCfg& cfg);
private:
rclcpp::Publisher<img_dev::msg::ImgMsg>::SharedPtr img_pub;
std::shared_ptr<img_dev::msg::ImgMsg> img_msg;
};
}

View File

@@ -1,46 +0,0 @@
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess
from launch.substitutions import LaunchConfiguration
from launch.conditions import IfCondition
def generate_launch_description():
return LaunchDescription([
# 启动orbbec_camera
ExecuteProcess(
cmd=[
'ros2',
'launch',
'orbbec_camera',
'multi_camera.launch.py'
],
output='screen'
),
ExecuteProcess(
cmd=[
'ros2',
'launch',
'realsense2_camera',
'rs_launch.py'
],
output='screen'
),
# 等待一段时间确保相机启动完成
ExecuteProcess(
cmd=['sleep', '3'],
output='screen'
),
# 启动img_dev_node
Node(
package='img_dev',
executable='img_dev_node',
name='img_dev_node',
output='screen',
parameters=[]
)
])

View File

@@ -1,7 +0,0 @@
sensor_msgs/Image image_depth
sensor_msgs/Image image_color
float64[] karr
float64[] darr
string source
string position
string type

View File

@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>img_dev</name>
<version>0.1.0</version>
<description>功能包用于实现图像采集、处理及自定义消息的封装与发布</description>
<maintainer email="h@example.com">h</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>sensor_msgs</depend>
<depend>rclcpp</depend>
<depend>realsense2_camera_msgs</depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<exec_depend>message_filters</exec_depend>
<build_depend>rosidl_default_generators</build_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -1,28 +0,0 @@
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/image.hpp>
#include "img_dev/msg/img_msg.hpp"// 自定义消息头文件
#include "img_dev/img_cfg.hpp"
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.hpp>
#include <message_filters/synchronizer.h>
#include"img_dev/img_dev_node.hpp"
namespace img_dev{
ImageSubscriber::ImageSubscriber() : Node("image_subscriber") {
img_msg= std::make_shared<img_dev::msg::ImgMsg>();
img_pub = this->create_publisher<img_dev::msg::ImgMsg>("/img_msg", 10);
}
static long long pub_cnt=0;
void ImageSubscriber::pub_msg(const sensor_msgs::msg::Image& c_img,const sensor_msgs::msg::Image& d_img,const ImgCfg& cfg){
img_msg->source = cfg.getSource();
img_msg->type = cfg.getType();
img_msg->position=cfg.getPosition();
img_msg->image_color = std::move(c_img);
img_msg->image_depth = std::move(d_img);
img_msg->karr=cfg.k_arr;
img_msg->darr=cfg.d_arr;
img_pub->publish(*img_msg);
pub_cnt+=1;
std::cout<<"pub msg["<<pub_cnt<<"]:"<<img_msg->darr[0]<<","<<img_msg->darr[1]<<",k:"<<img_msg->karr[0]<<","<<img_msg->karr[1]<<std::endl;
}
}

View File

@@ -1,91 +0,0 @@
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/image.hpp>
#include <sensor_msgs/msg/camera_info.hpp>
#include "img_dev/msg/img_msg.hpp"
#include "img_dev/img_cfg.hpp"
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.hpp>
#include <message_filters/synchronizer.h>
#include"img_dev/img_dev_node.hpp"
#include "realsense2_camera_msgs/msg/rgbd.hpp"
#include <vector>
#include<unordered_map>
using namespace std;
using namespace img_dev;
using SyncPolicy=message_filters::sync_policies::ApproximateTime<sensor_msgs::msg::Image,sensor_msgs::msg::Image>;
static shared_ptr<ImageSubscriber> cur_node=nullptr;
ImgCfg cfg0=ImgCfg("orbbec", "myType","left","/camera_01/color/image_raw","/camera_01/depth/image_raw");
ImgCfg cfg1=ImgCfg("orbbec", "myType","right","/camera_02/color/image_raw","/camera_02/depth/image_raw");
//
ImgCfg cfg2=ImgCfg("realsense", "myType","front","/camera/color/image_raw","/camera/depth/image_raw");
void sync_cb0(const sensor_msgs::msg::Image& c_img, const sensor_msgs::msg::Image& d_img) {
cur_node->pub_msg(c_img,d_img,cfg0);
}
void sync_cb1(const sensor_msgs::msg::Image& c_img, const sensor_msgs::msg::Image& d_img) {
cur_node->pub_msg(c_img,d_img,cfg1);
}
int main(int argc, char* argv[]) {
rclcpp::init(argc, argv);
cur_node=make_shared<ImageSubscriber>();
if(!cur_node){
RCLCPP_ERROR(rclcpp::get_logger("main"),"img_dev node create error!!!!");
return -1;
}
//////////////////奥比中光1 START///////////////////////
rclcpp::Subscription<sensor_msgs::msg::CameraInfo>::SharedPtr camera01_info=cur_node->create_subscription<sensor_msgs::msg::CameraInfo>("/camera_01/color/camera_info", 10,
[&](const sensor_msgs::msg::CameraInfo& info){
if(info.k.empty()||info.d.empty())
return;
if(cfg0.k_arr.size()==0||cfg0.d_arr.size()==0){
cfg0.k_arr.assign(info.k.begin(), info.k.end());
cfg0.d_arr.assign(info.d.begin(), info.d.end());
cfg0.arr_copy+=1;
cout<<"copy01:"<<cfg0.arr_copy<<"k:"<<info.k[0]<<"d:"<<info.d[0]<<endl;
}else{
cfg0.arr_copy=10;
////cout<<"copy finish:"<<cfg0.arr_copy<<"k:"<<cfg0.k_arr.size()<<"d:"<<cfg0.d_arr.size()<<endl;
}
});
message_filters::Subscriber<sensor_msgs::msg::Image> c_sub0(cur_node, cfg0.getColorTopic());
message_filters::Subscriber<sensor_msgs::msg::Image> d_sub0(cur_node,cfg0.getDepthTopic());
auto sync0 = make_shared<message_filters::Synchronizer<SyncPolicy>>(SyncPolicy(10), c_sub0, d_sub0);
sync0->registerCallback(&sync_cb0);
//////////////////奥比中光1 END///////////////////////
//////////////////奥比中光2 START///////////////////////
rclcpp::Subscription<sensor_msgs::msg::CameraInfo>::SharedPtr camera02_info=cur_node->create_subscription<sensor_msgs::msg::CameraInfo>("/camera_02/color/camera_info", 10,
[&](const sensor_msgs::msg::CameraInfo& info){
if(info.k.empty()||info.d.empty())
return;
if(cfg1.k_arr.size()==0||cfg1.d_arr.size()==0){
cfg1.k_arr.assign(info.k.begin(), info.k.end());
cfg1.d_arr.assign(info.d.begin(), info.d.end());
cfg1.arr_copy+=1;
cout<<"copy02:"<<cfg1.arr_copy<<"k:"<<info.k[0]<<"d:"<<info.d[0]<<endl;
}else{
cfg1.arr_copy=10;
}
});
message_filters::Subscriber<sensor_msgs::msg::Image> c_sub1(cur_node, cfg1.getColorTopic());
message_filters::Subscriber<sensor_msgs::msg::Image> d_sub1(cur_node,cfg1.getDepthTopic());
auto sync1 = make_shared<message_filters::Synchronizer<SyncPolicy>>(SyncPolicy(10), c_sub1, d_sub1);
sync1->registerCallback(&sync_cb1);
//////////////////奥比中光2 END///////////////////////
//////////////////realsense START///////////////////////
rclcpp::Subscription<realsense2_camera_msgs::msg::RGBD>::SharedPtr rgbd_sub_ = cur_node->create_subscription<realsense2_camera_msgs::msg::RGBD>("/camera/camera/rgbd", 10, [&](const realsense2_camera_msgs::msg::RGBD& msg) {
if(cfg2.k_arr.size()==0||cfg2.d_arr.size()==0){
cfg2.k_arr.assign(msg.rgb_camera_info.k.begin(), msg.rgb_camera_info.k.end());
cfg2.d_arr.assign(msg.rgb_camera_info.d.begin(), msg.rgb_camera_info.d.end());
cfg2.arr_copy+=1;
cout<<"copy:"<<"k:"<<cfg2.k_arr[0]<<"d:"<<cfg2.d_arr[0]<<endl;
}
cur_node->pub_msg(msg.rgb,msg.depth,cfg2);
});
//////////////////realsense END///////////////////////
rclcpp::spin(cur_node);
rclcpp::shutdown();
return 0;
}

View File

@@ -1,9 +0,0 @@
#!/usr/bin/bash
set -e
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
rm -fr debian obj-x86_64-linux-gnu .obj-aarch64-linux-gnu || true
export DEBIAN_INC=1
export BUILDING_PACKAGE=1
bloom-generate rosdebian --os-name ubuntu --ros-distro $ROS_DISTRO -i ${DEBIAN_INC}.$(date +%Y%m%d.%H%M%S)
export DEB_BUILD_OPTIONS="parallel=$(($(nproc) - 1))"
fakeroot debian/rules binary

View File

@@ -1,250 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(orbbec_camera)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC -g3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC -g3")
set(CMAKE_BUILD_TYPE "Release")
option(USE_RK_HW_DECODER "Use Rockchip hardware decoder" OFF)
option(USE_NV_HW_DECODER "Use Nvidia hardware decoder" OFF)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Werror -Wno-pedantic -Wno-array-bounds)
endif()
# Check if ROS Jazzy or iron is installed
if("$ENV{ROS_DISTRO}" STREQUAL "jazzy")
add_compile_definitions(ROS_JAZZY)
elseif("$ENV{ROS_DISTRO}" STREQUAL "iron")
add_compile_definitions(ROS_IRON)
endif()
# find dependencies
set(dependencies
ament_cmake
ament_index_cpp
Eigen3
builtin_interfaces
cv_bridge
backward_ros
camera_info_manager
image_transport
image_publisher
OpenCV
orbbec_camera_msgs
rclcpp
rclcpp_components
sensor_msgs
std_msgs
std_srvs
tf2
tf2_eigen
tf2_msgs
tf2_ros
tf2_sensor_msgs
Threads
diagnostic_updater
diagnostic_msgs
statistics_msgs
)
foreach(dep IN LISTS dependencies)
find_package(${dep} REQUIRED)
endforeach()
find_package(PkgConfig REQUIRED)
if(USE_RK_HW_DECODER)
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
if(NOT RK_MPP_FOUND)
message(FATAL_ERROR "rockchip_mpp is not found")
endif()
pkg_search_module(RGA librga)
if(NOT RGA_FOUND)
add_definitions(-DUSE_LIBYUV)
message("librga is not found, use libyuv instead")
endif()
endif()
execute_process(COMMAND uname -m OUTPUT_VARIABLE MACHINES)
execute_process(COMMAND getconf LONG_BIT OUTPUT_VARIABLE MACHINES_BIT)
message(STATUS "ORRBEC Machine : ${MACHINES}")
message(STATUS "ORRBEC Machine Bits : ${MACHINES_BIT}")
if((${MACHINES} MATCHES "x86_64") AND (${MACHINES_BIT} MATCHES "64"))
set(HOST_PLATFORM "x64")
elseif(${MACHINES} MATCHES "arm" OR (${MACHINES} MATCHES "aarch64" AND ${MACHINES_BIT} MATCHES "32"))
message(FATAL_ERROR "ORBBEC SDK does not support arm32")
set(HOST_PLATFORM "arm32")
elseif((${MACHINES} MATCHES "aarch64") AND (${MACHINES_BIT} MATCHES "64"))
set(HOST_PLATFORM "arm64")
endif()
set(ORBBEC_LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDK/lib/${HOST_PLATFORM})
set(ORBBEC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDK/include/)
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}:${ORBBEC_LIBS_DIR}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${ORBBEC_LIBS_DIR}")
if(USE_NV_HW_DECODER)
set(JETSON_MULTI_MEDIA_API_DIR /usr/src/jetson_multimedia_api)
set(JETSON_MULTI_MEDIA_API_CLASS_DIR ${JETSON_MULTI_MEDIA_API_DIR}/samples/common/classes)
set(JETSON_MULTI_MEDIA_API_INCLUDE_DIR ${JETSON_MULTI_MEDIA_API_DIR}/include/)
set(LIBJPEG8B_INCLUDE_DIR ${JETSON_MULTI_MEDIA_API_INCLUDE_DIR}/libjpeg-8b)
set(TEGRA_ARMABI /usr/lib/aarch64-linux-gnu/)
add_definitions(-DUSE_NV_HW_DECODER)
add_compile_options(-Wno-missing-field-initializers -Wno-unused-parameter)
set(NV_LIBRARIES -lnvjpeg -lnvbufsurface -lnvbufsurftransform -lyuv -lv4l2)
list(APPEND NV_LIBRARIES -L${TEGRA_ARMABI} -L${TEGRA_ARMABI}/tegra)
endif()
set(COMMON_INCLUDE_DIRS
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> ${ORBBEC_INCLUDE_DIR} ${OpenCV_INCLUDED_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/tools
)
set(COMMON_LIBRARIES
${ORBBEC_SDK_LIBRARIES}
${OpenCV_LIBS}
Eigen3::Eigen
-lOrbbecSDK
-L${ORBBEC_LIBS_DIR}
Threads::Threads
-lrt
-ldw
)
if(USE_RK_HW_DECODER)
list(APPEND COMMON_LIBRARIES ${RK_MPP_LIBRARIES} ${RGA_LIBRARIES})
endif()
if(USE_NV_HW_DECODER)
list(APPEND COMMON_LIBRARIES ${NV_LIBRARIES})
endif()
set(SOURCE_FILES
src/d2c_viewer.cpp
src/dynamic_params.cpp
src/image_publisher.cpp
src/ob_camera_node_driver.cpp
src/ob_camera_node.cpp
src/ros_param_backend.cpp
src/ros_service.cpp
src/synced_imu_publisher.cpp
src/utils.cpp
src/jpeg_decoder.cpp
)
if(USE_RK_HW_DECODER)
add_definitions(-DUSE_RK_HW_DECODER)
list(APPEND SOURCE_FILES src/rk_mpp_decoder.cpp)
list(APPEND COMMON_INCLUDE_DIRS ${RK_MPP_INCLUDE_DIRS} ${RGA_INCLUDE_DIRS})
list(APPEND COMMON_LIBRARIES ${RGA_LIBRARIES} ${RK_MPP_LIBRARIES})
if(NOT RGA_FOUND)
list(APPEND COMMON_LIBRARIES -lyuv)
endif()
endif()
if(USE_NV_HW_DECODER)
list(APPEND SOURCE_FILES src/jetson_nv_decoder.cpp)
list(APPEND COMMON_INCLUDE_DIRS ${JETSON_MULTI_MEDIA_API_INCLUDE_DIR} ${LIBJPEG8B_INCLUDE_DIR})
# append jetson_multimedia_api source files
list(
APPEND
SOURCE_FILES
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvBuffer.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvElement.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvElementProfiler.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvJpegDecoder.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvJpegEncoder.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvLogging.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvUtils.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvV4l2Element.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvV4l2ElementPlane.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvVideoDecoder.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvVideoEncoder.cpp
${JETSON_MULTI_MEDIA_API_CLASS_DIR}/NvBufSurface.cpp
)
endif()
macro(add_orbbec_executable TARGET SOURCE)
add_executable(${TARGET} ${SOURCE})
target_include_directories(${TARGET} PUBLIC ${COMMON_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${COMMON_LIBRARIES} ${PROJECT_NAME})
ament_target_dependencies(${TARGET} ${dependencies})
endmacro()
# Define library and nodes
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_include_directories(${PROJECT_NAME} PUBLIC ${COMMON_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES})
rclcpp_components_register_node(
${PROJECT_NAME} PLUGIN "orbbec_camera::OBCameraNodeDriver" EXECUTABLE orbbec_camera_node
)
# Add nodes using the macro
add_orbbec_executable(list_devices_node tools/list_devices_node.cpp)
add_orbbec_executable(list_depth_work_mode_node tools/list_depth_work_mode.cpp)
add_orbbec_executable(list_camera_profile_mode_node tools/list_camera_profile.cpp)
add_orbbec_executable(topic_statistics_node tools/topic_statistics.cpp)
add_orbbec_executable(ob_benchmark_node tools/ob_benchmark.cpp)
add_library(frame_latency SHARED tools/frame_latency.cpp)
target_include_directories(frame_latency PUBLIC ${COMMON_INCLUDE_DIRS})
target_link_libraries(frame_latency ${COMMON_LIBRARIES})
ament_target_dependencies(frame_latency ${dependencies})
rclcpp_components_register_node(frame_latency PLUGIN "orbbec_camera::FrameLatencyNode" EXECUTABLE frame_latency_node)
add_library(start_benchmark SHARED tools/start_benchmark.cpp)
target_include_directories(start_benchmark PUBLIC ${COMMON_INCLUDE_DIRS})
target_link_libraries(start_benchmark ${COMMON_LIBRARIES})
ament_target_dependencies(start_benchmark ${dependencies})
rclcpp_components_register_node(
start_benchmark PLUGIN "orbbec_camera::tools::StartBenchmark" EXECUTABLE start_benchmark_node
)
add_library(multi_save_rgbir SHARED tools/multi_save_rgbir.cpp src/utils.cpp)
target_include_directories(multi_save_rgbir PUBLIC ${COMMON_INCLUDE_DIRS})
target_link_libraries(multi_save_rgbir ${COMMON_LIBRARIES})
ament_target_dependencies(multi_save_rgbir ${dependencies})
rclcpp_components_register_node(
multi_save_rgbir PLUGIN "orbbec_camera::tools::MultiCameraSubscriber" EXECUTABLE multi_save_rgbir_node
)
# Install rules
install(TARGETS ${PROJECT_NAME} frame_latency start_benchmark multi_save_rgbir ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib RUNTIME DESTINATION bin
)
install(DIRECTORY include/ DESTINATION include)
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/)
install(DIRECTORY config DESTINATION share/${PROJECT_NAME}/)
install(DIRECTORY examples DESTINATION share/${PROJECT_NAME}/)
install(DIRECTORY ${ORBBEC_INCLUDE_DIR} DESTINATION include)
install(DIRECTORY ${ORBBEC_LIBS_DIR}/ DESTINATION lib/ FILES_MATCHING PATTERN "*.so*")
install(DIRECTORY ${ORBBEC_LIBS_DIR}/extensions DESTINATION lib/)
if(DEFINED ENV{BUILDING_PACKAGE})
# Install udev rules
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/99-obsensor-libusb.rules DESTINATION /etc/udev/rules.d)
endif()
install(TARGETS list_devices_node list_depth_work_mode_node list_camera_profile_mode_node topic_statistics_node
ob_benchmark_node DESTINATION lib/${PROJECT_NAME}/
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
ament_export_include_directories(include ${ORBBEC_INCLUDE_DIR})
ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(${dependencies} ${ORBBEC_LIBS})
ament_package()

View File

@@ -1,23 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* \file ObSensor.h
* \brief This file serves as the C entrance for the OrbbecSDK library.
* It includes all necessary header files for OrbbecSDK usage.
*/
#pragma once
#include <libobsensor/h/Context.h>
#include <libobsensor/h/Device.h>
#include <libobsensor/h/Error.h>
#include <libobsensor/h/Filter.h>
#include <libobsensor/h/Frame.h>
#include <libobsensor/h/ObTypes.h>
#include <libobsensor/h/Pipeline.h>
#include <libobsensor/h/Property.h>
#include <libobsensor/h/Sensor.h>
#include <libobsensor/h/StreamProfile.h>
#include <libobsensor/h/Version.h>
#include <libobsensor/h/TypeHelper.h>
#include <libobsensor/h/RecordPlayback.h>

View File

@@ -1,21 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* \file ObSensor.hpp
* \brief This is the main entry point for the OrbbecSDK C++ library.
* It includes all necessary header files for using the library.
*/
#pragma once
#include <libobsensor/hpp/Context.hpp>
#include <libobsensor/hpp/Device.hpp>
#include <libobsensor/hpp/Error.hpp>
#include <libobsensor/hpp/Filter.hpp>
#include <libobsensor/hpp/Frame.hpp>
#include <libobsensor/hpp/Pipeline.hpp>
#include <libobsensor/hpp/RecordPlayback.hpp>
#include <libobsensor/hpp/Sensor.hpp>
#include <libobsensor/hpp/StreamProfile.hpp>
#include <libobsensor/hpp/Version.hpp>
#include <libobsensor/hpp/TypeHelper.hpp>

View File

@@ -1,314 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Get the current depth work mode.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_depth_work_mode The current depth work mode.
*/
OB_EXPORT ob_depth_work_mode ob_device_get_current_depth_work_mode(const ob_device *device, ob_error **error);
/**
* @brief Get current depth mode name
* @brief According the current preset name to return current depth mode name
* @return const char* return the current depth mode name.
*/
OB_EXPORT const char *ob_device_get_current_depth_work_mode_name(const ob_device *device, ob_error **error);
/**
* @brief Switch the depth work mode by ob_depth_work_mode.
* Prefer to use ob_device_switch_depth_work_mode_by_name to switch depth mode when the complete name of the depth work mode is known.
*
* @param[in] device The device object.
* @param[in] work_mode The depth work mode from ob_depth_work_mode_list which is returned by ob_device_get_depth_work_mode_list.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
*/
OB_EXPORT ob_status ob_device_switch_depth_work_mode(ob_device *device, const ob_depth_work_mode *work_mode, ob_error **error);
/**
* @brief Switch the depth work mode by work mode name.
*
* @param[in] device The device object.
* @param[in] mode_name The depth work mode name which is equal to ob_depth_work_mode.name.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
*/
OB_EXPORT ob_status ob_device_switch_depth_work_mode_by_name(ob_device *device, const char *mode_name, ob_error **error);
/**
* @brief Request the list of supported depth work modes.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_depth_work_mode_list The list of ob_depth_work_mode.
*/
OB_EXPORT ob_depth_work_mode_list *ob_device_get_depth_work_mode_list(const ob_device *device, ob_error **error);
/**
* \if English
* @brief Get the depth work mode count that ob_depth_work_mode_list hold
* @param[in] work_mode_list data struct contain list of ob_depth_work_mode
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The total number contained in ob_depth_work_mode_list
*
*/
OB_EXPORT uint32_t ob_depth_work_mode_list_get_count(const ob_depth_work_mode_list *work_mode_list, ob_error **error);
/**
* @brief Get the index target of ob_depth_work_mode from work_mode_list
*
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
* @param[in] index Index of the target ob_depth_work_mode
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_depth_work_mode
*
*/
OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_work_mode_list *work_mode_list, uint32_t index, ob_error **error);
/**
* @brief Free the resources of ob_depth_work_mode_list
*
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
*/
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error);
/**
* @breif Get the current preset name.
* @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
*
* @param device The device object.
* @param error Pointer to an error object that will be set if an error occurs.
* @return The current preset name, it should be one of the preset names returned by @ref ob_device_get_available_preset_list.
*/
OB_EXPORT const char *ob_device_get_current_preset_name(const ob_device *device, ob_error **error);
/**
* @brief Get the available preset list.
* @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device
* settings to update the user program temporarily.
*
* @param device The device object.
* @param preset_name Pointer to an error object that will be set if an error occurs. The name should be one of the preset names returned by @ref
* ob_device_get_available_preset_list.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error);
/**
* @brief Load preset from json string.
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name.
*
* @param device The device object.
* @param json_file_path The json file path.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error);
/**
* @brief Load custom preset from data.
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the @ref presetName.
*
* @attention The user should ensure that the custom preset data is adapted to the device and the settings in the data are valid.
* @attention It is recommended to re-read the device settings to update the user program temporarily after successfully loading the custom preset.
*
* @param data The custom preset data.
* @param size The size of the custom preset data.
*/
OB_EXPORT void ob_device_load_preset_from_json_data(ob_device *device, const char *presetName, const uint8_t *data, uint32_t size, ob_error **error);
/**
* @brief Export current settings as a preset json file.
* @brief After exporting the custom preset, the available preset list will be appended with the custom preset and named as the file name.
*
* @param device The device object.
* @param json_file_path The json file path.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error);
/**
* @brief Export current device settings as a preset json data.
* @brief After exporting the preset, a new preset named as the @ref presetName will be added to the available preset list.
*
* @attention The memory of the data is allocated by the SDK, and will automatically be released by the SDK.
* @attention The memory of the data will be reused by the SDK on the next call, so the user should copy the data to a new buffer if it needs to be
* preserved.
*
* @param[out] data return the preset json data.
* @param[out] dataSize return the size of the preset json data.
*/
OB_EXPORT void ob_device_export_current_settings_as_preset_json_data(ob_device *device, const char *presetName, const uint8_t **data, uint32_t *dataSize,
ob_error **error);
/**
* @brief Get the available preset list.
*
* @param device The device object.
* @param error Pointer to an error object that will be set if an error occurs.
* @return The available preset list.
*/
OB_EXPORT ob_device_preset_list *ob_device_get_available_preset_list(const ob_device *device, ob_error **error);
/**
* @brief Delete the available preset list.
*
* @param preset_list The available preset list.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error);
/**
* @brief Get the number of preset in the preset list.
*
* @param preset_list The available preset list.
* @param error Pointer to an error object that will be set if an error occurs.
* @return The number of preset in the preset list.
*/
OB_EXPORT uint32_t ob_device_preset_list_get_count(const ob_device_preset_list *preset_list, ob_error **error);
/**
* @brief Get the name of the preset in the preset list.
*
* @param preset_list The available preset list.
* @param index The index of the preset in the preset list.
* @param error Pointer to an error object that will be set if an error occurs.
* @return The name of the preset in the preset list.
*/
OB_EXPORT const char *ob_device_preset_list_get_name(const ob_device_preset_list *preset_list, uint32_t index, ob_error **error);
/**
* @brief Check if the preset list has the preset.
*
* @param preset_list The available preset list.
* @param preset_name The name of the preset.
* @param error Pointer to an error object that will be set if an error occurs.
* @return Whether the preset list has the preset. If true, the preset list has the preset. If false, the preset list does not have the preset.
*/
OB_EXPORT bool ob_device_preset_list_has_preset(const ob_device_preset_list *preset_list, const char *preset_name, ob_error **error);
/**
* @brief Check if the device supports the frame interleave feature.
*
* @param device The device object.
* @param error Pointer to an error object that will be set if an error occurs.
* @return bool Returns true if the device supports the frame interleave feature.
*/
OB_EXPORT bool ob_device_is_frame_interleave_supported(const ob_device *device, ob_error **error);
/**
*
* @brief load the frame interleave mode according to frame interleavee name.
*
* @param device The device object.
* @param frame_interleave_name The name should be one of the frame interleave names returned by @ref ob_device_get_available_frame_interleave_list.
* @param error Log error messages.
*/
OB_EXPORT void ob_device_load_frame_interleave(ob_device *device, const char *frame_interleave_name, ob_error **error);
/**
* @brief Get the available frame interleave list.
*
* @param device The device object.
* @param error Log error messages.
* @return The available frame interleave list.
*/
OB_EXPORT ob_device_frame_interleave_list *ob_device_get_available_frame_interleave_list(ob_device *device, ob_error **error);
/**
* @brief Delete the available frame interleave list.
*
* @param frame_interleave_list The available frame interleave list.
* @param error Log error messages.
*/
OB_EXPORT void ob_delete_frame_interleave_list(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
/**
* @brief Get the number of frame interleave in the frame interleave list.
*
* @param frame_interleave_list The available frame interleave list.
* @param error Log error messages.
* @return The number of frame interleave in the frame interleave list.
*/
OB_EXPORT uint32_t ob_device_frame_interleave_list_get_count(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
/**
* @brief Get the name of frame interleave in the frame interleave list.
*
* @param frame_interleave_list The available frame interleave list.
* @param index The index of frame interleave in the frame interleave list.
* @param error Log error messages.
* @return The name of frame interleave in the frame interleave list..
*/
OB_EXPORT const char *ob_device_frame_interleave_list_get_name(ob_device_frame_interleave_list *frame_interleave_list, uint32_t index, ob_error **error);
/**
* @brief Check if the interleave ae list has the interleave ae.
*
* @param frame_interleave_list The available interleave ae list.
* @param frame_interleave_name The name of the interleave ae.
* @param error Log error messages.
* @return Whether the interleave ae list has the interleave ae. If true, the interleave ae list has the interleave ae. If false, the interleave ae list does
* not have the interleave ae.
*/
OB_EXPORT bool ob_device_frame_interleave_list_has_frame_interleave(ob_device_frame_interleave_list *frame_interleave_list, const char *frame_interleave_name,
ob_error **error);
/* @brief Get the available preset resolution config list.
*
* @param device The device object.
* @param error Log error messages.
* @return The available frame interleave list.
*
*/
OB_EXPORT ob_preset_resolution_config_list *ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error);
/* @brief Get the number of preset resolution in the preset resolution list.
*
* @param ob_preset_resolution_config_list The available preset resolution list.
* @param error Log error messages.
* @return The number of preset resolution in the preset resolution list.
*/
OB_EXPORT uint32_t ob_device_preset_resolution_config_get_count(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
/**
* @brief Get the preset resolution in the preset resolution list.
*
* @param ob_preset_resolution_config_list The available preset resolution list.
* @param index The index of preset resolution in the preset resolution list.
* @param error Log error messages.
* @return The preset resolution in the preset resolution list.
*/
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_lis,
uint32_t index, ob_error **error);
/**
* @brief Delete the available preset resolution list.
*
* @param frame_interleave_list The available preset resolution list.
* @param error Log error messages.
*/
OB_EXPORT void ob_delete_preset_resolution_config_list(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_depth_work_mode_list_count ob_depth_work_mode_list_get_count
#define ob_device_preset_list_count ob_device_preset_list_get_count
#ifdef __cplusplus
}
#endif

View File

@@ -1,173 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Context.h
* @brief Context is a management class that describes the runtime of the SDK and is responsible for resource allocation and release of the SDK.
* Context has the ability to manage multiple devices. It is responsible for enumerating devices, monitoring device callbacks, and enabling multi-device
* synchronization.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Create a context object with the default configuration file
*
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
* @return Pointer to the created context object
*/
OB_EXPORT ob_context *ob_create_context(ob_error **error);
/**
* @brief Create a context object with a specified configuration file
*
* @param[in] config_file_path Path to the configuration file. If NULL, the default configuration file will be used.
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
* @return Pointer to the created context object
*/
OB_EXPORT ob_context *ob_create_context_with_config(const char *config_file_path, ob_error **error);
/**
* @brief Delete a context object
*
* @param[in] context Pointer to the context object to be deleted
* @param[out] error Pointer to an error object that will be populated if an error occurs during context deletion
*/
OB_EXPORT void ob_delete_context(ob_context *context, ob_error **error);
/**
* @brief Get a list of enumerated devices
*
* @param[in] context Pointer to the context object
* @param[out] error Pointer to an error object that will be populated if an error occurs during device enumeration
* @return Pointer to the device list object
*/
OB_EXPORT ob_device_list *ob_query_device_list(ob_context *context, ob_error **error);
/**
* @brief Enable or disable network device enumeration
* @brief After enabling, the network device will be automatically discovered and can be retrieved through @ref ob_query_device_list. The default state can be
* set in the configuration file.
*
* @attention Network device enumeration is performed through the GVCP protocol. If the device is not in the same subnet as the host, it will be discovered but
* cannot be connected.
*
* @param[in] context Pointer to the context object
* @param[in] enable true to enable, false to disable
* @param[out] error Pointer to an error object that will be populated if an error occurs.
*/
OB_EXPORT void ob_enable_net_device_enumeration(ob_context *context, bool enable, ob_error **error);
/**
* @brief Create a network device object
*
* @param[in] context Pointer to the context object
* @param[in] address IP address of the device
* @param[in] port Port number of the device
* @param[out] error Pointer to an error object that will be populated if an error occurs during device creation
* @return Pointer to the created device object
*/
OB_EXPORT ob_device *ob_create_net_device(ob_context *context, const char *address, uint16_t port, ob_error **error);
/**
* @brief Set a device plug-in callback function
* @attention The added and removed device lists returned through the callback interface need to be released manually
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
*
* @param[in] context Pointer to the context object
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting
*/
OB_EXPORT void ob_set_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
/**
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
*
* @param[in] context Pointer to the context object
* @param[in] repeat_interval_msec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
* @param[out] error Pointer to an error object that will be populated if an error occurs during execution
*/
OB_EXPORT void ob_enable_device_clock_sync(ob_context *context, uint64_t repeat_interval_msec, ob_error **error);
/**
* @brief Free idle memory from the internal frame memory pool
*
* @param[in] context Pointer to the context object
* @param[out] error Pointer to an error object that will be populated if an error occurs during memory freeing
*/
OB_EXPORT void ob_free_idle_memory(ob_context *context, ob_error **error);
/**
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
* @brief It is effective when the new device is created.
*
* @attention This interface is only available for Linux.
*
* @param[in] context Pointer to the context object
* @param[in] backend_type The backend type to be used.
* @param[out] error Pointer to an error object that will be populated if an error occurs during backend type setting
*/
OB_EXPORT void ob_set_uvc_backend_type(ob_context *context, ob_uvc_backend_type backend_type, ob_error **error);
/**
* @brief Set the global log level
*
* @attention This interface setting will affect the output level of all logs (terminal, file, callback)
*
* @param[in] severity Log level to set
* @param[out] error Pointer to an error object that will be populated if an error occurs during log level setting
*/
OB_EXPORT void ob_set_logger_severity(ob_log_severity severity, ob_error **error);
/**
* @brief Set the log output to a file
*
* @param[in] severity Log level to output to file
* @param[in] directory Path to the log file output directory. If the path is empty, the existing settings will continue to be used (if the existing
* configuration is also empty, the log will not be output to the file)
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
*/
OB_EXPORT void ob_set_logger_to_file(ob_log_severity severity, const char *directory, ob_error **error);
/**
* @brief Set the log callback function
*
* @param[in] severity Log level to set for the callback function
* @param[in] callback Pointer to the callback function
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
* @param[out] error Pointer to an error object that will be populated if an error occurs during log callback function setting
*/
OB_EXPORT void ob_set_logger_to_callback(ob_log_severity severity, ob_log_callback callback, void *user_data, ob_error **error);
/**
* @brief Set the log output to the console
*
* @param[in] severity Log level to output to the console
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
*/
OB_EXPORT void ob_set_logger_to_console(ob_log_severity severity, ob_error **error);
/**
* @brief Set the extensions directory
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
*
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
*
* @param directory Path to the extensions directory. If the path is empty, extensions path will be set to the current working directory.
* @param error Pointer to an error object that will be populated if an error occurs during extensions directory setting
*/
OB_EXPORT void ob_set_extensions_directory(const char *directory, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_enable_multi_device_sync ob_enable_device_clock_sync
#define ob_set_logger_callback ob_set_logger_to_callback
#ifdef __cplusplus
}
#endif

View File

@@ -1,691 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Device.h
* @brief Device-related functions, including operations such as obtaining and creating a device, setting and obtaining device property, and obtaining sensors
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
#include "Property.h"
#include "MultipleDevices.h"
#include "Advanced.h"
/**
* @brief Delete a device.
*
* @param[in] device The device to be deleted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_device(ob_device *device, ob_error **error);
/**
* @brief List all sensors.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_sensor_list* The list of all sensors.
*/
OB_EXPORT ob_sensor_list *ob_device_get_sensor_list(const ob_device *device, ob_error **error);
/**
* @brief Get a device's sensor.
*
* @param[in] device The device object.
* @param[in] type The type of sensor to get.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_sensor* The acquired sensor.
*/
OB_EXPORT ob_sensor *ob_device_get_sensor(ob_device *device, ob_sensor_type type, ob_error **error);
/**
* @brief Set an integer type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property to be set.
* @param[in] value The property value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_int_property(ob_device *device, ob_property_id property_id, int32_t value, ob_error **error);
/**
* @brief Get an integer type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The property ID.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int32_t The property value.
*/
OB_EXPORT int32_t ob_device_get_int_property(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Get the integer type of device property range.
*
* @param[in] device The device object.
* @param[in] property_id The property id.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The property range.
*/
OB_EXPORT ob_int_property_range ob_device_get_int_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Set a float type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property to be set.
* @param[in] value The property value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_float_property(ob_device *device, ob_property_id property_id, float value, ob_error **error);
/**
* @brief Get a float type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The property ID.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return float The property value.
*/
OB_EXPORT float ob_device_get_float_property(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Get the float type of device property range.
*
* @param[in] device The device object.
* @param[in] property_id The property id.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The property range.
*/
OB_EXPORT ob_float_property_range ob_device_get_float_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Set a boolean type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property to be set.
* @param[in] value The property value to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_bool_property(ob_device *device, ob_property_id property_id, bool value, ob_error **error);
/**
* @brief Get a boolean type of device property.
*
* @param[in] device The device object.
* @param[in] property_id The property ID.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return bool The property value.
*/
OB_EXPORT bool ob_device_get_bool_property(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Get the boolean type of device property range.
*
* @param[in] device The device object.
* @param[in] property_id The property id.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The property range.
*/
OB_EXPORT ob_bool_property_range ob_device_get_bool_property_range(ob_device *device, ob_property_id property_id, ob_error **error);
/**
* @brief Set structured data.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property to be set.
* @param[in] data The property data to be set.
* @param[in] data_size The size of the property to be set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_structured_data(ob_device *device, ob_property_id property_id, const uint8_t *data, uint32_t data_size, ob_error **error);
/**
* @brief Get structured data of a device property.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property.
* @param[out] data The obtained property data.
* @param[out] data_size The size of the obtained property data.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_get_structured_data(ob_device *device, ob_property_id property_id, uint8_t *data, uint32_t *data_size, ob_error **error);
/**
* @brief Get raw data of a device property.
*
* @param[in] device The device object.
* @param[in] property_id The ID of the property.
* @param[out] cb The get data callback.
* @param[out] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_get_raw_data(ob_device *device, ob_property_id property_id, ob_get_data_callback cb, void *user_data, ob_error **error);
/**
* @brief Set customer data.
*
* @param[in] device The device object.
* @param[in] data The property data to be set.
* @param[in] data_size The size of the property to be set,the maximum length cannot exceed 65532 bytes.
* @param[out] error Log error messages.
*/
OB_EXPORT void ob_device_write_customer_data(ob_device *device, const void *data, uint32_t data_size, ob_error **error);
/**
* @brief Get customer data of a device property.
*
* @param[in] device The device object.
* @param[out] data The obtained property data.
* @param[out] data_size The size of the obtained property data.
* @param[out] error Log error messages.
*/
OB_EXPORT void ob_device_read_customer_data(ob_device *device, void *data, uint32_t *data_size, ob_error **error);
/**
* @brief Get the number of properties supported by the device.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The number of properties supported by the device.
*/
OB_EXPORT uint32_t ob_device_get_supported_property_count(const ob_device *device, ob_error **error);
/**
* @brief Get the type of property supported by the device.
*
* @param[in] device The device object.
* @param[in] index The property index.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The type of property supported by the device.
*/
OB_EXPORT ob_property_item ob_device_get_supported_property_item(const ob_device *device, uint32_t index, ob_error **error);
/**
* @brief Check if a device property permission is supported.
*
* @param[in] device The device object.
* @param[in] property_id The property id.
* @param[in] permission The type of permission that needs to be interpreted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return Whether the property permission is supported.
*/
OB_EXPORT bool ob_device_is_property_supported(const ob_device *device, ob_property_id property_id, ob_permission_type permission, ob_error **error);
/**
* @brief Check if the device supports global timestamp.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return bool Whether the device supports global timestamp.
*/
OB_EXPORT bool ob_device_is_global_timestamp_supported(const ob_device *device, ob_error **error);
/**
* @brief Enable or disable global timestamp.
*
* @param device The device object.
* @param enable Whether to enable global timestamp.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_enable_global_timestamp(ob_device *device, bool enable, ob_error **error);
/**
* @brief Update the device firmware.
*
* @param[in] device The device object.
* @param[in] path The firmware path.
* @param[in] callback The firmware upgrade progress callback.
* @param[in] async Whether to execute asynchronously.
* @param[in] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_update_firmware(ob_device *device, const char *path, ob_device_fw_update_callback callback, bool async, void *user_data,
ob_error **error);
/**
* @brief Update the device firmware from data.
*
* @param[in] device The device object.
* @param[in] data The firmware file data.
* @param[in] data_size The firmware file size.
* @param[in] callback The firmware upgrade progress callback.
* @param[in] async Whether to execute asynchronously.
* @param[in] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_update_firmware_from_data(ob_device *device, const uint8_t *data, uint32_t data_size, ob_device_fw_update_callback callback,
bool async, void *user_data, ob_error **error);
/**
* @brief Update the device optional depth presets.
*
* @param[in] device The device object.
* @param[in] file_path_list A list(2D array) of preset file paths, each up to OB_PATH_MAX characters.
* @param[in] path_count The number of the preset file paths.
* @param[in] callback The preset upgrade progress callback.
* @param[in] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_update_optional_depth_presets(ob_device *device, const char file_path_list[][OB_PATH_MAX], uint8_t path_count,
ob_device_fw_update_callback callback, void *user_data, ob_error **error);
/**
* @brief Device reboot
* @attention The device will be disconnected and reconnected. After the device is disconnected, the interface access to the device handle may be abnormal.
* Please use the ob_delete_device interface to delete the handle directly. After the device is reconnected, it can be obtained again.
*
* @param[in] device Device object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_reboot(ob_device *device, ob_error **error);
/**
* @brief Get the current device status.
*
* @param[in] device The device object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_device_state The device state information.
*/
OB_EXPORT ob_device_state ob_device_get_device_state(const ob_device *device, ob_error **error);
/**
* @brief Set the device state changed callback.
*
* @param[in] device The device object.
* @param[in] callback The callback function to be called when the device status changes.
* @param[in] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_state_changed_callback(ob_device *device, ob_device_state_callback callback, void *user_data, ob_error **error);
/**
* @brief Enable or disable the device heartbeat.
* @brief After enable the device heartbeat, the sdk will start a thread to send heartbeat signal to the device error every 3 seconds.
* @attention If the device does not receive the heartbeat signal for a long time, it will be disconnected and rebooted.
*
* @param[in] device The device object.
* @param[in] enable Whether to enable the device heartbeat.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_enable_heartbeat(ob_device *device, bool enable, ob_error **error);
/**
* @brief Send data to the device and receive data from the device.
* @brief This is a factory and debug function, which can be used to send and receive data from the device. The data format is secret and belongs to the device
* vendor.
*
* @param[in] device The device object.
* @param[in] send_data The data to be sent to the device.
* @param[in] send_data_size The size of the data to be sent to the device.
* @param[out] receive_data The data received from the device.
* @param[in,out] receive_data_size Pass in the expected size of the receive data, and return the actual size of the received data.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_send_and_receive_data(ob_device *device, const uint8_t *send_data, uint32_t send_data_size, uint8_t *receive_data,
uint32_t *receive_data_size, ob_error **error);
/**
* @brief Get device information.
*
* @param[in] device The device to obtain information from.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device_info* The device information.
*/
OB_EXPORT ob_device_info *ob_device_get_device_info(const ob_device *device, ob_error **error);
/**
* @brief Delete device information.
*
* @param[in] info The device information to be deleted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_device_info(ob_device_info *info, ob_error **error);
/**
* @brief Get device name
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* return the device name
*/
OB_EXPORT const char *ob_device_info_get_name(const ob_device_info *info, ob_error **error);
/**
* @brief Get device pid
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int return the device pid
*/
OB_EXPORT int ob_device_info_get_pid(const ob_device_info *info, ob_error **error);
/**
* @brief Get device vid
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int return device vid
*/
OB_EXPORT int ob_device_info_get_vid(const ob_device_info *info, ob_error **error);
/**
* @brief Get device uid
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* return device uid
*/
OB_EXPORT const char *ob_device_info_get_uid(const ob_device_info *info, ob_error **error);
/**
* @brief Get device serial number
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* return device serial number
*/
OB_EXPORT const char *ob_device_info_get_serial_number(const ob_device_info *info, ob_error **error);
/**
* @brief Get the firmware version number
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int return the firmware version number
*/
OB_EXPORT const char *ob_device_info_get_firmware_version(const ob_device_info *info, ob_error **error);
/**
* @brief Get the device connection type
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet"
*/
OB_EXPORT const char *ob_device_info_get_connection_type(const ob_device_info *info, ob_error **error);
/**
* @brief Get the device IP address
*
* @attention Only valid for network devices, otherwise it will return "0.0.0.0"
*
* @param info Device Information
* @param error Pointer to an error object that will be set if an error occurs.
* @return const char* The IP address, such as "192.168.1.10"
*/
OB_EXPORT const char *ob_device_info_get_ip_address(const ob_device_info *info, ob_error **error);
/**
* @brief Get the hardware version number
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The hardware version number
*/
OB_EXPORT const char *ob_device_info_get_hardware_version(const ob_device_info *info, ob_error **error);
/**
* @brief Check if the device extension information exists.
*
* @param device The device object.
* @param info_key The key of the device extension information.
* @param error Pointer to an error object that will be set if an error occurs.
* @return bool Whether the device extension information exists.
*/
OB_EXPORT bool ob_device_is_extension_info_exist(const ob_device *device, const char *info_key, ob_error **error);
/**
* @brief Get the device extension information.
* @brief Extension information is a set of key-value pair of string, user cat get the information by the key.
*
* @param[in] device The device object.
* @param[in] info_key The key of the device extension information.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The device extension information
*/
OB_EXPORT const char *ob_device_get_extension_info(const ob_device *device, const char *info_key, ob_error **error);
/**
* @brief Get the minimum SDK version number supported by the device
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The minimum SDK version number supported by the device
*/
OB_EXPORT const char *ob_device_info_get_supported_min_sdk_version(const ob_device_info *info, ob_error **error);
/**
* @brief Get the chip name
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The ASIC name
*/
OB_EXPORT const char *ob_device_info_get_asicName(const ob_device_info *info, ob_error **error);
/**
* @brief Get the device type
*
* @param[in] info Device Information
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device_type The device type
*/
OB_EXPORT ob_device_type ob_device_info_get_device_type(const ob_device_info *info, ob_error **error);
/**
* @brief Delete a device list.
*
* @param[in] list The device list object to be deleted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_device_list(ob_device_list *list, ob_error **error);
/**
* @brief Get the number of devices
*
* @param[in] list Device list object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the number of devices
*/
OB_EXPORT uint32_t ob_device_list_get_count(const ob_device_list *list, ob_error **error);
/**
* @brief Get device name
*
* @param[in] list Device list object
* @param[in] index Device index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* return device name
*/
OB_EXPORT const char *ob_device_list_get_device_name(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get the pid of the specified device
*
* @param[in] list Device list object
* @param[in] index Device index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int return the device pid
*/
OB_EXPORT int ob_device_list_get_device_pid(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get the vid of the specified device
*
* @param[in] list Device list object
* @param[in] index Device index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int return device vid
*/
OB_EXPORT int ob_device_list_get_device_vid(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get the uid of the specified device
*
* @param[in] list Device list object
* @param[in] index Device index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* return the device uid
*/
OB_EXPORT const char *ob_device_list_get_device_uid(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get the serial number of the specified device.
*
* @param[in] list Device list object.
* @param[in] index Device index.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* The device UID.
*/
OB_EXPORT const char *ob_device_list_get_device_serial_number(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get device connection type
*
* @param[in] list Device list object
* @param[in] index Device index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const char* returns the device connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2",
* "Ethernet"
*/
OB_EXPORT const char *ob_device_list_get_device_connection_type(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get device ip address
*
* @attention Only valid for network devices, otherwise it will return "0.0.0.0".
*
* @param list Device list object
* @param index Device index
* @param error Pointer to an error object that will be set if an error occurs.
* @return const char* returns the device ip address, such as "192.168.1.10"
*/
OB_EXPORT const char *ob_device_list_get_device_ip_address(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Get device local mac address
*
* @attention Only valid for network devices, otherwise it will return "0:0:0:0:0:0".
*
* @param list Device list object
* @param index Device index
* @param error Pointer to an error object that will be set if an error occurs.
* @return const char* returns the device mac address
*/
OB_EXPORT const char *ob_device_list_get_device_local_mac(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Create a device.
*
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
*
* @param[in] list Device list object.
* @param[in] index The index of the device to create.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device* The created device.
*
*/
OB_EXPORT ob_device *ob_device_list_get_device(const ob_device_list *list, uint32_t index, ob_error **error);
/**
* @brief Create a device.
*
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
*
* @param[in] list Device list object.
* @param[in] serial_number The serial number of the device to create.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device* The created device.
*/
OB_EXPORT ob_device *ob_device_list_get_device_by_serial_number(const ob_device_list *list, const char *serial_number, ob_error **error);
/**
* @brief Create device by uid
* @brief On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number and
* only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port. Similarly,
* users can also directly pass in bus-port as uid to create device.
* @brief For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.
*
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
*
* @param[in] list Device list object.
* @param[in] uid The UID of the device to create.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device* The created device.
*/
OB_EXPORT ob_device *ob_device_list_get_device_by_uid(const ob_device_list *list, const char *uid, ob_error **error);
/**
* @brief Get the original parameter list of camera calibration saved on the device.
*
* @attention The parameters in the list do not correspond to the current open-stream configuration.You need to select the parameters according to the actual
* situation, and may need to do scaling, mirroring and other processing. Non-professional users are recommended to use the ob_pipeline_get_camera_param()
* interface.
*
* @param[in] device The device object.
* @param[out] error Log error messages.
*
* @return ob_camera_param_list The camera parameter list.
*/
OB_EXPORT ob_camera_param_list *ob_device_get_calibration_camera_param_list(ob_device *device, ob_error **error);
/**
* @brief Get the number of camera parameter lists
*
* @param[in] param_list Camera parameter list
* @param[out] error Log error messages
* @return uint32_t The number of lists
*/
OB_EXPORT uint32_t ob_camera_param_list_get_count(ob_camera_param_list *param_list, ob_error **error);
/**
* @brief Get camera parameters from the camera parameter list
*
* @param[in] param_list Camera parameter list
* @param[in] index Parameter index
* @param[out] error Log error messages
* @return ob_camera_param The camera parameters. Since it returns the structure object directly, there is no need to provide a delete interface.
*/
OB_EXPORT ob_camera_param ob_camera_param_list_get_param(ob_camera_param_list *param_list, uint32_t index, ob_error **error);
/**
* @brief Delete the camera parameter list
*
* @param[in] param_list Camera parameter list
* @param[out] error Log error messages
*/
OB_EXPORT void ob_delete_camera_param_list(ob_camera_param_list *param_list, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_device_list_device_count ob_device_list_get_count
#define ob_device_list_get_extension_info ob_device_info_get_extension_info
#define ob_device_upgrade ob_device_update_firmware
#define ob_device_upgrade_from_data ob_device_update_firmware_from_data
#define ob_device_get_supported_property ob_device_get_supported_property_item
#define ob_device_state_changed ob_device_set_state_changed_callback
#define ob_device_info_name ob_device_info_get_name
#define ob_device_info_pid ob_device_info_get_pid
#define ob_device_info_vid ob_device_info_get_vid
#define ob_device_info_uid ob_device_info_get_uid
#define ob_device_info_serial_number ob_device_info_get_serial_number
#define ob_device_info_firmware_version ob_device_info_get_firmware_version
#define ob_device_info_connection_type ob_device_info_get_connection_type
#define ob_device_info_ip_address ob_device_info_get_ip_address
#define ob_device_info_hardware_version ob_device_info_get_hardware_version
#define ob_device_info_supported_min_sdk_version ob_device_info_get_supported_min_sdk_version
#define ob_device_info_asicName ob_device_info_get_asicName
#define ob_device_info_device_type ob_device_info_get_device_type
#define ob_device_list_get_device_count ob_device_list_get_count
#define ob_camera_param_list_count ob_camera_param_list_get_count
#ifdef __cplusplus
}
#endif

View File

@@ -1,84 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Error.h
* @brief Functions for handling errors, mainly used for obtaining error messages.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Create a new error object.
*
* @param status The error status.
* @param message The error message.
* @param function The name of the API function that caused the error.
* @param args The error parameters.
* @param exception_type The type of exception that caused the error.
* @return ob_error* The new error object.
*/
OB_EXPORT ob_error *ob_create_error(ob_status status, const char *message, const char *function, const char *args, ob_exception_type exception_type);
/**
* @brief Get the error status.
*
* @param[in] error The error object.
* @return The error status.
*/
OB_EXPORT ob_status ob_error_get_status(const ob_error *error);
/**
* @brief Get the error message.
*
* @param[in] error The error object.
* @return The error message.
*/
OB_EXPORT const char *ob_error_get_message(const ob_error *error);
/**
* @brief Get the name of the API function that caused the error.
*
* @param[in] error The error object.
* @return The name of the API function.
*/
OB_EXPORT const char *ob_error_get_function(const ob_error *error);
/**
* @brief Get the error parameters.
*
* @param[in] error The error object.
* @return The error parameters.
*/
OB_EXPORT const char *ob_error_get_args(const ob_error *error);
/**
* @brief Get the type of exception that caused the error.
*
* @param[in] error The error object.
* @return The type of exception.
*/
OB_EXPORT ob_exception_type ob_error_get_exception_type(const ob_error *error);
/**
* @brief Delete the error object.
*
* @param[in] error The error object to delete, you should set the pointer to NULL after calling this function.
*/
OB_EXPORT void ob_delete_error(ob_error *error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_error_status ob_error_get_status
#define ob_error_message ob_error_get_message
#define ob_error_function ob_error_get_function
#define ob_error_args ob_error_get_args
#define ob_error_exception_type ob_error_get_exception_type
#ifdef __cplusplus
}
#endif

View File

@@ -1,43 +0,0 @@
#ifndef OB_EXPORT_H
#define OB_EXPORT_H
#ifdef OB_STATIC_DEFINE
# define OB_EXPORT
# define OB_NO_EXPORT
#else
# ifndef OB_EXPORT
# ifdef OrbbecSDK_EXPORTS
/* We are building this library */
# define OB_EXPORT __attribute__((visibility("default")))
# else
/* We are using this library */
# define OB_EXPORT __attribute__((visibility("default")))
# endif
# endif
# ifndef OB_NO_EXPORT
# define OB_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif
#ifndef OB_DEPRECATED
# define OB_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef OB_DEPRECATED_EXPORT
# define OB_DEPRECATED_EXPORT OB_EXPORT OB_DEPRECATED
#endif
#ifndef OB_DEPRECATED_NO_EXPORT
# define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED
#endif
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef OB_NO_DEPRECATED
# define OB_NO_DEPRECATED
# endif
#endif
#endif /* OB_EXPORT_H */

View File

@@ -1,265 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Filter.h
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Create a Filter object.
*
* @attention If the filter of the specified name is a private filter, and the creator of the filter have not been activated, the function will return NULL.
*
* @param name The name of the filter.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT ob_filter *ob_create_filter(const char *name, ob_error **error);
/**
* @brief Get the name of ob_filter
*
* @param filter ob_filter object
* @param error Pointer to an error object that will be set if an error occurs.
* @return char The filter of name
*/
OB_EXPORT const char *ob_filter_get_name(const ob_filter *filter, ob_error **error);
/**
* @brief Get the vendor specific code of a filter by filter name.
* @brief A private filter can define its own vendor specific code for specific purposes.
*
* @param name The name of the filter.
* @param error Pointer to an error object that will be set if an error occurs.
* @return const char* Return the vendor specific code of the filter.
*/
OB_EXPORT const char *ob_filter_get_vendor_specific_code(const char *name, ob_error **error);
/**
* @brief Create a private Filter object with activation key.
* @brief Some private filters require an activation key to be activated, its depends on the vendor of the filter.
*
* @param name The name of the filter.
* @param activation_key The activation key of the filter.
* @param error Pointer to an error object that will be set if an error occurs.
*
* @return ob_filter* Return the private filter object.
*/
OB_EXPORT ob_filter *ob_create_private_filter(const char *name, const char *activation_key, ob_error **error);
/**
* @brief Delete the filter.
*
* @param[in] filter The filter object to be deleted.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_filter(ob_filter *filter, ob_error **error);
/**
* @brief Get config schema of the filter
* @brief The returned string is a csv format string representing the configuration schema of the filter. The format of the string is:
* <parameter_name>, <parameter_type: "int", "float", "bool">, <minimum_value>, <maximum_value>, <value_step>, <default_value>, <parameter_description>
*
* @param[in] filter The filter object to get the configuration schema for
* @param[out] error Pointer to an error object that will be set if an error occurs
*
* @return A csv format string representing the configuration schema of the filter
*/
OB_EXPORT const char *ob_filter_get_config_schema(const ob_filter *filter, ob_error **error);
/**
* @brief Get the filter config schema list of the filter
* @brief The returned string is a list of ob_config_schema_item representing the configuration schema of the filter.
*
* @attention The returned list should be deleted by calling @ref ob_delete_filter_config_schema_list when it is no longer needed.
*
* @param filter The filter object to get the configuration schema for
* @param error Pointer to an error object that will be set if an error occurs
* @return ob_filter_config_schema_list* Return the filter config schema list of the filter
*/
OB_EXPORT ob_filter_config_schema_list *ob_filter_get_config_schema_list(const ob_filter *filter, ob_error **error);
/**
* @brief Delete a list of filter config schema items.
*
* @param config_schema_list The list of filter config schema items to delete.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_filter_config_schema_list(ob_filter_config_schema_list *config_schema_list, ob_error **error);
/**
* @brief Update config of the filter
*
* @attention The passed in argc and argv must match the configuration schema returned by the @ref ob_filter_get_config_schema function.
*
* @param[in] filter The filter object to update the configuration for
* @param[in] argc The number of arguments in the argv array
* @param[in] argv An array of strings representing the configuration values
* @param[out] error Pointer to an error object that will be set if an error occurs
*/
OB_EXPORT void ob_filter_update_config(ob_filter *filter, uint8_t argc, const char **argv, ob_error **error);
/**
* @brief Get the filter config value by name and cast to double.
*
* @attention The returned value is cast to double, the actual type of the value depends on the filter config schema returned by @ref
* ob_filter_get_config_schema.
*
* @param[in] filter A filter object.
* @param[in] config_name config name
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return double The value of the config.
*/
OB_EXPORT double ob_filter_get_config_value(const ob_filter *filter, const char *config_name, ob_error **error);
/**
* @brief Set the filter config value by name.
*
* @attention The pass into value type is double, witch will be cast to the actual type inside the filter. The actual type can be queried by the filter config
* schema returned by @ref ob_filter_get_config_schema.
*
* @param[in] filter A filter object.
* @param[in] config_name config name
* @param[in] value The value to set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_filter_set_config_value(ob_filter *filter, const char *config_name, double value, ob_error **error);
/**
* @brief Reset the filter, clears the cache, and resets the state. If the asynchronous interface is used, the processing thread will also be stopped and the
* pending cache frames will be cleared.
*
* @param[in] filter A filter object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_filter_reset(ob_filter *filter, ob_error **error);
/**
* @brief Enable the frame post processing
* @brief The filter default is enable.
*
* @attention If the filter has been disabled by calling this function, processing will directly output a clone of the input frame.
*
* @param[in] filter A filter object.
* @param[in] enable enable status, true: enable; false: disable.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_filter_enable(ob_filter *filter, bool enable, ob_error **error);
/**
* @brief Get the enable status of the frame post processing
*
* @attention If the filter is disabled, the processing will directly output a clone of the input frame.
*
* @param[in] filter A filter object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return The post processing filter status. True: enable; False: disable.
*/
OB_EXPORT bool ob_filter_is_enabled(const ob_filter *filter, ob_error **error);
/**
* @brief Process the frame (synchronous interface).
*
* @param[in] filter A filter object.
* @param[in] frame Pointer to the frame object to be processed.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return The frame object processed by the filter.
*/
OB_EXPORT ob_frame *ob_filter_process(ob_filter *filter, const ob_frame *frame, ob_error **error);
/**
* @brief Set the processing result callback function for the filter (asynchronous callback interface).
*
* @param[in] filter A filter object.
* @param[in] callback Callback function.
* @param[in] user_data Arbitrary user data pointer can be passed in and returned from the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_filter_set_callback(ob_filter *filter, ob_filter_callback callback, void *user_data, ob_error **error);
/**
* @brief Push the frame into the pending cache for the filter (asynchronous callback interface).
* @brief The frame will be processed by the filter when the processing thread is available and return a new processed frame to the callback function.
*
* @attention The frame object will be add reference count, so the user still need call @ref ob_delete_frame to release the frame after calling this function.
*
* @param[in] filter A filter object.
* @param[in] frame Pointer to the frame object to be processed.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_filter_push_frame(ob_filter *filter, const ob_frame *frame, ob_error **error);
/**
* @brief Get the number of filter in the list
*
* @param[in] filter_list filter list
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t The number of list
*/
OB_EXPORT uint32_t ob_filter_list_get_count(const ob_filter_list *filter_list, ob_error **error);
/**
* @brief Get the filter by index
*
* @param[in] filter_list Filter list
* @param[in] index Filter index
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_filter The index of ob_filter
*/
OB_EXPORT ob_filter *ob_filter_list_get_filter(const ob_filter_list *filter_list, uint32_t index, ob_error **error);
/**
* @brief Delete a list of ob_filter objects.
*
* @param[in] filter_list The list of ob_filter objects to delete.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_filter_list(ob_filter_list *filter_list, ob_error **error);
/**
* @brief Get the number of config schema items in the config schema list
*
* @param config_schema_list Filter config schema list
* @param error Pointer to an error object that will be set if an error occurs.
* @return uint32_t The number of config schema items in the filter list
*/
OB_EXPORT uint32_t ob_filter_config_schema_list_get_count(const ob_filter_config_schema_list *config_schema_list, ob_error **error);
/**
* @brief Get the config schema item by index
*
* @param config_schema_list Filter config schema list
* @param index Config schema item index
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_filter_config_schema_item* The config schema item by index
*/
OB_EXPORT ob_filter_config_schema_item ob_filter_config_schema_list_get_item(const ob_filter_config_schema_list *config_schema_list, uint32_t index,
ob_error **error);
/**
* @brief Set the align to stream profile for the align filter.
* @breif It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
*
* @param filter A filter object.
* @param align_to_stream_profile The align target stream profile.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_align_filter_set_align_to_stream_profile(ob_filter *filter, const ob_stream_profile *align_to_stream_profile, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_get_filter ob_filter_list_get_filter
#define ob_get_filter_name ob_filter_get_name
#ifdef __cplusplus
}
#endif

View File

@@ -1,657 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Frame.h
* @brief Frame related function is mainly used to obtain frame data and frame information
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Crate a frame object based on the specified parameters.
*
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no longer needed.
*
* @param frame_type The frame object type.
* @param format The frame object format.
* @param data_size The size of the frame object data.
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frame object.
*/
OB_EXPORT ob_frame *ob_create_frame(ob_frame_type frame_type, ob_format format, uint32_t data_size, ob_error **error);
/**
* @brief Create (clone) a frame object based on the specified other frame object.
* @brief The new frame object will have the same properties as the other frame object, but the data buffer is newly allocated.
*
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no longer needed.
*
* @param[in] other_frame The frame object to create the new frame object according to.
* @param[in] should_copy_data If true, the data of the source frame object will be copied to the new frame object. If false, the new frame object will
* have a data buffer with random data.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the new frame object.
*/
OB_EXPORT ob_frame *ob_create_frame_from_other_frame(const ob_frame *other_frame, bool should_copy_data, ob_error **error);
/**
* @brief Create a frame object according to the specified stream profile.
*
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no logger needed.
*
* @param stream_profile The stream profile to create the new frame object according to.
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the new frame object.
*/
OB_EXPORT ob_frame *ob_create_frame_from_stream_profile(const ob_stream_profile *stream_profile, ob_error **error);
/**
* @brief Create an video frame object based on the specified parameters.
*
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no longer needed.
*
* @param[in] frame_type Frame object type.
* @param[in] format Frame object format.
* @param[in] width Frame object width.
* @param[in] height Frame object height.
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return an empty frame object.
*/
OB_EXPORT ob_frame *ob_create_video_frame(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, ob_error **error);
/**
* @brief Create a frame object based on an externally created buffer.
*
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no longer needed.
*
* @param[in] frame_type Frame object type.
* @param[in] format Frame object format.
* @param[in] buffer Frame object buffer.
* @param[in] buffer_size Frame object buffer size.
* @param[in] buffer_destroy_cb Destroy callback, will be called when the frame object is destroyed.
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frame object.
*/
OB_EXPORT ob_frame *ob_create_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint8_t *buffer, uint32_t buffer_size,
ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error);
/**
* @brief Create a video frame object based on an externally created buffer.
*
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
* no longer needed.
*
* @param[in] frame_type Frame object type.
* @param[in] format Frame object format.
* @param[in] width Frame object width.
* @param[in] height Frame object height.
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
* @param[in] buffer Frame object buffer.
* @param[in] buffer_size Frame object buffer size.
* @param[in] buffer_destroy_cb Destroy callback, user-defined function to destroy the buffer.
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frame object.
*/
OB_EXPORT ob_frame *ob_create_video_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes,
uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb,
void *buffer_destroy_context, ob_error **error);
/**
* @brief Create an empty frameset object.
* @brief A frameset object is a special type of frame object that can be used to store multiple frames.
*
* @attention The frameset object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it
* is no longer needed.
*
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frameset object.
*/
OB_EXPORT ob_frame *ob_create_frameset(ob_error **error);
/**
* @brief Increase the reference count of a frame object.
* @brief The reference count is used to manage the lifetime of the frame object.
*
* @attention When calling this function, the reference count of the frame object is
* increased and requires to be decreased by calling @ref ob_delete_frame().
*
* @param[in] frame Frame object to increase the reference count.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_add_ref(const ob_frame *frame, ob_error **error);
/**
* @brief Delete a frame object
* @brief This function will decrease the reference count of the frame object and release the memory if the reference count becomes 0.
*
* @param[in] frame The frame object to delete.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error);
/**
* @brief Copy the information of the source frame object to the destination frame object.
* @brief Including the index, timestamp, system timestamp, global timestamp and metadata will be copied.
*
* @param[in] src_frame Source frame object to copy the information from.
* @param[in] dst_frame Destination frame object to copy the information to.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_copy_info(const ob_frame *src_frame, ob_frame *dst_frame, ob_error **error);
/**
* @brief Get the frame index
*
* @param[in] frame Frame object
* @param[out] error Log wrong message
* @return uint64_t return the frame index
*/
OB_EXPORT uint64_t ob_frame_get_index(const ob_frame *frame, ob_error **error);
/**
* @brief Get the frame format
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_format return the frame format
*/
OB_EXPORT ob_format ob_frame_get_format(const ob_frame *frame, ob_error **error);
/**
* @brief Get the frame type
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame_type return the frame type
*/
OB_EXPORT ob_frame_type ob_frame_get_type(const ob_frame *frame, ob_error **error);
/**
* @brief Get the frame timestamp (also known as device timestamp, hardware timestamp) of the frame in microseconds.
* @brief The hardware timestamp is the time point when the frame was captured by the device (Typically in the mid-exposure, unless otherwise stated), on device
* clock domain.
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint64_t return the frame hardware timestamp in microseconds
*/
OB_EXPORT uint64_t ob_frame_get_timestamp_us(const ob_frame *frame, ob_error **error);
/**
* @brief Set the frame timestamp (also known as the device timestamp, hardware timestamp) of a frame object.
*
* @param[in] frame Frame object to set the timestamp.
* @param[in] timestamp_us frame timestamp to set in microseconds.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_set_timestamp_us(ob_frame *frame, uint64_t timestamp_us, ob_error **error);
/**
* @brief Get the system timestamp of the frame in microseconds.
* @brief The system timestamp is the time point when the frame was received by the host, on host clock domain.
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint64_t return the frame system timestamp in microseconds
*/
OB_EXPORT uint64_t ob_frame_get_system_timestamp_us(const ob_frame *frame, ob_error **error);
/**
* @brief Set the system timestamp of the frame in microseconds.
*
* @param frame Frame object
* @param system_timestamp_us frame system timestamp to set in microseconds.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system_timestamp_us, ob_error **error);
/**
* @brief Get the global timestamp of the frame in microseconds.
* @brief The global timestamp is the time point when the frame was captured by the device, and has been converted to the host clock domain. The
* conversion process base on the frame timestamp and can eliminate the timer drift of the device
*
* @attention The global timestamp is disabled by default. If global timestamp is not enabled, the function will return 0. To enable it, call @ref
* ob_device_enable_global_timestamp() function.
* @attention Only some models of device support getting the global timestamp. Check the device support status by @ref
* ob_device_is_global_timestamp_supported() function.
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint64_t The global timestamp of the frame in microseconds.
*/
OB_EXPORT uint64_t ob_frame_get_global_timestamp_us(const ob_frame *frame, ob_error **error);
/**
* @brief Get the data buffer of a frame.
*
* @attention The returned data buffer is mutable, but it is not recommended to modify it directly. Modifying the data directly may cause issues if the frame is
* being used in other threads or future use. If you need to modify the data, it is recommended to create a new frame object.
*
* @param[in] frame The frame object from which to retrieve the data.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint8_t* Pointer to the frame data buffer.
*/
OB_EXPORT uint8_t *ob_frame_get_data(const ob_frame *frame, ob_error **error);
/**
* @brief Update the data of a frame.
* @brief The data will be memcpy to the frame data buffer.
* @brief The frame data size will be also updated as the input data size.
*
* @attention It is not recommended to update the frame data if the frame was not created by the user. If you must update it, ensure that the frame is not being
* used in other threads.
* @attention The size of the new data should be equal to or less than the current data size of the frame. Exceeding the original size may cause memory
* exceptions.
*
* @param[in] frame The frame object to update.
* @param[in] data The new data to update the frame with.
* @param[in] data_size The size of the new data.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_update_data(ob_frame *frame, const uint8_t *data, uint32_t data_size, ob_error **error);
/**
* @brief Get the frame data size
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the frame data size
* If it is point cloud data, it return the number of bytes occupied by all point sets. If you need to find the number of points, you need to divide dataSize
* by the structure size of the corresponding point type.
*/
OB_EXPORT uint32_t ob_frame_get_data_size(const ob_frame *frame, ob_error **error);
/**
* @brief Get the metadata of the frame
*
* @attention The returned metadata is mutable, but it is not recommended to modify it directly. Modifying the metadata directly may cause issues if the frame
* is being used in other threads or future use. If you need to modify the metadata, it is recommended to create a new frame object.
*
* @param[in] frame frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return const uint8_t * return the metadata pointer of the frame
*/
OB_EXPORT uint8_t *ob_frame_get_metadata(const ob_frame *frame, ob_error **error);
#define ob_video_frame_metadata ob_frame_get_metadata // for compatibility
/**
* @brief Get the metadata size of the frame
*
* @param[in] frame frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the metadata size of the frame
*/
OB_EXPORT uint32_t ob_frame_get_metadata_size(const ob_frame *frame, ob_error **error);
#define ob_video_frame_metadata_size ob_frame_get_metadata_size // for compatibility
/**
* @brief Update the metadata of the frame
* @brief The metadata will be memcpy to the frame metadata buffer.
* @brief The frame metadata size will be also updated as the input metadata size.
*
* @attention It is not recommended to update the frame metadata if the frame was not created by the user. If you must update it, ensure that the frame is not
* being used in other threads or future use.
* @attention The metadata size should be equal to or less than 256 bytes, otherwise it will cause memory exception.
*
* @param[in] frame frame object
* @param[in] metadata The new metadata to update.
* @param[in] metadata_size The size of the new metadata.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_update_metadata(ob_frame *frame, const uint8_t *metadata, uint32_t metadata_size, ob_error **error);
/**
* @brief check if the frame contains the specified metadata
*
* @param[in] frame frame object
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT bool ob_frame_has_metadata(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
/**
* @brief Get the metadata value of the frame
*
* @param[in] frame frame object
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return int64_t return the metadata value of the frame
*/
OB_EXPORT int64_t ob_frame_get_metadata_value(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
/**
* @brief Get the stream profile of the frame
*
* @attention Require @ref ob_delete_stream_profile() to release the return stream profile.
*
* @param frame frame object
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile* Return the stream profile of the frame, if the frame is not captured by a sensor stream, it will return NULL
*/
OB_EXPORT ob_stream_profile *ob_frame_get_stream_profile(const ob_frame *frame, ob_error **error);
/**
* @brief Set (override) the stream profile of the frame
*
* @param frame frame object
* @param stream_profile The stream profile to set for the frame.
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frame_set_stream_profile(ob_frame *frame, const ob_stream_profile *stream_profile, ob_error **error);
/**
* @brief Get the sensor of the frame
*
* @attention Require @ref ob_delete_sensor() to release the return sensor.
*
* @param[in] frame frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_sensor* return the sensor of the frame, if the frame is not captured by a sensor or the sensor stream has been destroyed, it will return NULL
*/
OB_EXPORT ob_sensor *ob_frame_get_sensor(const ob_frame *frame, ob_error **error);
/**
* @brief Get the device of the frame
*
* @attention Require @ref ob_delete_device() to release the return device.
*
* @param frame frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device* return the device of the frame, if the frame is not captured by a sensor stream or the device has been destroyed, it will return NULL
*/
OB_EXPORT ob_device *ob_frame_get_device(const ob_frame *frame, ob_error **error);
/**
* @brief Get video frame width
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the frame width
*/
OB_EXPORT uint32_t ob_video_frame_get_width(const ob_frame *frame, ob_error **error);
/**
* @brief Get video frame height
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the frame height
*/
OB_EXPORT uint32_t ob_video_frame_get_height(const ob_frame *frame, ob_error **error);
/**
* @brief Get video frame pixel format
* @brief Usually used to determine the pixel type of depth frame (depth, disparity, raw phase, etc.)
*
* @attention Always return OB_PIXEL_UNKNOWN for non-depth frame currently if user has not set the pixel type by @ref ob_video_frame_set_pixel_type()
*
* @param frame Frame object
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_pixel_type return the pixel format of the frame.
*/
OB_EXPORT ob_pixel_type ob_video_frame_get_pixel_type(const ob_frame *frame, ob_error **error);
/**
* @brief Set video frame pixel format
*
* @param frame Frame object
* @param pixel_type the pixel format of the frame
* @param error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_frame_set_pixel_type(ob_frame *frame, ob_pixel_type pixel_type, ob_error **error);
/**
* @brief Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
*
* @param[in] frame video frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint8_t return the effective number of pixels in the pixel, or 0 if it is an unsupported format
*/
OB_EXPORT uint8_t ob_video_frame_get_pixel_available_bit_size(const ob_frame *frame, ob_error **error);
/**
* @brief Set the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
*
* @param[in] frame video frame object
* @param[in] bit_size the effective number of pixels in the pixel, or 0 if it is an unsupported format
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_frame_set_pixel_available_bit_size(ob_frame *frame, uint8_t bit_size, ob_error **error);
/**
* @brief Get the source sensor type of the ir frame (left or right for dual camera)
*
* @param frame Frame object
* @param ob_error Pointer to an error object that will be set if an error occurs.
* @return ob_sensor_type return the source sensor type of the ir frame
*/
OB_EXPORT ob_sensor_type ob_ir_frame_get_source_sensor_type(const ob_frame *frame, ob_error **ob_error);
/**
* @brief Get the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return float The value scale of the depth frame
*/
OB_EXPORT float ob_depth_frame_get_value_scale(const ob_frame *frame, ob_error **error);
/**
* @brief Set the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
*
* @param[in] frame Frame object
* @param[in] value_scale The value scale of the depth frame
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_depth_frame_set_value_scale(ob_frame *frame, float value_scale, ob_error **error);
/**
* @brief Get the point coordinate value scale of the points frame. The point position value of the points frame is multiplied by the scale to give a position
* value in millimeters. For example, if scale=0.1, the x-coordinate value of a point is x = 10000, which means that the actual x-coordinate value = x*scale =
* 10000*0.1 = 1000mm.
*
* @param[in] frame Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return float The coordinate value scale of the points frame
*/
OB_EXPORT float ob_points_frame_get_coordinate_value_scale(const ob_frame *frame, ob_error **error);
/**
* @brief Get accelerometer frame data.
*
* @param[in] frame Accelerometer frame.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_accel_value Return the accelerometer data.
*/
OB_EXPORT ob_accel_value ob_accel_frame_get_value(const ob_frame *frame, ob_error **error);
/**
* @brief Get the temperature when acquiring the accelerometer frame.
*
* @param[in] frame Accelerometer frame.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return float Return the temperature value.
*/
OB_EXPORT float ob_accel_frame_get_temperature(const ob_frame *frame, ob_error **error);
/**
* @brief Get gyroscope frame data.
*
* @param[in] frame Gyroscope frame.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_gyro_value Return the gyroscope data.
*/
OB_EXPORT ob_gyro_value ob_gyro_frame_get_value(const ob_frame *frame, ob_error **error);
/**
* @brief Get the temperature when acquiring the gyroscope frame.
*
* @param[in] frame Gyroscope frame.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return float Return the temperature value.
*/
OB_EXPORT float ob_gyro_frame_get_temperature(const ob_frame *frame, ob_error **error);
/**
* @brief Get the number of frames contained in the frameset
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset frameset object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the number of frames
*/
OB_EXPORT uint32_t ob_frameset_get_count(const ob_frame *frameset, ob_error **error);
/**
* @brief Get the depth frame from the frameset.
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the depth frame.
*/
OB_EXPORT ob_frame *ob_frameset_get_depth_frame(const ob_frame *frameset, ob_error **error);
/**
* @brief Get the color frame from the frameset.
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the color frame.
*/
OB_EXPORT ob_frame *ob_frameset_get_color_frame(const ob_frame *frameset, ob_error **error);
/**
* @brief Get the infrared frame from the frameset.
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the infrared frame.
*/
OB_EXPORT ob_frame *ob_frameset_get_ir_frame(const ob_frame *frameset, ob_error **error);
/**
* @brief Get point cloud frame from the frameset.
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the point cloud frame.
*/
OB_EXPORT ob_frame *ob_frameset_get_points_frame(const ob_frame *frameset, ob_error **error);
/**
* @brief Get a frame of a specific type from the frameset.
*
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[in] frame_type Frame type.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frame of the specified type, or nullptr if it does not exist.
*/
OB_EXPORT ob_frame *ob_frameset_get_frame(const ob_frame *frameset, ob_frame_type frame_type, ob_error **error);
/**
* @brief Get a frame at a specific index from the FrameSet
*
* @param[in] frameset Frameset object.
* @param[in] index The index of the frame.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* Return the frame at the specified index, or nullptr if it does not exist.
*/
OB_EXPORT ob_frame *ob_frameset_get_frame_by_index(const ob_frame *frameset, uint32_t index, ob_error **error);
/**
* @brief Push a frame to the frameset
*
* @attention If a frame with same type already exists in the frameset, it will be replaced by the new frame.
* @attention The frame push to the frameset will be add reference count, so you still need to call @ref ob_delete_frame() to decrease the reference count when
* it is no longer needed.
*
* @param[in] frameset Frameset object.
* @param[in] frame Frame object to push.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error);
/**
* @brief Get point cloud frame width
*
* @param[in] frame point cloud Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the point cloud frame width
*/
OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error);
/**
* @brief Get point cloud frame height
*
* @param[in] frame point cloud Frame object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the point cloud frame height
*/
OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_frame_index ob_frame_get_index
#define ob_frame_format ob_frame_get_format
#define ob_frame_time_stamp_us ob_frame_get_timestamp_us
#define ob_frame_set_device_time_stamp_us ob_frame_set_timestamp_us
#define ob_frame_system_time_stamp_us ob_frame_get_system_timestamp_us
#define ob_frame_global_time_stamp_us ob_frame_get_global_timestamp_us
#define ob_frame_data ob_frame_get_data
#define ob_frame_data_size ob_frame_get_data_size
#define ob_frame_metadata ob_frame_get_metadata
#define ob_frame_metadata_size ob_frame_get_metadata_size
#define ob_video_frame_width ob_video_frame_get_width
#define ob_video_frame_height ob_video_frame_get_height
#define ob_video_frame_pixel_available_bit_size ob_video_frame_get_pixel_available_bit_size
#define ob_points_frame_get_position_value_scale ob_points_frame_get_coordinate_value_scale
#define ob_frameset_frame_count ob_frameset_get_count
#define ob_frameset_depth_frame ob_frameset_get_depth_frame
#define ob_frameset_color_frame ob_frameset_get_color_frame
#define ob_frameset_ir_frame ob_frameset_get_ir_frame
#define ob_frameset_points_frame ob_frameset_get_points_frame
#define ob_accel_frame_value ob_accel_frame_get_value
#define ob_accel_frame_temperature ob_accel_frame_get_temperature
#define ob_gyro_frame_value ob_gyro_frame_get_value
#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
#define ob_frameset_get_frame_count ob_frameset_get_count
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err) / 1000)
#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
#ifdef __cplusplus
}
#endif

View File

@@ -1,128 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file MultipleDevices.h
* @brief This file contains the multiple devices related API witch is used to control the synchronization between multiple devices and the synchronization
* between different sensor within single device.
* @brief The synchronization between multiple devices is complex, and different models have different synchronization modes and limitations. please refer to
* the product manual for details.
* @brief As the Depth and Infrared are the same sensor physically, the behavior of the Infrared is same as the Depth in the synchronization mode.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
#include "Device.h"
/**
* @brief Get the supported multi device sync mode bitmap of the device.
* @brief For example, if the return value is 0b00001100, it means the device supports @ref OB_MULTI_DEVICE_SYNC_MODE_PRIMARY and @ref
* OB_MULTI_DEVICE_SYNC_MODE_SECONDARY. User can check the supported mode by the code:
* ```c
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN){
* //support OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN
* }
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_STANDALONE){
* //support OB_MULTI_DEVICE_SYNC_MODE_STANDALONE
* }
* // and so on
* ```
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint16_t return the supported multi device sync mode bitmap of the device.
*/
OB_EXPORT uint16_t ob_device_get_supported_multi_device_sync_mode_bitmap(const ob_device *device, ob_error **error);
/**
* @brief set the multi device sync configuration of the device.
*
* @param[in] device The device handle.
* @param[in] config The multi device sync configuration.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_multi_device_sync_config(ob_device *device, const ob_multi_device_sync_config *config, ob_error **error);
/**
* @brief get the current multi device sync configuration of the device.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_multi_device_sync_config return the multi device sync configuration of the device.
*/
OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(const ob_device *device, ob_error **error);
/**
* @brief send the capture command to the device to trigger the capture.
* @brief The device will start one time capture after receiving the capture command when it is in the @ref OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING
*
* @attention The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream. The
* number of frames per trigger can be set by @ref framesPerTrigger.
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
* function should not be too high, please refer to the product manual for the specific supported frequency.
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_trigger_capture(ob_device *device, ob_error **error);
/**
* @brief set the timestamp reset configuration of the device.
*
* @param[in] device The device handle.
* @param[in] config The timestamp reset configuration.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_set_timestamp_reset_config(ob_device *device, const ob_device_timestamp_reset_config *config, ob_error **error);
/**
* @brief get the timestamp reset configuration of the device.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device_timestamp_reset_config return the timestamp reset configuration of the device.
*/
OB_EXPORT ob_device_timestamp_reset_config ob_device_get_timestamp_reset_config(ob_device *device, ob_error **error);
/**
* @brief send the timestamp reset command to the device.
* @brief The device will reset the timer for calculating the timestamp for output frames to 0 after receiving the timestamp reset command when the timestamp
* reset function is enabled. The timestamp reset function can be enabled by call @ref ob_device_set_timestamp_reset_config.
*
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will jump once after the timestamp reset.
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
* can call this function periodically to reset the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_timestamp_reset(ob_device *device, ob_error **error);
/**
* @brief Alias for @ref ob_device_timestamp_reset since it is more accurate.
*/
#define ob_device_timer_reset ob_device_timestamp_reset
/**
* @brief synchronize the timer of the device with the host.
* @brief After calling this function, the timer of the device will be synchronized with the host. User can call this function to multiple devices to
* synchronize all timers of the devices.
*
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will may jump once after the timer sync.
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
* can call this function periodically to synchronize the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
*
* @param[in] device The device handle.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_timer_sync_with_host(ob_device *device, ob_error **error);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -1,335 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Pipeline.h
* @brief The SDK's advanced API can quickly implement functions such as switching streaming, frame synchronization, software filtering, etc., suitable for
* applications, and the algorithm focuses on rgbd data stream scenarios. If you are on real-time or need to handle synchronization separately, align the scene.
* Please use the interface of Device's Lower API.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Create a pipeline object
*
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_pipeline* return the pipeline object
*/
OB_EXPORT ob_pipeline *ob_create_pipeline(ob_error **error);
/**
* @brief Using device objects to create pipeline objects
*
* @param[in] dev Device object used to create pipeline
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_pipeline* return the pipeline object
*/
OB_EXPORT ob_pipeline *ob_create_pipeline_with_device(const ob_device *dev, ob_error **error);
/**
* @brief Delete pipeline objects
*
* @param[in] pipeline The pipeline object to be deleted
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_pipeline(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Start the pipeline with default parameters
*
* @param[in] pipeline pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_start(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Start the pipeline with configuration parameters
*
* @param[in] pipeline pipeline object
* @param[in] config Parameters to be configured
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_start_with_config(ob_pipeline *pipeline, const ob_config *config, ob_error **error);
/**
* @brief Start the pipeline and set the frame collection data callback
*
* @attention After start the pipeline with this interface, the frames will be output to the callback function and cannot be obtained frames by call
* @ob_pipeline_wait_for_frameset
*
* @param[in] pipeline pipeline object
* @param[in] config Parameters to be configured
* @param[in] callback Trigger a callback when all frame data in the frameset arrives
* @param[in] user_data Pass in any user data and get it from the callback
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_start_with_callback(ob_pipeline *pipeline, const ob_config *config, ob_frameset_callback callback, void *user_data,
ob_error **error);
/**
* @brief Stop pipeline
*
* @param[in] pipeline pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_stop(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Get the configuration object associated with the pipeline
* @brief Returns default configuration if the user has not configured
*
* @param[in] pipeline The pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_config* The configuration object
*/
OB_EXPORT ob_config *ob_pipeline_get_config(const ob_pipeline *pipeline, ob_error **error);
/**
* @brief Switch the corresponding configuration
*
* @param[in] pipeline The pipeline object
* @param[in] config The pipeline configuration
* @param[out] error Log error messages
*/
OB_EXPORT void ob_pipeline_switch_config(ob_pipeline *pipeline, ob_config *config, ob_error **error);
/**
* @brief Wait for a set of frames to be returned synchronously
*
* @param[in] pipeline The pipeline object
* @param[in] timeout_ms The timeout for waiting (in milliseconds)
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_frame* The frameset that was waited for. A frameset is a special frame that can be used to obtain independent frames from the set.
*/
OB_EXPORT ob_frame *ob_pipeline_wait_for_frameset(ob_pipeline *pipeline, uint32_t timeout_ms, ob_error **error);
/**
* @brief Get the device object associated with the pipeline
*
* @param[in] pipeline The pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_device* The device object
*/
OB_EXPORT ob_device *ob_pipeline_get_device(const ob_pipeline *pipeline, ob_error **error);
/**
* @brief Get the stream profile list associated with the pipeline
*
* @param[in] pipeline The pipeline object
* @param[in] sensorType The sensor type. The supported sensor types can be obtained through the ob_device_get_sensor_list() interface.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile_list* The stream profile list
*/
OB_EXPORT ob_stream_profile_list *ob_pipeline_get_stream_profile_list(const ob_pipeline *pipeline, ob_sensor_type sensorType, ob_error **error);
/**
* @brief Enable frame synchronization
* @brief Synchronize the frames of different streams by using the timestamp information of the frames.
* @brief Dynamically (when pipeline is started) enable/disable frame synchronization is allowed.
*
* @param[in] pipeline The pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_enable_frame_sync(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Disable frame synchronization
*
* @param[in] pipeline The pipeline object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_pipeline_disable_frame_sync(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Return a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
*
* @param[in] pipeline The pipeline object
* @param[in] color_profile The input profile of the color sensor
* @param[in] align_mode The input align mode
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile_list* The list of D2C-enabled depth sensor resolutions
*/
OB_EXPORT ob_stream_profile_list *ob_get_d2c_depth_profile_list(const ob_pipeline *pipeline, const ob_stream_profile *color_profile, ob_align_mode align_mode,
ob_error **error);
/**
* @brief Create the pipeline configuration
*
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_config* The configuration object
*/
OB_EXPORT ob_config *ob_create_config(ob_error **error);
/**
* @brief Delete the pipeline configuration
*
* @param[in] config The configuration to be deleted
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_config(ob_config *config, ob_error **error);
/**
* @brief Enable a stream with default profile
*
* @param[in] config The pipeline configuration object
* @param[in] stream_type The type of the stream to be enabled
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_enable_stream(ob_config *config, ob_stream_type stream_type, ob_error **error);
/**
* @brief Enable all streams in the pipeline configuration
*
* @param[in] config The pipeline configuration
* @param[out] error Log error messages
*/
OB_EXPORT void ob_config_enable_all_stream(ob_config *config, ob_error **error);
/**
* @brief Enable a stream according to the stream profile
*
* @param[in] config The pipeline configuration object
* @param[in] profile The stream profile to be enabled
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_enable_stream_with_stream_profile(ob_config *config, const ob_stream_profile *profile, ob_error **error);
/**
* @brief Enable video stream with specified parameters
*
* @attention The stream_type should be a video stream type, such as OB_STREAM_IR, OB_STREAM_COLOR, OB_STREAM_DEPTH, etc.
*
* @param[in] config The pipeline configuration object
* @param[in] stream_type The type of the stream to be enabled
* @param[in] width The width of the video stream
* @param[in] height The height of the video stream
* @param[in] fps The frame rate of the video stream
* @param[in] format The format of the video stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_enable_video_stream(ob_config *config, ob_stream_type stream_type, uint32_t width, uint32_t height, uint32_t fps, ob_format format,
ob_error **error);
/**
* @brief Enable accelerometer stream with specified parameters
*
* @param[in] config The pipeline configuration object
* @param[in] full_scale_range The full scale range of the accelerometer
* @param[in] sample_rate The sample rate of the accelerometer
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_enable_accel_stream(ob_config *config, ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
/**
* @brief Enable gyroscope stream with specified parameters
*
* @param[in] config The pipeline configuration object
* @param[in] full_scale_range The full scale range of the gyroscope
* @param[in] sample_rate The sample rate of the gyroscope
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_enable_gyro_stream(ob_config *config, ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
/**
* @brief Get the enabled stream profile list in the pipeline configuration
*
* @param config The pipeline configuration object
* @param error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile_list* The enabled stream profile list, should be released by @ref ob_delete_stream_profile_list after use
*/
OB_EXPORT ob_stream_profile_list *ob_config_get_enabled_stream_profile_list(const ob_config *config, ob_error **error);
/**
* @brief Disable a specific stream in the pipeline configuration
*
* @param[in] config The pipeline configuration object
* @param[in] type The type of stream to be disabled
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_disable_stream(ob_config *config, ob_stream_type type, ob_error **error);
/**
* @brief Disable all streams in the pipeline configuration
*
* @param[in] config The pipeline configuration object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_disable_all_stream(ob_config *config, ob_error **error);
/**
* @brief Set the alignment mode for the pipeline configuration
*
* @param[in] config The pipeline configuration object
* @param[in] mode The alignment mode to be set
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_set_align_mode(ob_config *config, ob_align_mode mode, ob_error **error);
/**
* @brief Set whether depth scaling is required after enable depth to color alignment
* @brief After enabling depth to color alignment, the depth image may need to be scaled to match the color image size.
*
* @param[in] config The pipeline configuration object
* @param[in] enable Whether scaling is required
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_set_depth_scale_after_align_require(ob_config *config, bool enable, ob_error **error);
/**
* @brief Set the frame aggregation output mode for the pipeline configuration
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
*
* @param[in] config The pipeline configuration object
* @param[in] mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_config_set_frame_aggregate_output_mode(ob_config *config, ob_frame_aggregate_output_mode mode, ob_error **error);
/**
* @brief Get current camera parameters
* @attention If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
*
* @param[in] pipeline pipeline object
* @param[out] error Log error messages
* @return ob_camera_param The camera internal parameters
*/
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param(ob_pipeline *pipeline, ob_error **error);
/**
* @brief Get the current camera parameters
*
* @param[in] pipeline pipeline object
* @param[in] colorWidth color width
* @param[in] colorHeight color height
* @param[in] depthWidth depth width
* @param[in] depthHeight depth height
* @param[out] error Log error messages
* @return ob_camera_param returns camera internal parameters
*/
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param_with_profile(ob_pipeline *pipeline, uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth,
uint32_t depthHeight, ob_error **error);
/**
* @brief Get device calibration parameters with the specified configuration
*
* @param[in] pipeline pipeline object
* @param[in] config The pipeline configuration
* @param[out] error Log error messages
* @return ob_calibration_param The calibration parameters
*/
OB_EXPORT ob_calibration_param ob_pipeline_get_calibration_param(ob_pipeline *pipeline, ob_config *config, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_config_set_depth_scale_require ob_config_set_depth_scale_after_align_require
#ifdef __cplusplus
}
#endif

View File

@@ -1,902 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Property.h
* @brief Control command property list maintenance
*/
#pragma once
#include "ObTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Enumeration value describing all attribute control commands of the device
*/
typedef enum {
/**
* @brief LDP switch
*/
OB_PROP_LDP_BOOL = 2,
/**
* @brief Laser switch
*/
OB_PROP_LASER_BOOL = 3,
/**
* @brief laser pulse width
*/
OB_PROP_LASER_PULSE_WIDTH_INT = 4,
/**
* @brief Laser current (uint: mA)
*/
OB_PROP_LASER_CURRENT_FLOAT = 5,
/**
* @brief IR flood switch
*/
OB_PROP_FLOOD_BOOL = 6,
/**
* @brief IR flood level
*/
OB_PROP_FLOOD_LEVEL_INT = 7,
/**
* @brief Enable/disable temperature compensation
*
*/
OB_PROP_TEMPERATURE_COMPENSATION_BOOL = 8,
/**
* @brief Depth mirror
*/
OB_PROP_DEPTH_MIRROR_BOOL = 14,
/**
* @brief Depth flip
*/
OB_PROP_DEPTH_FLIP_BOOL = 15,
/**
* @brief Depth Postfilter
*/
OB_PROP_DEPTH_POSTFILTER_BOOL = 16,
/**
* @brief Depth Holefilter
*/
OB_PROP_DEPTH_HOLEFILTER_BOOL = 17,
/**
* @brief IR mirror
*/
OB_PROP_IR_MIRROR_BOOL = 18,
/**
* @brief IR flip
*/
OB_PROP_IR_FLIP_BOOL = 19,
/**
* @brief Minimum depth threshold
*/
OB_PROP_MIN_DEPTH_INT = 22,
/**
* @brief Maximum depth threshold
*/
OB_PROP_MAX_DEPTH_INT = 23,
/**
* @brief Software filter switch
*/
OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_BOOL = 24,
/**
* @brief LDP status
*/
OB_PROP_LDP_STATUS_BOOL = 32,
/**
* @brief maxdiff for depth noise removal filter
*/
OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_MAX_DIFF_INT = 40,
/**
* @brief maxSpeckleSize for depth noise removal filter
*/
OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_MAX_SPECKLE_SIZE_INT = 41,
/**
* @brief Hardware d2c is on
*/
OB_PROP_DEPTH_ALIGN_HARDWARE_BOOL = 42,
/**
* @brief Timestamp adjustment
*/
OB_PROP_TIMESTAMP_OFFSET_INT = 43,
/**
* @brief Hardware distortion switch Rectify
*/
OB_PROP_HARDWARE_DISTORTION_SWITCH_BOOL = 61,
/**
* @brief Fan mode switch
*/
OB_PROP_FAN_WORK_MODE_INT = 62,
/**
* @brief Multi-resolution D2C mode
*/
OB_PROP_DEPTH_ALIGN_HARDWARE_MODE_INT = 63,
/**
* @brief Anti_collusion activation status
*/
OB_PROP_ANTI_COLLUSION_ACTIVATION_STATUS_BOOL = 64,
/**
* @brief the depth precision level, which may change the depth frame data unit, needs to be confirmed through the ValueScale interface of
* DepthFrame
*/
OB_PROP_DEPTH_PRECISION_LEVEL_INT = 75,
/**
* @brief tof filter range configuration
*/
OB_PROP_TOF_FILTER_RANGE_INT = 76,
/**
* @brief laser mode, the firmware terminal currently only return 1: IR Drive, 2: Torch
*/
OB_PROP_LASER_MODE_INT = 79,
/**
* @brief brt2r-rectify function switch (brt2r is a special module on mx6600), 0: Disable, 1: Rectify Enable
*/
OB_PROP_RECTIFY2_BOOL = 80,
/**
* @brief Color mirror
*/
OB_PROP_COLOR_MIRROR_BOOL = 81,
/**
* @brief Color flip
*/
OB_PROP_COLOR_FLIP_BOOL = 82,
/**
* @brief Indicator switch, 0: Disable, 1: Enable
*/
OB_PROP_INDICATOR_LIGHT_BOOL = 83,
/**
* @brief Disparity to depth switch, false: switch to software disparity convert to depth, true: switch to hardware disparity convert to depth
*/
OB_PROP_DISPARITY_TO_DEPTH_BOOL = 85,
/**
* @brief BRT function switch (anti-background interference), 0: Disable, 1: Enable
*/
OB_PROP_BRT_BOOL = 86,
/**
* @brief Watchdog function switch, 0: Disable, 1: Enable
*/
OB_PROP_WATCHDOG_BOOL = 87,
/**
* @brief External signal trigger restart function switch, 0: Disable, 1: Enable
*/
OB_PROP_EXTERNAL_SIGNAL_RESET_BOOL = 88,
/**
* @brief Heartbeat monitoring function switch, 0: Disable, 1: Enable
*/
OB_PROP_HEARTBEAT_BOOL = 89,
/**
* @brief Depth cropping mode device: OB_DEPTH_CROPPING_MODE
*/
OB_PROP_DEPTH_CROPPING_MODE_INT = 90,
/**
* @brief D2C preprocessing switch (such as RGB cropping), 0: off, 1: on
*/
OB_PROP_D2C_PREPROCESS_BOOL = 91,
/**
* @brief Enable/disable GPM function
*/
OB_PROP_GPM_BOOL = 93,
/**
* @brief Custom RGB cropping switch, 0 is off, 1 is on custom cropping, and the ROI cropping area is issued
*/
OB_PROP_RGB_CUSTOM_CROP_BOOL = 94,
/**
* @brief Device operating mode (power consumption)
*/
OB_PROP_DEVICE_WORK_MODE_INT = 95,
/**
* @brief Device communication type, 0: USB; 1: Ethernet(RTSP)
*/
OB_PROP_DEVICE_COMMUNICATION_TYPE_INT = 97,
/**
* @brief Switch infrared imaging mode, 0: active IR mode, 1: passive IR mode
*/
OB_PROP_SWITCH_IR_MODE_INT = 98,
/**
* @brief Laser power level
*/
OB_PROP_LASER_POWER_LEVEL_CONTROL_INT = 99,
/**
* @brief LDP's measure distance, unit: mm
*/
OB_PROP_LDP_MEASURE_DISTANCE_INT = 100,
/**
* @brief Reset device time to zero
*/
OB_PROP_TIMER_RESET_SIGNAL_BOOL = 104,
/**
* @brief Enable send reset device time signal to other device. true: enable, false: disable
*/
OB_PROP_TIMER_RESET_TRIGGER_OUT_ENABLE_BOOL = 105,
/**
* @brief Delay to reset device time, unit: us
*/
OB_PROP_TIMER_RESET_DELAY_US_INT = 106,
/**
* @brief Signal to capture image
*/
OB_PROP_CAPTURE_IMAGE_SIGNAL_BOOL = 107,
/**
* @brief Right IR sensor mirror state
*/
OB_PROP_IR_RIGHT_MIRROR_BOOL = 112,
/**
* @brief Number frame to capture once a 'OB_PROP_CAPTURE_IMAGE_SIGNAL_BOOL' effect. range: [1, 255]
*/
OB_PROP_CAPTURE_IMAGE_FRAME_NUMBER_INT = 113,
/**
* @brief Right IR sensor flip state. true: flip image, false: origin, default: false
*/
OB_PROP_IR_RIGHT_FLIP_BOOL = 114,
/**
* @brief Color sensor rotation, angle{0, 90, 180, 270}
*/
OB_PROP_COLOR_ROTATE_INT = 115,
/**
* @brief IR/Left-IR sensor rotation, angle{0, 90, 180, 270}
*/
OB_PROP_IR_ROTATE_INT = 116,
/**
* @brief Right IR sensor rotation, angle{0, 90, 180, 270}
*/
OB_PROP_IR_RIGHT_ROTATE_INT = 117,
/**
* @brief Depth sensor rotation, angle{0, 90, 180, 270}
*/
OB_PROP_DEPTH_ROTATE_INT = 118,
/**
* @brief Get hardware laser power actual level which real state of laser element. OB_PROP_LASER_POWER_LEVEL_CONTROL_INT99 will effect this command
* which it setting and changed the hardware laser energy level.
*/
OB_PROP_LASER_POWER_ACTUAL_LEVEL_INT = 119,
/**
* @brief USB's power state, enum type: OBUSBPowerState
*/
OB_PROP_USB_POWER_STATE_INT = 121,
/**
* @brief DC's power state, enum type: OBDCPowerState
*/
OB_PROP_DC_POWER_STATE_INT = 122,
/**
* @brief Device development mode switch, optional modes can refer to the definition in @ref OBDeviceDevelopmentMode,the default mode is
* @ref OB_USER_MODE
* @attention The device takes effect after rebooting when switching modes.
*/
OB_PROP_DEVICE_DEVELOPMENT_MODE_INT = 129,
/**
* @brief Multi-DeviceSync synchronized signal trigger out is enable state. true: enable, false: disable
*/
OB_PROP_SYNC_SIGNAL_TRIGGER_OUT_BOOL = 130,
/**
* @brief Restore factory settings and factory parameters
* @attention This command can only be written, and the parameter value must be true. The command takes effect after restarting the device.
*/
OB_PROP_RESTORE_FACTORY_SETTINGS_BOOL = 131,
/**
* @brief Enter recovery mode (flashing mode) when boot the device
* @attention The device will take effect after rebooting with the enable option. After entering recovery mode, you can upgrade the device system. Upgrading
* the system may cause system damage, please use it with caution.
*/
OB_PROP_BOOT_INTO_RECOVERY_MODE_BOOL = 132,
/**
* @brief Query whether the current device is running in recovery mode (read-only)
*/
OB_PROP_DEVICE_IN_RECOVERY_MODE_BOOL = 133,
/**
* @brief Capture interval mode, 0:time interval, 1:number interval
*/
OB_PROP_CAPTURE_INTERVAL_MODE_INT = 134,
/**
* @brief Capture time interval
*/
OB_PROP_CAPTURE_IMAGE_TIME_INTERVAL_INT = 135,
/**
* @brief Capture number interval
*/
OB_PROP_CAPTURE_IMAGE_NUMBER_INTERVAL_INT = 136,
/*
* @brief Timer reset function enable
*/
OB_PROP_TIMER_RESET_ENABLE_BOOL = 140,
/**
* @brief Enable or disable the device to retry USB2.0 re-identification when the device is connected to a USB2.0 port.
* @brief This feature ensures that the device is not mistakenly identified as a USB 2.0 device when connected to a USB 3.0 port.
*/
OB_PROP_DEVICE_USB2_REPEAT_IDENTIFY_BOOL = 141,
/**
* @brief Reboot device delay mode. Delay time unit: ms, range: [0, 8000).
*/
OB_PROP_DEVICE_REBOOT_DELAY_INT = 142,
/**
* @brief Query the status of laser overcurrent protection (read-only)
*/
OB_PROP_LASER_OVERCURRENT_PROTECTION_STATUS_BOOL = 148,
/**
* @brief Query the status of laser pulse width protection (read-only)
*/
OB_PROP_LASER_PULSE_WIDTH_PROTECTION_STATUS_BOOL = 149,
/**
* @brief Laser always on, true: always on, false: off, laser will be turned off when out of exposure time
*/
OB_PROP_LASER_ALWAYS_ON_BOOL = 174,
/**
* @brief Laser on/off alternate mode, 0: off, 1: on-off alternate, 2: off-on alternate
* @attention When turn on this mode, the laser will turn on and turn off alternately each frame.
*/
OB_PROP_LASER_ON_OFF_PATTERN_INT = 175,
/**
* @brief Depth unit flexible adjustment\
* @brief This property allows continuous adjustment of the depth unit, unlike @ref OB_PROP_DEPTH_PRECISION_LEVEL_INT must be set to some fixed value.
*/
OB_PROP_DEPTH_UNIT_FLEXIBLE_ADJUSTMENT_FLOAT = 176,
/**
* @brief Laser control, 0: off, 1: on, 2: auto
*
*/
OB_PROP_LASER_CONTROL_INT = 182,
/**
* @brief IR brightness
*/
OB_PROP_IR_BRIGHTNESS_INT = 184,
/**
* @brief Slave/secondary device synchronization status (read-only)
*/
OB_PROP_SLAVE_DEVICE_SYNC_STATUS_BOOL = 188,
/**
* @brief Color AE max exposure
*/
OB_PROP_COLOR_AE_MAX_EXPOSURE_INT = 189,
/**
* @brief Max exposure time of IR auto exposure
*/
OB_PROP_IR_AE_MAX_EXPOSURE_INT = 190,
/**
* @brief Disparity search range mode, 1: 128, 2: 256
*/
OB_PROP_DISP_SEARCH_RANGE_MODE_INT = 191,
/**
* @brief Laser high temperature protection
*/
OB_PROP_LASER_HIGH_TEMPERATURE_PROTECT_BOOL = 193,
/**
* @brief low exposure laser control
*
* @brief Currently using for DabaiA device,if the exposure value is lower than a certain threshold, the laser is turned off;
* if it exceeds another threshold, the laser is turned on again.
*/
OB_PROP_LOW_EXPOSURE_LASER_CONTROL_BOOL = 194,
/**
* @brief check pps sync in signal
*/
OB_PROP_CHECK_PPS_SYNC_IN_SIGNAL_BOOL = 195,
/**
* @brief Disparity search range offset, range: [0, 127]
*/
OB_PROP_DISP_SEARCH_OFFSET_INT = 196,
/**
* @brief Repower device (cut off power and power on again)
*
* @brief Currently using for GMSL device, cut off power and power on again by GMSL host driver.
*/
OB_PROP_DEVICE_REPOWER_BOOL = 202,
/**
* @brief frame interleave config index
*/
OB_PROP_FRAME_INTERLEAVE_CONFIG_INDEX_INT = 204,
/**
* @brief frame interleave enable (true:enable,false:disable)
*/
OB_PROP_FRAME_INTERLEAVE_ENABLE_BOOL = 205,
/**
* @brief laser pattern sync with delay(us)
*/
OB_PROP_FRAME_INTERLEAVE_LASER_PATTERN_SYNC_DELAY_INT = 206,
/**
* @brief Get the health check result from device,range is [0.0f,1.5f]
*/
OB_PROP_ON_CHIP_CALIBRATION_HEALTH_CHECK_FLOAT = 209,
/**
* @brief Enable or disable on-chip calibration
*/
OB_PROP_ON_CHIP_CALIBRATION_ENABLE_BOOL = 210,
/**
* @brief hardware noise remove filter switch
*/
OB_PROP_HW_NOISE_REMOVE_FILTER_ENABLE_BOOL = 211,
/**
* @brief hardware noise remove filter threshold ,range [0.0 - 1.0]
*/
OB_PROP_HW_NOISE_REMOVE_FILTER_THRESHOLD_FLOAT = 212,
/**
* @brief soft trigger auto capture enable, use in OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode
*/
OB_DEVICE_AUTO_CAPTURE_ENABLE_BOOL = 216,
/**
* @brief soft trigger auto capture interval time, use in OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode
*/
OB_DEVICE_AUTO_CAPTURE_INTERVAL_TIME_INT = 217,
/**
* @brief PTP time synchronization enable
*/
OB_DEVICE_PTP_CLOCK_SYNC_ENABLE_BOOL = 223,
/**
* @brief Depth with confidence stream enable
*/
OB_PROP_DEPTH_WITH_CONFIDENCE_STREAM_ENABLE_BOOL = 224,
/**
* @brief Enable or disable confidence stream filter
*/
OB_PROP_CONFIDENCE_STREAM_FILTER_BOOL = 226,
/**
* @brief Confidence stream filter threshold, range [0, 255]
*/
OB_PROP_CONFIDENCE_STREAM_FILTER_THRESHOLD_INT = 227,
/**
* @brief Confidence stream mirror enable
*/
OB_PROP_CONFIDENCE_MIRROR_BOOL = 229,
/**
* @brief Confidence stream flip enable
*/
OB_PROP_CONFIDENCE_FLIP_BOOL = 230,
/**
* @brief Confidence stream rotate angle{0, 90, 180, 270}
*/
OB_PROP_CONFIDENCE_ROTATE_INT = 231,
/**
* @brief Baseline calibration parameters
*/
OB_STRUCT_BASELINE_CALIBRATION_PARAM = 1002,
/**
* @brief Device temperature information
*/
OB_STRUCT_DEVICE_TEMPERATURE = 1003,
/**
* @brief TOF exposure threshold range
*/
OB_STRUCT_TOF_EXPOSURE_THRESHOLD_CONTROL = 1024,
/**
* @brief get/set serial number
*/
OB_STRUCT_DEVICE_SERIAL_NUMBER = 1035,
/**
* @brief get/set device time
*/
OB_STRUCT_DEVICE_TIME = 1037,
/**
* @brief Multi-device synchronization mode and parameter configuration
*/
OB_STRUCT_MULTI_DEVICE_SYNC_CONFIG = 1038,
/**
* @brief RGB cropping ROI
*/
OB_STRUCT_RGB_CROP_ROI = 1040,
/**
* @brief Device IP address configuration
*/
OB_STRUCT_DEVICE_IP_ADDR_CONFIG = 1041,
/**
* @brief The current camera depth mode
*/
OB_STRUCT_CURRENT_DEPTH_ALG_MODE = 1043,
/**
* @brief A list of depth accuracy levels, returning an array of uin16_t, corresponding to the enumeration
*/
OB_STRUCT_DEPTH_PRECISION_SUPPORT_LIST = 1045,
/**
* @brief Device network static ip config record
* @brief Using for get last static ip config, witch is record in device flash when user set static ip config
*
* @attention read only
*/
OB_STRUCT_DEVICE_STATIC_IP_CONFIG_RECORD = 1053,
/**
* @brief Using to configure the depth sensor's HDR mode
* @brief The Value type is @ref OBHdrConfig
*
* @attention After enable HDR mode, the depth sensor auto exposure will be disabled.
*/
OB_STRUCT_DEPTH_HDR_CONFIG = 1059,
/**
* @brief Color Sensor AE ROI configuration
* @brief The Value type is @ref OBRegionOfInterest
*/
OB_STRUCT_COLOR_AE_ROI = 1060,
/**
* @brief Depth Sensor AE ROI configuration
* @brief The Value type is @ref OBRegionOfInterest
* @brief Since the ir sensor is the same physical sensor as the depth sensor, this property will also effect the ir sensor.
*/
OB_STRUCT_DEPTH_AE_ROI = 1061,
/**
* @brief ASIC serial number
*/
OB_STRUCT_ASIC_SERIAL_NUMBER = 1063,
/**
* @brief Disparity offset interleaving
*/
OB_STRUCT_DISP_OFFSET_CONFIG = 1064,
/**
* @brief Preset resolution ratio configuration
*/
OB_STRUCT_PRESET_RESOLUTION_CONFIG = 1069,
/**
* @brief Color camera auto exposure
*/
OB_PROP_COLOR_AUTO_EXPOSURE_BOOL = 2000,
/**
* @brief Color camera exposure adjustment
*/
OB_PROP_COLOR_EXPOSURE_INT = 2001,
/**
* @brief Color camera gain adjustment
*/
OB_PROP_COLOR_GAIN_INT = 2002,
/**
* @brief Color camera automatic white balance
*/
OB_PROP_COLOR_AUTO_WHITE_BALANCE_BOOL = 2003,
/**
* @brief Color camera white balance adjustment
*/
OB_PROP_COLOR_WHITE_BALANCE_INT = 2004,
/**
* @brief Color camera brightness adjustment
*/
OB_PROP_COLOR_BRIGHTNESS_INT = 2005,
/**
* @brief Color camera sharpness adjustment
*/
OB_PROP_COLOR_SHARPNESS_INT = 2006,
/**
* @brief Color camera shutter adjustment
*/
OB_PROP_COLOR_SHUTTER_INT = 2007,
/**
* @brief Color camera saturation adjustment
*/
OB_PROP_COLOR_SATURATION_INT = 2008,
/**
* @brief Color camera contrast adjustment
*/
OB_PROP_COLOR_CONTRAST_INT = 2009,
/**
* @brief Color camera gamma adjustment
*/
OB_PROP_COLOR_GAMMA_INT = 2010,
/**
* @brief Color camera image rotation
*/
OB_PROP_COLOR_ROLL_INT = 2011,
/**
* @brief Color camera auto exposure priority
*/
OB_PROP_COLOR_AUTO_EXPOSURE_PRIORITY_INT = 2012,
/**
* @brief Color camera brightness compensation
*/
OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT = 2013,
/**
* @brief Color camera color tint
*/
OB_PROP_COLOR_HUE_INT = 2014,
/**
* @brief Color Camera Power Line Frequency
*/
OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT = 2015,
/**
* @brief Automatic exposure of depth camera (infrared camera will be set synchronously under some models of devices)
*/
OB_PROP_DEPTH_AUTO_EXPOSURE_BOOL = 2016,
/**
* @brief Depth camera exposure adjustment (infrared cameras will be set synchronously under some models of devices)
*/
OB_PROP_DEPTH_EXPOSURE_INT = 2017,
/**
* @brief Depth camera gain adjustment (infrared cameras will be set synchronously under some models of devices)
*/
OB_PROP_DEPTH_GAIN_INT = 2018,
/**
* @brief Infrared camera auto exposure (depth camera will be set synchronously under some models of devices)
*/
OB_PROP_IR_AUTO_EXPOSURE_BOOL = 2025,
/**
* @brief Infrared camera exposure adjustment (some models of devices will set the depth camera synchronously)
*/
OB_PROP_IR_EXPOSURE_INT = 2026,
/**
* @brief Infrared camera gain adjustment (the depth camera will be set synchronously under some models of devices)
*/
OB_PROP_IR_GAIN_INT = 2027,
/**
* @brief Select Infrared camera data source channel. If not support throw exception. 0 : IR stream from IR Left sensor; 1 : IR stream from IR Right sensor;
*/
OB_PROP_IR_CHANNEL_DATA_SOURCE_INT = 2028,
/**
* @brief Depth effect dedistortion, true: on, false: off. mutually exclusive with D2C function, RM_Filter disable When hardware or software D2C is enabled.
*/
OB_PROP_DEPTH_RM_FILTER_BOOL = 2029,
/**
* @brief Color camera maximal gain
*/
OB_PROP_COLOR_MAXIMAL_GAIN_INT = 2030,
/**
* @brief Color camera shutter gain
*/
OB_PROP_COLOR_MAXIMAL_SHUTTER_INT = 2031,
/**
* @brief The enable/disable switch for IR short exposure function, supported only by a few devices.
*/
OB_PROP_IR_SHORT_EXPOSURE_BOOL = 2032,
/**
* @brief Color camera HDR
*/
OB_PROP_COLOR_HDR_BOOL = 2034,
/**
* @brief IR long exposure mode switch read and write.
*/
OB_PROP_IR_LONG_EXPOSURE_BOOL = 2035,
/**
* @brief Setting and getting the USB device frame skipping mode status, true: frame skipping mode, false: non-frame skipping mode.
*/
OB_PROP_SKIP_FRAME_BOOL = 2036,
/**
* @brief Depth HDR merge, true: on, false: off.
*/
OB_PROP_HDR_MERGE_BOOL = 2037,
/**
* @brief Color camera FOCUS
*/
OB_PROP_COLOR_FOCUS_INT = 2038,
/**
* @brief ir rectify status,true: ir rectify, false: no rectify
*/
OB_PROP_IR_RECTIFY_BOOL = 2040,
/**
* @brief Depth camera priority
*
*/
OB_PROP_DEPTH_AUTO_EXPOSURE_PRIORITY_INT = 2052,
/**
* @brief Software disparity to depth
*/
OB_PROP_SDK_DISPARITY_TO_DEPTH_BOOL = 3004,
/**
* @brief Depth data unpacking function switch (each open stream will be turned on by default, support RLE/Y10/Y11/Y12/Y14 format)
*/
OB_PROP_SDK_DEPTH_FRAME_UNPACK_BOOL = 3007,
/**
* @brief IR data unpacking function switch (each current will be turned on by default, support RLE/Y10/Y11/Y12/Y14 format)
*/
OB_PROP_SDK_IR_FRAME_UNPACK_BOOL = 3008,
/**
* @brief Accel data conversion function switch (on by default)
*/
OB_PROP_SDK_ACCEL_FRAME_TRANSFORMED_BOOL = 3009,
/**
* @brief Gyro data conversion function switch (on by default)
*/
OB_PROP_SDK_GYRO_FRAME_TRANSFORMED_BOOL = 3010,
/**
* @brief Left IR frame data unpacking function switch (each current will be turned on by default, support RLE/Y10/Y11/Y12/Y14 format)
*/
OB_PROP_SDK_IR_LEFT_FRAME_UNPACK_BOOL = 3011,
/**
* @brief Right IR frame data unpacking function switch (each current will be turned on by default, support RLE/Y10/Y11/Y12/Y14 format)
*/
OB_PROP_SDK_IR_RIGHT_FRAME_UNPACK_BOOL = 3012,
/**
* @brief Read the current network bandwidth type of the network device, whether it is Gigabit Ethernet or Fast Ethernet, such as G335LE.
*/
OB_PROP_NETWORK_BANDWIDTH_TYPE_INT = 3027,
/**
* @brief Switch device performance mode, currently available in Adaptive Mode and High Performance Mode, such as G335LE.
*/
OB_PROP_DEVICE_PERFORMANCE_MODE_INT = 3028,
/**
* @brief Calibration JSON file read from device (Femto Mega, read only)
*/
OB_RAW_DATA_CAMERA_CALIB_JSON_FILE = 4029,
/**
* @brief Confidence degree
*/
OB_PROP_DEBUG_ESGM_CONFIDENCE_FLOAT = 5013,
} OBPropertyID,
ob_property_id;
// For backward compatibility
#define OB_PROP_TIMER_RESET_TRIGGLE_OUT_ENABLE_BOOL OB_PROP_TIMER_RESET_TRIGGER_OUT_ENABLE_BOOL
#define OB_PROP_LASER_ON_OFF_MODE_INT OB_PROP_LASER_ON_OFF_PATTERN_INT
#define OB_PROP_LASER_ENERGY_LEVEL_INT OB_PROP_LASER_POWER_LEVEL_CONTROL_INT
#define OB_PROP_LASER_HW_ENERGY_LEVEL_INT OB_PROP_LASER_POWER_ACTUAL_LEVEL_INT
#define OB_PROP_DEVICE_USB3_REPEAT_IDENTIFY_BOOL OB_PROP_DEVICE_USB2_REPEAT_IDENTIFY_BOOL
#define OB_PROP_DEPTH_SOFT_FILTER_BOOL OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_BOOL
#define OB_PROP_DEPTH_MAX_DIFF_INT OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_MAX_DIFF_INT
#define OB_PROP_DEPTH_MAX_SPECKLE_SIZE_INT OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_MAX_SPECKLE_SIZE_INT
/**
* @brief The data type used to describe all property settings
*/
typedef enum OBPropertyType {
OB_BOOL_PROPERTY = 0, /**< Boolean property */
OB_INT_PROPERTY = 1, /**< Integer property */
OB_FLOAT_PROPERTY = 2, /**< Floating-point property */
OB_STRUCT_PROPERTY = 3, /**< Struct property */
} OBPropertyType,
ob_property_type;
/**
* @brief Used to describe the characteristics of each property
*/
typedef struct OBPropertyItem {
OBPropertyID id; /**< Property ID */
const char *name; /**< Property name */
OBPropertyType type; /**< Property type */
OBPermissionType permission; /**< Property read and write permission */
} OBPropertyItem, ob_property_item;
#ifdef __cplusplus
}
#endif

View File

@@ -1,135 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file RecordPlayback.hpp
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
record and playback streaming data, etc.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "Device.h"
/**
* @brief Create a recording device for the specified device with a specified file path and compression enabled.
*
* @param[in] device The device to record.
* @param[in] file_path The file path to record to.
* @param[in] compression_enabled Whether to enable compression for the recording.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return A pointer to the newly created recording device, or NULL if an error occurred.
*/
OB_EXPORT ob_record_device *ob_create_record_device(ob_device *device, const char *file_path, bool compression_enabled, ob_error **error);
/**
* @brief Delete a recording device.
*
* @param[in] recorder The recording device to delete.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_record_device(ob_record_device *recorder, ob_error **error);
/**
* @brief Pause recording on the specified recording device.
*
* @param[in] recorder The recording device to pause.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_record_device_pause(ob_record_device *recorder, ob_error **error);
/**
* @brief Resume recording on the specified recording device.
*
* @param[in] recorder The recording device to resume.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_record_device_resume(ob_record_device *recorder, ob_error **error);
/**
* @brief Create a playback device for the specified file path.
*
* @param[in] file_path The file path to playback from.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return A pointer to the newly created playback device, or NULL if an error occurred.
*/
OB_EXPORT ob_device *ob_create_playback_device(const char *file_path, ob_error **error);
/**
* @brief Pause playback on the specified playback device.
*
* @param[in] player The playback device to pause.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_playback_device_pause(ob_device *player, ob_error **error);
/**
* @brief Resume playback on the specified playback device.
*
* @param[in] player The playback device to resume.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_playback_device_resume(ob_device *player, ob_error **error);
/**
* @brief Set the playback to a specified time point of the played data.
*
* @param[in] player The playback device to set the position for.
* @param[in] timestamp The position to set the playback to, in milliseconds.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_playback_device_seek(ob_device *player, const uint64_t timestamp, ob_error **error);
/**
* @brief Set the playback to a specified time point of the played data.
*
* @param[in] player The playback device to set the position for.
* @param[in] rate The playback rate to set.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_playback_device_set_playback_rate(ob_device *player, const float rate, ob_error **error);
/**
* @brief Get the current playback status of the played data.
*
* @param[in] player The playback device to get the status for.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The current playback status of the played data.
*/
OB_EXPORT ob_playback_status ob_playback_device_get_current_playback_status(ob_device *player, ob_error **error);
/**
* @brief Set a callback function to receive playback status updates.
*
* @param[in] player The playback device to set the callback for.
* @param[in] callback The callback function to receive playback status updates.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_playback_device_set_playback_status_changed_callback(ob_device *player, ob_playback_status_changed_callback callback, void *user_data,
ob_error **error);
/**
* @brief Get the current playback position of the played data.
*
* @param[in] player The playback device to get the position for.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The current playback position of the played data, in milliseconds.
*/
OB_EXPORT uint64_t ob_playback_device_get_position(ob_device *player, ob_error **error);
/**
* @brief Get the duration of the played data.
*
* @param[in] player The playback device to get the duration for.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The duration of the played data, in milliseconds.
*/
OB_EXPORT uint64_t ob_playback_device_get_duration(ob_device *player, ob_error **error);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -1,132 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Sensor.h
* @brief Defines types related to sensors, used for obtaining stream configurations, opening and closing streams, and setting and getting sensor properties.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Get the type of the sensor.
*
* @param[in] sensor The sensor object.
* @param[out] error Logs error messages.
* @return The sensor type.
*/
OB_EXPORT ob_sensor_type ob_sensor_get_type(const ob_sensor *sensor, ob_error **error);
/**
* @brief Get a list of all supported stream profiles.
*
* @param[in] sensor The sensor object.
* @param[out] error Logs error messages.
* @return A list of stream profiles.
*/
OB_EXPORT ob_stream_profile_list *ob_sensor_get_stream_profile_list(const ob_sensor *sensor, ob_error **error);
/**
* @brief Open the current sensor and set the callback data frame.
*
* @param[in] sensor The sensor object.
* @param[in] profile The stream configuration information.
* @param[in] callback The callback function triggered when frame data arrives.
* @param[in] user_data Any user data to pass in and get from the callback.
* @param[out] error Logs error messages.
*/
OB_EXPORT void ob_sensor_start(ob_sensor *sensor, const ob_stream_profile *profile, ob_frame_callback callback, void *user_data, ob_error **error);
/**
* @brief Stop the sensor stream.
*
* @param[in] sensor The sensor object.
* @param[out] error Logs error messages.
*/
OB_EXPORT void ob_sensor_stop(ob_sensor *sensor, ob_error **error);
/**
* @brief Switch resolutions.
*
* @param[in] sensor The sensor object.
* @param[in] profile The stream configuration information.
* @param[out] error Logs error messages.
*/
OB_EXPORT void ob_sensor_switch_profile(ob_sensor *sensor, ob_stream_profile *profile, ob_error **error);
/**
* @brief Delete a sensor object.
*
* @param[in] sensor The sensor object to delete.
* @param[out] error Logs error messages.
*/
OB_EXPORT void ob_delete_sensor(ob_sensor *sensor, ob_error **error);
/**
* @brief Create a list of recommended filters for the specified sensor.
*
* @param[in] sensor The ob_sensor object.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_filter_list
*/
OB_EXPORT ob_filter_list *ob_sensor_create_recommended_filter_list(const ob_sensor *sensor, ob_error **error);
/**
* @brief Get the number of sensors in the sensor list.
*
* @param[in] sensor_list The list of sensor objects.
* @param[out] error Logs error messages.
* @return The number of sensors in the list.
*/
OB_EXPORT uint32_t ob_sensor_list_get_count(const ob_sensor_list *sensor_list, ob_error **error);
/**
* @brief Get the sensor type.
*
* @param[in] sensor_list The list of sensor objects.
* @param[in] index The index of the sensor on the list.
* @param[out] error Logs error messages.
* @return The sensor type.
*/
OB_EXPORT ob_sensor_type ob_sensor_list_get_sensor_type(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
/**
* @brief Get a sensor by sensor type.
*
* @param[in] sensor_list The list of sensor objects.
* @param[in] sensorType The sensor type to be obtained.
* @param[out] error Logs error messages.
* @return The sensor pointer. If the specified type of sensor does not exist, it will return null.
*/
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor_by_type(const ob_sensor_list *sensor_list, ob_sensor_type sensorType, ob_error **error);
/**
* @brief Get a sensor by index number.
*
* @param[in] sensor_list The list of sensor objects.
* @param[in] index The index of the sensor on the list.
* @param[out] error Logs error messages.
* @return The sensor object.
*/
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
/**
* @brief Delete a list of sensor objects.
*
* @param[in] sensor_list The list of sensor objects to delete.
* @param[out] error Logs error messages.
*/
OB_EXPORT void ob_delete_sensor_list(ob_sensor_list *sensor_list, ob_error **error);
#define ob_sensor_list_get_sensor_count ob_sensor_list_get_count
#define ob_sensor_get_recommended_filter_list ob_sensor_create_recommended_filter_list
#ifdef __cplusplus
}
#endif

View File

@@ -1,417 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file StreamProfile.h
* @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Create a stream profile object
*
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile* return the stream profile object
*/
OB_EXPORT ob_stream_profile *ob_create_stream_profile(ob_stream_type type, ob_format format, ob_error **error);
/**
* @brief Create a video stream profile object
*
* @param[in] type Stream type
* @param[in] format Stream format
* @param[in] width Stream width
* @param[in] height Stream height
* @param[in] fps Stream frame rate
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile* return the video stream profile object
*/
OB_EXPORT ob_stream_profile *ob_create_video_stream_profile(ob_stream_type type, ob_format format, uint32_t width, uint32_t height, uint32_t fps,
ob_error **error);
/**
* @brief Create a accel stream profile object
*
* @param[in] full_scale_range Accel full scale range
* @param[in] sample_rate Accel sample rate
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile* return the accel stream profile object
*/
OB_EXPORT ob_stream_profile *ob_create_accel_stream_profile(ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
/**
* @brief Create a gyro stream profile object
*
* @param[in] full_scale_range Gyro full scale range
* @param[in] sample_rate Gyro sample rate
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_profile* return the accel stream profile object
*/
OB_EXPORT ob_stream_profile *ob_create_gyro_stream_profile(ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
/**
* @brief Copy the stream profile object from an other stream profile object
*
* @param[in] srcProfile Source stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_stream_profile* return the new stream profile object
*/
OB_EXPORT ob_stream_profile *ob_create_stream_profile_from_other_stream_profile(const ob_stream_profile *srcProfile, ob_error **error);
/**
* @brief Copy the stream profile object with a new format object
*
* @param[in] profile Stream profile object
* @param[in] new_format New format
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return ob_stream_profile* return the new stream profile object with the new format
*/
OB_EXPORT ob_stream_profile *ob_create_stream_profile_with_new_format(const ob_stream_profile *profile, ob_format new_format, ob_error **error);
/**
* @brief Delete the stream configuration.
*
* @param[in] profile Stream profile object .
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_stream_profile(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get stream profile format
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_format return the format of the stream
*/
OB_EXPORT ob_format ob_stream_profile_get_format(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set stream profile format
*
* @param[in] profile Stream profile object
* @param[in] format The format of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_stream_profile_set_format(ob_stream_profile *profile, ob_format format, ob_error **error);
/**
* @brief Get stream profile type
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_stream_type stream type
*/
OB_EXPORT ob_stream_type ob_stream_profile_get_type(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set stream profile type
*
* @param[in] profile Stream profile object
* @param[in] type The type of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_stream_profile_set_type(const ob_stream_profile *profile, ob_stream_type type, ob_error **error);
/**
* @brief Get the extrinsic for source stream to target stream
*
* @param[in] source Source stream profile
* @param[in] target Target stream profile
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_extrinsic The extrinsic
*/
OB_EXPORT ob_extrinsic ob_stream_profile_get_extrinsic_to(const ob_stream_profile *source, ob_stream_profile *target, ob_error **error);
/**
* @brief Set the extrinsic for source stream to target stream
*
* @param[in] source Stream profile object
* @param[in] target Target stream type
* @param[in] extrinsic The extrinsic
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_stream_profile_set_extrinsic_to(ob_stream_profile *source, const ob_stream_profile *target, ob_extrinsic extrinsic, ob_error **error);
/**
* @brief Set the extrinsic for source stream to target stream type
*
* @param[in] source Source stream profile
* @param[in] type Target stream type
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_extrinsic The extrinsic
*/
OB_EXPORT void ob_stream_profile_set_extrinsic_to_type(ob_stream_profile *source, const ob_stream_type type, ob_extrinsic extrinsic, ob_error **error);
/**
* @brief Get the frame rate of the video stream
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the frame rate of the stream
*/
OB_EXPORT uint32_t ob_video_stream_profile_get_fps(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the width of the video stream
*
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the width of the stream
*/
OB_EXPORT uint32_t ob_video_stream_profile_get_width(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the width of the video stream
*
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
* @param[in] width The width of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_stream_profile_set_width(ob_stream_profile *profile, uint32_t width, ob_error **error);
/**
* @brief Get the height of the video stream
*
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return uint32_t return the height of the stream
*/
OB_EXPORT uint32_t ob_video_stream_profile_get_height(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the height of the video stream
*
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
* @param[in] height The height of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_stream_profile_set_height(ob_stream_profile *profile, uint32_t height, ob_error **error);
/**
* @brief Get the intrinsic of the video stream profile
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_camera_intrinsic Return the intrinsic of the stream
*/
OB_EXPORT ob_camera_intrinsic ob_video_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the intrinsic of the video stream profile
*
* @param[in] profile Stream profile object
* @param[in] intrinsic The intrinsic of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_camera_intrinsic intrinsic, ob_error **error);
/**
* @brief Get the distortion of the video stream profile
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_camera_distortion Return the distortion of the stream
*/
OB_EXPORT ob_camera_distortion ob_video_stream_profile_get_distortion(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the distortion of the video stream profile
*
* @param[in] profile Stream profile object
* @param[in] distortion The distortion of the stream
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_video_stream_profile_set_distortion(ob_stream_profile *profile, ob_camera_distortion distortion, ob_error **error);
/**
* @brief Get the process param of the disparity stream
*
* @param[in] profile Stream profile object
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_disparity_param Return the disparity process param of the stream
*/
OB_EXPORT ob_disparity_param ob_disparity_based_stream_profile_get_disparity_param(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the disparity process param of the disparity stream.
*
* @param[in] profile Stream profile object. If the profile is not for the disparity stream, an error will be returned.
* @param[in] param The disparity process param of the disparity stream.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_disparity_based_stream_profile_set_disparity_param(ob_stream_profile *profile, ob_disparity_param param, ob_error **error);
/**
* @brief Get the full-scale range of the accelerometer stream.
*
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The full-scale range of the accelerometer stream.
*/
OB_EXPORT ob_accel_full_scale_range ob_accel_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the sampling frequency of the accelerometer frame.
*
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The sampling frequency of the accelerometer frame.
*/
OB_EXPORT ob_accel_sample_rate ob_accel_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the intrinsic of the accelerometer stream.
*
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_accel_intrinsic Return the intrinsic of the accelerometer stream.
*/
OB_EXPORT ob_accel_intrinsic ob_accel_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the intrinsic of the accelerometer stream.
*
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
* @param[in] intrinsic The intrinsic of the accelerometer stream.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_accel_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_accel_intrinsic intrinsic, ob_error **error);
/**
* @brief Get the full-scale range of the gyroscope stream.
*
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The full-scale range of the gyroscope stream.
*/
OB_EXPORT ob_gyro_full_scale_range ob_gyro_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the sampling frequency of the gyroscope stream.
*
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The sampling frequency of the gyroscope stream.
*/
OB_EXPORT ob_gyro_sample_rate ob_gyro_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Get the intrinsic of the gyroscope stream.
*
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return ob_gyro_intrinsic Return the intrinsic of the gyroscope stream.
*/
OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
/**
* @brief Set the intrinsic of the gyroscope stream.
*
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
* @param[in] intrinsic The intrinsic of the gyroscope stream.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_gyro_stream_set_intrinsic(ob_stream_profile *profile, ob_gyro_intrinsic intrinsic, ob_error **error);
/**
* @brief Get the number of StreamProfile lists.
*
* @param[in] profile_list StreamProfile list.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The number of StreamProfile lists.
*/
OB_EXPORT uint32_t ob_stream_profile_list_get_count(const ob_stream_profile_list *profile_list, ob_error **error);
/**
* @brief Get the corresponding StreamProfile by subscripting.
*
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
*
* @param[in] profile_list StreamProfile lists.
* @param[in] index Index.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The matching profile.
*/
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_profile(const ob_stream_profile_list *profile_list, int index, ob_error **error);
/**
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
*
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
*
* @param[in] profile_list Resolution list.
* @param[in] width Width. If you don't need to add matching conditions, you can pass OB_WIDTH_ANY.
* @param[in] height Height. If you don't need to add matching conditions, you can pass OB_HEIGHT_ANY.
* @param[in] format Format. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
* @param[in] fps Frame rate. If you don't need to add matching conditions, you can pass OB_FPS_ANY.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The matching profile.
*/
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile(const ob_stream_profile_list *profile_list, int width, int height,
ob_format format, int fps, ob_error **error);
/**
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
*
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
*
* @param[in] profile_list Resolution list.
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The matching profile.
*/
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_accel_stream_profile(const ob_stream_profile_list *profile_list,
ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate,
ob_error **error);
/**
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
*
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
*
* @param[in] profile_list Resolution list.
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
* @param[out] error Pointer to an error object that will be set if an error occurs.
* @return The matching profile.
*/
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_gyro_stream_profile(const ob_stream_profile_list *profile_list,
ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate,
ob_error **error);
/**
* @brief Delete the stream profile list.
*
* @param[in] profile_list Stream configuration list.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_delete_stream_profile_list(const ob_stream_profile_list *profile_list, ob_error **error);
// The following interfaces are deprecated and are retained here for compatibility purposes.
#define ob_stream_profile_format ob_stream_profile_get_format
#define ob_stream_profile_type ob_stream_profile_get_type
#define ob_video_stream_profile_fps ob_video_stream_profile_get_fps
#define ob_video_stream_profile_width ob_video_stream_profile_get_width
#define ob_video_stream_profile_height ob_video_stream_profile_get_height
#define ob_accel_stream_profile_full_scale_range ob_accel_stream_profile_get_full_scale_range
#define ob_accel_stream_profile_sample_rate ob_accel_stream_profile_get_sample_rate
#define ob_gyro_stream_profile_full_scale_range ob_gyro_stream_profile_get_full_scale_range
#define ob_gyro_stream_profile_sample_rate ob_gyro_stream_profile_get_sample_rate
#define ob_stream_profile_list_count ob_stream_profile_list_get_count
#ifdef __cplusplus
}
#endif

View File

@@ -1,93 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Convert OBFormat to " char* " type and then return.
*
* @param[in] type OBFormat type.
* @return OBFormat of "char*" type.
*/
OB_EXPORT const char* ob_format_type_to_string(OBFormat type);
/**
* @brief Convert OBFrameType to " char* " type and then return.
*
* @param[in] type OBFrameType type.
* @return OBFrameType of "char*" type.
*/
OB_EXPORT const char* ob_frame_type_to_string(OBFrameType type);
/**
* @brief Convert OBStreamType to " char* " type and then return.
*
* @param[in] type OBStreamType type.
* @return OBStreamType of "char*" type.
*/
OB_EXPORT const char* ob_stream_type_to_string(OBStreamType type);
/**
* @brief Convert OBSensorType to " char* " type and then return.
*
* @param[in] type OBSensorType type.
* @return OBSensorType of "char*" type.
*/
OB_EXPORT const char* ob_sensor_type_to_string(OBSensorType type);
/**
* @brief Convert OBIMUSampleRate to " char* " type and then return.
*
* @param[in] type OBIMUSampleRate type.
* @return OBIMUSampleRate of "char*" type.
*/
OB_EXPORT const char* ob_imu_rate_type_to_string(OBIMUSampleRate type);
/**
* @brief Convert OBGyroFullScaleRange to " char* " type and then return.
*
* @param[in] type OBGyroFullScaleRange type.
* @return OBGyroFullScaleRange of "char*" type.
*/
OB_EXPORT const char* ob_gyro_range_type_to_string(OBGyroFullScaleRange type);
/**
* @brief Convert OBAccelFullScaleRange to " char* " type and then return.
*
* @param[in] type OBAccelFullScaleRange type.
* @return OBAccelFullScaleRange of "char*" type.
*/
OB_EXPORT const char* ob_accel_range_type_to_string(OBAccelFullScaleRange type);
/**
* @brief Convert OBFrameMetadataType to " char* " type and then return.
*
* @param[in] type OBFrameMetadataType type.
* @return OBFrameMetadataType of "char*" type.
*/
OB_EXPORT const char* ob_meta_data_type_to_string(OBFrameMetadataType type);
/**
* @brief Convert OBStreamType to OBSensorType.
*
* @param[in] type The sensor type to convert.
* @return OBStreamType The corresponding stream type.
*/
OB_EXPORT OBStreamType ob_sensor_type_to_stream_type(OBSensorType type);
/**
* @brief Convert OBFormat to " char* " type and then return.
*
* @param format The OBFormat to convert.
* @return The string.
*/
OB_EXPORT const char *ob_format_to_string(OBFormat format);
#ifdef __cplusplus
}
#endif

View File

@@ -1,124 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "ObTypes.h"
/**
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
*
* @param[in] source_point3f Source 3d point value
* @param[in] extrinsic Transformation matrix from source to target
* @param[out] target_point3f Target 3d point value
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Transform result
*/
OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
/**
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
*
* @param[in] source_point2f Source 2d point value
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
* @param[in] source_intrinsic Source intrinsic parameters
* @param[in] extrinsic Transformation matrix from source to target
* @param[out] target_point3f Target 3d point value
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Transform result
*/
OB_EXPORT bool ob_transformation_2d_to_3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
/**
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
*
* @param[in] source_point3f Source 3d point value
* @param[in] target_intrinsic Target intrinsic parameters
* @param[in] target_distortion Target distortion parameters
* @param[in] extrinsic Transformation matrix from source to target
* @param[out] target_point2f Target 2d point value
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Transform result
*/
OB_EXPORT bool ob_transformation_3d_to_2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
/**
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel coordinate of the target camera
*
* @param[in] source_intrinsic Source intrinsic parameters
* @param[in] source_distortion Source distortion parameters
* @param[in] source_point2f Source 2d point value
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
* @param[in] target_intrinsic Target intrinsic parameters
* @param[in] target_distortion Target distortion parameters
* @param[in] extrinsic Transformation matrix from source to target
* @param[out] target_point2f Target 2d point value
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool Transform result
*/
OB_EXPORT bool ob_transformation_2d_to_2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
OB_EXPORT ob_frame *transformation_depth_frame_to_color_camera(ob_device *device, ob_frame *depth_frame, uint32_t target_color_camera_width,
uint32_t target_color_camera_height, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
OB_EXPORT bool transformation_init_xy_tables(const ob_calibration_param calibration_param, const ob_sensor_type sensor_type, float *data, uint32_t *data_size,
ob_xy_tables *xy_tables, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
OB_EXPORT void transformation_depth_to_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, void *pointcloud_data, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
OB_EXPORT void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data,
void *pointcloud_data, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
// Use the ob_transformation_3d_to_3d instead.
OB_EXPORT bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
// Use the ob_transformation_2d_to_3d instead.
OB_EXPORT bool ob_calibration_2d_to_3d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f,
ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
// Use the ob_transformation_3d_to_2d instead.
OB_EXPORT bool ob_calibration_3d_to_2d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
// \deprecated This function is deprecated and will be removed in a future version.
// Use the ob_transformation_2d_to_2d instead.
OB_EXPORT bool ob_calibration_2d_to_2d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point2f *target_point2f,
ob_error **error);
/**
* @brief save point cloud to ply file.
*
* @param[in] file_name Point cloud save path
* @param[in] frame Point cloud frame
* @param[in] save_binary Binary or textual,true: binary, false: textual
* @param[in] use_mesh Save mesh or not, true: save as mesh, false: not save as mesh
* @param[in] mesh_threshold Distance threshold for creating faces in point cloud,default value :50
* @param[out] error Pointer to an error object that will be set if an error occurs.
*
* @return bool save point cloud result
*/
OB_EXPORT bool ob_save_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, bool use_mesh, float mesh_threshold, ob_error **error);
#ifdef __cplusplus
}
#endif

View File

@@ -1,55 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Version.h
* @brief Functions for retrieving the SDK version number information.
*
*/
#pragma once
#include "Export.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Get the SDK version number.
*
* @return int The SDK version number.
*/
OB_EXPORT int ob_get_version();
/**
* @brief Get the SDK major version number.
*
* @return int The SDK major version number.
*/
OB_EXPORT int ob_get_major_version();
/**
* @brief Get the SDK minor version number.
*
* @return int The SDK minor version number.
*/
OB_EXPORT int ob_get_minor_version();
/**
* @brief Get the SDK patch version number.
*
* @return int The SDK patch version number.
*/
OB_EXPORT int ob_get_patch_version();
/**
* @brief Get the SDK stage version.
* @attention The returned char* does not need to be freed.
*
* @return const char* The SDK stage version.
*/
OB_EXPORT const char *ob_get_stage_version();
#ifdef __cplusplus
}
#endif

View File

@@ -1,251 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Context.hpp
* @brief The SDK context class, which serves as the entry point to the underlying SDK. It is used to query device lists, handle device callbacks, and set the
* log level.
*
*/
#pragma once
#include "libobsensor/h/Context.h"
#include "Types.hpp"
#include "Error.hpp"
#include <functional>
#include <memory>
namespace ob {
// forward declarations
class Device;
class DeviceInfo;
class DeviceList;
class Context {
public:
/**
* @brief Type definition for the device changed callback function.
*
* @param removedList The list of removed devices.
* @param addedList The list of added devices.
*/
typedef std::function<void(std::shared_ptr<DeviceList> removedList, std::shared_ptr<DeviceList> addedList)> DeviceChangedCallback;
/**
* @brief Type definition for the log output callback function.
*
* @param severity The current callback log level.
* @param logMsg The log message.
*/
typedef std::function<void(OBLogSeverity severity, const char *logMsg)> LogCallback;
private:
ob_context *impl_ = nullptr;
DeviceChangedCallback deviceChangedCallback_;
// static LogCallback logCallback_;
public:
/**
* @brief Context constructor.
* @brief The Context class is a management class that describes the runtime of the SDK. It is responsible for applying and releasing resources for the SDK.
* The context has the ability to manage multiple devices, enumerate devices, monitor device callbacks, and enable functions such as multi-device
* synchronization.
*
* @param[in] configPath The path to the configuration file. If the path is empty, the default configuration will be used.
*/
explicit Context(const char *configPath = "") {
ob_error *error = nullptr;
impl_ = ob_create_context_with_config(configPath, &error);
Error::handle(&error);
}
/**
* @brief Context destructor.
*/
~Context() noexcept {
ob_error *error = nullptr;
ob_delete_context(impl_, &error);
Error::handle(&error, false);
}
/**
* @brief Queries the enumerated device list.
*
* @return std::shared_ptr<DeviceList> A pointer to the device list class.
*/
std::shared_ptr<DeviceList> queryDeviceList() const {
ob_error *error = nullptr;
auto list = ob_query_device_list(impl_, &error);
Error::handle(&error);
return std::make_shared<DeviceList>(list);
}
/**
* @brief enable or disable net device enumeration.
* @brief after enable, the net device will be discovered automatically and can be retrieved by @ref queryDeviceList. The default state can be set in the
* configuration file.
*
* @attention Net device enumeration by gvcp protocol, if the device is not in the same subnet as the host, it will be discovered but cannot be connected.
*
* @param[in] enable true to enable, false to disable
*/
void enableNetDeviceEnumeration(bool enable) const {
ob_error *error = nullptr;
ob_enable_net_device_enumeration(impl_, enable, &error);
Error::handle(&error);
}
/**
* @brief Creates a network device with the specified IP address and port.
*
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
* @param[in] port The port number, currently only support 8090
* @return std::shared_ptr<Device> The created device object.
*/
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port) const {
ob_error *error = nullptr;
auto device = ob_create_net_device(impl_, address, port, &error);
Error::handle(&error);
return std::make_shared<Device>(device);
}
/**
* @brief Set the device plug-in callback function.
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
*
* @param callback The function triggered when the device is plugged and unplugged.
*/
void setDeviceChangedCallback(DeviceChangedCallback callback) {
deviceChangedCallback_ = callback;
ob_error *error = nullptr;
ob_set_device_changed_callback(impl_, &Context::deviceChangedCallback, this, &error);
Error::handle(&error);
}
/**
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
*
* @param repeatIntervalMsec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
*/
void enableDeviceClockSync(uint64_t repeatIntervalMsec) const {
ob_error *error = nullptr;
ob_enable_device_clock_sync(impl_, repeatIntervalMsec, &error);
Error::handle(&error);
}
/**
* @brief Frees idle memory from the internal frame memory pool.
* @brief The SDK includes an internal frame memory pool that caches memory allocated for frames received from devices.
*/
void freeIdleMemory() const {
ob_error *error = nullptr;
ob_free_idle_memory(impl_, &error);
Error::handle(&error);
}
/**
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
* @brief It is effective when the new device is created.
*
* @attention This interface is only available for Linux.
*
* @param[in] type The backend type to be used.
*/
void setUvcBackendType(OBUvcBackendType type) const {
ob_error *error = nullptr;
ob_set_uvc_backend_type(impl_, type, &error);
Error::handle(&error);
}
/**
* @brief Set the level of the global log, which affects both the log level output to the console, output to the file and output the user defined
* callback.
*
* @param severity The log output level.
*/
static void setLoggerSeverity(OBLogSeverity severity) {
ob_error *error = nullptr;
ob_set_logger_severity(severity, &error);
Error::handle(&error);
}
/**
* @brief Set log output to a file.
*
* @param severity The log level output to the file.
* @param directory The log file output path. If the path is empty, the existing settings will continue to be used (if the existing configuration is also
* empty, the log will not be output to the file).
*/
static void setLoggerToFile(OBLogSeverity severity, const char *directory) {
ob_error *error = nullptr;
ob_set_logger_to_file(severity, directory, &error);
Error::handle(&error);
}
/**
* @brief Set log output to the console.
*
* @param severity The log level output to the console.
*/
static void setLoggerToConsole(OBLogSeverity severity) {
ob_error *error = nullptr;
ob_set_logger_to_console(severity, &error);
Error::handle(&error);
}
/**
* @brief Set the logger to callback.
*
* @param severity The callback log level.
* @param callback The callback function.
*/
static void setLoggerToCallback(OBLogSeverity severity, LogCallback callback) {
ob_error *error = nullptr;
Context::getLogCallback() = callback;
ob_set_logger_to_callback(severity, &Context::logCallback, &Context::getLogCallback(), &error);
Error::handle(&error);
}
/**
* @brief Set the extensions directory
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
*
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
*
* @param directory Path to the extensions directory. If the path is empty, the existing settings will continue to be used (if the existing
*/
static void setExtensionsDirectory(const char *directory) {
ob_error *error = nullptr;
ob_set_extensions_directory(directory, &error);
Error::handle(&error);
}
private:
static void deviceChangedCallback(ob_device_list *removedList, ob_device_list *addedList, void *userData) {
auto ctx = static_cast<Context *>(userData);
if(ctx && ctx->deviceChangedCallback_) {
auto removed = std::make_shared<DeviceList>(removedList);
auto added = std::make_shared<DeviceList>(addedList);
ctx->deviceChangedCallback_(removed, added);
}
}
static void logCallback(OBLogSeverity severity, const char *logMsg, void *userData) {
auto cb = static_cast<LogCallback *>(userData);
if(cb) {
(*cb)(severity, logMsg);
}
}
// Lazy initialization of the logcallback_. The purpose is to initialize logcallback_ in .hpp
static LogCallback &getLogCallback() {
static LogCallback logCallback_ = nullptr;
return logCallback_;
}
// for backward compatibility
#define enableMultiDeviceSync enableDeviceClockSync
};
} // namespace ob

View File

@@ -1,116 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Error.hpp
* @brief This file defines the Error class, which describes abnormal errors within the SDK.
* Detailed information about the exception can be obtained through this class.
*/
#pragma once
#include "Types.hpp"
#include "libobsensor/h/Error.h"
#include <memory>
namespace ob {
class Error : public std::exception {
private:
ob_error *impl_;
/**
* @brief Construct a new Error object
*
* @attention This constructor should not be called directly, use the handle() function instead.
*
* @param error The ob_error object
*/
explicit Error(ob_error *error) : impl_(error) {};
Error& operator=(const Error&) = default;
public:
/**
* @brief A static function to handle the ob_error and throw an exception if needed.
*
* @param error The ob_error pointer to be handled.
* @param throw_exception A boolean value to indicate whether to throw an exception or not, the default value is true.
*/
static void handle(ob_error **error, bool throw_exception = true) {
if(!error || !*error) { // no error
return;
}
if(throw_exception) {
throw Error(*error);
}
else {
ob_delete_error(*error);
*error = nullptr;
}
}
/**
* @brief Destroy the Error object
*/
~Error() override {
if(impl_) {
ob_delete_error(impl_);
impl_ = nullptr;
}
}
/**
* @brief Returns the error message of the exception.
*
* @return const char* The error message.
*/
const char *what() const noexcept override {
return impl_->message;
}
/**
* @brief Returns the exception type of the exception.
* @brief Read the comments of the OBExceptionType enum in the libobsensor/h/ObTypes.h file for more information.
*
* @return OBExceptionType The exception type.
*/
OBExceptionType getExceptionType() const noexcept {
return impl_->exception_type;
}
/**
* @brief Returns the name of the function where the exception occurred.
*
* @return const char* The function name.
*/
const char *getFunction() const noexcept {
return impl_->function;
}
/**
* @brief Returns the arguments of the function where the exception occurred.
*
* @return const char* The arguments.
*/
const char *getArgs() const noexcept {
return impl_->args;
}
/**
* @brief Returns the error message of the exception.
* @brief It is recommended to use the what() function instead.
*
* @return const char* The error message.
*/
const char *getMessage() const noexcept {
return impl_->message;
}
public:
// The following interfaces are deprecated and are retained here for compatibility purposes.
const char *getName() const noexcept {
return impl_->function;
}
};
} // namespace ob

View File

@@ -1,451 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file Pipeline.hpp
* @brief The SDK's advanced API type can quickly implement switching streaming and frame synchronization
* operations.
*/
#pragma once
#include "Frame.hpp"
#include "Device.hpp"
#include "StreamProfile.hpp"
#include "libobsensor/h/Pipeline.h"
#include "libobsensor/hpp/Types.hpp"
#include "libobsensor/hpp/TypeHelper.hpp"
#include <memory>
#include <functional>
namespace ob {
/**
* @brief Config class for configuring pipeline parameters
*
* The Config class provides an interface for configuring pipeline parameters.
*/
class Config {
private:
ob_config_t *impl_;
public:
/**
* @brief Construct a new Config object
*/
Config() {
ob_error *error = nullptr;
impl_ = ob_create_config(&error);
Error::handle(&error);
}
explicit Config(ob_config_t *impl) : impl_(impl) {}
/**
* @brief Destroy the Config object
*/
~Config() noexcept {
ob_error *error = nullptr;
ob_delete_config(impl_, &error);
Error::handle(&error, false);
}
ob_config_t *getImpl() const {
return impl_;
}
/**
* @brief enable a stream with a specific stream type
*
* @param streamType The stream type to be enabled
*/
void enableStream(OBStreamType streamType) const {
ob_error *error = nullptr;
ob_config_enable_stream(impl_, streamType, &error);
Error::handle(&error);
}
/**
* @brief Enable a stream with a specific sensor type
* @brief Will convert sensor type to stream type automatically.
*
* @param sensorType The sensor type to be enabled
*/
void enableStream(OBSensorType sensorType) const {
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
enableStream(streamType);
}
/**
* @brief Enable a stream to be used in the pipeline
*
* @param streamProfile The stream configuration to be enabled
*/
void enableStream(std::shared_ptr<const StreamProfile> streamProfile) const {
ob_error *error = nullptr;
auto c_stream_profile = streamProfile->getImpl();
ob_config_enable_stream_with_stream_profile(impl_, c_stream_profile, &error);
Error::handle(&error);
}
/**
* @brief Enable a video stream to be used in the pipeline.
*
* This function allows users to enable a video stream with customizable parameters.
* If no parameters are specified, the stream will be enabled with default resolution settings.
* Users who wish to set custom resolutions should refer to the product manual, as available resolutions vary by camera model.
*
* @param streamType The video stream type.
* @param width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
* @param height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
* @param fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
* @param format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
*/
void enableVideoStream(OBStreamType streamType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
OBFormat format = OB_FORMAT_ANY) const {
ob_error *error = nullptr;
ob_config_enable_video_stream(impl_, streamType, width, height, fps, format, &error);
Error::handle(&error);
}
/**
* @brief Enable a video stream to be used in the pipeline.
* @brief Will convert sensor type to stream type automatically.
*
* @param sensorType The sensor type to be enabled.
* @param width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
* @param height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
* @param fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
* @param format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
*/
void enableVideoStream(OBSensorType sensorType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
OBFormat format = OB_FORMAT_ANY) const {
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
enableVideoStream(streamType, width, height, fps, format);
}
/**
* @brief Enable an accelerometer stream to be used in the pipeline.
*
* This function allows users to enable an accelerometer stream with customizable parameters.
* If no parameters are specified, the stream will be enabled with default settings.
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
*
* @param fullScaleRange The full-scale range of the accelerometer (default is OB_ACCEL_FULL_SCALE_RANGE_ANY, which selects the default range).
* @param sampleRate The sample rate of the accelerometer (default is OB_ACCEL_SAMPLE_RATE_ANY, which selects the default rate).
*/
void enableAccelStream(OBAccelFullScaleRange fullScaleRange = OB_ACCEL_FULL_SCALE_RANGE_ANY,
OBAccelSampleRate sampleRate = OB_ACCEL_SAMPLE_RATE_ANY) const {
ob_error *error = nullptr;
ob_config_enable_accel_stream(impl_, fullScaleRange, sampleRate, &error);
Error::handle(&error);
}
/**
* @brief Enable a gyroscope stream to be used in the pipeline.
*
* This function allows users to enable a gyroscope stream with customizable parameters.
* If no parameters are specified, the stream will be enabled with default settings.
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
*
* @param fullScaleRange The full-scale range of the gyroscope (default is OB_GYRO_FULL_SCALE_RANGE_ANY, which selects the default range).
* @param sampleRate The sample rate of the gyroscope (default is OB_GYRO_SAMPLE_RATE_ANY, which selects the default rate).
*/
void enableGyroStream(OBGyroFullScaleRange fullScaleRange = OB_GYRO_FULL_SCALE_RANGE_ANY, OBGyroSampleRate sampleRate = OB_GYRO_SAMPLE_RATE_ANY) const {
ob_error *error = nullptr;
ob_config_enable_gyro_stream(impl_, fullScaleRange, sampleRate, &error);
Error::handle(&error);
}
/**
* @deprecated Use enableStream(std::shared_ptr<StreamProfile> streamProfile) instead
* @brief Enable all streams to be used in the pipeline
*/
void enableAllStream() {
ob_error *error = nullptr;
ob_config_enable_all_stream(impl_, &error);
Error::handle(&error);
}
/**
* @brief Disable a stream to be used in the pipeline
*
* @param streamType The stream configuration to be disabled
*/
void disableStream(OBStreamType streamType) const {
ob_error *error = nullptr;
ob_config_disable_stream(impl_, streamType, &error);
Error::handle(&error);
}
/**
* @brief Disable a sensor stream to be used in the pipeline.
* @brief Will convert sensor type to stream type automatically.
*
* @param sensorType The sensor configuration to be disabled
*/
void disableStream(OBSensorType sensorType) const {
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
disableStream(streamType);
}
/**
* @brief Disable all streams to be used in the pipeline
*/
void disableAllStream() const {
ob_error *error = nullptr;
ob_config_disable_all_stream(impl_, &error);
Error::handle(&error);
}
/**
* @brief Get the Enabled Stream Profile List
*
* @return std::shared_ptr<StreamProfileList>
*/
std::shared_ptr<StreamProfileList> getEnabledStreamProfileList() const {
ob_error *error = nullptr;
auto list = ob_config_get_enabled_stream_profile_list(impl_, &error);
Error::handle(&error);
return std::make_shared<StreamProfileList>(list);
}
/**
* @brief Set the alignment mode
*
* @param mode The alignment mode
*/
void setAlignMode(OBAlignMode mode) const {
ob_error *error = nullptr;
ob_config_set_align_mode(impl_, mode, &error);
Error::handle(&error);
}
/**
* @brief Set whether the depth needs to be scaled after setting D2C
*
* @param enable Whether scaling is required
*/
void setDepthScaleRequire(bool enable) const {
ob_error *error = nullptr;
ob_config_set_depth_scale_after_align_require(impl_, enable, &error);
Error::handle(&error);
}
/**
* @brief Set the frame aggregation output mode for the pipeline configuration
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
*
* @param mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
*/
void setFrameAggregateOutputMode(OBFrameAggregateOutputMode mode) const {
ob_error *error = nullptr;
ob_config_set_frame_aggregate_output_mode(impl_, mode, &error);
Error::handle(&error);
}
};
class Pipeline {
public:
/**
* @brief FrameSetCallback is a callback function type for frameset data arrival.
*
* @param frame The returned frameset data
*/
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
private:
ob_pipeline_t *impl_;
FrameSetCallback callback_;
public:
/**
* @brief Pipeline is a high-level interface for applications, algorithms related RGBD data streams. Pipeline can provide alignment inside and synchronized
* FrameSet. Pipeline() no parameter version, which opens the first device in the list of devices connected to the OS by default. If the application has
* obtained the device through the DeviceList, opening the Pipeline() at this time will throw an exception that the device has been created.
*/
Pipeline() {
ob_error *error = nullptr;
impl_ = ob_create_pipeline(&error);
Error::handle(&error);
}
/**
* @brief
* Pipeline(std::shared_ptr< Device > device ) Function for multi-device operations. Multiple devices need to be obtained through DeviceList, and the device
* and pipeline are bound through this interface.
*/
explicit Pipeline(std::shared_ptr<Device> device) {
ob_error *error = nullptr;
impl_ = ob_create_pipeline_with_device(device->getImpl(), &error);
Error::handle(&error);
}
/**
* @brief Destroy the pipeline object
*/
~Pipeline() noexcept {
ob_error *error = nullptr;
ob_delete_pipeline(impl_, &error);
Error::handle(&error, false);
}
/**
* @brief Start the pipeline with configuration parameters
*
* @param config The parameter configuration of the pipeline
*/
void start(std::shared_ptr<Config> config = nullptr) const {
ob_error *error = nullptr;
ob_config_t *config_impl = config == nullptr ? nullptr : config->getImpl();
ob_pipeline_start_with_config(impl_, config_impl, &error);
Error::handle(&error);
}
/**
* @brief Start the pipeline and set the frameset data callback
*
* @param config The configuration of the pipeline
* @param callback The callback to be triggered when all frame data in the frameset arrives
*/
void start(std::shared_ptr<Config> config, FrameSetCallback callback) {
callback_ = callback;
ob_error *error = nullptr;
ob_pipeline_start_with_callback(impl_, config ? config->getImpl() : nullptr, &Pipeline::frameSetCallback, this, &error);
Error::handle(&error);
}
static void frameSetCallback(ob_frame_t *frameSet, void *userData) {
auto pipeline = static_cast<Pipeline *>(userData);
pipeline->callback_(std::make_shared<FrameSet>(frameSet));
}
/**
* @brief Stop the pipeline
*/
void stop() const {
ob_error *error = nullptr;
ob_pipeline_stop(impl_, &error);
Error::handle(&error);
}
/**
* @brief Get the pipeline configuration parameters
* @brief Returns the default configuration if the user has not configured it
*
* @return std::shared_ptr<Config> The configured parameters
*/
std::shared_ptr<Config> getConfig() const {
ob_error *error = nullptr;
auto config = ob_pipeline_get_config(impl_, &error);
Error::handle(&error);
return std::make_shared<Config>(config);
}
/**
* @brief Wait for frameset
*
* @param timeoutMs The waiting timeout in milliseconds
* @return std::shared_ptr<FrameSet> The waiting frameset data
*/
std::shared_ptr<FrameSet> waitForFrameset(uint32_t timeoutMs = 1000) const {
ob_error *error = nullptr;
auto frameSet = ob_pipeline_wait_for_frameset(impl_, timeoutMs, &error);
if(frameSet == nullptr) {
return nullptr;
}
Error::handle(&error);
return std::make_shared<FrameSet>(frameSet);
}
/**
* @brief Get the device object
*
* @return std::shared_ptr<Device> The device object
*/
std::shared_ptr<Device> getDevice() const {
ob_error *error = nullptr;
auto device = ob_pipeline_get_device(impl_, &error);
Error::handle(&error);
return std::make_shared<Device>(device);
}
/**
* @brief Get the stream profile of the specified sensor
*
* @param sensorType The type of sensor
* @return std::shared_ptr<StreamProfileList> The stream profile list
*/
std::shared_ptr<StreamProfileList> getStreamProfileList(OBSensorType sensorType) const {
ob_error *error = nullptr;
auto list = ob_pipeline_get_stream_profile_list(impl_, sensorType, &error);
Error::handle(&error);
return std::make_shared<StreamProfileList>(list);
}
/**
* @brief Get the stream profile list of supported depth-to-color alignments
*
* @param colorProfile The color stream profile, which is the target stream profile for the depth-to-color alignment.
* @param alignMode The alignment mode.
*
* @attention Currently, only ALIGN_D2C_HW_MODE supported. For other align modes, please using the AlignFilter interface.
*
* @return std::shared_ptr<StreamProfileList> The stream profile list of supported depth-to-color alignments.
*/
std::shared_ptr<StreamProfileList> getD2CDepthProfileList(std::shared_ptr<StreamProfile> colorProfile, OBAlignMode alignMode) {
ob_error *error = nullptr;
auto list = ob_get_d2c_depth_profile_list(impl_, colorProfile->getImpl(), alignMode, &error);
Error::handle(&error);
return std::make_shared<StreamProfileList>(list);
}
/**
* @brief Turn on frame synchronization
*/
void enableFrameSync() const {
ob_error *error = nullptr;
ob_pipeline_enable_frame_sync(impl_, &error);
Error::handle(&error);
}
/**
* @brief Turn off frame synchronization
*/
void disableFrameSync() const {
ob_error *error = nullptr;
ob_pipeline_disable_frame_sync(impl_, &error);
Error::handle(&error);
}
public:
// The following interfaces are deprecated and are retained here for compatibility purposes.
OBCameraParam getCameraParam() {
ob_error *error = nullptr;
OBCameraParam cameraParam = ob_pipeline_get_camera_param(impl_, &error);
Error::handle(&error);
return cameraParam;
}
OBCameraParam getCameraParamWithProfile(uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth, uint32_t depthHeight) {
ob_error *error = nullptr;
OBCameraParam cameraParam = ob_pipeline_get_camera_param_with_profile(impl_, colorWidth, colorHeight, depthWidth, depthHeight, &error);
Error::handle(&error);
return cameraParam;
}
OBCalibrationParam getCalibrationParam(std::shared_ptr<Config> config) {
ob_error *error = nullptr;
OBCalibrationParam calibrationParam = ob_pipeline_get_calibration_param(impl_, config->getImpl(), &error);
Error::handle(&error);
return calibrationParam;
}
std::shared_ptr<FrameSet> waitForFrames(uint32_t timeoutMs = 1000) const {
return waitForFrameset(timeoutMs);
}
};
} // namespace ob

View File

@@ -1,188 +0,0 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
* @file RecordPlayback.hpp
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
record and playback streaming data, etc.
*/
#pragma once
#include "Types.hpp"
#include "Error.hpp"
#include "libobsensor/h/RecordPlayback.h"
#include "libobsensor/hpp/Device.hpp"
namespace ob {
typedef std::function<void(OBPlaybackStatus status)> PlaybackStatusChangeCallback;
class RecordDevice {
private:
ob_record_device_t *impl_ = nullptr;
public:
explicit RecordDevice(std::shared_ptr<Device> device, const std::string &file, bool compressionEnabled = true) {
ob_error *error = nullptr;
impl_ = ob_create_record_device(device->getImpl(), file.c_str(), compressionEnabled, &error);
Error::handle(&error);
}
virtual ~RecordDevice() noexcept {
ob_error *error = nullptr;
ob_delete_record_device(impl_, &error);
Error::handle(&error, false);
}
RecordDevice(RecordDevice &&other) noexcept {
if(this != &other) {
impl_ = other.impl_;
other.impl_ = nullptr;
}
}
RecordDevice &operator=(RecordDevice &&other) noexcept {
if(this != &other) {
impl_ = other.impl_;
other.impl_ = nullptr;
}
return *this;
}
RecordDevice(const RecordDevice &) = delete;
RecordDevice &operator=(const RecordDevice &) = delete;
public:
void pause() {
ob_error *error = nullptr;
ob_record_device_pause(impl_, &error);
Error::handle(&error);
}
void resume() {
ob_error *error = nullptr;
ob_record_device_resume(impl_, &error);
Error::handle(&error);
}
};
class PlaybackDevice : public Device {
public:
explicit PlaybackDevice(const std::string &file) : Device(nullptr) {
ob_error *error = nullptr;
impl_ = ob_create_playback_device(file.c_str(), &error);
Error::handle(&error);
}
virtual ~PlaybackDevice() noexcept override = default;
PlaybackDevice(PlaybackDevice &&other) noexcept : Device(std::move(other)) {}
PlaybackDevice &operator=(PlaybackDevice &&other) noexcept {
Device::operator=(std::move(other));
return *this;
}
PlaybackDevice(const PlaybackDevice &) = delete;
PlaybackDevice &operator=(const PlaybackDevice &) = delete;
public:
/**
* @brief Pause the streaming data from the playback device.
*/
void pause() {
ob_error *error = nullptr;
ob_playback_device_pause(impl_, &error);
Error::handle(&error);
}
/**
* @brief Resume the streaming data from the playback device.
*/
void resume() {
ob_error *error = nullptr;
ob_playback_device_resume(impl_, &error);
Error::handle(&error);
}
/**
* @brief Seek to a specific timestamp when playing back a recording.
* @param[in] timestamp The timestamp to seek to, in milliseconds.
*/
void seek(const int64_t timestamp) {
ob_error *error = nullptr;
ob_playback_device_seek(impl_, timestamp, &error);
Error::handle(&error);
}
/**
* @brief Set the playback rate of the playback device.
* @param[in] rate The playback rate to set.
*/
void setPlaybackRate(const float rate) {
ob_error *error = nullptr;
ob_playback_device_set_playback_rate(impl_, rate, &error);
Error::handle(&error);
}
/**
* @brief Set a callback function to be called when the playback status changes.
* @param[in] callback The callback function to set.
*/
void setPlaybackStatusChangeCallback(PlaybackStatusChangeCallback callback) {
callback_ = callback;
ob_error *error = nullptr;
ob_playback_device_set_playback_status_changed_callback(impl_, &PlaybackDevice::playbackStatusCallback, this, &error);
Error::handle(&error);
}
/**
* @brief Get the current playback status of the playback device.
* @return The current playback status.
*/
OBPlaybackStatus getPlaybackStatus() const {
ob_error *error = nullptr;
OBPlaybackStatus status = ob_playback_device_get_current_playback_status(impl_, &error);
Error::handle(&error);
return status;
}
/**
* @brief Get the current position of the playback device.
* @return The current position of the playback device, in milliseconds.
*/
uint64_t getPosition() const {
ob_error *error = nullptr;
uint64_t position = ob_playback_device_get_position(impl_, &error);
Error::handle(&error);
return position;
}
/**
* @brief Get the duration of the playback device.
* @return The duration of the playback device, in milliseconds.
*/
uint64_t getDuration() const {
ob_error *error = nullptr;
uint64_t duration = ob_playback_device_get_duration(impl_, &error);
Error::handle(&error);
return duration;
}
private:
static void playbackStatusCallback(OBPlaybackStatus status, void *userData) {
auto *playbackDevice = static_cast<PlaybackDevice *>(userData);
if(playbackDevice && playbackDevice->callback_) {
playbackDevice->callback_(status);
}
}
private:
PlaybackStatusChangeCallback callback_;
};
} // namespace ob

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