SMACC2
Loading...
Searching...
No Matches
cl_keyboard.hpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
18
20
22#include <smacc2/smacc.hpp>
23
24#include <boost/asio.hpp>
25#include <boost/asio/posix/stream_descriptor.hpp>
26#include <iostream>
27
28#include <std_msgs/msg/u_int16.hpp>
29
30namespace cl_keyboard
31{
33{
34public:
35 ClKeyboard();
36 virtual ~ClKeyboard();
37
38 // Override the base class methods to call our setup
39 template <typename TOrthogonal, typename TClient>
41
42 // Clients utilize a composition based architecture for their components.
43 // In the function body below we create the components that will be used in this client.
44
45 {
46 // We start by creating a topic subscriber component from SMACC2s client core components.
47 // We use this to gain the topic funcionality interated with SMACC and the ability to post smacc events for transitions.
48 // We are using it to handle the reception of ros topic messages and to notify the other components in the client.
49 this->createComponent<
51 ClKeyboard>("/keyboard_unicode");
52
53 // This keyboard listener component requires CpTopicSubscriber.
54 // It is notified by the CpTopicSubscriber and processes the messages to decide which keyboard event must be posted and then posts it.
56 }
57};
58} // namespace cl_keyboard
SmaccComponentType * createComponent(TArgs... targs)