本文整理汇总了C++中OutputPort::write方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputPort::write方法的具体用法?C++ OutputPort::write怎么用?C++ OutputPort::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPort
的用法示例。
在下文中一共展示了OutputPort::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testPortBufferConnection
void CorbaMQueueIPCTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mw1 => server => mr1 of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mw1->connected() );
BOOST_CHECK( mr1->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK( !mr1->read(value) );
// Check if writing works
ASSERT_PORT_SIGNALLING(mw1->write(1.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(2.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(3.0), mr1);
// it will be emptied too fast by mqueue.
//ASSERT_PORT_SIGNALLING(mw1->write(4.0), 0);
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mr1->read(value), OldData );
}
示例2: updateHook
void updateHook() {
dummyInPort.read(dataVar);
dummyOutPort.write(dataVar);
dataInPort.read(dataVar);
dataOutPort.write(dataVar);
//log(Info) << "Worker relaying data!" << endlog();
}
示例3: testPortBufferConnection
void CorbaTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mo => mi of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mo->connected() );
BOOST_CHECK( mi->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK_EQUAL( mi->read(value), NoData );
// Check if writing works
ASSERT_PORT_SIGNALLING(mo->write(1.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(2.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(3.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(4.0), 0);
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mi->read(value), OldData );
}
示例4: testPortBufferConnection
void CorbaMQueueIPCTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mw1 => server => mr1 of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mw1->connected() );
BOOST_CHECK( mr1->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK( !mr1->read(value) );
// Check if writing works
ASSERT_PORT_SIGNALLING(mw1->write(1.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(2.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(3.0), mr1);
// There are two connections between mw1 and mr1. We first flush one of the
// two, and then the second one (normal multi-writer single-reader
// behaviour)
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mr1->read(value), OldData );
}
示例5: updateHook
void updateHook() {
cwport.write(i);
swport.write(i);
iwport.write(i);
fwport.write(i);
dwport.write( std::vector<double>(10,i) );
++i;
}
示例6: updateHook
void updateHook() {
double input_sample;
if ( input.read(input_sample) ) {
current += this->engine()->getActivity()->getPeriod()*input_sample /inertia.value();
}
output.write( current );
}
示例7: TestTaskContext
TestTaskContext(std::string name)
: TaskContext(name),
hello("Hello", "The hello thing", "World"),
cwport("cw_port", 'a'),
swport("sw_port", 1),
iwport("iw_port", 0),
fwport("fw_port", 0.0),
dwport("dw_port"),
crport("cr_port"),
srport("sr_port"),
irport("ir_port"),
frport("fr_port"),
drport("dr_port"), i(0)
{
this->properties()->addProperty( hello );
this->ports()->addPort( cwport );
this->ports()->addPort( swport );
this->ports()->addPort( iwport );
this->ports()->addPort( fwport );
this->ports()->addPort( dwport );
this->ports()->addPort( crport );
this->ports()->addPort( srport );
this->ports()->addPort( irport );
this->ports()->addPort( frport );
this->ports()->addPort( drport );
// write initial value.
std::vector<double> init(10, 5.4528);
dwport.write( init );
}
示例8: writeJointPositionsToPort
void ArmBridgeRosOrocos::writeJointPositionsToPort(brics_actuator::JointPositions brics_joint_positions, std_msgs::Float64MultiArray& orocos_data_array, OutputPort<std_msgs::Float64MultiArray>& output_port)
{
for (size_t i = 0; i < brics_joint_positions.positions.size(); i++)
{
std::cout << brics_joint_positions.positions[i].value << " ";
orocos_data_array.data[i] = brics_joint_positions.positions[i].value;
}
output_port.write(orocos_data_array);
}
示例9: updateHook
void updateHook() {
xpos = xpos + 0.001;
ypos = ypos + 0.001;
zpos = zpos + 0.000;
object_coordinates_Pose.setOrigin( tf::Vector3(xpos,ypos,zpos) );
object_PoseTF = geometric_semantics::Pose<tf::Pose> (object_PoseCoordinatesSemantics, object_coordinates_Pose);
object_PoseTF_msg = conversions_geometric_msgs::PoseTFToMsg(object_PoseTF);
outPortPose.write(object_PoseTF_msg);
log(Debug) << "Geometric_semantics_component_tutorial_publisher executes updateHook !" <<endlog();
}
开发者ID:tdelaet,项目名称:geometric_relations_semantics_tutorial,代码行数:11,代码来源:geometric_semantics_component-tutorial-publisher.hpp
示例10: testPortDataConnection
void CorbaTest::testPortDataConnection()
{
// This test assumes that there is a data connection mo1 => mi2
// Check if connection succeeded both ways:
BOOST_CHECK( mo1->connected() );
BOOST_CHECK( mi2->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK_EQUAL( mi2->read(value), NoData );
// Check if writing works (including signalling)
ASSERT_PORT_SIGNALLING(mo1->write(1.0), mi2)
BOOST_CHECK( mi2->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
ASSERT_PORT_SIGNALLING(mo1->write(2.0), mi2);
BOOST_CHECK( mi2->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
}
示例11: testPortDataConnection
void CorbaMQueueIPCTest::testPortDataConnection()
{
// This test assumes that there is a data connection mw1 => server => mr1
// Check if connection succeeded both ways:
BOOST_CHECK( mw1->connected() );
BOOST_CHECK( mr1->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK( !mr1->read(value) );
// Check if writing works (including signalling)
ASSERT_PORT_SIGNALLING(mw1->write(1.0), mr1)
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
ASSERT_PORT_SIGNALLING(mw1->write(2.0), mr1);
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
}
示例12: hello
TestTaskContext2(std::string name)
: RTT::TaskContext(name),
hello("Hello", "The hello thing", "World"),
dwport("D1Port"),
drport("D2Port")
{
this->properties()->addProperty( hello );
this->ports()->addPort( drport );
this->ports()->addPort( dwport );
// write initial value.
dwport.write( 0.0 );
}
示例13: TestTaskContext
TestTaskContext(std::string name)
: RTT::TaskContext(name),
hello("Hello", "The hello thing", "World"),
dwport("D2Port"),
drport("D1Port")
{
this->properties()->addProperty( hello );
this->ports()->addPort( drport );
this->ports()->addPort( dwport );
std::vector<double> init(10, 1.0);
dwport.write(init);
}
示例14: updateHook
void updateHook()
{
if(NewData==posInc_in.read(posIncData) && NewData==deltaInc_in.read(deltaIncData))
{
/*for(int i=0; i<number_of_drives; i++)
{
std::cout << "POS INC" << posIncData[i] << std::endl;
}*/
computedPwm_out.write(computePwmValue(posIncData,deltaIncData));
}
/*else
std::cout << "NO DATA" << std::endl;
*/
}
示例15: updateHook
virtual void updateHook () {
if( pos > 9 )
{
init[2]+=2;
} else if( pos > 3 ) {
init[2]++;
} else {
init[2]--;
}
if( pos > 5 ) {
init[4] += 4;
} else {
init[4] -= 4;
}
pos--;
if( pos == 0 ) { pos = 10; }
dwport.write( init );
}