Skip to content

Commit

Permalink
wip mrs simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Oct 12, 2023
1 parent e8a78d3 commit 3d1984f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
101 changes: 101 additions & 0 deletions docs/simulation/mrs/mrs/standalone_outside_ros.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
layout: default
title: Standalone outside ROS
parent: MRS Simulator
grand_parent: Simulation
nav_order: 3
---

The MRS Multirotor Simulator contains a **header-only** implementation of the single UAV dynamics including a feedback controller pipeline.

## Headers

The headers are located in [include/mrs_multirotor_simulator/uav_system](https://github.com/ctu-mrs/mrs_multirotor_simulator/tree/master/include/mrs_multirotor_simulator/uav_system).
All the headers should be linked using relative includes so it should be possible to just copy the whole folder into your own code.

## Provided API

The API to the single UAV model is provided from
```
include uav_system.hpp
```

### Constructors

Default constructor, uses parameters for Holybro x500 drone:
```C
UavSystem(void);
```
A constructor that accepts model parameters:
```C
UavSystem(const MultirotorModel::ModelParams& model_params);
```

A constructor that accepts model parameters and an initial spawn position:
```C
UavSystem(const MultirotorModel::ModelParams& model_params, const Eigen::Vector3d spawn_pos, const double spawn_heading);
```
### Stepping the simulator
The simulator step with a particular time step can be executed by:
```C
void makeStep(const double dt);
```

### Control inputs

The UAV accepts a variety of control inputs.
You can start controlling the drone by calling any of these functions:
```C
void setInput(const reference::Actuators& actuators);
void setInput(const reference::ControlGroup& control_group);
void setInput(const reference::AttitudeRate& attitude_rate);
void setInput(const reference::Attitude& attitude);
void setInput(const reference::TiltHdgRate& tilt);
void setInput(const reference::AccelerationHdgRate& acceleration);
void setInput(const reference::AccelerationHdg& acceleration);
void setInput(const reference::VelocityHdgRate& velocity);
void setInput(const reference::VelocityHdg& velocity);
void setInput(const reference::Position& position);

void setFeedforward(const reference::AccelerationHdgRate& cmd);
void setFeedforward(const reference::AccelerationHdg& cmd);
void setFeedforward(const reference::VelocityHdg& cmd);
void setFeedforward(const reference::VelocityHdgRate& cmd);
```
### Getting data
The full UAV state can be obtained by:
```C
MultirotorModel::State getState(void);
```

The simulated accelerometer measurement can be obtained by:
```C
Eigen::Vector3d getImuAcceleration(void);
```
### Setting controller parameters
```C
void setMixerParams(const Mixer::Params& params);
void setRateControllerParams(const RateController::Params& params);
void setAttitudeControllerParams(const AttitudeController::Params& params);
void setVelocityControllerParams(const VelocityController::Params& params);
void setPositionControllerParams(const PositionController::Params& params);
```

### Other routines

A crash can be induced by:
```C
void crash(void);
```
External force can be applied to the UAV by:
```C
void applyForce(const Eigen::Vector3d& force);
```
7 changes: 7 additions & 0 deletions docs/simulation/mrs/mrs/standalone_ros_sim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: default
title: Standalone ROS simulation
parent: MRS Simulator
grand_parent: Simulation
nav_order: 2
---
7 changes: 7 additions & 0 deletions docs/simulation/mrs/mrs/with_mrs_system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: default
title: With the MRS UAV System
parent: MRS Simulator
grand_parent: Simulation
nav_order: 1
---

0 comments on commit 3d1984f

Please sign in to comment.