本文整理汇总了C++中ros::NodeHandle::getHardware方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeHandle::getHardware方法的具体用法?C++ NodeHandle::getHardware怎么用?C++ NodeHandle::getHardware使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ros::NodeHandle
的用法示例。
在下文中一共展示了NodeHandle::getHardware方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
// TivaC application specific code
MAP_FPUEnable();
MAP_FPULazyStackingEnable();
// TivaC system clock configuration. Set to 80MHz.
MAP_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
uint8_t button_debounced_delta;
uint8_t button_raw_state;
ButtonsInit();
// ROS nodehandle initialization and topic registration
nh.initNode();
nh.advertise(button_publisher);
while (1)
{
uint8_t button_debounced_state = ButtonsPoll(&button_debounced_delta, &button_raw_state);
// Publish message to be transmitted.
button_msg.sw1.data = button_debounced_state & LEFT_BUTTON;
button_msg.sw2.data = button_debounced_state & RIGHT_BUTTON;
button_publisher.publish(&button_msg);
// Handle all communications and callbacks.
nh.spinOnce();
// Delay for a bit.
nh.getHardware()->delay(100);
}
}
示例2: setup
void setup()
{
RelayShield::begin();
node_handle.getHardware()->setBaud(115200);
node_handle.initNode();
node_handle.subscribe(relay_subscriber);
}
示例3: main
int main(void)
{
SetSysClockTo56();
// ROS nodehandle initialization and topic registration
nh.initNode();
nh.advertise(chatter);
// Initialize LED
GPIO_InitTypeDef GPIO_Config;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
GPIO_Config.GPIO_Pin = GPIO_Pin_5;
GPIO_Config.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Config.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_Config);
GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_RESET);
while (1)
{
// Toggle LED
if (GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_5))
GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_RESET);
else
GPIO_WriteBit(GPIOB, GPIO_Pin_5, Bit_SET);
// Publish message to be transmitted.
str_msg.data = hello;
chatter.publish(&str_msg);
// Handle all communications and callbacks.
nh.spinOnce();
// Delay for a bit.
nh.getHardware()->delay(100);
}
}