Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 15 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ The video is available on youtube: https://youtu.be/hiRtcq-5lN0 and

## Update

Ubuntu 20.04 is also supported in ubuntu20 branch.
Ubuntu 22.04 with ROS 2 Humble is supported.

**Ten realistic maps (low and high resolution) have been realeased in the realease packages.**

**A new branch that merge with FUEL has been released in the fuel_ubuntu20 branch.**



## Prerequisited

### Ubuntu and ROS
### Ubuntu and ROS 2

Ubuntu 16.04~20.04. [ROS Installation](http://wiki.ros.org/ROS/Installation).
Ubuntu 22.04 with ROS 2 Humble. [ROS 2 Installation](https://docs.ros.org/en/humble/Installation.html).

### PCL && Eigen && glfw3

Expand All @@ -52,55 +48,37 @@ sudo apt-get install libglfw3-dev libglew-dev

### Make
```
mkdir -p marsim_ws/src
cd marsim_ws/src
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone git@github.com:hku-mars/MARSIM.git
cd ..
catkin_make
colcon build
```

## Run single drone simulation

```
source devel/setup.bash
roslaunch test_interface single_drone_avia.launch
source install/setup.bash
ros2 launch test_interface single_drone_simple.launch.py
```
Click on 3Dgoal tool on the Rviz, you can give the UAV a position command to control its flight.
Click on 2D Goal Pose tool on the RViz2, you can give the UAV a position command to control its flight.

For now, we provide several launch files for users, which can be found in test_interface/launch folder.

You can change the parameter in launch files to change the map and LiDAR to be simulated. The maps have been uploaded to the realease files in this repository.

```
<arg name="map_name" value="$(find map_generator)/resource/small_forest01cutoff.pcd"/>

```

**If you want to use the GPU version of MARSIM, please set the parameter "use_gpu" to true.**

## Run single drone simulation with dynamic obstacles
```
source devel/setup.bash
roslaunch test_interface single_drone_mid360_dynobs.launch
```

## Run multiple drones simulation
```
source devel/setup.bash
roslaunch test_interface triple_drone_mid360.launch
```
**Available maps can be found in the `map_generator/resource/` folder.**

## Run the simulation with FUEL algorithm
**If you want to use the GPU version of MARSIM, please set the parameter "use_gpu_" to true.**

You should first change the branch to fuel_ubuntu20 branch. If you are using ubuntu 20.04, you should first download Nlopt and make install it in your environment. Then you can run the simulation by the command below:
## Run single drone simulation with MID360 LiDAR
```
source devel/setup.bash
roslaunch exploration_manager exploration.launch
source install/setup.bash
ros2 launch test_interface single_drone_mid360.launch.py
```
Then click on 2Dgoal tool on the Rviz, randomly click on the map, and FUEL would automously run.

## Acknowledgments
Thanks for [FUEL](https://github.com/HKUST-Aerial-Robotics/FUEL.git)

## Future
More realistic maps and functions are going to be released soon.
More realistic maps and functions are going to be released soon.
197 changes: 81 additions & 116 deletions Utils/mars_quadrotor_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,124 +1,89 @@
#-cmake_minimum_required(VERSION 2.4.6)
#-include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

#-rosbuild_init()

#set the default path for built executables to the "bin" directory
#-set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
#-set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#-\rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

#-rosbuild_add_library(encode_msgs src/encode_msgs.cpp)
#-rosbuild_add_link_flags(encode_msgs -Wl,--as-needed)

#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
#find_package(Eigen3 REQUIRED)

#include_directories(${EIGEN3_INCLUDE_DIR})
#-rosbuild_add_library(decode_msgs src/decode_msgs.cpp)
#-rosbuild_add_link_flags(decode_msgs -Wl,--as-needed)

#------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.8)
project(quadrotor_msgs)

find_package(catkin REQUIRED COMPONENTS
#armadillo
roscpp
nav_msgs
geometry_msgs
message_generation
)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

include_directories(
${catkin_INCLUDE_DIRS}
include
)

#
add_message_files(
FILES
esdf_map.msg
fc_to_oa.msg
oa_result.msg
vio_result.msg
ctrl.msg
aec.msg
AuxCommand.msg
Corrections.msg
Gains.msg
OutputData.msg
PositionCommand.msg
PPROutputData.msg
Serial.msg
SO3Command.msg
StatusData.msg
TRPYCommand.msg
Odometry.msg
PolynomialTrajectory.msg
MincoTrajectory.msg
LQRTrajectory.msg
drone_aec_info.msg
oa_manager_debug.msg
TakeoffLand.msg
Px4ctrlDebug.msg
ServerTime.msg
TrakingPerformance.msg
MpcPositionCommand.msg
QuadrotorState.msg
)

generate_messages(
DEPENDENCIES
geometry_msgs
nav_msgs
)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)

catkin_package(
#INCLUDE_DIRS include
LIBRARIES encode_msgs decode_msgs
#CATKIN_DEPENDS geometry_msgs nav_msgs
#DEPENDS system_lib
CATKIN_DEPENDS message_runtime
include_directories(include)

rosidl_generate_interfaces(${PROJECT_NAME}
"msg/EsdfMap.msg"
"msg/FcToOa.msg"
"msg/OaResult.msg"
"msg/VioResult.msg"
"msg/Ctrl.msg"
"msg/Aec.msg"
"msg/AuxCommand.msg"
"msg/Corrections.msg"
"msg/Gains.msg"
"msg/OutputData.msg"
"msg/PositionCommand.msg"
"msg/PPROutputData.msg"
"msg/Serial.msg"
"msg/SO3Command.msg"
"msg/StatusData.msg"
"msg/TRPYCommand.msg"
"msg/Odometry.msg"
"msg/PolynomialTrajectory.msg"
"msg/MincoTrajectory.msg"
"msg/LQRTrajectory.msg"
"msg/DroneAecInfo.msg"
"msg/OaManagerDebug.msg"
"msg/TakeoffLand.msg"
"msg/Px4ctrlDebug.msg"
"msg/ServerTime.msg"
"msg/TrakingPerformance.msg"
"msg/MpcPositionCommand.msg"
"msg/QuadrotorState.msg"
DEPENDENCIES geometry_msgs nav_msgs std_msgs builtin_interfaces
)

# add_executable(test_exe src/test_exe.cpp)
add_library(decode_msgs src/decode_msgs.cpp)
add_library(encode_msgs src/encode_msgs.cpp)

# add_dependencies(test_exe quadrotor_msgs_generate_messages_cpp)
add_dependencies(encode_msgs quadrotor_msgs_generate_messages_cpp)
add_dependencies(decode_msgs quadrotor_msgs_generate_messages_cpp)

find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})


# target_link_libraries(test_exe
# decode_msgs
# encode_msgs
# )

target_include_directories(decode_msgs PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_include_directories(encode_msgs PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

target_compile_features(decode_msgs PUBLIC c_std_99 cxx_std_17)
target_compile_features(encode_msgs PUBLIC c_std_99 cxx_std_17)

ament_target_dependencies(decode_msgs "Eigen3")
ament_target_dependencies(encode_msgs "Eigen3")

rosidl_get_typesupport_target(cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
target_link_libraries(decode_msgs "${cpp_typesupport_target}")
target_link_libraries(encode_msgs "${cpp_typesupport_target}")

install(TARGETS decode_msgs encode_msgs
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

# Install header files
install(DIRECTORY include/
DESTINATION include/)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

ament_export_dependencies(rosidl_default_runtime)
ament_package()
12 changes: 6 additions & 6 deletions Utils/mars_quadrotor_msgs/include/quadrotor_msgs/decode_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@

#include <stdint.h>
#include <vector>
#include <quadrotor_msgs/OutputData.h>
#include <quadrotor_msgs/StatusData.h>
#include <quadrotor_msgs/PPROutputData.h>
#include <quadrotor_msgs/msg/output_data.hpp>
#include <quadrotor_msgs/msg/status_data.hpp>
#include <quadrotor_msgs/msg/ppr_output_data.hpp>

namespace quadrotor_msgs
{

bool decodeOutputData(const std::vector<uint8_t> &data,
quadrotor_msgs::OutputData &output);
quadrotor_msgs::msg::OutputData &output);

bool decodeStatusData(const std::vector<uint8_t> &data,
quadrotor_msgs::StatusData &status);
quadrotor_msgs::msg::StatusData &status);

bool decodePPROutputData(const std::vector<uint8_t> &data,
quadrotor_msgs::PPROutputData &output);
quadrotor_msgs::msg::PPROutputData &output);
}

#endif
12 changes: 6 additions & 6 deletions Utils/mars_quadrotor_msgs/include/quadrotor_msgs/encode_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

#include <stdint.h>
#include <vector>
#include <quadrotor_msgs/SO3Command.h>
#include <quadrotor_msgs/TRPYCommand.h>
#include <quadrotor_msgs/Gains.h>
#include <quadrotor_msgs/msg/so3_command.hpp>
#include <quadrotor_msgs/msg/trpy_command.hpp>
#include <quadrotor_msgs/msg/gains.hpp>

namespace quadrotor_msgs
{

void encodeSO3Command(const quadrotor_msgs::SO3Command &so3_command,
void encodeSO3Command(const quadrotor_msgs::msg::SO3Command &so3_command,
std::vector<uint8_t> &output);
void encodeTRPYCommand(const quadrotor_msgs::TRPYCommand &trpy_command,
void encodeTRPYCommand(const quadrotor_msgs::msg::TRPYCommand &trpy_command,
std::vector<uint8_t> &output);

void encodePPRGains(const quadrotor_msgs::Gains &gains,
void encodePPRGains(const quadrotor_msgs::msg::Gains &gains,
std::vector<uint8_t> &output);
}

Expand Down
2 changes: 1 addition & 1 deletion Utils/mars_quadrotor_msgs/msg/Bspline.msg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ int32 order
int64 traj_id
float64[] knots
geometry_msgs/Point[] pts
time start_time
builtin_interfaces/Time start_time
float64 time_extra
float64 replan_to_global_time
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Header header
std_msgs/Header header
uint16 map_plantform
uint8 map_version
uint8 map_log_version
Expand Down
8 changes: 4 additions & 4 deletions Utils/mars_quadrotor_msgs/msg/Gains.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
float64 Kp
float64 Kd
float64 Kp_yaw
float64 Kd_yaw
float64 kp
float64 kd
float64 kp_yaw
float64 kd_yaw
2 changes: 1 addition & 1 deletion Utils/mars_quadrotor_msgs/msg/LQRTrajectory.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Header header
std_msgs/Header header

# the trajectory id, starts from "1".
uint32 trajectory_id
Expand Down
4 changes: 2 additions & 2 deletions Utils/mars_quadrotor_msgs/msg/MincoTrajectory.msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Header header
std_msgs/Header header

# the trajectory id, starts from "1".
uint32 trajectory_id
Expand Down Expand Up @@ -26,7 +26,7 @@ float64[] waypoints_z
float64[] time
float64 mag_coeff
uint32[] order
time start_time
builtin_interfaces/Time start_time
float64 local_start_t
#the occ state of trajectory.
uint32 occ_state
Expand Down
Loading