Hello, I am having issues using the joystick component. whenever the getProto() command runs it gives an error stating “no message available”. I’ve followed other component example codes, but there doesn’t see to be an example code that uses the joystick component fully. I’m not sure what I am doing wrong because these files follow examples like realsense camera, and the carter sim joystick examples.
…What am I missing?
json file
"modules": ["sensors:joystick", "//packages/Bot:Bot_components"],
"graph": {
"nodes": [
{
"name": "controls",
"components": [
{
"name": "message_ledger",
"type": "isaac::alice::MessageLedger"
},
{
"name": "controls",
"type": "isaac::Controls"
}
]
},
{
"name": "controller",
"components": [
{
"name": "message_ledger",
"type": "isaac::alice::MessageLedger"
},
{
"name": "isaac.Joystick",
"type": "isaac::Joystick"
}
]
}
],
"edges": [
{
"source": "controller/isaac.Joystick/js_state",
"target": "controls/controls/joy"
}
]
},
"config": {
"controls" : {
"controls" : {
"tick_period" : ".3s"
}
},
"controller": {
"isaac.Joystick": {
"num_axes": 8,
"num_buttons": 11
}
}
}
build file
load("//engine/build:isaac.bzl", "isaac_app", "isaac_cc_module")
isaac_app(
name = "Bot",
modules = [
"//packages/Bot:Bot_components",
"sensors:joystick",
]
)
isaac_cc_module(
name = "Bot_components",
srcs = ["Controls.cpp"],
hdrs = ["Controls.hpp"],
)
header file
#pragma once
#include "engine/alice/alice_codelet.hpp"
#include "messages/messages.hpp"
namespace isaac {
class Controls : public isaac::alice::Codelet {
public:
void start() override;
void tick() override;
ISAAC_PROTO_RX(JoystickStateProto, joy);
};
} //isaac
ISAAC_ALICE_REGISTER_CODELET(isaac::Controls);
cpp file
#include "Controls.hpp"
#include <cstdio>
using namespace std;
namespace isaac {
void Controls::start() {
tickPeriodically();
}
void Controls::tick() {
auto controller = rx_joy().getProto().getButtons();
//if(controller.getButtons()[0]){
// LOG_INFO("ping");
//}
}
} //isaac