mirror of
https://github.com/okalachev/flix.git
synced 2025-08-17 17:16:10 +00:00
Change C++ code style: put curly brace on the same line
This commit is contained in:
@@ -44,8 +44,7 @@ public:
|
||||
|
||||
class Print {
|
||||
public:
|
||||
size_t printf(const char *format, ...)
|
||||
{
|
||||
size_t printf(const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
size_t result = vprintf(format, args);
|
||||
@@ -53,48 +52,39 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t print(float n, int digits = 2)
|
||||
{
|
||||
size_t print(float n, int digits = 2) {
|
||||
return printf("%.*f", digits, n);
|
||||
}
|
||||
|
||||
size_t println(float n, int digits = 2)
|
||||
{
|
||||
size_t println(float n, int digits = 2) {
|
||||
return printf("%.*f\n", digits, n);
|
||||
}
|
||||
|
||||
size_t print(const char* s)
|
||||
{
|
||||
size_t print(const char* s) {
|
||||
return printf("%s", s);
|
||||
}
|
||||
|
||||
size_t println()
|
||||
{
|
||||
size_t println() {
|
||||
return print("\n");
|
||||
}
|
||||
|
||||
size_t println(const char* s)
|
||||
{
|
||||
size_t println(const char* s) {
|
||||
return printf("%s\n", s);
|
||||
}
|
||||
|
||||
size_t println(const Printable& p)
|
||||
{
|
||||
size_t println(const Printable& p) {
|
||||
return p.printTo(*this) + print("\n");
|
||||
}
|
||||
|
||||
size_t print(const String& s)
|
||||
{
|
||||
size_t print(const String& s) {
|
||||
return printf("%s", s.c_str());
|
||||
}
|
||||
|
||||
size_t println(const std::string& s)
|
||||
{
|
||||
size_t println(const std::string& s) {
|
||||
return printf("%s\n", s.c_str());
|
||||
}
|
||||
|
||||
size_t println(const String& s)
|
||||
{
|
||||
size_t println(const String& s) {
|
||||
return printf("%s\n", s.c_str());
|
||||
}
|
||||
};
|
||||
|
@@ -24,8 +24,7 @@ bool joystickInitialized = false, warnShown = false;
|
||||
|
||||
void normalizeRC();
|
||||
|
||||
void joystickInit()
|
||||
{
|
||||
void joystickInit() {
|
||||
SDL_Init(SDL_INIT_JOYSTICK);
|
||||
joystick = SDL_JoystickOpen(0);
|
||||
if (joystick != NULL) {
|
||||
@@ -37,8 +36,7 @@ void joystickInit()
|
||||
}
|
||||
}
|
||||
|
||||
void joystickGet()
|
||||
{
|
||||
void joystickGet() {
|
||||
if (!joystickInitialized) {
|
||||
joystickInit();
|
||||
return;
|
||||
|
@@ -33,8 +33,7 @@ using ignition::math::Vector3d;
|
||||
using namespace gazebo;
|
||||
using namespace std;
|
||||
|
||||
class ModelFlix : public ModelPlugin
|
||||
{
|
||||
class ModelFlix : public ModelPlugin {
|
||||
private:
|
||||
physics::ModelPtr model;
|
||||
physics::LinkPtr body;
|
||||
@@ -45,8 +44,7 @@ private:
|
||||
LowPassFilter<Vector> accFilter = LowPassFilter<Vector>(0.1);
|
||||
|
||||
public:
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) {
|
||||
this->model = _parent;
|
||||
this->body = this->model->GetLink("body");
|
||||
this->imu = dynamic_pointer_cast<sensors::ImuSensor>(sensors::get_sensor(model->GetScopedName(true) + "::body::imu")); // default::flix::body::imu
|
||||
@@ -58,14 +56,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
void OnReset()
|
||||
{
|
||||
void OnReset() {
|
||||
attitude = Quaternion(); // reset estimated attitude
|
||||
gzmsg << "Flix plugin reset" << endl;
|
||||
}
|
||||
|
||||
void OnUpdate()
|
||||
{
|
||||
void OnUpdate() {
|
||||
__micros = model->GetWorld()->SimTime().Double() * 1000000;
|
||||
step();
|
||||
|
||||
@@ -91,8 +87,7 @@ public:
|
||||
logData();
|
||||
}
|
||||
|
||||
void applyMotorsThrust()
|
||||
{
|
||||
void applyMotorsThrust() {
|
||||
// thrusts
|
||||
const double dist = 0.035355; // motors shift from the center, m
|
||||
const double maxThrust = 0.03 * ONE_G; // ~30 g, https://youtu.be/VtKI4Pjx8Sk?&t=78
|
||||
|
Reference in New Issue
Block a user