Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest]
os: [ubuntu-20.04]
build-type: [RelWithDebInfo]
compiler: [gcc]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
Expand Down
61 changes: 27 additions & 34 deletions src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,34 @@ namespace mc_plugin

mc_joystick_plugin::~mc_joystick_plugin() = default;

void mc_joystick_plugin::init(mc_control::MCGlobalController & controller, const mc_rtc::Configuration & config)
void mc_joystick_plugin::init(mc_control::MCGlobalController & controller, const mc_rtc::Configuration &)
{
if(controller.controller().config().has("JoystickPlugin"))
{
configure(controller.controller().config()("JoystickPlugin"));
}
else
{
configure(config);
}
reset(controller);
}

double mc_joystick_plugin::get_inputs(joystickButtonInputs in)
{
return joystick_button_state_(in);
}
double mc_joystick_plugin::get_events(joystickButtonInputs in)
{
return joystick_button_event_(in);
}
double mc_joystick_plugin::get_inputs(joystickAnalogicInputs in)
{

return joystick_analogical_state_(in, 0);
}
Eigen::Vector2d mc_joystick_plugin::get_stick_value(joystickAnalogicInputs in)
{
return Eigen::Vector2d{joystick_analogical_state_(in, 0), joystick_analogical_state_(in, 1)};
}

void mc_joystick_plugin::reset(mc_control::MCGlobalController & controller)
{
mc_rtc::log::info("mc_joystick_plugin::reset called");
joystickConnected_ = false;
joystick_.reset();
if(!joystick_.isFound())
{
joystickConnected_ = false;
Expand Down Expand Up @@ -72,31 +90,6 @@ void mc_joystick_plugin::init(mc_control::MCGlobalController & controller, const
"joystick_plugin_analogical_state_1", [this]() -> Eigen::VectorXd { return joystick_analogical_state_.col(1); });
}

double mc_joystick_plugin::get_inputs(joystickButtonInputs in)
{
return joystick_button_state_(in);
}
double mc_joystick_plugin::get_events(joystickButtonInputs in)
{
return joystick_button_event_(in);
}
double mc_joystick_plugin::get_inputs(joystickAnalogicInputs in)
{

return joystick_analogical_state_(in, 0);
}
Eigen::Vector2d mc_joystick_plugin::get_stick_value(joystickAnalogicInputs in)
{
return Eigen::Vector2d{joystick_analogical_state_(in, 0), joystick_analogical_state_(in, 1)};
}

void mc_joystick_plugin::reset(mc_control::MCGlobalController & controller)
{
mc_rtc::log::info("mc_joystick_plugin::reset called");
joystickConnected_ = false;
joystick_.reset();
}

void mc_joystick_plugin::before(mc_control::MCGlobalController & controller)
{
joystickConnected_ = joystick_.isFound();
Expand Down
5 changes: 0 additions & 5 deletions src/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ struct mc_joystick_plugin : public mc_control::GlobalPlugin

~mc_joystick_plugin() override;

void configure(const mc_rtc::Configuration & config)
{
mc_rtc::log::info("[mc_joystick_plugin] configuration:\n{}", config.dump(true, true));
}

double get_inputs(joystickButtonInputs input);
double get_inputs(joystickAnalogicInputs input);
double get_events(joystickButtonInputs in);
Expand Down