Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ROS2 wrapper #3976

Merged
merged 123 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
26ea2ab
-Add maximize subwindow
alonfaraj Feb 4, 2021
1a3ae35
Fix broken docs ref to image types
alonfaraj Mar 14, 2021
aee0025
- fix missing cmmits after merge
alonfaraj Jul 8, 2021
3fd51ed
- add ros2 folder and first changes
Aug 12, 2021
4f2dc08
- commit everything
alonfaraj Aug 12, 2021
c8cb2f6
- update macros
alonfaraj Aug 12, 2021
8cb50e8
- update ROS_ERROR_STREAM
alonfaraj Aug 12, 2021
ab90dc4
- add missin msg
alonfaraj Aug 12, 2021
3eafad2
- update macros
alonfaraj Aug 12, 2021
e204812
- update ros::Publisher and ros::Subscriber
alonfaraj Aug 12, 2021
b9d7f55
- update subscribers and callbacks
alonfaraj Aug 13, 2021
dc5c103
- update nh_private to sub_node
alonfaraj Aug 13, 2021
cf7c221
- add SharedPtr to Publisher
alonfaraj Aug 13, 2021
7cff7e8
- fix cb
alonfaraj Aug 13, 2021
1187ac1
- commit everything after PD_position node pass
alonfaraj Aug 13, 2021
86b4fcd
- commit some convrsions airsim_ros_wrapper
alonfaraj Aug 14, 2021
0200df0
- commit updates
alonfaraj Aug 14, 2021
d180718
- update CameraInfo
alonfaraj Aug 14, 2021
f868289
- Update CameraInfo
alonfaraj Aug 14, 2021
e3c1177
- update
alonfaraj Aug 14, 2021
a44eb96
- update
alonfaraj Aug 15, 2021
5bb4344
- update time
alonfaraj Aug 15, 2021
0a80b88
- update imageptr
alonfaraj Aug 15, 2021
8326c12
- cosmetic
alonfaraj Aug 15, 2021
6fc7aa2
- fix cb with placeholders and args
alonfaraj Aug 15, 2021
cb14693
- fix image msg ptr
alonfaraj Aug 15, 2021
639054b
- fix set_parameter
alonfaraj Aug 15, 2021
bd3add7
- update
alonfaraj Aug 15, 2021
2e1f18b
- commit fix
alonfaraj Aug 15, 2021
9cd345c
- chane sensor_pubs to seperate vectors
alonfaraj Aug 16, 2021
60cb1d6
- replace ros::AsyncSpinner logic
alonfaraj Aug 17, 2021
a78ee59
- update fromSec()
alonfaraj Aug 17, 2021
0d0d183
- update
alonfaraj Aug 17, 2021
d35f0dd
- add DEPENDENCIES to rosidl_generate_interfaces
alonfaraj Aug 18, 2021
694eae7
- add inline to get_yaw_from_quat_msg()
alonfaraj Aug 18, 2021
f4fdcef
- add launch files
alonfaraj Aug 18, 2021
28b5401
- some fixes and ToDo's
alonfaraj Aug 18, 2021
369c105
- add '-g' to cmakelist.txt
alonfaraj Aug 18, 2021
4cbe414
- add auto params declartion
alonfaraj Aug 19, 2021
c279dad
- cosmetic
alonfaraj Aug 19, 2021
de07119
- add missing declare_parameter
alonfaraj Aug 19, 2021
2f49e35
- change airsim_node launch file
alonfaraj Aug 19, 2021
845497c
- add static_transforms to launch file
alonfaraj Aug 19, 2021
431cd3f
- add pd_position_controller_simple launch file
alonfaraj Aug 19, 2021
38973cb
- update topic names to show node name
alonfaraj Aug 19, 2021
ef4b668
Revert "- fix missing cmmits after merge"
alonfaraj Aug 19, 2021
b5c726b
Revert "Fix broken docs ref to image types"
alonfaraj Aug 19, 2021
c7fc7d7
Revert "-Add maximize subwindow"
alonfaraj Aug 19, 2021
37fd2fe
- remove folders from tracking
alonfaraj Aug 22, 2021
c95f50c
- remove folder from tracking
alonfaraj Aug 22, 2021
a2bc00c
- remove file from tracking
alonfaraj Aug 22, 2021
5fb7053
- update gitignore
alonfaraj Aug 22, 2021
672cd52
- remove folder from tracking
alonfaraj Aug 22, 2021
b0ecd0c
- add airsim_with_simple_PD_position_controller lauch
alonfaraj Aug 22, 2021
2428e0a
- add dynamic_constraints.launch.py
alonfaraj Aug 22, 2021
ff2c49a
- update static_transforms lauhc file
alonfaraj Aug 22, 2021
77eb8d0
- remove folder from tracking
alonfaraj Aug 22, 2021
ef420fe
- remove priavte node handle
alonfaraj Aug 22, 2021
98f223f
- update gitignore
alonfaraj Aug 22, 2021
657da12
- apply clang format
alonfaraj Aug 22, 2021
3b8b71c
- apply clang
alonfaraj Aug 22, 2021
74e5e2f
- undo changes in ros1 src files
alonfaraj Aug 22, 2021
0427c94
- apply clang
alonfaraj Aug 22, 2021
cc69f61
- revert change in ros1
alonfaraj Aug 22, 2021
05e3c32
- revert change in ros1
alonfaraj Aug 22, 2021
39665bd
- add rviz launch file
alonfaraj Aug 22, 2021
9306d9e
- delete old launch files
alonfaraj Aug 22, 2021
a7e3efe
- cleanup
alonfaraj Aug 23, 2021
7e60c72
- update airsim_interfaces package.xml
alonfaraj Aug 25, 2021
7e66542
- cleanup
alonfaraj Aug 25, 2021
75cfe80
- remove ros pkgs from include
alonfaraj Aug 25, 2021
f4b5e0c
- cleanup
alonfaraj Aug 26, 2021
2645426
- enable complier warnings
alonfaraj Aug 26, 2021
b150402
- fix compiler warnings - init order, unused params
alonfaraj Aug 26, 2021
a5991ee
- remove '-g' from compiler args
alonfaraj Aug 26, 2021
ccaf873
- remove boost dependencies
alonfaraj Aug 31, 2021
6c285d2
- reorder find_package(OpenCV REQUIRED)
alonfaraj Aug 31, 2021
4c0b602
- remove set LIBRARY_DIRS, LIBS and link_directories
alonfaraj Aug 31, 2021
d945369
- remove stray semicolons
alonfaraj Sep 12, 2021
ec808f1
- move members initialization
alonfaraj Sep 12, 2021
753d8b0
- change member to const
alonfaraj Sep 12, 2021
13bbb27
- marl dtor as defualt
alonfaraj Sep 12, 2021
991e7dd
- apply clang
alonfaraj Sep 12, 2021
b858232
- convert std::cout to RCLCPP logger
alonfaraj Sep 12, 2021
f5607b1
- clang
alonfaraj Sep 12, 2021
c50021f
- change check isENU_
alonfaraj Sep 13, 2021
3e665c5
- move odom msg generation to unified function
alonfaraj Sep 13, 2021
c6c7ea1
- add convert_tf_msg_to_enu() to avoid code duplication
alonfaraj Sep 13, 2021
a1ba52a
- add ROS2 dockerfile
alonfaraj Oct 20, 2021
80b488c
- add tf2_ros/buffer.h to fix galactic build
alonfaraj Nov 7, 2021
7cd73f0
- cleanup
alonfaraj Nov 11, 2021
c6c17b1
- clean commented out code
alonfaraj Nov 11, 2021
ff3bf75
- change member variables to under_scored_with_
alonfaraj Nov 11, 2021
3f5ea2d
- change member variables to under_scored_with_
alonfaraj Nov 11, 2021
a43d299
- move publish_clock_ init to ctor
alonfaraj Nov 11, 2021
52e79aa
- cleanup
alonfaraj Nov 11, 2021
819ed88
- remove ros1 launch files
alonfaraj Nov 11, 2021
27c3314
- apply clang
alonfaraj Nov 11, 2021
3e99415
- get GeoPoint directly from AirSimSettings
alonfaraj Nov 11, 2021
4bceece
- add more details about QoS
alonfaraj Nov 11, 2021
26096b5
- rename member drone_control_mutex_ to control_mutex_
alonfaraj Nov 11, 2021
87d3eaf
- apply clang
alonfaraj Nov 11, 2021
cd25854
- change std::function to one-liner lambda
alonfaraj Nov 11, 2021
92c7ae3
- chnage VelCmdGroup to use VelCmd msg instead of duplicate
alonfaraj Nov 11, 2021
2b0e47f
- unified generate VelCmd msg logic
alonfaraj Nov 11, 2021
d5c72ed
- cleanup
alonfaraj Nov 11, 2021
2f43573
- shutdown node in case initialize_airsim() failed
alonfaraj Nov 11, 2021
ca6fccd
- change the image step calculation to avoid hard coded
alonfaraj Nov 11, 2021
0ebec3c
removed a modified file from PR
alonfaraj Nov 14, 2021
98428ff
- removed a modified file from PR
alonfaraj Nov 14, 2021
ef87585
add get_transform_msg_from_airsim() ro reduce code duplication
alonfaraj Nov 14, 2021
9734b48
- get_transform_msg_from_airsim overload to use with Quaternionr
alonfaraj Nov 14, 2021
ce98edb
- move airsim_client_ init to ctor
alonfaraj Nov 14, 2021
041c652
- remove [PIDPositionController] from log, it's already printed by ROS
alonfaraj Nov 15, 2021
54a89a6
- add get_airlib_body_vel_cmd() to avoid code duplicate
alonfaraj Nov 15, 2021
e28cb2e
- assign structs directly instead of members
alonfaraj Nov 15, 2021
a90e5f3
- check image type against Enum instead int
alonfaraj Nov 21, 2021
51751cb
- move camera topic to seperate string to avoid duplicate
alonfaraj Nov 21, 2021
08d1d2d
- cleanup
alonfaraj Nov 21, 2021
b070336
- move common topic prefix to string variable
alonfaraj Nov 21, 2021
a4605bd
- simplify Dockerfile
alonfaraj Nov 21, 2021
4946fa6
- remove DEBIAN_FRONTEND from Dockerfile
alonfaraj Nov 21, 2021
8f5f660
- revert using lambda, it cause a crash so leave it with std::functio…
alonfaraj Dec 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ ros/logs/
ros/.catkin_workspace
ros/src/CMakeLists.txt

# ROS2
ros2/install/
ros2/log/
ros2/src/log

# docs
docs/README.md
build_docs/
Expand Down
39 changes: 39 additions & 0 deletions ros2/src/airsim_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.5)

project(airsim_interfaces)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(geographic_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
"msg/GimbalAngleEulerCmd.msg"
"msg/GimbalAngleQuatCmd.msg"
"msg/GPSYaw.msg"
"msg/VelCmd.msg"
"msg/VelCmdGroup.msg"
"msg/CarControls.msg"
"msg/CarState.msg"
"msg/Altimeter.msg"
"msg/Environment.msg"
"srv/SetGPSPosition.srv"
"srv/Takeoff.srv"
"srv/TakeoffGroup.srv"
"srv/Land.srv"
"srv/LandGroup.srv"
"srv/Reset.srv"
"srv/SetLocalPosition.srv" DEPENDENCIES std_msgs geometry_msgs geographic_msgs
)

ament_export_dependencies(rosidl_default_runtime)
ament_package()
4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/msg/Altimeter.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
std_msgs/Header header
float32 altitude
float32 pressure
float32 qnh
8 changes: 8 additions & 0 deletions ros2/src/airsim_interfaces/msg/CarControls.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
std_msgs/Header header
float32 throttle
float32 brake
float32 steering
bool handbrake
bool manual
int8 manual_gear
bool gear_immediate
8 changes: 8 additions & 0 deletions ros2/src/airsim_interfaces/msg/CarState.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
std_msgs/Header header
geometry_msgs/PoseWithCovariance pose
geometry_msgs/TwistWithCovariance twist
float32 speed
int8 gear
float32 rpm
float32 maxrpm
bool handbrake
8 changes: 8 additions & 0 deletions ros2/src/airsim_interfaces/msg/Environment.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
std_msgs/Header header
geometry_msgs/Vector3 position
geographic_msgs/GeoPoint geo_point
geometry_msgs/Vector3 gravity
float32 air_pressure
float32 temperature
float32 air_density

4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/msg/GPSYaw.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
float64 latitude
float64 longitude
float64 altitude
float64 yaw
6 changes: 6 additions & 0 deletions ros2/src/airsim_interfaces/msg/GimbalAngleEulerCmd.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
std_msgs/Header header
string camera_name
string vehicle_name
float64 roll
float64 pitch
float64 yaw
4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/msg/GimbalAngleQuatCmd.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
std_msgs/Header header
string camera_name
string vehicle_name
geometry_msgs/Quaternion orientation
1 change: 1 addition & 0 deletions ros2/src/airsim_interfaces/msg/VelCmd.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
geometry_msgs/Twist twist
2 changes: 2 additions & 0 deletions ros2/src/airsim_interfaces/msg/VelCmdGroup.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
airsim_interfaces/VelCmd vel_cmd
string[] vehicle_names
26 changes: 26 additions & 0 deletions ros2/src/airsim_interfaces/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package format="3">
<name>airsim_interfaces</name>
<version>0.1.0</version>
<description>Contains message and service definitions used by the examples.</description>
<maintainer email="[email protected]">AAA</maintainer>
<license>Apache License 2.0</license>

<author email="[email protected]">AAA</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<buildtool_depend>rosidl_default_generators</buildtool_depend>

<depend>std_msgs</depend>
<depend>geometry_msgs</depend>
<depend>geographic_msgs</depend>

<exec_depend>rosidl_default_runtime</exec_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
3 changes: 3 additions & 0 deletions ros2/src/airsim_interfaces/srv/Land.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bool wait_on_last_task
---
bool success
4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/srv/LandGroup.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string[] vehicle_names
bool wait_on_last_task
---
bool success
4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/srv/Reset.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# string vehicle_name
bool wait_on_last_task
---
bool success
8 changes: 8 additions & 0 deletions ros2/src/airsim_interfaces/srv/SetGPSPosition.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
float64 latitude
float64 longitude
float64 altitude
float64 yaw
string vehicle_name
---
#Response : return success=true, (if async=false && if setpoint reached before timeout = 30sec) || (if async=true && command sent to autopilot)
bool success
11 changes: 11 additions & 0 deletions ros2/src/airsim_interfaces/srv/SetLocalPosition.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#Request : expects position setpoint via x, y, z
#Request : expects yaw setpoint via yaw (send yaw_valid=true)
float64 x
float64 y
float64 z
float64 yaw
string vehicle_name
---
#Response : success=true - (if async=false && if setpoint reached before timeout = 30sec) || (if async=true)
bool success
string message
3 changes: 3 additions & 0 deletions ros2/src/airsim_interfaces/srv/Takeoff.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bool wait_on_last_task
---
bool success
4 changes: 4 additions & 0 deletions ros2/src/airsim_interfaces/srv/TakeoffGroup.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string[] vehicle_names
bool wait_on_last_task
---
bool success
136 changes: 136 additions & 0 deletions ros2/src/airsim_ros_pkgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
cmake_minimum_required(VERSION 3.5)
project(airsim_ros_pkgs)

find_package(rclcpp REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geographic_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_sensor_msgs REQUIRED)
find_package(rclpy REQUIRED)
find_package(tf2 REQUIRED)
find_package(image_transport REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(mavros_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(ament_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_typesupport_cpp REQUIRED)
find_package(rosidl_default_runtime REQUIRED)
find_package(airsim_interfaces REQUIRED)
find_package(OpenCV REQUIRED)

set(AIRSIM_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../)

add_subdirectory("${AIRSIM_ROOT}/cmake/rpclib_wrapper" rpclib_wrapper)
add_subdirectory("${AIRSIM_ROOT}/cmake/AirLib" AirLib)
add_subdirectory("${AIRSIM_ROOT}/cmake/MavLinkCom" MavLinkCom)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -Wnoexcept -Wstrict-null-sentinel")
set(CXX_EXP_LIB "-nostdinc++ -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -nodefaultlibs
-l/usr/lib/x86_64-linux-gnu/libc++.so -l/usr/lib/x86_64-linux-gnu/libc++abi.so
-lm -lc -lgcc_s -lgcc
-lstdc++fs -fmax-errors=10")
set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/rpclib-2.3.0/include")
set(RPC_LIB rpc)
message(STATUS "found RPC_LIB_INCLUDES=${RPC_LIB_INCLUDES}")

set(INCLUDE_DIRS include
${AIRSIM_ROOT}/AirLib/deps/eigen3
${AIRSIM_ROOT}/AirLib/include
${RPC_LIB_INCLUDES}
${AIRSIM_ROOT}/MavLinkCom/include
${AIRSIM_ROOT}/MavLinkCom/common_utils
${OpenCV_INCLUDE_DIRS}
)
include_directories(${INCLUDE_DIRS})

add_library(airsim_settings_parser src/airsim_settings_parser.cpp)
target_link_libraries(airsim_settings_parser AirLib)

add_library(pd_position_controller_simple src/pd_position_controller_simple.cpp)
target_link_libraries(pd_position_controller_simple AirLib)
ament_target_dependencies(pd_position_controller_simple
rclcpp
nav_msgs
geometry_msgs
airsim_interfaces
)

add_library(airsim_ros src/airsim_ros_wrapper.cpp)
target_link_libraries(airsim_ros ${OpenCV_LIBS} yaml-cpp AirLib airsim_settings_parser)
ament_target_dependencies(airsim_ros
rclcpp
sensor_msgs
geometry_msgs
nav_msgs
image_transport
tf2_ros
cv_bridge
airsim_interfaces
)

add_executable(airsim_node src/airsim_node.cpp)
target_link_libraries(airsim_node airsim_ros AirLib)
ament_target_dependencies(airsim_node
rclcpp
)

add_executable(pd_position_controller_simple_node
src/pd_position_controller_simple_node.cpp)
target_link_libraries(pd_position_controller_simple_node
pd_position_controller_simple airsim_ros AirLib)
ament_target_dependencies(pd_position_controller_simple_node
rclcpp
)

# rosidl_target_interfaces(airsim_node
alonfaraj marked this conversation as resolved.
Show resolved Hide resolved
# ${PROJECT_NAME} "rosidl_typesupport_cpp")

# rosidl_target_interfaces(pd_position_controller_simple_node
# ${PROJECT_NAME} "rosidl_typesupport_cpp")

install(TARGETS airsim_node pd_position_controller_simple_node
DESTINATION lib/${PROJECT_NAME})

install(TARGETS airsim_ros pd_position_controller_simple
ARCHIVE
DESTINATION lib
LIBRARY
DESTINATION lib)

install(FILES README.md DESTINATION share/${PROJECT_NAME})

install(DIRECTORY launch rviz DESTINATION share/${PROJECT_NAME})



ament_export_dependencies(rclcpp)
ament_export_dependencies(nav_msgs)
ament_export_dependencies(geographic_msgs)
ament_export_dependencies(std_srvs)
ament_export_dependencies(tf2_ros)
ament_export_dependencies(tf2_sensor_msgs)
ament_export_dependencies(rclpy)
ament_export_dependencies(tf2)
ament_export_dependencies(image_transport)
ament_export_dependencies(geometry_msgs)
ament_export_dependencies(cv_bridge)
ament_export_dependencies(tf2_geometry_msgs)
ament_export_dependencies(sensor_msgs)
ament_export_dependencies(mavros_msgs)
ament_export_dependencies(rosidl_default_generators)
ament_export_dependencies(ament_cmake)
ament_export_dependencies(std_msgs)
ament_export_dependencies(rosidl_default_runtime)
ament_export_dependencies(airsim_interfaces)

ament_export_include_directories(${INCLUDE_DIRS})
ament_export_libraries(airsim_settings_parser pd_position_controller_simple
airsim_ros)

ament_package()
3 changes: 3 additions & 0 deletions ros2/src/airsim_ros_pkgs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# airsim_ros_pkgs

This page has moved [here](https://github.com/microsoft/AirSim/blob/master/docs/airsim_ros_pkgs.md).
Loading