You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-guide/hardware-setup.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ You will need a laptop which can run ROS2 to communicate with the MAV over the g
86
86
87
87
### Joystick
88
88
89
-
A joystick is used for [software-in-the-loop (SIL) simulations](running-simulations-with-rosflight.md). The joystick is not technically a required component because it is possible to control your MAV from the command line, but it makes things much easier. Our first recommendation is to use the same transmitter you use for hardware as a joystick by plugging it into the computer via USB. We support Taranis QX7 transmitters, Radiomaster TX16s transmitters, RealFlight controllers, and XBOX controllers. Other joysticks can be used, but you may need to create custom axis and button mappings within the ROSflight joystick utility.
89
+
A joystick is used for [software-in-the-loop (SIL) simulations](simulator/running-simulations-with-rosflight.md). The joystick is not technically a required component because it is possible to control your MAV from the command line, but it makes things much easier. Our first recommendation is to use the same transmitter you use for hardware as a joystick by plugging it into the computer via USB. We support Taranis QX7 transmitters, Radiomaster TX16s transmitters, RealFlight controllers, and XBOX controllers. Other joysticks can be used, but you may need to create custom axis and button mappings within the ROSflight joystick utility.
@@ -18,62 +18,137 @@ Thus, in this guide, we will refer interchangeably between _simulator_ and _visu
18
18
The ROSflight simulation module was designed to be as modular as possible, in order to support different simulation and visualization needs.
19
19
Currently, we support 2 visualizers out-of-the-box:
20
20
21
+
- A "standalone" visualizer using [ROS2 RViz](https://docs.ros.org/en/humble/Tutorials/Intermediate/RViz/RViz-Main.html#rviz) tool (**recommended**)
21
22
-[Gazebo Classic](https://classic.gazebosim.org/)
22
-
- A "standalone" visualizer using [ROS2 RViz](https://docs.ros.org/en/humble/Tutorials/Intermediate/RViz/RViz-Main.html#rviz) tool
23
23
24
24
Adding your own visualizer is part of what `rosflight_sim` was designed for.
25
25
See the [instructions on adding your own visualizer](simulator-architecture.md#adding-your-own-visualizer) page for more information on plugging in your simulator into `rosflight_sim`.
26
26
27
27
This following sections detail how to launch and debug these two simulators.
28
28
29
29
!!! TODO
30
-
Continue here with the detailed launching guide. Add figures and the architecture image to show what nodes run with Gazebo
30
+
Continue here with the detailed launching guide. Add figures and the architecture image to show what nodes run with Gazebo Classic
31
+
32
+
## Standalone Sim
33
+
The "standalone" sim is a simulator that uses [ROS2 RViz](https://docs.ros.org/en/humble/Tutorials/Intermediate/RViz/RViz-Main.html#rviz) to visualize aircraft motion.
34
+
35
+
### Launching instructions
36
+
- Set up ROSflight with the [ROS2 Setup](../ros2-setup.md) guide, making sure to install the `-desktop` package of ROS2, not the `-ros-base`.
For more information on each of these nodes, see the [simulator architecture](simulator-architecture.md) page.
65
+
31
66
32
67
## Gazebo Classic
68
+
!!! DANGER
69
+
Gazebo Classic is officially EOL as of January 2025, and **does not work with ROS2 Jazzy**.
70
+
If you are using ROS2 Jazzy, please only use the standalond sim.
71
+
The following instructions assume you are using ROS2 Humble.
72
+
73
+
We have not yet upgraded to Gazebo, which is not EOL and better.
74
+
If you would like to help in this effort, please visit the [GitHub issue](https://github.com/rosflight/rosflight_ros_pkgs/issues/166) and let us know :)
75
+
76
+
### Launching Instructions
33
77
34
-
* Setup ROSflight with the [ROS2 Setup](ros2-setup.md) guide, making sure to install the `-desktop` package of ROS2, not the `-ros-base`.
78
+
!!!TODO
79
+
Change the ROS2 setup instructions include details about Gazebo and skipping if you don't want it.
35
80
36
-
* Source the Gazebo setup file if you haven't added it to `~/.bashrc`:
81
+
* Set up ROSflight with the [ROS2 Setup](../ros2-setup.md) guide, making sure to install the `-desktop` package of ROS2, not the `-ros-base`.
82
+
* Source the Gazebo Classic setup file if you haven't added it to `~/.bashrc`:
* At this point, you can't actually do anything because there is no RC connection and no `rosflight_io` to talk to the firmware. Let's start by running a `rosflight_io` node. In a separate terminal, run:
51
-
```bash
52
-
ros2 run rosflight_io rosflight_io --ros-args -p udp:=true
53
-
```
95
+
!!! Tip
96
+
Run `rqt_graph` with `rqt_graph` the in a new terminal, assuming [correct version of ROS2 was installed](../ros2-setup.md).
54
97
55
-
* The `udp` parameter tells `rosflight_io` to simulate a serial connection over UDP rather than using the USB connection to hardware
56
98
57
-
Your `rqt_graph` should look something like the following image. This looks funny because ROS2 doesn't actually know that there is a UDP connection between `rosflight_io` and gazebo. There is one, though, and you can test it by echoing any of the topics published by `rosflight_io`.
99
+
### Explanation
100
+
The launch file manages launching several nodes all at once, as shown in the `rqt_graph` image:
-`/rosflight_io`: Handles the communication between the companion computer and the flight controller
103
+
-`/rosflight_sil_manager`: Calls the firmware at the correct time interval
104
+
-`/standalone_sensors`: Simulates sensor measurements given the true state of the robot
105
+
-`/rc`: Simulates the RC safety pilot connection to the firmware
106
+
-`/sil_board`: Instantiation of the firmware
107
+
-`/gazebo`: Visualizer
108
+
-`/multirotor/dynamics`: Dynamics plugin to Gazebo Classic, computes the aerodynamic forces and moments given motor commands
109
+
-`/dynamics`: Interface node between the dynamics plugin and the rest of the `rosflight_sim` modules
60
110
61
-
* Start up a simulated RC connection. The easiest way to do this is with the ROSflight utility `rc_joy.py`. Connect a joystick to the computer (or transmitter) and run:
62
-
```bash
63
-
ros2 run rosflight_sim rc_joy.py --ros-args --remap /RC:=/multirotor/RC
64
-
```
65
-
This simulates the RC connection in hardware. If everything is mapped correctly, you should now be able to arm, disarm and fly the aircraft in simulation!
111
+
For more information on each of these nodes, see the [simulator architecture](simulator-architecture.md) page.
66
112
67
-
!!! tip
68
-
To start the Gazebo sim, rosflight_io node, and rc_joy.py utility all at once, run this command instead of the three commands individually:
113
+
## Launch arguments
114
+
!!! Tip
115
+
Command line arguments to launch files can be previewed by appending `--show-args` to the launch call:
There are several command line arguments you can pass to customize the behavior at runtime.
121
+
Here are some important ones:
122
+
123
+
-`aircraft`: Defaults to "skyhunter". This parameter controls which dynamics and parameter files get loaded. Make sure this is set to your correct airframe!
124
+
-`use_sim_time`: By default, set false. This parameter is a parameter of all nodes in ROS2. If set to true on launch, the node will create a subscription to the `/clock` topic, and will use that as the source of time for its timers.
125
+
For Gazebo Classic, it is recommended to **leave this as false**, since Gazebo Classic publishes a `/clock` topic at 10Hz, which is too slow for most modules. If using the standalone sim, this parameter will allow you to speed up, slow down, or pause time. See the [simulation architecture](simulation-architecture.md) page for more information.
126
+
-`use_vimfly`: Node that changes the default RC behavior to use VimFly, a program that lets you use Vim commands to fly around in the sim!
127
+
Vim, of course, is recommended for everyone, but VimFly especially if you don't have access to RC transmitter connected over USB.
128
+
See the [joystick](#joysticks) section for more information on what joysticks are supported.
129
+
130
+
These command line arguments should be passed using the `<argument>:=<value>` syntax.
131
+
132
+
133
+
## Joysticks
134
+
ROSflight supports several types of transmitters or controllers that you can use to fly around in the sim as the RC safety pilot.
135
+
If one of the supported transmitters is connected via USB at launch, then the sim will default to using that controller instead of the default, **which is no RC connection**.
136
+
73
137
!!! note
74
-
It is much easier to fly with a real transmitter than with an Xbox-type controller. FrSky Taranis QX7 transmitters, Radiomaster TX16s transmitters, and RealFlight controllers are also supported. Non-Xbox joysticks may have incorrect mappings. If your joystick does not work, and you write your own mapping, please contribute back your new joystick mapping!
138
+
It is much easier to fly with a real transmitter than with an Xbox-type controller.
139
+
FrSky Taranis QX7 transmitters, Radiomaster TX16s transmitters, and RealFlight controllers are also supported.
140
+
Non-Xbox joysticks may have incorrect mappings.
141
+
If your joystick does not work, and you write your own mapping, please contribute back your new joystick mapping!
142
+
143
+
If you want to fly around in the sim and you don't have access to a transmitter, we recommend using VimFly, which allows you to fly around in the sim with your keyboard.
144
+
To use VimFly, just add the `use_vimfly:=true` string to the end of the launch command.
145
+
146
+
## After launching
147
+
!!! TODO
148
+
Continue here. Finish the calibration and "gotchas" for setting up the sim.
149
+
Also write a section somewhere documenting gotchas for the mixing matrix stuff.
75
150
76
-
Remember, the SIL tries its best to replicate hardware. That means you have to calibrate and set parameters in the same way you doin hardware. See the [Hardware Setup](hardware-setup.md) and [Parameter Configuration](parameter-configuration.md) pages in this documentation for instructions on how to perform all preflight configuration before the aircraft will arm. You can also run
151
+
Remember, the SIL tries its best to replicate hardware. That means you have to calibrate and set parameters in the same way you do in hardware. See the [Hardware Setup](../hardware-setup.md) and [Parameter Configuration](../parameter-configuration.md) pages in this documentation for instructions on how to perform all preflight configuration before the aircraft will arm. You can also run
Copy file name to clipboardExpand all lines: docs/user-guide/simulator/running-simulations-with-rosflight.md
+1-67Lines changed: 1 addition & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,72 +58,6 @@ For other out-of-the box supported visualizers, see the detailed launching instr
58
58
If you run into errors or problems when launching, please see the detailed launching instructions.
59
59
60
60
!!! TODO
61
-
Continue on the detailed launching guide. Certainly put the architecture on a separate page. There you can run through how everything is working.
61
+
Verify the detailed launching guide. Finish architecture on a separate page. There you can run through how everything is working.
62
62
Add a page in the developer guide explaining how to add your own sim interfaces / dynamics / etc. to the sim.
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
## Architecture of the SIL Simulation
72
-
73
-
!!! TODO
74
-
Make a figure of the new architecture. Maybe make it be a GIF? We could replace the table below
75
-
76
-
To best mimic the hardware experience of ROSflight, the SIL plugin for Gazebo actually implements the firmware source code as a library.
77
-
We just implemented a different "board layer" which uses gazebo instead of hardware calls for things like `imu_read()` and `pwm_write()`.
78
-
Instead of a serial link over USB to the flight controller, we use a UDP connection bouncing off of localhost to communicate between `rosflight_io` and the firmware.
79
-
This means the interface to the SIL plugin is identical to that of hardware.
80
-
The `rosflight_io` node is the main gateway to the firmware in simulation, just as it is in hardware.
81
-
82
-
The following table summarizes the correlation between connections in hardware and simulation:
Make a figure of the new architecture. Maybe make it be a GIF? We could replace the table below
7
+
8
+
To best mimic the hardware experience of ROSflight, the SIL plugin for Gazebo actually implements the firmware source code as a library.
9
+
We just implemented a different "board layer" which uses gazebo instead of hardware calls for things like `imu_read()` and `pwm_write()`.
10
+
Instead of a serial link over USB to the flight controller, we use a UDP connection bouncing off of localhost to communicate between `rosflight_io` and the firmware.
11
+
This means the interface to the SIL plugin is identical to that of hardware.
12
+
The `rosflight_io` node is the main gateway to the firmware in simulation, just as it is in hardware.
13
+
14
+
The following table summarizes the correlation between connections in hardware and simulation:
0 commit comments