Added rviz config files to ros2 native example
This commit is contained in:
parent
7a12801610
commit
28887886a2
|
@ -0,0 +1,40 @@
|
|||
# ROS2 Native Example
|
||||
|
||||
This example demonstrates how to utilize the ROS 2 native interface in CARLA.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To run this example, ensure `docker` is installed in your system, which is used to launch an instance of `rviz` for visualizing sensor data.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Step 1: Start the CARLA Simulator with ROS2 enabled
|
||||
Launch the CARLA simulator with the ROS 2 integration enabled:
|
||||
|
||||
```bash
|
||||
./CarlaUnreal.sh --ros2
|
||||
```
|
||||
|
||||
### Step 2: Run the ROS2 Example
|
||||
|
||||
Execute the ROS 2 example script:
|
||||
|
||||
```bash
|
||||
python3 ros2_native.py --file stack.json
|
||||
```
|
||||
|
||||
* The `stack.json` file defines the sensor configuration.
|
||||
* You can edit this file to adjust the sensor setup according to your requirements.
|
||||
|
||||
|
||||
### Step 3: Run RViz to Visualize Sensor Data
|
||||
|
||||
Start `rviz` to visualize the sensor output from CARLA:
|
||||
|
||||
> [!NOTE]
|
||||
Docker must be installed on your system to complete this step.
|
||||
|
||||
```bash
|
||||
./run_rviz.sh
|
||||
```
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
|
||||
<transport_descriptors>
|
||||
<transport_descriptor>
|
||||
<transport_id>CustomUdpTransport</transport_id>
|
||||
<type>UDPv4</type>
|
||||
</transport_descriptor>
|
||||
</transport_descriptors>
|
||||
|
||||
<participant profile_name="participant_profile" is_default_profile="true">
|
||||
<rtps>
|
||||
<userTransports>
|
||||
<transport_id>CustomUdpTransport</transport_id>
|
||||
</userTransports>
|
||||
|
||||
<useBuiltinTransports>false</useBuiltinTransports>
|
||||
</rtps>
|
||||
</participant>
|
||||
<publisher profile_name="default publisher profile" is_default_profile="true">
|
||||
<qos>
|
||||
<publishMode>
|
||||
<kind>SYNCHRONOUS</kind>
|
||||
</publishMode>
|
||||
</qos>
|
||||
<historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
|
||||
</publisher>
|
||||
</profiles>
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
function transfer_x11_permissions() {
|
||||
# store X11 access rights in temp file to be passed into docker container
|
||||
XAUTH=/tmp/.docker.xauth
|
||||
touch $XAUTH
|
||||
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
|
||||
}
|
||||
|
||||
transfer_x11_permissions
|
||||
docker run \
|
||||
--rm \
|
||||
--net=host \
|
||||
--env="DISPLAY=$DISPLAY" \
|
||||
--env="XAUTHORITY=$XAUTH" \
|
||||
--env="FASTRTPS_DEFAULT_PROFILES_FILE=/config/fastrtps-profile.xml" \
|
||||
--volume="${SCRIPT_DIR}/config:/config:ro" \
|
||||
--volume="${SCRIPT_DIR}/rviz:/rviz:rw" \
|
||||
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
|
||||
--volume="$XAUTH:$XAUTH" \
|
||||
osrf/ros:humble-desktop \
|
||||
ros2 run rviz2 rviz2 -d /rviz/ros2_native.rviz
|
|
@ -0,0 +1,209 @@
|
|||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 116
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /TF1/Frames1
|
||||
- /TF1/Tree1
|
||||
- /Lidar1/PointCloud1
|
||||
Splitter Ratio: 0.6775068044662476
|
||||
Tree Height: 557
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: false
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: false
|
||||
- Class: rviz_default_plugins/TF
|
||||
Enabled: true
|
||||
Frame Timeout: 15
|
||||
Frames:
|
||||
All Enabled: true
|
||||
hero:
|
||||
Value: true
|
||||
lidar:
|
||||
Value: true
|
||||
rgb:
|
||||
Value: true
|
||||
Marker Scale: 10
|
||||
Name: TF
|
||||
Show Arrows: false
|
||||
Show Axes: true
|
||||
Show Names: true
|
||||
Tree:
|
||||
hero:
|
||||
lidar:
|
||||
{}
|
||||
rgb:
|
||||
{}
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
- Class: rviz_common/Group
|
||||
Displays:
|
||||
- Class: rviz_default_plugins/Image
|
||||
Enabled: true
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
Name: RGB
|
||||
Normalize Range: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /carla/hero/rgb/image
|
||||
Value: true
|
||||
Enabled: true
|
||||
Name: Cameras
|
||||
- Class: rviz_common/Group
|
||||
Displays:
|
||||
- Alpha: 1
|
||||
Autocompute Intensity Bounds: true
|
||||
Autocompute Value Bounds:
|
||||
Max Value: 10
|
||||
Min Value: -10
|
||||
Value: true
|
||||
Axis: Z
|
||||
Channel Name: intensity
|
||||
Class: rviz_default_plugins/PointCloud2
|
||||
Color: 255; 255; 255
|
||||
Color Transformer: Intensity
|
||||
Decay Time: 0.15000000596046448
|
||||
Enabled: true
|
||||
Invert Rainbow: false
|
||||
Max Color: 255; 255; 255
|
||||
Max Intensity: 0.9900385737419128
|
||||
Min Color: 0; 0; 0
|
||||
Min Intensity: 0.7121721506118774
|
||||
Name: PointCloud
|
||||
Position Transformer: XYZ
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.10999999940395355
|
||||
Style: Flat Squares
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /carla/hero/lidar
|
||||
Use Fixed Frame: true
|
||||
Use rainbow: true
|
||||
Value: true
|
||||
Enabled: true
|
||||
Name: Lidar
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: hero
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Covariance x: 0.25
|
||||
Covariance y: 0.25
|
||||
Covariance yaw: 0.06853891909122467
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 77.47811889648438
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 0.7942232489585876
|
||||
Y: -0.8899260759353638
|
||||
Z: -0.2945995330810547
|
||||
Focal Shape Fixed Size: false
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.34039872884750366
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 3.1253957748413086
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 1163
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd00000004000000000000022c00000435fc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002dc000000c700fffffffb00000006005200470042010000031d000001530000002800fffffffb0000000a004400650070007400680100000197000001690000000000000000fb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d00650072006101000002ff000000ca0000000000000000fb0000000e004e006f0072006d0061006c00730100000249000002270000000000000000000000010000016500000435fc020000000bfb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b00000435000000a000fffffffb0000000a0049006d0061006700650100000399000000d70000000000000000fb0000000600440056005301000000e1000000b10000000000000000fb0000002a0049006e007300740061006e006300650020005300650067006d0065006e0074006100740069006f006e0100000198000000af0000000000000000fb0000002a00530065006d0061006e0074006900630020005300650067006d0065006e0074006100740069006f006e010000024d000000b00000000000000000fb0000002a00530065006d0061006e0074006900630020005300650067006d0065006e0074006100740069006f006e01000002c0000000ca0000000000000000fb0000000a0049006d0061006700650100000291000000dd0000000000000000fb0000000a004400650070007400680100000303000000b30000000000000000fb00000018004f00700074006900630061006c00200046006c006f007701000003bc000000b40000000000000000fb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000003e30000043500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
RGB:
|
||||
collapsed: false
|
||||
Selection:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1920
|
||||
X: 1920
|
||||
Y: 0
|
Loading…
Reference in New Issue