Page MenuHomec4science

anglesstatusallplot.cpp
No OneTemporary

File Metadata

Created
Mon, Nov 11, 13:49

anglesstatusallplot.cpp

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <ctime>
#include <rsc/logging/LoggerFactory.h>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/timer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/program_options.hpp>
#include <rsb/Informer.h>
#include <rsb/Handler.h>
#include <rsb/Factory.h>
#include <rsb/converter/Repository.h>
#include <rsb/converter/ProtocolBufferConverter.h>
#include <cca/Beat.h>
#include <rci/nodes/SimpleOscillator.h>
#include <rci/dto/JointAngles.h>
#include <rci/dto/converter/JointAnglesConverter.h>
using namespace std;
using namespace boost;
namespace po = boost::program_options;
using namespace rsc;
using namespace rsc::logging;
using namespace rsb;
using namespace rsb::converter;
using namespace rst::converter::rci;
using namespace cca;
using namespace cca::rci;
using namespace cca::rci::driver;
nemo::RealVector angles(nemo::dim(8), 0.0);
static JointAnglesPtr angls = JointAnglesPtr(new JointAngles(angles));
void inputCallback(EventPtr event) {
JointAnglesPtr input = boost::static_pointer_cast<JointAngles>(
event->getData());
std::cout << *input << std::endl;
}
int main() {
/**
* Register converters for Joint Angles
*/
boost::shared_ptr<JointAnglesConverter> converter(
new JointAnglesConverter());
stringConverterRepository()->registerConverter(converter);
LoggerFactory::getInstance().reconfigure(Logger::LEVEL_ERROR);
// Participant configuration
rsb::ParticipantConfig config =
Factory::getInstance().getDefaultParticipantConfig();
ParticipantConfig::Transport inprocess = config.getTransport("inprocess");
inprocess.setEnabled(false);
config.addTransport(inprocess);
ParticipantConfig::Transport spread = config.getTransport("spread");
spread.setEnabled(true);
config.addTransport(spread);
/**
* Listening to JointAngles
*/
ListenerPtr listener = Factory::getInstance().createListener(
Scope("/oncilla/status/nodes/angles/all"), config);
listener->addHandler(
HandlerPtr(new EventFunctionHandler(bind(&inputCallback, _1))));
std::cout << "Now listening to joint angles ..." << std::endl;
while (true) {
sleep(1);
}
return EXIT_SUCCESS;
}

Event Timeline