WEEK1 - dingdongdengdong/astra_ws GitHub Wiki
graph TD
subgraph User_Input ["User Input"]
direction LR
UI["Web Browser UI / Local Camera"] --> CamInput{"Camera Feed + User Actions"};
end
subgraph Non_ROS_Vision_Processing ["Non-ROS Vision Processing"]
direction LR
CamInput --> ATeleopProc["astra_teleop/process.py - ArUco Detection and Pose Estimation"];
ATeleopProc --> ProcessedVisionData{"Processed Vision Data Marker Poses)"};
subgraph Web_Interface ["non_ros_src/astra_teleop_web"]
direction LR
CamInputWeb["Web Client index.html, index.js, opencv.js"] -->|Marker Data, Pedal via WebRTC| WebServer["webserver.py"];
WebServer --> Teleoperator["teleoprator.py"];
Teleoperator -->|Uses| ATeleopProc;
Teleoperator --> WebArmGoal{"Arm Goal Pose"};
end
end
subgraph ROS2_System ["ROS2 System (ros_src)"]
direction TB
subgraph ROS_Input_Nodes ["ROS Input Nodes"]
direction LR
ProcessedVisionData --> TeleopNode["astra_controller/teleop_node.py"];
WebArmGoal --> TeleopWebNode["astra_controller/teleop_web_node.py"];
end
subgraph ROS_Controllers ["ROS Controllers"]
direction LR
TeleopNode -->|Target Pose| AstraCtrl["astra_controller/astra_controller.py"];
TeleopWebNode -->|Target Pose| AstraCtrl;
AstraCtrl --> ArmCtrl["astra_controller/arm_controller.py"];
AstraCtrl --> OtherCtrls["(Head, Gripper, Base Ctrls)"];
ArmCtrl -->|Joint Commands| SimOrHW{"Simulated/Real Robot"};
OtherCtrls -->|Joint Commands| SimOrHW;
end
subgraph Simulation_Setup ["Simulation - MoveIt povr Gazebo/RViz"]
direction TB
LaunchSim["astra_moveit_config/launch/demo.launch.py"] --> RVizGazebo["RViz / Gazebo"];
RobotModel["astra_description (URDF)"] --> RVizGazebo;
ROS2CtrlCfgs["astra_moveit_config/config/ros2_controllers.yaml"] --> SimCtrlManager["Simulated Controller Manager (e.g., FakeControllerManager or Gazebo Controllers)"];
SimCtrlManager --> SimOrHW;
end
subgraph Main_Launch_File ["Main Launch"]
StartLaunch["astra_controller/launch/start.launch.py"] --> AstraCtrl;
StartLaunch --> TeleopNode;
StartLaunch --> TeleopWebNode;
StartLaunch -->|Can Include| LaunchSim;
end
end
style User_Input fill:#E6E6FA,stroke:#333,stroke-width:2px
style CamInput fill:#ADD8E6,stroke:#333,stroke-width:1px
style Non_ROS_Vision_Processing fill:#FFFACD,stroke:#333,stroke-width:2px
style ATeleopProc fill:#FAFAD2,stroke:#333,stroke-width:1px
style ProcessedVisionData fill:#FFEFD5,stroke:#333,stroke-width:1px
style Web Trinface fill:#F0FFF0,stroke:#333,stroke-width:1.5px
style CamInputWeb fill:#98FB98,stroke:#333,stroke-width:1px
style WebServer fill:#AFEEEE,stroke:#333,stroke-width:1px
style Teleoperator fill:#AFEEEE,stroke:#333,stroke-width:1px
style WebArmGoal fill:#FFE4E1,stroke:#333,stroke-width:1px
style ROS2_System fill:#D3D3D3,stroke:#000,stroke-width:2px
style ROS_Input_Nodes fill:#F5DEB3,stroke:#333,stroke-width:1.5px
style TeleopNode fill:#FFEBCD,stroke:#333,stroke-width:1px
style TeleopWebNode fill:#FFEBCD,stroke:#333,stroke-width:1px
style ROS_Controllers fill:#E0FFFF,stroke:#333,stroke-width:1.5px
style AstraCtrl fill:#B0E0E6,stroke:#333,stroke-width:1px
style ArmCtrl fill:#B0E0E6,stroke:#333,stroke-width:1px
style OtherCtrls fill:#B0E0E6,stroke:#333,stroke-width:1px
style SimOrHW fill:#FFDAB9,stroke:#333,stroke-width:1px
style Simulation_Setup fill:#F0E68C,stroke:#333,stroke-width:1.5px
style LaunchSim fill:#FFF8DC,stroke:#333,stroke-width:1px
style RVizGazebo fill:#F5F5DC,stroke:#333,stroke-width:1px
style RobotModel fill:#F5F5DC,stroke:#333,stroke-width:1px
style ROS2CtrlCfgs fill:#F5F5DC,stroke:#333,stroke-width:1px
style SimCtrlManager fill:#F5F5DC,stroke:#333,stroke-width:1px
style Main_Launch_File fill:#FFE4B5,stroke:#333,stroke-width:1.5px
style StartLaunch fill:#FFDEAD,stroke:#333,stroke-width:1px
1์ฃผ์ฐจ ํ๋ก์ ํธ ๊ฐ์ ๋ฐ ๊ตฌํ ํ๋ฆ
๋ชฉํ: ์นด๋ฉ๋ผ ๋น์ ์ฒ๋ฆฌ(non_ros_src/astra_teleop
๋ก์ง)๋ฅผ ํตํด ์ป์ ๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ๋ฅผ teleop_node
๋ก ์ ๋ฌํ๊ณ , ์ด ๋ฐ์ดํฐ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก MoveIt ์๋ฎฌ๋ ์ด์
ํ๊ฒฝ์ Astra ๋ก๋ด ํ์ ์์ง์ด๋ ๊ธฐ๋ณธ ์์คํ
์ ๊ตฌ์ถํฉ๋๋ค. ๋์์ ํ๋ฌ ์
๋ ฅ์ ๋ฐ์ ํ๋ถ ์์ง์ ๋ฐ ๊ทธ๋ฆฌํผ ์ ์ด๋ฅผ ์ํ ํ์ดํ๋ผ์ธ์ ์ฐ๊ฒฐํฉ๋๋ค.
ํต์ฌ ๊ธฐ์ : ROS2 ๋ ธ๋ ํต์ (Topics), MoveIt ์๋ฎฌ๋ ์ด์ ํ๊ฒฝ ๊ตฌ์ฑ, Python ๊ธฐ๋ฐ ROS2 ๋ ธ๋ ์์ ๋ฐ ๊ฐ๋ฐ, Launch ํ์ผ ํ์ฉ, ๋น์ ์ฒ๋ฆฌ ์ฐ๋
goalPos๋ ธ๋ ํ๋ฆ(์์).
graph TD
%% Define nodes and main flow
A[Source Node: Teleop] -->|Sends Goal Pose| B{IK Node: ik_node.py}
B -->|"Joint Commands"| E[dry_run_node: Simulation]
E -->|"Simulated Joint State"| F[MoveIt & RViz: Visualization]
E -->|"Joint State Feedback"| C[MoveIt - move_group Node]
%% Highlight critical data paths
A -->|"goal_pose: PoseStamped"| B
B -->|"JointCommand: astra_controller"| E
E -->|"JointState: sensor_msgs"| F
E -->|"JointState: sensor_msgs"| C
%% Styling for clarity and readability
classDef node fill:#f0f9ff,stroke:#333,stroke-width:2px
classDef highlight fill:#fff3cd,stroke:#d4a017,stroke-width:2px
class A,B,C,E,F node
class E,C highlight
%% Style feedback loop and goal_pose path
linkStyle 3,5 stroke:#d4a017,stroke-width:2px
%% Comments for additional clarity
%% Source Node (Teleop) sends goal_pose to IK Node.
%% IK Node computes joint commands using inverse kinematics.
%% dry_run_node simulates joint motion and publishes states.
%% MoveIt uses feedback to plan motion; RViz visualizes results.
๊ตฌํ ํ๋ฆ๋ :
graph LR
A[Camera Input] --> B[Vision Processing\nnon_ros_src/astra_teleop logic]
I[Pedal Input] --> J[Pedal Input Node]
subgraph astra_controller
C[teleop_node]
D[moveit_relay_node]
K[Base/Lift/Gripper Nodes]
end
B -->|Processed Arm Movement Data| C
J -->|Pedal Data| C
C -->|Arm Commands\nsensor_msgs/msg/JointState| D
C -->|Base/Gripper Commands| K
D -->|/joint_trajectory_controller/joint_trajectory| E[MoveIt / ros2_control\nSimulated Arm]
K -->|Commands| F[ros2_control\nSimulated Base/Gripper]
E -->|/joint_states Arm| G[Robot State Publisher\nJoint State Publisher]
F -->|/joint_states Base/Gripper| G
G --> H[RViz\nVisualization]
E -->|/joint_states Feedback| C
F -->|/joint_states Feedback| C
๊ธฐ์ ์ค๋ช
- Camera Input: ๋ก๋ด์ ์ฅ์ฐฉ๋ ์นด๋ฉ๋ผ๋ก๋ถํฐ ์ ๋ ฅ ์์์ ํ๋ํฉ๋๋ค.
- Vision Processing (non_ros_src/astra_teleop): ์นด๋ฉ๋ผ ์์์ ๋ถ์ํ์ฌ ์์ ์์น, ์ ์ค์ฒ ๋ฑ์ ์ธ์ํ๊ณ , ๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ(์: ๋ชฉํ ์กฐ์ธํธ ๊ฐ๋, ์๋์ดํํฐ ์์ธ)๋ก ๋ณํํฉ๋๋ค. ์ด ๋ก์ง์
non_ros_src/astra_teleop
ํด๋์ ํฌํจ๋๋ฉฐ, ์ฒ๋ฆฌ๋ ๋ฐ์ดํฐ๋teleop_node
์ ์ฃผ ์ ๋ ฅ์ ๋๋ค. - Pedal Input Node: ํ๋ฌ ์ฅ์น๋ก๋ถํฐ ์
๋ ฅ์ ์ฝ์ด ๋ก๋ด ํ๋ถ ์์ง์ ๋ฐ ๊ทธ๋ฆฌํผ ์ ์ด์ ์ฌ์ฉํ๋ฉฐ,
teleop_node
๋ก ์ ๋ฌ๋ฉ๋๋ค. (์์คํ ์ ๋ฐ๋ผteleop_node
์ ํตํฉ ๊ฐ๋ฅ) - teleop_node (src/astra_controller):
rclpy.node.Node("teleop_node")
๋ก ์ ์๋ ํต์ฌ ๋ ธ๋์ ๋๋ค. **๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ(๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ)**์ ํ๋ฌ ์ ๋ ฅ์ ์์ ํ์ฌ,sensor_msgs/msg/JointState
๋ฉ์์ง๋ก ๋ณํํด/leader_arm/commands
ํ ํฝ์ ๋ฐํํฉ๋๋ค. ํ๋ฌ ์ ๋ ฅ์ ํ๋ถ ๋ฐ ๊ทธ๋ฆฌํผ ์ ์ด ๋ช ๋ น์ผ๋ก ๋ณํ๋์ด ํด๋น ํ ํฝ์ ๋ฐํ๋ฉ๋๋ค. - moveit_relay_node (src/astra_controller):
/leader_arm/commands
ํ ํฝ์์JointState
๋ฉ์์ง๋ฅผ ์์ ํ์ฌ MoveIt์/joint_trajectory_controller/joint_trajectory
ํ ํฝ์ผ๋ก ์ ๋ฌ, ์๋ฎฌ๋ ์ด์ ๋ก๋ด ํ์ ์์ง์ ๋๋ค. - Base/Lift/Gripper Nodes (src/astra_controller): ํ๋ฌ ์
๋ ฅ ๊ธฐ๋ฐ ๋ช
๋ น์ ์์ ํ์ฌ ํ๋ถ ์์ง์ ๋ฐ ๊ทธ๋ฆฌํผ๋ฅผ ์ ์ดํ๋ฉฐ,
ros2_control
์ธํฐํ์ด์ค์ ์ํธ์์ฉํฉ๋๋ค. - MoveIt / ros2_control (Simulated Robot): MoveIt์ ๋ก๋ด ๋ชจ๋ธ๊ณผ ์กฐ์ธํธ ์ํ๋ฅผ ๊ด๋ฆฌํ๊ณ ,
ros2_control
์FakeSystem
์ธํฐํ์ด์ค๋ฅผ ํตํด ์์ง์์ ์๋ฎฌ๋ ์ด์ ํฉ๋๋ค. ๋ช ๋ น์ ๋ฐ์ ์กฐ์ธํธ ์ํ๋ฅผ ์ ๋ฐ์ดํธํ๊ณ/joint_states
ํ ํฝ์ ๋ฐํํฉ๋๋ค. - Robot State Publisher & Joint State Publisher:
/joint_states
ํ ํฝ์ ๊ตฌ๋ ํ์ฌ URDF/XACRO ๊ธฐ๋ฐ์ผ๋ก ๋ก๋ด์ 3D ์์ธ(tf ๋ณํ)๋ฅผ ๊ณ์ฐ ๋ฐ ๋ฐํํฉ๋๋ค. - RViz (Visualization):
/joint_states
๋ฐ tf ๋ฐ์ดํฐ๋ฅผ ๊ตฌ๋ ํ์ฌ ๋ก๋ด ๋ชจ๋ธ์ 3D๋ก ์๊ฐํํฉ๋๋ค.
1์ฃผ์ฐจ ๊ณผ์ ์์ธ ํด๊ฒฐ ๊ฐ์ด๋
๊ณผ์ 1.1: MoveIt ์๋ฎฌ๋ ์ด์ ํ๊ฒฝ ์คํ ๋ฐ ๊ฒ์ฆ
๋ชฉํ
astra_moveit_config
ํจํค์ง๋ฅผ ์ฌ์ฉํด MoveIt ์๋ฎฌ๋ ์ด์
ํ๊ฒฝ(๋ก๋ด ํ, ํ๋ถ, ๊ทธ๋ฆฌํผ ํฌํจ)์ ์คํํ๊ณ , RViz์์ Astra ๋ก๋ด ๋ชจ๋ธ์ ํ์ธํฉ๋๋ค.
๊ธฐ์ ์ค๋ช
astra_moveit_config
ํจํค์ง๋ URDF/XACRO ๋ชจ๋ธ, SRDF, MoveIt ์ค์ , ์๋ฎฌ๋ ์ด์
๋ฐ RViz ์คํ์ฉ Launch ํ์ผ์ ํฌํจํฉ๋๋ค. demo.launch.py
๋ ๋ก๋ด ์ํ ๋ฐํ, ์กฐ์ธํธ ์ํ ๋ฐํ, MoveIt ๋
ธ๋, RViz๋ฅผ ์์ํฉ๋๋ค. ํ๋ถ์ ๊ทธ๋ฆฌํผ๊ฐ URDF ๋ฐ MoveIt/ros2_control์ ๋ฐ์๋๋ฉด RViz์์ ์ ์ฒด ๋ชจ๋ธ์ ํ์ธํ ์ ์์ต๋๋ค.
์คํ ๋จ๊ณ
- ROS2 ์์
๊ณต๊ฐ์
src
ํด๋๋ก ์ด๋ํ์ฌastra_moveit_config
ํจํค์ง๋ฅผ ํ์ธํฉ๋๋ค. - ์์
๊ณต๊ฐ ๋ฃจํธ(์:
colcon_ws
)์์colcon build --packages-select astra_moveit_config
๋ฅผ ์คํํฉ๋๋ค. source install/setup.bash
๋ก ํ๊ฒฝ์ ์ค์ ํฉ๋๋ค.ros2 launch astra_moveit_config demo.launch.py
๋ก ์๋ฎฌ๋ ์ด์ ํ๊ฒฝ์ ์์ํฉ๋๋ค.- RViz์์ Astra ๋ก๋ด ๋ชจ๋ธ์ด ํ์๋๋์ง ํ์ธํฉ๋๋ค.
- RViz์ Displays ํจ๋์์ RobotModel ์ํ๋ฅผ ์ ๊ฒํฉ๋๋ค.
- MoveIt MotionPlanning ํ๋ฌ๊ทธ์ธ์ผ๋ก ๋ก๋ด ํ, ํ๋ถ, ๊ทธ๋ฆฌํผ์ ๊ณํ ๋ฐ ์คํ์ ํ ์คํธํฉ๋๋ค.
ํต์ฌ ํ์ผ/๊ฐ๋
astra_moveit_config/launch/demo.launch.py
- URDF/SRDF
robot_state_publisher
joint_state_publisher
move_group
node- RViz
์์ ๊ฒฐ๊ณผ
RViz์ Astra ๋ก๋ด ๋ชจ๋ธ์ด ์ ์ ํ์๋๊ณ , MoveIt Planning์ผ๋ก ๊ฐ ๋ถ๋ถ์ ์์ง์ผ ์ ์์ต๋๋ค.
๋ฌธ์ ํด๊ฒฐ ํ
- ํฐ๋ฏธ๋ ๋ก๊ทธ๋ฅผ ํ์ธํฉ๋๋ค.
rqt_graph
,ros2 topic list
,ros2 node list
๋ก ๋ฌธ์ ๋ฅผ ์ง๋จํฉ๋๋ค.
๊ณผ์ 1.2: ๋น์ ์ฒ๋ฆฌ, ํ ๋ ์คํผ๋ ์ด์ , MoveIt Relay ๋ ธ๋ ๋ถ์
๋ชฉํ
non_ros_src/astra_teleop
, teleop_node.py
, moveit_relay_node.py
, ํ๋ถ/๊ทธ๋ฆฌํผ ๋
ธ๋ ์ฝ๋๋ฅผ ๋ถ์ํ์ฌ ์ญํ , ํต์ ์ธํฐํ์ด์ค, ๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ teleop_node
์ ๋ฌ ๋ฐฉ์์ ํ์
ํฉ๋๋ค.
๊ธฐ์ ์ค๋ช
๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ธ ๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ๊ฐ teleop_node
๋ก ์ ๋ฌ๋์ด ROS2 ๋ช
๋ น์ผ๋ก ๋ณํ๋๋ ๋ฐ์ดํฐ ํ๋ฆ์ ์ดํดํฉ๋๋ค. moveit_relay_node
๋ฐ ํ๋ถ/๊ทธ๋ฆฌํผ ๋
ธ๋์ ๊ธฐ๋ ๋ฉ์์ง๋ ํ์ธํฉ๋๋ค.
์คํ ๋จ๊ณ
non_ros_src/astra_teleop/
์ Python ํ์ผ(์:cam.py
,process.py
)์ ๋ถ์ํ์ฌ ๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ ์์ฑ ๋ฐ ์ ๋ฌ ๋ฐฉ์(ํ์ผ, ๋คํธ์ํฌ, ํจ์ ํธ์ถ ๋ฑ)์ ํ์ ํฉ๋๋ค.src/astra_controller/teleop_node.py
๋ฅผ ๋ถ์:- ๋ ธ๋ ์ด๋ฆ("teleop_node") ํ์ธ.
- ๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ ๋ฐ ํ๋ฌ ์ ๋ ฅ ์์ ๋ก์ง ํ์ .
/leader_arm/commands
ํ ํฝ๊ณผsensor_msgs/msg/JointState
๋ฐํ ํ์ธ.- ํ๋ถ/๊ทธ๋ฆฌํผ ๋ช ๋ น ํ ํฝ ๋ฐ ๋ฉ์์ง ํ์ ํ์ธ.
- ๋ฐ์ดํฐ ๋ณํ ๋ก์ง ๋ถ์.
src/astra_controller/moveit_relay_node.py
๋ฅผ ๋ถ์:/leader_arm/commands
ํ ํฝ ๋ฐJointState
๊ตฌ๋ ํ์ธ.JointState
๋ฉ์์ง๊ฐ/joint_trajectory_controller/joint_trajectory
๋ก ์ ๋ฌ๋๋ ๋ฐฉ์๊ณผ ์ฌ์ฉ ํ๋(position
,velocity
,effort
) ํ์ธ.
base_node.py
,lift_node.py
๋ฅผ ๋ถ์:- ๊ฐ ๋ ธ๋ ์ญํ (ํ๋ถ, ๋ฆฌํํธ/๊ทธ๋ฆฌํผ) ํ์ .
- ๊ตฌ๋
ํ ํฝ ๋ฐ ๋ฉ์์ง ํ์
(์:
geometry_msgs/msg/Twist
,std_msgs/msg/Float64
) ํ์ธ.
ํต์ฌ ํ์ผ/๊ฐ๋
non_ros_src/astra_teleop/
src/astra_controller/teleop_node.py
src/astra_controller/moveit_relay_node.py
base_node.py
,lift_node.py
sensor_msgs/msg/JointState
geometry_msgs/msg/Twist
- Topics
์์ ๊ฒฐ๊ณผ
๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ์ ์์ฑ ๋ฐ ์ ๋ฌ ๋ฐฉ์, teleop_node
์ ๋ฐ์ดํฐ ์์ ๋ฐ ๋ช
๋ น ๋ณํ ๊ณผ์ ์ ์ดํดํฉ๋๋ค.
๋ฌธ์ ํด๊ฒฐ ํ
- ๋น์ ์ฒ๋ฆฌ์
teleop_node
๊ฐ ๋ฐ์ดํฐ ์ ๋ฌ ๋ฐฉ์์ ๋ช ํํ ์ถ์ ํฉ๋๋ค. - ์ฝ๋ ์ฃผ์์ ํ์ฉํฉ๋๋ค.
๊ณผ์ 1.3: ๋น์ ๋ฐ์ดํฐ ๊ธฐ๋ฐ ๋ก๋ด ํ ๋ช ๋ น ๋ฐํ ๋ ธ๋ ๊ตฌํ ๋ฐ ํ๋ฌ ์ ์ด ์ฐ๊ฒฐ
๋ชฉํ
teleop_node.py
๋ฅผ ์์ ํ์ฌ **๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ(๋ก๋ด ํ ์์ง์ ๋ฐ์ดํฐ)**๋ฅผ sensor_msgs/msg/JointState
๋ก ๋ณํํด /leader_arm/commands
ํ ํฝ์ ๋ฐํํ๊ณ , ํ๋ฌ ์
๋ ฅ์ผ๋ก ํ๋ถ/๊ทธ๋ฆฌํผ ๋ช
๋ น์ ๋ฐํํฉ๋๋ค. ์ด๊ธฐ์๋ ํน์ ์กฐ์ธํธ ํ๋๋ง ์ ์ดํฉ๋๋ค.
๊ธฐ์ ์ค๋ช
๋น์ ๋ฐ์ดํฐ์ ํ๋ฌ ์
๋ ฅ์ ๋ฐ์ ROS2 ๋ฉ์์ง๋ก ๋ณํํ์ฌ ๊ฐ ์ ์ด ๋
ธ๋์ ๋ฐํํฉ๋๋ค. ๋น์ ๋ฐ์ดํฐ๋ JointState
์ position
๋๋ velocity
๋ก, ํ๋ฌ ์
๋ ฅ์ Twist
๋ฐ ๊ทธ๋ฆฌํผ ๋ฉ์์ง๋ก ๋งคํ๋ฉ๋๋ค.
์คํ ๋จ๊ณ
src/astra_controller/teleop_node.py
๋ฅผ ์ฝ๋๋ค.- ๋ฉ์์ง ํ์
์ํฌํธ:
sensor_msgs.msg.JointState
,geometry_msgs.msg.Twist
,std_msgs.msg.Float64
. - ๋น์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ ๋ฐ ํ๋ฌ ์ ๋ ฅ ์์ ๋ก์ง์ ๊ตฌํ(๊ณผ์ 1.2 ๊ธฐ๋ฐ).
- ๋ก๋ด ํ ์ ์ด:
/leader_arm/commands
ํ ํฝ์JointState
๋ฐํ ์ค์ .- ๋น์ ๋ฐ์ดํฐ(์: ์ ๋์ด)๋ฅผ ํน์ ์กฐ์ธํธ(์:
joint1
)์ ๋ชฉํ ๊ฐ์ผ๋ก ๋ณํ. JointState
๋ฉ์์ง ์์ฑ(header.stamp
,name
,position
/velocity
).- ๋ฉ์์ง ๋ฐํ.
- ํ๋ถ/๊ทธ๋ฆฌํผ ์ ์ด:
/cmd_vel
,/gripper_command
ํ ํฝ์ ๋ฉ์์ง ๋ฐํ ์ค์ .- ํ๋ฌ ์ ๋ ฅ์ ์๋ ๋ฐ ๊ทธ๋ฆฌํผ ๋ช ๋ น์ผ๋ก ๋ณํ.
- ๋ฉ์์ง ๋ฐํ.
create_timer()
๋ก ์ฃผ๊ธฐ์ ์คํ ์ค์ .colcon build --packages-select astra_controller
๋ก ๋น๋.
ํต์ฌ ํ์ผ/๊ฐ๋
src/astra_controller/teleop_node.py
- ๋น์ /ํ๋ฌ ์ ๋ ฅ ์์
sensor_msgs/msg/JointState
/leader_arm/commands
- ROS2 Publisher/Subscriber/Timer
์์ ๊ฒฐ๊ณผ
teleop_node
๊ฐ ๋น์ ๋ฐ์ดํฐ ๋ฐ ํ๋ฌ ์
๋ ฅ์ ๋ฐ์ ๋ช
๋ น์ ๋ฐํํ๋ฉฐ, ros2 topic echo
๋ก ๋ฉ์์ง๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
๋ฌธ์ ํด๊ฒฐ ํ
- ๋น์ ๋ฐ์ดํฐ ํ์์ด
teleop_node
๊ธฐ๋ ํ์๊ณผ ์ผ์นํ๋์ง ํ์ธ. - ํ ํฝ ์ด๋ฆ ๋ฐ ๋ฉ์์ง ํ์ ์ ๊ฒ.
- ๊ฐ๋จํ ๋งคํ์ผ๋ก ์์.
๊ณผ์ 1.4: ๋ชจ๋ ๊ตฌ์ฑ ์์ ํตํฉ ์คํ ๋ฐ ๊ธฐ๋ณธ ๋์ ํ์ธ
๋ชฉํ
์นด๋ฉ๋ผ ๋๋ผ์ด๋ฒ, ๋น์ ์ฒ๋ฆฌ, ํ๋ฌ ์
๋ ฅ, teleop_node
, moveit_relay_node
, ํ๋ถ/๊ทธ๋ฆฌํผ ๋
ธ๋, MoveIt ์๋ฎฌ๋ ์ด์
์ Launch ํ์ผ๋ก ์คํํ๊ณ , ๋น์ ์
๋ ฅ๊ณผ ํ๋ฌ ์กฐ์์ ๋ฐ๋ผ RViz ๋ก๋ด์ด ์์ง์ด๋์ง ํ์ธํฉ๋๋ค.
๊ธฐ์ ์ค๋ช
ROS2 Launch๋ก ๋ชจ๋ ๋
ธ๋์ MoveIt ์๋ฎฌ๋ ์ด์
์ ์์ํฉ๋๋ค. teleop_node
๋ ๋น์ /ํ๋ฌ ์
๋ ฅ์ ๋ช
๋ น์ผ๋ก ๋ณํํ๊ณ , moveit_relay_node
๋ฐ ํ๋ถ/๊ทธ๋ฆฌํผ ๋
ธ๋๋ ์ด๋ฅผ ์๋ฎฌ๋ ์ด์
๋ก๋ด์ ๋ฐ์ํฉ๋๋ค.
์คํ ๋จ๊ณ
astra_controller/launch/teleop_vision_sim.launch.py
๋ฅผ ์์ฑ.- ๋ชจ๋ ์ํฌํธ:
import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch_ros.actions import Node from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource
generate_launch_description()
์ ์.- ์นด๋ฉ๋ผ ๋๋ผ์ด๋ฒ ๋
ธ๋ ์ถ๊ฐ:
camera_node = Node( package='usb_cam', executable='usb_cam_node', name='camera_driver', output='screen' )
- ๋น์ ์ฒ๋ฆฌ ๋ ธ๋ ์ถ๊ฐ(๋ ๋ฆฝ์ ์ธ ๊ฒฝ์ฐ).
- ํ๋ฌ ์ ๋ ฅ ๋ ธ๋ ์ถ๊ฐ(๋ ๋ฆฝ์ ์ธ ๊ฒฝ์ฐ).
teleop_node
์ถ๊ฐ:teleop_node = Node( package='astra_controller', executable='teleop_node', name='teleop_main', output='screen' )
moveit_relay_node
์ถ๊ฐ:moveit_relay_node = Node( package='astra_controller', executable='moveit_relay_node', name='moveit_relay', output='screen', parameters=[{ 'command_topic_name': '/leader_arm/commands', 'controller_topic_name': '/joint_trajectory_controller/joint_trajectory', 'joint_names': ['joint1', 'joint2', 'joint3', 'joint4', 'joint5', 'joint6'] }] )
- ํ๋ถ/๊ทธ๋ฆฌํผ ๋
ธ๋ ์ถ๊ฐ:
base_node = Node( package='astra_controller', executable='base_node', name='base_controller', output='screen' ) lift_node = Node( package='astra_controller', executable='lift_node', name='lift_controller', output='screen' )
- MoveIt ์๋ฎฌ๋ ์ด์
ํฌํจ:
moveit_launch_file = os.path.join( get_package_share_directory('astra_moveit_config'), 'launch', 'demo.launch.py' ) moveit_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource(moveit_launch_file), launch_arguments={'use_sim_time': 'true'}.items() )
LaunchDescription
์ ์ถ๊ฐ:ld = LaunchDescription([ camera_node, teleop_node, moveit_relay_node, base_node, lift_node, moveit_launch ]) return ld
setup.py
์ Launch ํ์ผ ์ถ๊ฐ.colcon build --packages-select astra_controller astra_moveit_config usb_cam
.source install/setup.bash
.ros2 launch astra_controller teleop_vision_sim.launch.py
์คํ.- RViz์์ ๋น์ ์ ๋ ฅ๊ณผ ํ๋ฌ ์กฐ์์ ๋ฐ๋ฅธ ๋ก๋ด ์์ง์ ํ์ธ.
ํต์ฌ ํ์ผ/๊ฐ๋
astra_controller/launch/teleop_vision_sim.launch.py
launch_ros.actions.Node
launch.actions.IncludeLaunchDescription
- ์นด๋ฉ๋ผ/๋น์ /ํ๋ฌ ๋ ธ๋
teleop_node
,moveit_relay_node
astra_moveit_config/launch/demo.launch.py
์์ ๊ฒฐ๊ณผ
Launch ํ์ผ๋ก ์์คํ ์ด ์คํ๋๋ฉฐ, ๋น์ ์ ๋ ฅ๊ณผ ํ๋ฌ ์กฐ์์ ๋ฐ๋ผ RViz ๋ก๋ด์ด ์์ง์ ๋๋ค.
๋ฌธ์ ํด๊ฒฐ ํ
- ์คํ ๋ก๊ทธ ํ์ธ.
rqt_graph
,ros2 topic echo
๋ก ๋ฉ์์ง ์ ๊ฒ.- ์นด๋ฉ๋ผ ์ ๋ ฅ ๋ฐ ๋น์ ๋ฐ์ดํฐ ์ ๋ฌ ํ์ธ