New Crowdin translations - zh-CN (#24563)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
PX4 Build Bot
2025-03-19 20:59:57 +11:00
committed by GitHub
co-authored by Crowdin Bot
parent bd0a59eb1f
commit d04e6695ac
180 changed files with 2417 additions and 2402 deletions
+31 -31
View File
@@ -37,63 +37,63 @@ This is needed because, by default, you cannot arm a vehicle without a connectio
2. 使用以下方法创建并切换至新的 colcon工作目录:
```sh
mkdir -p ~/ws_offboard_control/src/
cd ~/ws_offboard_control/src/
```
```sh
mkdir -p ~/ws_offboard_control/src/
cd ~/ws_offboard_control/src/
```
3. Clone the [px4_msgs](https://github.com/PX4/px4_msgs) repo to the `/src` directory (this repo is needed in every ROS 2 PX4 workspace!):
```sh
git clone https://github.com/PX4/px4_msgs.git
# checkout the matching release branch if not using PX4 main.
```
```sh
git clone https://github.com/PX4/px4_msgs.git
# checkout the matching release branch if not using PX4 main.
```
4. Clone the example repository [px4_ros_com](https://github.com/PX4/px4_ros_com) to the `/src` directory:
```sh
git clone https://github.com/PX4/px4_ros_com.git
```
```sh
git clone https://github.com/PX4/px4_ros_com.git
```
5. Source the ROS 2 development environment into the current terminal and compile the workspace using `colcon`:
:::: tabs
:::: tabs
::: tab humble
::: tab humble
```sh
cd ..
source /opt/ros/humble/setup.bash
colcon build
```
```sh
cd ..
source /opt/ros/humble/setup.bash
colcon build
```
:::
::: tab foxy
::: tab foxy
```sh
cd ..
source /opt/ros/foxy/setup.bash
colcon build
```
```sh
cd ..
source /opt/ros/foxy/setup.bash
colcon build
```
:::
::::
::::
6. Source the `local_setup.bash`:
```sh
source install/local_setup.bash
```
```sh
source install/local_setup.bash
```
7. 启动例程。
```
ros2 run px4_ros_com offboard_control
```
```
ros2 run px4_ros_com offboard_control
```
飞行器将解锁、起飞至5米并悬停等待(永久)。
+53 -53
View File
@@ -108,92 +108,92 @@ The following steps are required to get started:
2. Clone the repository into the workspace:
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
:::
3. Build the workspace:
```sh
cd ..
colcon build
source install/setup.bash
```
```sh
cd ..
colcon build
source install/setup.bash
```
4. In a different shell, start PX4 SITL:
```sh
cd $px4-autopilot
make px4_sitl gazebo-classic
```
```sh
cd $px4-autopilot
make px4_sitl gazebo-classic
```
(here we use Gazebo-Classic, but you can use any model or simulator)
(here we use Gazebo-Classic, but you can use any model or simulator)
5. Run the micro XRCE agent in a new shell (you can keep it running afterward):
```sh
MicroXRCEAgent udp4 -p 8888
```
```sh
MicroXRCEAgent udp4 -p 8888
```
6. Start QGroundControl.
::: info
Use QGroundControl Daily, which supports dynamically updating the list of modes.
::: info
Use QGroundControl Daily, which supports dynamically updating the list of modes.
:::
7. Back in the ROS 2 terminal, run one of the example modes:
```sh
ros2 run example_mode_manual_cpp example_mode_manual
```
```sh
ros2 run example_mode_manual_cpp example_mode_manual
```
You should get an output like this showing 'My Manual Mode' mode being registered:
You should get an output like this showing 'My Manual Mode' mode being registered:
```sh
[DEBUG] [example_mode_manual]: Checking message compatibility...
[DEBUG] [example_mode_manual]: Subscriber found, continuing
[DEBUG] [example_mode_manual]: Publisher found, continuing
[DEBUG] [example_mode_manual]: Registering 'My Manual Mode' (arming check: 1, mode: 1, mode executor: 0)
[DEBUG] [example_mode_manual]: Subscriber found, continuing
[DEBUG] [example_mode_manual]: Publisher found, continuing
[DEBUG] [example_mode_manual]: Got RegisterExtComponentReply
[DEBUG] [example_mode_manual]: Arming check request (id=1, only printed once)
```
```sh
[DEBUG] [example_mode_manual]: Checking message compatibility...
[DEBUG] [example_mode_manual]: Subscriber found, continuing
[DEBUG] [example_mode_manual]: Publisher found, continuing
[DEBUG] [example_mode_manual]: Registering 'My Manual Mode' (arming check: 1, mode: 1, mode executor: 0)
[DEBUG] [example_mode_manual]: Subscriber found, continuing
[DEBUG] [example_mode_manual]: Publisher found, continuing
[DEBUG] [example_mode_manual]: Got RegisterExtComponentReply
[DEBUG] [example_mode_manual]: Arming check request (id=1, only printed once)
```
8. On the PX4 shell, you can check that PX4 registered the new mode:
```sh
commander status
```
```sh
commander status
```
The output should contain:
The output should contain:
```plain
INFO [commander] Disarmed
INFO [commander] navigation mode: Position
INFO [commander] user intended navigation mode: Position
INFO [commander] in failsafe: no
INFO [commander] External Mode 1: nav_state: 23, name: My Manual Mode
```
```plain
INFO [commander] Disarmed
INFO [commander] navigation mode: Position
INFO [commander] user intended navigation mode: Position
INFO [commander] in failsafe: no
INFO [commander] External Mode 1: nav_state: 23, name: My Manual Mode
```
9. At this point you should be able to see the mode in QGroundControl as well:
![QGC Modes](../../assets/middleware/ros2/px4_ros2_interface_lib/qgc_modes.png)
![QGC Modes](../../assets/middleware/ros2/px4_ros2_interface_lib/qgc_modes.png)
10. Select the mode, make sure you have a manual control source (physical or virtual joystick), and arm the vehicle.
The mode will then activate, and it should print the following output:
The mode will then activate, and it should print the following output:
```sh
[DEBUG] [example_mode_manual]: Mode 'My Manual Mode' activated
```
```sh
[DEBUG] [example_mode_manual]: Mode 'My Manual Mode' activated
```
11. Now you are ready to create your own mode.
@@ -422,7 +422,7 @@ If you want to control an independent actuator (a servo), follow these steps:
1. [Configure the output](../payloads/generic_actuator_control.md#generic-actuator-control-with-mavlink)
2. Create an instance of [px4_ros2::PeripheralActuatorControls](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1PeripheralActuatorControls.html) in the constructor of your mode.
3. Call the `set()` method to control the actuator(s).
This can be done independently of any active setpoints.
This can be done independently of any active setpoints.
### Telemetry
+90 -90
View File
@@ -27,36 +27,36 @@ The following steps describe how to install and run the translation node on your
1. (Optional) Create a new ROS 2 workspace in which to build the message translation node and its dependencies:
```sh
mkdir -p /path/to/ros_ws/src
```
```sh
mkdir -p /path/to/ros_ws/src
```
2. Run the following helper script to copy the message definitions and translation node into your ROS workspace directory.
```sh
cd /path/to/ros_ws
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
```
```sh
cd /path/to/ros_ws
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
```
3. Build and source the workspace.
```sh
colcon build
source /path/to/ros_ws/install/setup.bash
```
```sh
colcon build
source /path/to/ros_ws/install/setup.bash
```
4. Finally, run the translation node.
```sh
ros2 run translation_node translation_node_bin
```
```sh
ros2 run translation_node translation_node_bin
```
You should see an output similar to:
You should see an output similar to:
```sh
[INFO] [1734525720.729530513] [translation_node]: Registered pub/sub topics and versions:
[INFO] [1734525720.729594413] [translation_node]: Registered services and versions:
```
```sh
[INFO] [1734525720.729530513] [translation_node]: Registered pub/sub topics and versions:
[INFO] [1734525720.729594413] [translation_node]: Registered services and versions:
```
With the translation node running, any simultaneously running ROS 2 application designed to communicate with PX4 can do so, as long as it uses message versions recognized by the node.
The translation node will print a warning if it encounters an unknown topic version.
@@ -295,111 +295,111 @@ The example describes the process of updating the `VehicleAttitude` message defi
1. **Create an Archived Definition of the Current Versioned Message**
Copy the versioned `.msg` topic message file (or `.srv` service message file) to `px4_msgs_old/msg/` (or `px4_msgs_old/srv/`), and append its message version to the file name.
Copy the versioned `.msg` topic message file (or `.srv` service message file) to `px4_msgs_old/msg/` (or `px4_msgs_old/srv/`), and append its message version to the file name.
For example:<br>
Copy `msg/versioned/VehicleAttitude.msg` → `msg/versioned/px4_msgs_old/msg/VehicleAttitudeV3.msg`
For example:<br>
Copy `msg/versioned/VehicleAttitude.msg` → `msg/versioned/px4_msgs_old/msg/VehicleAttitudeV3.msg`
2. **Update Translation References to the Archived Definition**
Update the existing translations header files `msg/translation_node/translations/*.h` to reference the newly archived message definition.
Update the existing translations header files `msg/translation_node/translations/*.h` to reference the newly archived message definition.
For example, update references in those files:<br>
For example, update references in those files:<br>
- Replace `px4_msgs::msg::VehicleAttitude` → `px4_msgs_old::msg::VehicleAttitudeV3`
- Replace `#include <px4_msgs/msg/vehicle_attitude.hpp>` → `#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>`
- Replace `px4_msgs::msg::VehicleAttitude` → `px4_msgs_old::msg::VehicleAttitudeV3`
- Replace `#include <px4_msgs/msg/vehicle_attitude.hpp>` → `#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>`
3. **Update the Versioned Definition**
Update the versioned `.msg` topic message file (or `.srv` service message file) with required changes.
Update the versioned `.msg` topic message file (or `.srv` service message file) with required changes.
First increment the `MESSAGE_VERSION` field.
Then update the message fields that prompted the version change.
First increment the `MESSAGE_VERSION` field.
Then update the message fields that prompted the version change.
For example, update `msg/versioned/VehicleAttitude.msg` from:
For example, update `msg/versioned/VehicleAttitude.msg` from:
```.msg
uint32 MESSAGE_VERSION = 3
uint64 timestamp
...
```
```txt
uint32 MESSAGE_VERSION = 3
uint64 timestamp
...
```
to
to
```.msg
uint32 MESSAGE_VERSION = 4 # Increment
uint64 timestamp
float32 new_field # Make definition changes
...
```
```txt
uint32 MESSAGE_VERSION = 4 # Increment
uint64 timestamp
float32 new_field # Make definition changes
...
```
4. **Add a New Translation Header**
Add a new version translation to bridge the archived version and the updated current version, by creating a new translation header.
Add a new version translation to bridge the archived version and the updated current version, by creating a new translation header.
For example, create a direct translation header `translation_node/translations/translation_vehicle_attitude_v4.h`:
For example, create a direct translation header `translation_node/translations/translation_vehicle_attitude_v4.h`:
```c++
// Translate VehicleAttitude v3 <--> v4
#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>
#include <px4_msgs/msg/vehicle_attitude.hpp>
```c++
// Translate VehicleAttitude v3 <--> v4
#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>
#include <px4_msgs/msg/vehicle_attitude.hpp>
class VehicleAttitudeV4Translation {
public:
using MessageOlder = px4_msgs_old::msg::VehicleAttitudeV3;
static_assert(MessageOlder::MESSAGE_VERSION == 3);
class VehicleAttitudeV4Translation {
public:
using MessageOlder = px4_msgs_old::msg::VehicleAttitudeV3;
static_assert(MessageOlder::MESSAGE_VERSION == 3);
using MessageNewer = px4_msgs::msg::VehicleAttitude;
static_assert(MessageNewer::MESSAGE_VERSION == 4);
using MessageNewer = px4_msgs::msg::VehicleAttitude;
static_assert(MessageNewer::MESSAGE_VERSION == 4);
static constexpr const char* kTopic = "fmu/out/vehicle_attitude";
static constexpr const char* kTopic = "fmu/out/vehicle_attitude";
static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) {
msg_newer.timestamp = msg_older.timestamp;
msg_newer.timestamp_sample = msg_older.timestamp_sample;
msg_newer.q[0] = msg_older.q[0];
msg_newer.q[1] = msg_older.q[1];
msg_newer.q[2] = msg_older.q[2];
msg_newer.q[3] = msg_older.q[3];
msg_newer.delta_q_reset = msg_older.delta_q_reset;
msg_newer.quat_reset_counter = msg_older.quat_reset_counter;
static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) {
msg_newer.timestamp = msg_older.timestamp;
msg_newer.timestamp_sample = msg_older.timestamp_sample;
msg_newer.q[0] = msg_older.q[0];
msg_newer.q[1] = msg_older.q[1];
msg_newer.q[2] = msg_older.q[2];
msg_newer.q[3] = msg_older.q[3];
msg_newer.delta_q_reset = msg_older.delta_q_reset;
msg_newer.quat_reset_counter = msg_older.quat_reset_counter;
// Populate `new_field` with some value
msg_newer.new_field = -1;
}
// Populate `new_field` with some value
msg_newer.new_field = -1;
}
static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) {
msg_older.timestamp = msg_newer.timestamp;
msg_older.timestamp_sample = msg_newer.timestamp_sample;
msg_older.q[0] = msg_newer.q[0];
msg_older.q[1] = msg_newer.q[1];
msg_older.q[2] = msg_newer.q[2];
msg_older.q[3] = msg_newer.q[3];
msg_older.delta_q_reset = msg_newer.delta_q_reset;
msg_older.quat_reset_counter = msg_newer.quat_reset_counter;
static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) {
msg_older.timestamp = msg_newer.timestamp;
msg_older.timestamp_sample = msg_newer.timestamp_sample;
msg_older.q[0] = msg_newer.q[0];
msg_older.q[1] = msg_newer.q[1];
msg_older.q[2] = msg_newer.q[2];
msg_older.q[3] = msg_newer.q[3];
msg_older.delta_q_reset = msg_newer.delta_q_reset;
msg_older.quat_reset_counter = msg_newer.quat_reset_counter;
// Discards `new_field` from MessageNewer
}
};
// Discards `new_field` from MessageNewer
}
};
REGISTER_TOPIC_TRANSLATION_DIRECT(VehicleAttitudeV4Translation);
```
REGISTER_TOPIC_TRANSLATION_DIRECT(VehicleAttitudeV4Translation);
```
Version translation templates are provided here:
Version translation templates are provided here:
- [Direct Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_direct_v1.h)
- [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h)
- [Direct Service Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_service_v1.h)
- [Direct Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_direct_v1.h)
- [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h)
- [Direct Service Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_service_v1.h)
5. **Include New Headers in `all_translations.h`**
Add all newly created headers to [`translations/all_translations.h`](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/all_translations.h) so that the translation node can find them.
Add all newly created headers to [`translations/all_translations.h`](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/all_translations.h) so that the translation node can find them.
For example, append the following line to `all_translation.h`:
For example, append the following line to `all_translation.h`:
```c++
#include "translation_vehicle_attitude_v4.h"
```
```c++
#include "translation_vehicle_attitude_v4.h"
```
Note that in the example above and in most cases, step 4 only requires the developer to create a direct translation for the definition change.
This is because the changes only involved a single message.
+51 -51
View File
@@ -22,80 +22,80 @@ The following steps are required to get started:
2. Clone the repository into the workspace:
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
:::
3. Build the workspace:
```sh
cd ..
colcon build
```
```sh
cd ..
colcon build
```
4. In a different shell, start PX4 SITL:
```sh
cd $px4-autopilot
make px4_sitl gazebo-classic
```
```sh
cd $px4-autopilot
make px4_sitl gazebo-classic
```
(here we use Gazebo-Classic, but you can use any model or simulator)
(here we use Gazebo-Classic, but you can use any model or simulator)
5. In yet a different shell, run the micro XRCE agent (you can keep it running afterward):
```sh
MicroXRCEAgent udp4 -p 8888
```
```sh
MicroXRCEAgent udp4 -p 8888
```
6. Back in the ROS 2 terminal, source the workspace you just built (in step 3) and run the [global_navigation](https://github.com/Auterion/px4-ros2-interface-lib/tree/main/examples/cpp/navigation/global_navigation) example, which periodically sends dummy global position updates:
```sh
source install/setup.bash
ros2 run example_global_navigation_cpp example_global_navigation
```
```sh
source install/setup.bash
ros2 run example_global_navigation_cpp example_global_navigation
```
You should get an output like this showing that the global interface is successfully sending position updates:
You should get an output like this showing that the global interface is successfully sending position updates:
```sh
[INFO] [1702030701.836897756] [example_global_navigation_node]: example_global_navigation_node running!
[DEBUG] [1702030702.837279784] [example_global_navigation_node]: Successfully sent position update to navigation interface.
[DEBUG] [1702030703.837223884] [example_global_navigation_node]: Successfully sent position update to navigation interface.
```
```sh
[INFO] [1702030701.836897756] [example_global_navigation_node]: example_global_navigation_node running!
[DEBUG] [1702030702.837279784] [example_global_navigation_node]: Successfully sent position update to navigation interface.
[DEBUG] [1702030703.837223884] [example_global_navigation_node]: Successfully sent position update to navigation interface.
```
7. In the PX4 shell, you can check that PX4 receives global position updates:
```sh
listener aux_global_position
```
```sh
listener aux_global_position
```
The output should look like:
The output should look like:
```sh
TOPIC: aux_global_position
aux_global_position
timestamp: 46916000 (0.528000 seconds ago)
timestamp_sample: 46916000 (0 us before timestamp)
lat: 12.343210
lon: 23.454320
alt: 12.40000
alt_ellipsoid: 0.00000
delta_alt: 0.00000
eph: 0.31623
epv: 0.44721
terrain_alt: 0.00000
lat_lon_reset_counter: 0
alt_reset_counter: 0
terrain_alt_valid: False
dead_reckoning: False
```
```sh
TOPIC: aux_global_position
aux_global_position
timestamp: 46916000 (0.528000 seconds ago)
timestamp_sample: 46916000 (0 us before timestamp)
lat: 12.343210
lon: 23.454320
alt: 12.40000
alt_ellipsoid: 0.00000
delta_alt: 0.00000
eph: 0.31623
epv: 0.44721
terrain_alt: 0.00000
lat_lon_reset_counter: 0
alt_reset_counter: 0
terrain_alt_valid: False
dead_reckoning: False
```
8. Now you are ready to use the navigation interface to send your own position updates.