From d786ef6cef3106b44a93ae782c4a074df18600fe Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Wed, 3 Apr 2019 16:16:48 +0200 Subject: [PATCH 1/7] Support custom lidar attributes --- .../src/carla_ego_vehicle/carla_ego_vehicle_base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle_base.py b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle_base.py index 59827113..7ca898df 100644 --- a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle_base.py +++ b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle_base.py @@ -151,12 +151,12 @@ def setup_sensors(self, sensors): roll=sensor_spec['roll'], yaw=sensor_spec['yaw']) elif sensor_spec['type'].startswith('sensor.lidar'): - bp.set_attribute('range', '200') - bp.set_attribute('rotation_frequency', '10') - bp.set_attribute('channels', '32') - bp.set_attribute('upper_fov', '15') - bp.set_attribute('lower_fov', '-30') - bp.set_attribute('points_per_second', '500000') + bp.set_attribute('range', str(sensor_spec['range'])) + bp.set_attribute('rotation_frequency', str(sensor_spec['rotation_frequency'])) + bp.set_attribute('channels', str(sensor_spec['channels'])) + bp.set_attribute('upper_fov', str(sensor_spec['upper_fov'])) + bp.set_attribute('lower_fov', str(sensor_spec['lower_fov'])) + bp.set_attribute('points_per_second', str(sensor_spec['points_per_second'])) sensor_location = carla.Location(x=sensor_spec['x'], y=sensor_spec['y'], z=sensor_spec['z']) sensor_rotation = carla.Rotation(pitch=sensor_spec['pitch'], From a8afa65d7abde6e6a9cc326232f134ab4258b978 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Wed, 3 Apr 2019 16:20:01 +0200 Subject: [PATCH 2/7] Fix manual control display of GNSS --- .../src/carla_ego_vehicle/carla_ros_manual_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py index 9673deef..7553964e 100755 --- a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py +++ b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py @@ -278,7 +278,7 @@ def __init__(self, width, height): self.latitude = 0 self.longitude = 0 self.gnss_subscriber = rospy.Subscriber( - "/carla/ego_vehicle/gnss/front/gnss", NavSatFix, self.gnss_updated) + "/carla/ego_vehicle/gnss/sensor/gnss", NavSatFix, self.gnss_updated) self.tf_listener = tf.TransformListener() def __del__(self): From 0767e2b5de7e5fdfe59eba03e0ecfa761cf42a22 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Wed, 3 Apr 2019 16:31:09 +0200 Subject: [PATCH 3/7] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0672a73e..0b4ad2e6 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ This documentation is for CARLA versions *newer* than 0.9.4. #install required ros-dependencies rosdep update - rosdep install --from-path . + rosdep install --from-paths src --ignore-src -r #build catkin_make From c82dc51cece5b235442841e00e33c9e5e7499d5e Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Thu, 4 Apr 2019 11:27:16 +0200 Subject: [PATCH 4/7] Move ros-bridge messages to separate catkin-package --- README.md | 10 +++--- carla_ackermann_control/CMakeLists.txt | 6 ++-- .../msg/EgoVehicleControlInfo.msg | 2 +- carla_ackermann_control/package.xml | 3 +- .../carla_ackermann_control_node.py | 6 ++-- .../carla_ros_manual_control.py | 10 +++--- carla_ros_bridge/CMakeLists.txt | 18 ---------- carla_ros_bridge/package.xml | 1 + .../src/carla_ros_bridge/collision_sensor.py | 2 +- .../src/carla_ros_bridge/ego_vehicle.py | 10 +++--- .../carla_ros_bridge/lane_invasion_sensor.py | 2 +- .../carla_ros_bridge_lifecycle.py | 2 +- carla_ros_bridge_msgs/CMakeLists.txt | 34 +++++++++++++++++++ .../msg/CarlaCollisionEvent.msg | 0 .../msg/CarlaEgoVehicleControl.msg | 0 .../msg/CarlaEgoVehicleInfo.msg | 0 .../msg/CarlaEgoVehicleInfoWheel.msg | 0 .../msg/CarlaEgoVehicleStatus.msg | 0 .../msg/CarlaLaneInvasionEvent.msg | 0 carla_ros_bridge_msgs/package.xml | 15 ++++++++ 20 files changed, 76 insertions(+), 45 deletions(-) create mode 100644 carla_ros_bridge_msgs/CMakeLists.txt rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaCollisionEvent.msg (100%) rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaEgoVehicleControl.msg (100%) rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaEgoVehicleInfo.msg (100%) rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaEgoVehicleInfoWheel.msg (100%) rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaEgoVehicleStatus.msg (100%) rename {carla_ros_bridge => carla_ros_bridge_msgs}/msg/CarlaLaneInvasionEvent.msg (100%) create mode 100644 carla_ros_bridge_msgs/package.xml diff --git a/README.md b/README.md index 0b4ad2e6..2520c21e 100644 --- a/README.md +++ b/README.md @@ -124,21 +124,21 @@ Currently the following sensors are supported: |Topic | Type | |-------------------------------|------| -| `/carla//collision` | [carla_ros_bridge.CarlaCollisionEvent](carla_ros_bridge/msg/CarlaCollisionEvent.msg) | +| `/carla//collision` | [carla_ros_bridge_msgs.CarlaCollisionEvent](carla_ros_bridge_msgs/msg/CarlaCollisionEvent.msg) | #### Lane Invasion Sensor |Topic | Type | |-------------------------------|------| -| `/carla//lane_invasion` | [carla_ros_bridge.CarlaLaneInvasionEvent](carla_ros_bridge/msg/CarlaLaneInvasionEvent.msg) | +| `/carla//lane_invasion` | [carla_ros_bridge_msgs.CarlaLaneInvasionEvent](carla_ros_bridge_msgs/msg/CarlaLaneInvasionEvent.msg) | ### Control |Topic | Type | |--------------------------------------|------| -| `/carla//vehicle_control_cmd` (subscriber) | [carla_ros_bridge.CarlaEgoVehicleControl](carla_ros_bridge/msg/CarlaEgoVehicleControl.msg) | -| `/carla//vehicle_status` | [carla_ros_bridge.CarlaEgoVehicleStatus](carla_ros_bridge/msg/CarlaEgoVehicleStatus.msg) | -| `/carla//vehicle_info` | [carla_ros_bridge.CarlaEgoVehicleInfo](carla_ros_bridge/msg/CarlaEgoVehicleInfo.msg) | +| `/carla//vehicle_control_cmd` (subscriber) | [carla_ros_bridge_msgs.CarlaEgoVehicleControl](carla_ros_bridge_msgs/msg/CarlaEgoVehicleControl.msg) | +| `/carla//vehicle_status` | [carla_ros_bridge_msgs.CarlaEgoVehicleStatus](carla_ros_bridge_msgs/msg/CarlaEgoVehicleStatus.msg) | +| `/carla//vehicle_info` | [carla_ros_bridge_msgs.CarlaEgoVehicleInfo](carla_ros_bridge_msgs/msg/CarlaEgoVehicleInfo.msg) | You can stear the ego vehicle from the commandline by publishing to the topic `/carla//vehicle_control_cmd`. diff --git a/carla_ackermann_control/CMakeLists.txt b/carla_ackermann_control/CMakeLists.txt index d8849a4b..5ce1eac4 100644 --- a/carla_ackermann_control/CMakeLists.txt +++ b/carla_ackermann_control/CMakeLists.txt @@ -6,10 +6,9 @@ find_package(catkin REQUIRED COMPONENTS message_generation rospy std_msgs - geometry_msgs ackermann_msgs dynamic_reconfigure - carla_ros_bridge + carla_ros_bridge_msgs ) catkin_python_setup() @@ -26,8 +25,7 @@ add_message_files( generate_messages( DEPENDENCIES std_msgs - geometry_msgs - carla_ros_bridge + carla_ros_bridge_msgs ) generate_dynamic_reconfigure_options( diff --git a/carla_ackermann_control/msg/EgoVehicleControlInfo.msg b/carla_ackermann_control/msg/EgoVehicleControlInfo.msg index ca4e5358..2adebac0 100644 --- a/carla_ackermann_control/msg/EgoVehicleControlInfo.msg +++ b/carla_ackermann_control/msg/EgoVehicleControlInfo.msg @@ -21,4 +21,4 @@ EgoVehicleControlCurrent current EgoVehicleControlStatus status # the current control output to CARLA -carla_ros_bridge/CarlaEgoVehicleControl output +carla_ros_bridge_msgs/CarlaEgoVehicleControl output diff --git a/carla_ackermann_control/package.xml b/carla_ackermann_control/package.xml index 03598028..4bf299b9 100644 --- a/carla_ackermann_control/package.xml +++ b/carla_ackermann_control/package.xml @@ -7,13 +7,14 @@ MIT catkin rospy + carla_ros_bridge_msgs rospy rospy ackermann_msgs carla_ros_bridge std_msgs - geometry_msgs dynamic_reconfigure + carla_ros_bridge_msgs diff --git a/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py b/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py index 6d3c4f6b..ad0e9ff2 100755 --- a/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py +++ b/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py @@ -18,9 +18,9 @@ from dynamic_reconfigure.server import Server from ackermann_msgs.msg import AckermannDrive -from carla_ros_bridge.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module,import-error -from carla_ros_bridge.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error -from carla_ros_bridge.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module,import-error from carla_ackermann_control.msg import EgoVehicleControlInfo # pylint: disable=no-name-in-module,import-error from carla_ackermann_control.cfg import EgoVehicleControlParameterConfig # pylint: disable=no-name-in-module,import-error import carla_control_physics as phys # pylint: disable=relative-import diff --git a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py index 7553964e..f451e7ef 100755 --- a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py +++ b/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py @@ -37,11 +37,11 @@ from std_msgs.msg import Bool from sensor_msgs.msg import NavSatFix from sensor_msgs.msg import Image -from carla_ros_bridge.msg import CarlaCollisionEvent # pylint: disable=no-name-in-module, import-error -from carla_ros_bridge.msg import CarlaLaneInvasionEvent # pylint: disable=no-name-in-module, import-error -from carla_ros_bridge.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module, import-error -from carla_ros_bridge.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module, import-error -from carla_ros_bridge.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module, import-error +from carla_ros_bridge_msgs.msg import CarlaCollisionEvent # pylint: disable=no-name-in-module, import-error +from carla_ros_bridge_msgs.msg import CarlaLaneInvasionEvent # pylint: disable=no-name-in-module, import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module, import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module, import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module, import-error try: import pygame diff --git a/carla_ros_bridge/CMakeLists.txt b/carla_ros_bridge/CMakeLists.txt index 230a2bad..307c0328 100644 --- a/carla_ros_bridge/CMakeLists.txt +++ b/carla_ros_bridge/CMakeLists.txt @@ -3,7 +3,6 @@ project(carla_ros_bridge) ## Find catkin macros and libraries find_package(catkin REQUIRED COMPONENTS - message_generation rospy sensor_msgs geometry_msgs @@ -13,23 +12,6 @@ find_package(catkin REQUIRED COMPONENTS catkin_python_setup() -add_message_files( - FILES - CarlaEgoVehicleControl.msg - CarlaEgoVehicleStatus.msg - CarlaEgoVehicleInfoWheel.msg - CarlaEgoVehicleInfo.msg - CarlaCollisionEvent.msg - CarlaLaneInvasionEvent.msg -) - -generate_messages( - DEPENDENCIES - std_msgs - geometry_msgs -) - - catkin_package() diff --git a/carla_ros_bridge/package.xml b/carla_ros_bridge/package.xml index dcc126e8..662c285d 100644 --- a/carla_ros_bridge/package.xml +++ b/carla_ros_bridge/package.xml @@ -22,6 +22,7 @@ tf2_msgs rosgraph_msgs cv_bridge + carla_ros_bridge_msgs diff --git a/carla_ros_bridge/src/carla_ros_bridge/collision_sensor.py b/carla_ros_bridge/src/carla_ros_bridge/collision_sensor.py index d397acf3..f9875352 100644 --- a/carla_ros_bridge/src/carla_ros_bridge/collision_sensor.py +++ b/carla_ros_bridge/src/carla_ros_bridge/collision_sensor.py @@ -11,7 +11,7 @@ """ from carla_ros_bridge.sensor import Sensor -from carla_ros_bridge.msg import CarlaCollisionEvent # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaCollisionEvent # pylint: disable=no-name-in-module,import-error class CollisionSensor(Sensor): diff --git a/carla_ros_bridge/src/carla_ros_bridge/ego_vehicle.py b/carla_ros_bridge/src/carla_ros_bridge/ego_vehicle.py index a626a16c..4ad49e1a 100644 --- a/carla_ros_bridge/src/carla_ros_bridge/ego_vehicle.py +++ b/carla_ros_bridge/src/carla_ros_bridge/ego_vehicle.py @@ -20,10 +20,10 @@ from carla import VehicleControl from carla_ros_bridge.vehicle import Vehicle -from carla_ros_bridge.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module,import-error -from carla_ros_bridge.msg import CarlaEgoVehicleInfoWheel # pylint: disable=no-name-in-module,import-error -from carla_ros_bridge.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error -from carla_ros_bridge.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleInfo # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleInfoWheel # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleStatus # pylint: disable=no-name-in-module,import-error class EgoVehicle(Vehicle): @@ -193,7 +193,7 @@ def control_command_updated(self, ros_vehicle_control): It's just forwarding the ROS input to CARLA :param ros_vehicle_control: current vehicle control input received via ROS - :type ros_vehicle_control: carla_ros_bridge.msg.CarlaEgoVehicleControl + :type ros_vehicle_control: carla_ros_bridge_msgs.msg.CarlaEgoVehicleControl :return: """ vehicle_control = VehicleControl() diff --git a/carla_ros_bridge/src/carla_ros_bridge/lane_invasion_sensor.py b/carla_ros_bridge/src/carla_ros_bridge/lane_invasion_sensor.py index e0c9bc08..0110af3a 100644 --- a/carla_ros_bridge/src/carla_ros_bridge/lane_invasion_sensor.py +++ b/carla_ros_bridge/src/carla_ros_bridge/lane_invasion_sensor.py @@ -11,7 +11,7 @@ """ from carla_ros_bridge.sensor import Sensor -from carla_ros_bridge.msg import CarlaLaneInvasionEvent # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaLaneInvasionEvent # pylint: disable=no-name-in-module,import-error class LaneInvasionSensor(Sensor): diff --git a/carla_ros_bridge_lifecycle/src/carla_ros_bridge_lifecycle/carla_ros_bridge_lifecycle.py b/carla_ros_bridge_lifecycle/src/carla_ros_bridge_lifecycle/carla_ros_bridge_lifecycle.py index a986741d..dc2846a5 100755 --- a/carla_ros_bridge_lifecycle/src/carla_ros_bridge_lifecycle/carla_ros_bridge_lifecycle.py +++ b/carla_ros_bridge_lifecycle/src/carla_ros_bridge_lifecycle/carla_ros_bridge_lifecycle.py @@ -17,7 +17,7 @@ import rospy import roslaunch -from carla_ros_bridge.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error +from carla_ros_bridge_msgs.msg import CarlaEgoVehicleControl # pylint: disable=no-name-in-module,import-error class RosBridgeLifecycle(object): diff --git a/carla_ros_bridge_msgs/CMakeLists.txt b/carla_ros_bridge_msgs/CMakeLists.txt new file mode 100644 index 00000000..5ef9b89b --- /dev/null +++ b/carla_ros_bridge_msgs/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8.3) +project(carla_ros_bridge_msgs) + +## Find catkin macros and libraries +find_package(catkin REQUIRED COMPONENTS + message_generation + std_msgs + geometry_msgs +) + +add_message_files( + DIRECTORY msg + FILES + CarlaEgoVehicleControl.msg + CarlaEgoVehicleStatus.msg + CarlaEgoVehicleInfoWheel.msg + CarlaEgoVehicleInfo.msg + CarlaCollisionEvent.msg + CarlaLaneInvasionEvent.msg +) + +generate_messages( + DEPENDENCIES + std_msgs + geometry_msgs +) + + +catkin_package( + CATKIN_DEPENDS + message_runtime + std_msgs + geometry_msgs +) diff --git a/carla_ros_bridge/msg/CarlaCollisionEvent.msg b/carla_ros_bridge_msgs/msg/CarlaCollisionEvent.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaCollisionEvent.msg rename to carla_ros_bridge_msgs/msg/CarlaCollisionEvent.msg diff --git a/carla_ros_bridge/msg/CarlaEgoVehicleControl.msg b/carla_ros_bridge_msgs/msg/CarlaEgoVehicleControl.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaEgoVehicleControl.msg rename to carla_ros_bridge_msgs/msg/CarlaEgoVehicleControl.msg diff --git a/carla_ros_bridge/msg/CarlaEgoVehicleInfo.msg b/carla_ros_bridge_msgs/msg/CarlaEgoVehicleInfo.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaEgoVehicleInfo.msg rename to carla_ros_bridge_msgs/msg/CarlaEgoVehicleInfo.msg diff --git a/carla_ros_bridge/msg/CarlaEgoVehicleInfoWheel.msg b/carla_ros_bridge_msgs/msg/CarlaEgoVehicleInfoWheel.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaEgoVehicleInfoWheel.msg rename to carla_ros_bridge_msgs/msg/CarlaEgoVehicleInfoWheel.msg diff --git a/carla_ros_bridge/msg/CarlaEgoVehicleStatus.msg b/carla_ros_bridge_msgs/msg/CarlaEgoVehicleStatus.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaEgoVehicleStatus.msg rename to carla_ros_bridge_msgs/msg/CarlaEgoVehicleStatus.msg diff --git a/carla_ros_bridge/msg/CarlaLaneInvasionEvent.msg b/carla_ros_bridge_msgs/msg/CarlaLaneInvasionEvent.msg similarity index 100% rename from carla_ros_bridge/msg/CarlaLaneInvasionEvent.msg rename to carla_ros_bridge_msgs/msg/CarlaLaneInvasionEvent.msg diff --git a/carla_ros_bridge_msgs/package.xml b/carla_ros_bridge_msgs/package.xml new file mode 100644 index 00000000..9a293d76 --- /dev/null +++ b/carla_ros_bridge_msgs/package.xml @@ -0,0 +1,15 @@ + + + carla_ros_bridge_msgs + 0.1.0 + The carla_ros_bridge_msgs package + CARLA Simulator Team + MIT + catkin + message_generation + std_msgs + geometry_msgs + message_runtime + std_msgs + geometry_msgs + From 9431821b20cc88d5afeba68eee344ae14cb9a680 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Thu, 4 Apr 2019 15:24:26 +0200 Subject: [PATCH 5/7] Move carla_ros_manual_control to a separate catkin package carla_manual_control --- carla_ego_vehicle/CMakeLists.txt | 1 - carla_ego_vehicle/README.md | 28 +------------------ .../launch/carla_ros_manual_control.launch | 7 ----- carla_manual_control/CMakeLists.txt | 22 +++++++++++++++ carla_manual_control/README.md | 18 ++++++++++++ .../launch/carla_manual_control.launch | 7 +++++ carla_manual_control/package.xml | 17 +++++++++++ carla_manual_control/setup.py | 10 +++++++ .../src/carla_manual_control/__init__.py | 0 .../carla_manual_control.py | 2 +- ...ros_bridge_with_example_ego_vehicle.launch | 2 +- 11 files changed, 77 insertions(+), 37 deletions(-) delete mode 100644 carla_ego_vehicle/launch/carla_ros_manual_control.launch create mode 100644 carla_manual_control/CMakeLists.txt create mode 100644 carla_manual_control/README.md create mode 100644 carla_manual_control/launch/carla_manual_control.launch create mode 100644 carla_manual_control/package.xml create mode 100644 carla_manual_control/setup.py create mode 100644 carla_manual_control/src/carla_manual_control/__init__.py rename carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py => carla_manual_control/src/carla_manual_control/carla_manual_control.py (99%) diff --git a/carla_ego_vehicle/CMakeLists.txt b/carla_ego_vehicle/CMakeLists.txt index 2cf054c1..d8d3abc6 100644 --- a/carla_ego_vehicle/CMakeLists.txt +++ b/carla_ego_vehicle/CMakeLists.txt @@ -15,7 +15,6 @@ catkin_package( catkin_install_python(PROGRAMS src/carla_ego_vehicle/carla_example_ego_vehicle.py src/carla_ego_vehicle/carla_ego_vehicle_base.py - src/carla_ego_vehicle/carla_ros_manual_control.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) diff --git a/carla_ego_vehicle/README.md b/carla_ego_vehicle/README.md index e6f6b650..cb1a4c5d 100644 --- a/carla_ego_vehicle/README.md +++ b/carla_ego_vehicle/README.md @@ -1,13 +1,5 @@ # ROS Ego Vehicle -This package provides two ROS nodes: - -- Carla Example Ego Vehicle: A reference client for spawning an ego vehicle -- Carla ROS Manual Control: a ROS-only manual control - - -## Carla Example Ego Vehicle - The reference Carla client `carla_example_ego_vehicle` can be used to spawn an ego vehicle (role-name: "ego_vehicle") with the following sensors attached to it. - GNSS @@ -16,7 +8,7 @@ The reference Carla client `carla_example_ego_vehicle` can be used to spawn an e - Collision Sensor - Lane Invasion Sensor -Info: To be able to use carla_ros_manual_control a camera with role-name 'view' is required. +Info: To be able to use `carla_manual_control` a camera with role-name 'view' and resolution of 800x600 is required. If no specific position is set, the ego vehicle is spawned at a random position. @@ -47,21 +39,3 @@ The format is a list of dictionaries. One dictionary has the values as follows: } -## Carla ROS Manual Control - -The node `carla_ros_manual_control` is a ROS-only version of the Carla `manual_control.py`. All data is received -via ROS topics. - -Note: To be able to use carla_ros_manual_control a camera with role-name 'view' needs to be spawned by `carla_ego_vehicle`. - - -### Manual steering - -In order to steer manually, you might need to disable sending vehicle control commands within another ROS node. - -Therefore the manual control is able to publish to `/vehicle_control_manual_override` ([std_msgs/Bool](http://docs.ros.org/api/std_msgs/html/msg/Bool.html)). - -Press `B` to toggle the value. - -Note: As sending the vehicle control commands is highly dependent on your setup, you need to implement the subscriber to that topic yourself. - diff --git a/carla_ego_vehicle/launch/carla_ros_manual_control.launch b/carla_ego_vehicle/launch/carla_ros_manual_control.launch deleted file mode 100644 index c5310b54..00000000 --- a/carla_ego_vehicle/launch/carla_ros_manual_control.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/carla_manual_control/CMakeLists.txt b/carla_manual_control/CMakeLists.txt new file mode 100644 index 00000000..4332af95 --- /dev/null +++ b/carla_manual_control/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8.3) +project(carla_manual_control) + +find_package(catkin REQUIRED COMPONENTS + rospy +) + +catkin_python_setup() + +catkin_package( + CATKIN_DEPENDS + rospy +) + +catkin_install_python(PROGRAMS + src/carla_manual_control/carla_manual_control.py + DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +) + +install(DIRECTORY launch/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch +) diff --git a/carla_manual_control/README.md b/carla_manual_control/README.md new file mode 100644 index 00000000..f8a7217c --- /dev/null +++ b/carla_manual_control/README.md @@ -0,0 +1,18 @@ +# Carla Manual Control + +The node `carla_manual_control` is a ROS-only version of the Carla `manual_control.py`. All data is received +via ROS topics. + +__Info__: To be able to use `carla_manual_control` a camera with role-name 'view' and resolution 800x600 needs to be attached to the ego vehicle. + + +## Manual steering + +In order to steer manually, you might need to disable sending vehicle control commands within another ROS node. + +Therefore the manual control is able to publish to `/vehicle_control_manual_override` ([std_msgs/Bool](http://docs.ros.org/api/std_msgs/html/msg/Bool.html)). + +Press `B` to toggle the value. + +Note: As sending the vehicle control commands is highly dependent on your setup, you need to implement the subscriber to that topic yourself. + diff --git a/carla_manual_control/launch/carla_manual_control.launch b/carla_manual_control/launch/carla_manual_control.launch new file mode 100644 index 00000000..3118eb07 --- /dev/null +++ b/carla_manual_control/launch/carla_manual_control.launch @@ -0,0 +1,7 @@ + + + + + + + diff --git a/carla_manual_control/package.xml b/carla_manual_control/package.xml new file mode 100644 index 00000000..986d1f63 --- /dev/null +++ b/carla_manual_control/package.xml @@ -0,0 +1,17 @@ + + + carla_manual_control + 0.0.0 + The carla_manual_control package + CARLA Simulator Team + MIT + catkin + rospy + rospy + rospy + carla_ros_bridge_msgs + sensor_msgs + std_msgs + + + diff --git a/carla_manual_control/setup.py b/carla_manual_control/setup.py new file mode 100644 index 00000000..f77026e1 --- /dev/null +++ b/carla_manual_control/setup.py @@ -0,0 +1,10 @@ +from distutils.core import setup +from catkin_pkg.python_setup import generate_distutils_setup + +d = generate_distutils_setup( + packages=['carla_manual_control'], + package_dir={'': 'src'} +) + +setup(**d) + diff --git a/carla_manual_control/src/carla_manual_control/__init__.py b/carla_manual_control/src/carla_manual_control/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py b/carla_manual_control/src/carla_manual_control/carla_manual_control.py similarity index 99% rename from carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py rename to carla_manual_control/src/carla_manual_control/carla_manual_control.py index f451e7ef..9fe0bae6 100755 --- a/carla_ego_vehicle/src/carla_ego_vehicle/carla_ros_manual_control.py +++ b/carla_manual_control/src/carla_manual_control/carla_manual_control.py @@ -506,7 +506,7 @@ def main(): """ main function """ - rospy.init_node('carla_ros_manual_control') + rospy.init_node('carla_manual_control') # resolution should be similar to spawned camera with role-name 'view' resolution = {"width": 800, "height": 600} diff --git a/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch b/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch index 6684f67e..678c92c9 100644 --- a/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch +++ b/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch @@ -2,5 +2,5 @@ - + From 80c2761ee6a89b1fde822029a2f21cb2214b4f77 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Fri, 5 Apr 2019 15:13:59 +0200 Subject: [PATCH 6/7] Change gnss topic, rgb-camera-encoding --- CHANGELOG.md | 2 ++ .../src/carla_ego_vehicle/carla_example_ego_vehicle.py | 8 ++++---- carla_manual_control/README.md | 7 ++++++- .../src/carla_manual_control/carla_manual_control.py | 2 +- carla_ros_bridge/src/carla_ros_bridge/gnss.py | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 988ce10f..25b8f7c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Latest changed +* send rgb-camera images in 'bgr8' format (instead of 'bgra8') +* rename gnss topic from '../gnss' to '../fix' * Add lane invasion sensor * Add collision sensor * Rename CarlaVehicleControl to CarlaEgoVehicleControl (and add some more message types) diff --git a/carla_ego_vehicle/src/carla_ego_vehicle/carla_example_ego_vehicle.py b/carla_ego_vehicle/src/carla_ego_vehicle/carla_example_ego_vehicle.py index 7d0eb2e7..f6eab606 100755 --- a/carla_ego_vehicle/src/carla_ego_vehicle/carla_example_ego_vehicle.py +++ b/carla_ego_vehicle/src/carla_ego_vehicle/carla_example_ego_vehicle.py @@ -40,7 +40,7 @@ def sensors(self): }, { 'type': 'sensor.lidar.ray_cast', - 'role_name': 'front', + 'role_name': 'lidar1', 'x': 0.0, 'y': 0.0, 'z': 2.4, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0, 'range': 5000, 'channels': 32, @@ -51,17 +51,17 @@ def sensors(self): }, { 'type': 'sensor.other.gnss', - 'role_name': 'sensor', + 'role_name': 'gnss1', 'x': 1.0, 'y': 0.0, 'z': 2.0 }, { 'type': 'sensor.other.collision', - 'role_name': 'sensor', + 'role_name': 'collision1', 'x': 0.0, 'y': 0.0, 'z': 0.0 }, { 'type': 'sensor.other.lane_invasion', - 'role_name': 'sensor', + 'role_name': 'laneinvasion1', 'x': 0.0, 'y': 0.0, 'z': 0.0 } ] diff --git a/carla_manual_control/README.md b/carla_manual_control/README.md index f8a7217c..7073e101 100644 --- a/carla_manual_control/README.md +++ b/carla_manual_control/README.md @@ -3,7 +3,12 @@ The node `carla_manual_control` is a ROS-only version of the Carla `manual_control.py`. All data is received via ROS topics. -__Info__: To be able to use `carla_manual_control` a camera with role-name 'view' and resolution 800x600 needs to be attached to the ego vehicle. +## Prerequistes +To be able to use `carla_manual_control`, some sensors need to be attached to the ego vehicle: +- to display an image: a camera with role-name 'view' and resolution 800x600 +- to display the current gnss position: a gnss sensor with role-name 'gnss1' +- to get a notification on lane invasions: a lane invasion sensor +- to get a notification on lane invasions: a collision sensor ## Manual steering diff --git a/carla_manual_control/src/carla_manual_control/carla_manual_control.py b/carla_manual_control/src/carla_manual_control/carla_manual_control.py index 9fe0bae6..d7eadd22 100755 --- a/carla_manual_control/src/carla_manual_control/carla_manual_control.py +++ b/carla_manual_control/src/carla_manual_control/carla_manual_control.py @@ -278,7 +278,7 @@ def __init__(self, width, height): self.latitude = 0 self.longitude = 0 self.gnss_subscriber = rospy.Subscriber( - "/carla/ego_vehicle/gnss/sensor/gnss", NavSatFix, self.gnss_updated) + "/carla/ego_vehicle/gnss/gnss1/fix", NavSatFix, self.gnss_updated) self.tf_listener = tf.TransformListener() def __del__(self): diff --git a/carla_ros_bridge/src/carla_ros_bridge/gnss.py b/carla_ros_bridge/src/carla_ros_bridge/gnss.py index 1f9ba915..5b4d4a09 100644 --- a/carla_ros_bridge/src/carla_ros_bridge/gnss.py +++ b/carla_ros_bridge/src/carla_ros_bridge/gnss.py @@ -55,4 +55,4 @@ def sensor_data_updated(self, carla_gnss_event): navsatfix_msg.longitude = carla_gnss_event.longitude navsatfix_msg.altitude = carla_gnss_event.altitude self.publish_ros_message( - self.topic_name() + "/gnss", navsatfix_msg) + self.topic_name() + "/fix", navsatfix_msg) From 814af5ce28878a8f1b4f4877d484efeb432ddd61 Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Fri, 5 Apr 2019 15:20:17 +0200 Subject: [PATCH 7/7] Add info text, if manual control override is enabled --- CHANGELOG.md | 1 - .../carla_manual_control/carla_manual_control.py | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b8f7c8..ff8d8773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ ## Latest changed -* send rgb-camera images in 'bgr8' format (instead of 'bgra8') * rename gnss topic from '../gnss' to '../fix' * Add lane invasion sensor * Add collision sensor diff --git a/carla_manual_control/src/carla_manual_control/carla_manual_control.py b/carla_manual_control/src/carla_manual_control/carla_manual_control.py index d7eadd22..bc7e08fa 100755 --- a/carla_manual_control/src/carla_manual_control/carla_manual_control.py +++ b/carla_manual_control/src/carla_manual_control/carla_manual_control.py @@ -277,9 +277,12 @@ def __init__(self, width, height): "/carla/ego_vehicle/vehicle_info", CarlaEgoVehicleInfo, self.vehicle_info_updated) self.latitude = 0 self.longitude = 0 + self.manual_control = False self.gnss_subscriber = rospy.Subscriber( "/carla/ego_vehicle/gnss/gnss1/fix", NavSatFix, self.gnss_updated) self.tf_listener = tf.TransformListener() + self.manual_control_subscriber = rospy.Subscriber( + "/vehicle_control_manual_override", Bool, self.manual_control_override_updated) def __del__(self): self.gnss_subscriber.unregister() @@ -292,6 +295,13 @@ def tick(self, clock): """ self._notifications.tick(clock) + def manual_control_override_updated(self, data): + """ + Callback on vehicle status updates + """ + self.manual_control = data.data + self.update_info_text() + def vehicle_status_updated(self, vehicle_status): """ Callback on vehicle status updates @@ -356,7 +366,9 @@ def update_info_text(self): ('Hand brake:', self.vehicle_status.control.hand_brake), ('Manual:', self.vehicle_status.control.manual_gear_shift), 'Gear: %s' % {-1: 'R', 0: 'N'}.get(self.vehicle_status.control.gear, - self.vehicle_status.control.gear)] + self.vehicle_status.control.gear), + ''] + self._info_text += [('Manual ctrl:', self.manual_control)] def toggle_info(self): """