<commit_before>#include <iostream>
#include "drake/examples/Pendulum/Pendulum.h"
#include "drake/systems/Simulation.h"
#include "drake/systems/plants/BotVisualizer.h"
#include "drake/systems/cascade_system.h"
#include "drake/systems/feedback_system.h"
#include "drake/util/drakeAppUtil.h"

using namespace std;
using namespace Drake;

/**
 * Runs the energy shaping controller as an LCM node or, with "-s",
 * as a standalone BotVisualizer-compatible app.
 */
int main(int argc, char* argv[]) {
  shared_ptr<lcm::LCM> lcm = make_shared<lcm::LCM>();
  if (!lcm->good()) return 1;

  auto p = std::make_shared<Pendulum>();
  auto c = std::make_shared<PendulumEnergyShapingController>(*p);

  if (commandLineOptionExists(argv, argv+argc, "-h")) {
    std::cout
        << "Runs the energy shaping controller as an LCM node or," << std::endl
        << "with '-s', as a standalone BotVisualizer-compatible app."
        << std::endl;
    exit(0);
  }

  if (!commandLineOptionExists(argv, argv+argc, "-s")) {
    // run as LCM node
    runLCM(c, lcm, 0, 10, NullVector<double>());
  } else {  // run a stand-alone simulation
    SimulationOptions options;
    options.realtime_factor = 1.0;

    Eigen::Vector2d x0;
    x0 << 0.1, 0.2;

    auto v = std::make_shared<BotVisualizer<PendulumState> >(
        lcm, getDrakePath() + "/examples/Pendulum/Pendulum.urdf",
        DrakeJoint::FIXED);
    auto sys = cascade(feedback(p, c), v);
    simulate(*sys, 0, 10, x0, options);
  }
}
<commit_msg>Reformat to google style conventions via: clang-format-3.5 -style=google -i drake/examples/Pendulum/runEnergyShaping.cpp<commit_after>#include <iostream>
#include "drake/examples/Pendulum/Pendulum.h"
#include "drake/systems/Simulation.h"
#include "drake/systems/plants/BotVisualizer.h"
#include "drake/systems/cascade_system.h"
#include "drake/systems/feedback_system.h"
#include "drake/util/drakeAppUtil.h"

using namespace std;
using namespace Drake;

/**
 * Runs the energy shaping controller as an LCM node or, with "-s",
 * as a standalone BotVisualizer-compatible app.
 */
int main(int argc, char* argv[]) {
  shared_ptr<lcm::LCM> lcm = make_shared<lcm::LCM>();
  if (!lcm->good()) return 1;

  auto p = std::make_shared<Pendulum>();
  auto c = std::make_shared<PendulumEnergyShapingController>(*p);

  if (commandLineOptionExists(argv, argv + argc, "-h")) {
    std::cout << "Runs the energy shaping controller as an LCM node or,"
              << std::endl
              << "with '-s', as a standalone BotVisualizer-compatible app."
              << std::endl;
    exit(0);
  }

  if (!commandLineOptionExists(argv, argv + argc, "-s")) {
    // run as LCM node
    runLCM(c, lcm, 0, 10, NullVector<double>());
  } else {  // run a stand-alone simulation
    SimulationOptions options;
    options.realtime_factor = 1.0;

    Eigen::Vector2d x0;
    x0 << 0.1, 0.2;

    auto v = std::make_shared<BotVisualizer<PendulumState> >(
        lcm, getDrakePath() + "/examples/Pendulum/Pendulum.urdf",
        DrakeJoint::FIXED);
    auto sys = cascade(feedback(p, c), v);
    simulate(*sys, 0, 10, x0, options);
  }
}

{'fraction_non_alphanumeric': 0.151495657767771, 'fraction_numerical': 0.012222579607590866, 'mean_word_length': 3.7336377473363775, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3944319', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1080, 'n_words': 259}