-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
646 additions
and
88 deletions.
There are no files selected for viewing
166 changes: 92 additions & 74 deletions
166
depthai_descriptions/urdf/include/base_macro.urdf.xacro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,110 @@ | ||
<?xml version="1.0"?> | ||
<robot name="base" | ||
xmlns:xacro="http://ros.org/wiki/xacro"> | ||
xmlns:xacro="http://ros.org/wiki/xacro"> | ||
|
||
<xacro:macro name="base" params="camera_name camera_model parent base_frame | ||
<xacro:macro name="base" | ||
params="camera_name camera_model parent base_frame | ||
cam_pos_x cam_pos_y cam_pos_z | ||
cam_roll cam_pitch cam_yaw has_imu r:=0.8 g:=0.8 b:=0.8 a:=0.8 simulation:=false"> | ||
|
||
<xacro:if value="${simulation}"> | ||
<xacro:property | ||
name="file_prefix" | ||
value="file://$(find depthai_descriptions)" | ||
/> | ||
</xacro:if> | ||
<xacro:unless value="${simulation}"> | ||
<xacro:property | ||
name="file_prefix" | ||
value="package://depthai_descriptions" | ||
/> | ||
</xacro:unless> | ||
<xacro:if value="${simulation}"> | ||
<xacro:property | ||
name="file_prefix" | ||
value="file://$(find depthai_descriptions)" | ||
/> | ||
</xacro:if> | ||
<xacro:unless value="${simulation}"> | ||
<xacro:property | ||
name="file_prefix" | ||
value="package://depthai_descriptions" | ||
/> | ||
</xacro:unless> | ||
|
||
<!-- base_link of the sensor--> | ||
<link name="${base_frame}"/> | ||
<xacro:property name="M_PI" value="3.1415926535897931" /> | ||
<xacro:property name="model" value="${camera_model}" /> | ||
<!-- base_link of the sensor--> | ||
<link name="${base_frame}" /> | ||
<xacro:property name="M_PI" value="3.1415926535897931" /> | ||
<xacro:property name="model" value="${camera_model}" /> | ||
|
||
<joint name="${camera_name}_center_joint" type="fixed"> | ||
<parent link="${parent}"/> | ||
<child link="${base_frame}"/> | ||
<origin xyz="${cam_pos_x} ${cam_pos_y} ${cam_pos_z}" rpy="${cam_roll} ${cam_pitch} ${cam_yaw}" /> | ||
</joint> | ||
<joint name="${camera_name}_center_joint" type="fixed"> | ||
<parent link="${parent}" /> | ||
<child link="${base_frame}" /> | ||
<origin xyz="${cam_pos_x} ${cam_pos_y} ${cam_pos_z}" | ||
rpy="${cam_roll} ${cam_pitch} ${cam_yaw}" /> | ||
</joint> | ||
|
||
<!-- device Center --> | ||
<link name="${camera_name}_model_origin"> | ||
<visual> | ||
<origin xyz="0 0 0" rpy="0 0 0"/> | ||
<geometry> | ||
<mesh filename="${file_prefix}/urdf/models/${model}.stl" /> | ||
</geometry> | ||
<material name="mat"> | ||
<color rgba="${r} ${g} ${b} ${a}"/> | ||
</material> | ||
</visual> | ||
</link> | ||
<!-- device Center --> | ||
<xacro:unless value="${model in ['OAK-D-SR-POE']}"> | ||
<link name="${camera_name}_model_origin"> | ||
<visual> | ||
<origin xyz="0 0 0" rpy="0 0 0" /> | ||
<geometry> | ||
<mesh filename="${file_prefix}/urdf/models/${model}.stl" /> | ||
</geometry> | ||
<material name="mat"> | ||
<color rgba="${r} ${g} ${b} ${a}" /> | ||
</material> | ||
</visual> | ||
</link> | ||
</xacro:unless> | ||
<xacro:if value="${model in ['OAK-D-SR-POE']}"> | ||
<link name="${camera_name}_model_origin"> | ||
<visual> | ||
<origin xyz="0.019 0 0" rpy="0 0 0" /> | ||
<geometry> | ||
<mesh filename="${file_prefix}/urdf/models/${model}.stl" /> | ||
</geometry> | ||
<material name="mat"> | ||
<color rgba="${r} ${g} ${b} ${a}" /> | ||
</material> | ||
</visual> | ||
</link> | ||
</xacro:if> | ||
|
||
<joint name="${camera_name}_model_origin_joint" type="fixed"> | ||
<parent link="${base_frame}"/> | ||
<child link="${camera_name}_model_origin"/> | ||
<origin xyz="0 0 0" rpy="1.5708 0 1.5708" /> | ||
</joint> | ||
<joint name="${camera_name}_model_origin_joint" type="fixed"> | ||
<parent link="${base_frame}" /> | ||
<child link="${camera_name}_model_origin" /> | ||
<origin xyz="0 0 0" rpy="1.5708 0 1.5708" /> | ||
</joint> | ||
|
||
|
||
<!-- IMU --> | ||
<!-- IMU --> | ||
|
||
<xacro:if value="${model == 'OAK-D'}"> | ||
<xacro:property name="imu_offset_x" value="0.0" /> | ||
<xacro:property name="imu_offset_y" value="-0.015" /> | ||
<xacro:property name="imu_offset_z" value="-0.013662" /> | ||
<xacro:property name="imu_r" value="0.0" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
<xacro:if value="${model == 'OAK-D'}"> | ||
<xacro:property name="imu_offset_x" value="0.0" /> | ||
<xacro:property name="imu_offset_y" value="-0.015" /> | ||
<xacro:property name="imu_offset_z" value="-0.013662" /> | ||
<xacro:property name="imu_r" value="0.0" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
|
||
<xacro:if value="${model == 'OAK-D-PRO'}"> | ||
<xacro:property name="imu_offset_x" value="-0.008" /> | ||
<xacro:property name="imu_offset_y" value="-0.037945" /> | ||
<xacro:property name="imu_offset_z" value="-0.00079" /> | ||
<xacro:property name="imu_r" value="${M_PI}" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
<xacro:if value="${model == 'OAK-D-PRO'}"> | ||
<xacro:property name="imu_offset_x" value="-0.008" /> | ||
<xacro:property name="imu_offset_y" value="-0.037945" /> | ||
<xacro:property name="imu_offset_z" value="-0.00079" /> | ||
<xacro:property name="imu_r" value="${M_PI}" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
|
||
<xacro:if value="${model == 'OAK-D-POE'}"> | ||
<xacro:property name="imu_offset_x" value="-0.008" /> | ||
<xacro:property name="imu_offset_y" value="-0.04" /> | ||
<xacro:property name="imu_offset_z" value="-0.020265" /> | ||
<xacro:property name="imu_r" value="${M_PI}" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
<xacro:if value="${model == 'OAK-D-POE'}"> | ||
<xacro:property name="imu_offset_x" value="-0.008" /> | ||
<xacro:property name="imu_offset_y" value="-0.04" /> | ||
<xacro:property name="imu_offset_z" value="-0.020265" /> | ||
<xacro:property name="imu_r" value="${M_PI}" /> | ||
<xacro:property name="imu_p" value="${M_PI/2.0}" /> | ||
<xacro:property name="imu_y" value="0.0" /> | ||
</xacro:if> | ||
|
||
<xacro:if value="${has_imu}"> | ||
<link name="${camera_name}_imu_frame" /> | ||
<joint name="${camera_name}_imu_joint" type="fixed"> | ||
<parent link="${base_frame}"/> | ||
<child link="${camera_name}_imu_frame"/> | ||
<origin xyz="${imu_offset_x} ${imu_offset_y} ${imu_offset_z}" rpy="${imu_r} ${imu_p} ${imu_y}" /> | ||
</joint> | ||
</xacro:if> | ||
<xacro:if value="${has_imu}"> | ||
<link name="${camera_name}_imu_frame" /> | ||
<joint name="${camera_name}_imu_joint" type="fixed"> | ||
<parent link="${base_frame}" /> | ||
<child link="${camera_name}_imu_frame" /> | ||
<origin xyz="${imu_offset_x} ${imu_offset_y} ${imu_offset_z}" | ||
rpy="${imu_r} ${imu_p} ${imu_y}" /> | ||
</joint> | ||
</xacro:if> | ||
|
||
</xacro:macro> | ||
</xacro:macro> | ||
</robot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
/oak: | ||
ros__parameters: | ||
camera: | ||
i_enable_imu: true | ||
i_enable_ir: false | ||
i_nn_type: none | ||
i_pipeline_type: rgbtof | ||
right: | ||
i_low_bandwidth: true |
File renamed without changes.
60 changes: 60 additions & 0 deletions
60
depthai_ros_driver/include/depthai_ros_driver/dai_nodes/sensors/tof.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#pragma once | ||
|
||
#include "depthai_ros_driver/dai_nodes/base_node.hpp" | ||
#include "depthai_ros_driver/dai_nodes/sensors/sensor_helpers.hpp" | ||
|
||
namespace dai { | ||
class Pipeline; | ||
class Device; | ||
class DataInputQueue; | ||
class ADatatype; | ||
namespace node { | ||
class Camera; | ||
class ToF; | ||
class ImageAlign; | ||
class XLinkIn; | ||
} // namespace node | ||
} // namespace dai | ||
|
||
namespace rclcpp { | ||
class Node; | ||
class Parameter; | ||
} // namespace rclcpp | ||
|
||
namespace depthai_ros_driver { | ||
namespace param_handlers { | ||
class ToFParamHandler; | ||
} | ||
namespace dai_nodes { | ||
|
||
namespace sensor_helpers { | ||
class ImagePublisher; | ||
} // namespace sensor_helpers | ||
class ToF : public BaseNode { | ||
public: | ||
explicit ToF(const std::string& daiNodeName, | ||
std::shared_ptr<rclcpp::Node> node, | ||
std::shared_ptr<dai::Pipeline> pipeline, | ||
dai::CameraBoardSocket boardSocket = dai::CameraBoardSocket::CAM_A); | ||
~ToF(); | ||
void updateParams(const std::vector<rclcpp::Parameter>& params) override; | ||
void setupQueues(std::shared_ptr<dai::Device> device) override; | ||
void link(dai::Node::Input in, int linkType = 0) override; | ||
dai::Node::Input getInput(int linkType = 0) override; | ||
void setNames() override; | ||
void setXinXout(std::shared_ptr<dai::Pipeline> pipeline) override; | ||
std::vector<std::shared_ptr<sensor_helpers::ImagePublisher>> getPublishers() override; | ||
void closeQueues() override; | ||
|
||
private: | ||
std::shared_ptr<sensor_helpers::ImagePublisher> tofPub; | ||
std::shared_ptr<dai::node::Camera> camNode; | ||
std::shared_ptr<dai::node::ToF> tofNode; | ||
std::shared_ptr<dai::node::ImageAlign> alignNode; | ||
std::unique_ptr<param_handlers::ToFParamHandler> ph; | ||
dai::CameraBoardSocket boardSocket; | ||
std::string tofQName; | ||
}; | ||
|
||
} // namespace dai_nodes | ||
} // namespace depthai_ros_driver |
35 changes: 35 additions & 0 deletions
35
depthai_ros_driver/include/depthai_ros_driver/param_handlers/tof_param_handler.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "depthai/pipeline/datatype/CameraControl.hpp" | ||
#include "depthai/pipeline/datatype/ToFConfig.hpp" | ||
#include "depthai_ros_driver/param_handlers/base_param_handler.hpp" | ||
|
||
namespace dai { | ||
namespace node { | ||
class Camera; | ||
class ToF; | ||
} // namespace node | ||
} // namespace dai | ||
|
||
namespace rclcpp { | ||
class Node; | ||
class Parameter; | ||
} // namespace rclcpp | ||
|
||
namespace depthai_ros_driver { | ||
namespace param_handlers { | ||
|
||
class ToFParamHandler : public BaseParamHandler { | ||
public: | ||
explicit ToFParamHandler(std::shared_ptr<rclcpp::Node> node, const std::string& name); | ||
~ToFParamHandler(); | ||
void declareParams(std::shared_ptr<dai::node::Camera> cam, std::shared_ptr<dai::node::ToF> tof); | ||
dai::CameraControl setRuntimeParams(const std::vector<rclcpp::Parameter>& params) override; | ||
std::unordered_map<std::string, dai::MedianFilter> medianFilterMap; | ||
}; | ||
} // namespace param_handlers | ||
} // namespace depthai_ros_driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.