Created
March 10, 2017 23:02
-
-
Save david-german-tri/8f7a4392326c0002204ed58c5cf385f0 to your computer and use it in GitHub Desktop.
Drake package example consumer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/RobotLocomotion/drake/pull/5448 | |
#include <iostream> | |
#include <Eigen/Dense> | |
#include "drake/systems/framework/diagram.h" | |
#include "drake/systems/primitives/adder.h" | |
using namespace drake::systems; | |
int main(int argc, char* argv[]) { | |
const int kNumInputs = 2; | |
const int kSize = 1; | |
Adder<double> adder(kNumInputs, kSize); | |
std::unique_ptr<Context<double>> context = adder.CreateDefaultContext(); | |
std::unique_ptr<SystemOutput<double>> output = adder.AllocateOutput(*context); | |
context->FixInputPort(0, BasicVector<double>::Make({7})); | |
context->FixInputPort(1, BasicVector<double>::Make({11})); | |
adder.CalcOutput(*context, output.get()); | |
std::cout << std::to_string(output->get_vector_data(0)->GetAtIndex(0)) << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment