Skip to content

Commit 3c93b74

Browse files
committed
docs(README): update documentation and remove unused files
- Update README.md with project structure and data packet formats - Remove unused camera_info.yaml file - Comment out timer-related code in rm_serial_driver
1 parent 48598d6 commit 3c93b74

File tree

6 files changed

+128
-29
lines changed

6 files changed

+128
-29
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
11
# XTU_Sentry
2+
3+
![代码结构框架](doc/picture/Sentry_Nav.drawio.png)
4+
5+
6+
上位机收发数据格式:
7+
```
8+
struct ReceivePacket
9+
{
10+
uint8_t header = 0x5A;
11+
uint8_t detect_color : 1; // 0-red 1-blue
12+
uint8_t task_mode : 2; // 0-手打 1-自瞄 2-大符
13+
bool reset_tracker : 1; // 1-重启跟踪器
14+
uint8_t is_play : 1; // 1-play 0-stop
15+
bool change_target : 1; // 1-change target
16+
uint8_t reserved : 2;
17+
float roll;
18+
float pitch;
19+
float yaw;
20+
uint16_t robot_HP; // 机器人自身血量
21+
uint16_t game_time; // (s) game time [0, 450]
22+
uint16_t checksum = 0;
23+
} __attribute__((packed));
24+
25+
26+
struct SendPacket
27+
{
28+
uint8_t header = 0xA5;
29+
uint8_t state : 4; // 0-untracking 1-tracking-aim 2-tracking-buff
30+
uint8_t fire_flag : 4; // 0-fired-off 1-fired-on
31+
float pitch;
32+
float yaw;
33+
34+
float nav_x;
35+
float nav_y;
36+
float nav_z;
37+
38+
uint16_t checksum = 0;
39+
} __attribute__((packed));
40+
```

camera_info.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

doc/picture/Sentry_Nav.drawio

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0" version="27.1.4">
2+
<diagram name="第 1 页" id="z-py1rGn_Ya1MJFAARSf">
3+
<mxGraphModel dx="1356" dy="765" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-5" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-1" target="bZHmnCdVlWdmFKNPFxgX-3">
8+
<mxGeometry relative="1" as="geometry">
9+
<Array as="points">
10+
<mxPoint x="410" y="340" />
11+
<mxPoint x="410" y="340" />
12+
</Array>
13+
</mxGeometry>
14+
</mxCell>
15+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-1" target="bZHmnCdVlWdmFKNPFxgX-2">
16+
<mxGeometry relative="1" as="geometry">
17+
<Array as="points">
18+
<mxPoint x="410" y="340" />
19+
<mxPoint x="220" y="340" />
20+
</Array>
21+
</mxGeometry>
22+
</mxCell>
23+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-1" target="bZHmnCdVlWdmFKNPFxgX-4">
24+
<mxGeometry relative="1" as="geometry">
25+
<Array as="points">
26+
<mxPoint x="410" y="340" />
27+
<mxPoint x="600" y="340" />
28+
</Array>
29+
</mxGeometry>
30+
</mxCell>
31+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-1" value="Sentry_Nav" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
32+
<mxGeometry x="350" y="250" width="120" height="60" as="geometry" />
33+
</mxCell>
34+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-2" target="bZHmnCdVlWdmFKNPFxgX-9">
35+
<mxGeometry relative="1" as="geometry" />
36+
</mxCell>
37+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-2" value="autoaim" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
38+
<mxGeometry x="160" y="370" width="120" height="60" as="geometry" />
39+
</mxCell>
40+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-3" target="bZHmnCdVlWdmFKNPFxgX-10">
41+
<mxGeometry relative="1" as="geometry" />
42+
</mxCell>
43+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-3" value="navigation" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
44+
<mxGeometry x="350" y="370" width="120" height="60" as="geometry" />
45+
</mxCell>
46+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-4" target="bZHmnCdVlWdmFKNPFxgX-11">
47+
<mxGeometry relative="1" as="geometry" />
48+
</mxCell>
49+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-4" value="judge" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
50+
<mxGeometry x="540" y="370" width="120" height="60" as="geometry" />
51+
</mxCell>
52+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-9" target="bZHmnCdVlWdmFKNPFxgX-18">
53+
<mxGeometry relative="1" as="geometry" />
54+
</mxCell>
55+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-9" value="自瞄" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
56+
<mxGeometry x="160" y="480" width="120" height="60" as="geometry" />
57+
</mxCell>
58+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-10" target="bZHmnCdVlWdmFKNPFxgX-18">
59+
<mxGeometry relative="1" as="geometry" />
60+
</mxCell>
61+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-10" value="导航" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
62+
<mxGeometry x="350" y="480" width="120" height="60" as="geometry" />
63+
</mxCell>
64+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-11" target="bZHmnCdVlWdmFKNPFxgX-15">
65+
<mxGeometry relative="1" as="geometry" />
66+
</mxCell>
67+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-11" value="决策" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
68+
<mxGeometry x="540" y="480" width="120" height="60" as="geometry" />
69+
</mxCell>
70+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-15" target="bZHmnCdVlWdmFKNPFxgX-10">
71+
<mxGeometry relative="1" as="geometry" />
72+
</mxCell>
73+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-15" value="调用Nav2_API" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
74+
<mxGeometry x="540" y="590" width="120" height="60" as="geometry" />
75+
</mxCell>
76+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-22" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="bZHmnCdVlWdmFKNPFxgX-18" target="bZHmnCdVlWdmFKNPFxgX-21">
77+
<mxGeometry relative="1" as="geometry" />
78+
</mxCell>
79+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-18" value="rm_serial_driver" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
80+
<mxGeometry x="160" y="590" width="120" height="60" as="geometry" />
81+
</mxCell>
82+
<mxCell id="bZHmnCdVlWdmFKNPFxgX-21" value="下位机" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
83+
<mxGeometry x="160" y="700" width="120" height="60" as="geometry" />
84+
</mxCell>
85+
</root>
86+
</mxGraphModel>
87+
</diagram>
88+
</mxfile>

doc/picture/Sentry_Nav.drawio.png

30 KB
Loading

src/autoaim/rm_serial_driver/include/rm_serial_driver/rm_serial_driver.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ class RMSerialDriver : public rclcpp::Node
105105

106106
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr record_controller_pub_;
107107

108-
// rclcpp::TimerBase::SharedPtr timer_;
109-
// void on_timer(void);
110108
rclcpp::Subscription<geometry_msgs::msg::Twist>::SharedPtr cmd_vel_sub_;
111109
void cmd_vel_callback(const geometry_msgs::msg::Twist::SharedPtr cmd_vel_msg);
112110
SendPacket packet;

src/autoaim/rm_serial_driver/src/rm_serial_driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ RMSerialDriver::RMSerialDriver(const rclcpp::NodeOptions & options)
7878
throw ex;
7979
}
8080

81-
// timer_ = this->create_wall_timer(8ms, std::bind(&RMSerialDriver::on_timer, this));
81+
8282
cmd_vel_sub_ = this->create_subscription<geometry_msgs::msg::Twist>(
8383
"/cmd_vel", rclcpp::SensorDataQoS(),
8484
std::bind(&RMSerialDriver::cmd_vel_callback, this, std::placeholders::_1));

0 commit comments

Comments
 (0)