bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::utils::render::KeyboardRC Class Reference

The keyboard as a radio transmitter: More...

#include <keyboard_rc.h>

Inheritance diagram for bitsim::utils::render::KeyboardRC:
Collaboration diagram for bitsim::utils::render::KeyboardRC:

Public Member Functions

 KeyboardRC (real_t throttle_rate=0.25, real_t deflection=1.0)
bool OnEvent (const irr::SEvent &event) override
control::RCCommand command (real_t dt)
 The command for the keys held now, dt [s] after the last call.
bool reset_requested ()
 True once after R was pressed.
void reset ()
 Put the throttle down and disarm.
void set_key (irr::EKEY_CODE key, bool down)
 Hold a key down or let it go, as if it were pressed, for tests and scripts.

Detailed Description

The keyboard as a radio transmitter:

Key Stick
W, S throttle up, down: it stays where it is left, as a throttle stick does
A, D yaw left, right
Up, Down pitch forward, back
Left, Right roll left, right
Space arm, or disarm
R ask the application to start again

The yaw, pitch and roll keys deflect their stick by deflection while they are held, and the stick springs back to the centre when they are let go. Add it to the window with chrono::irrlicht::ChVisualSystemIrrlicht::AddUserEventReceiver; it takes these keys, so the camera does not see them.

Constructor & Destructor Documentation

◆ KeyboardRC()

bitsim::utils::render::KeyboardRC::KeyboardRC ( real_t throttle_rate = 0.25,
real_t deflection = 1.0 )
explicit
Parameters
throttle_rateHow fast holding W or S moves the throttle [1/s]
deflectionHow far the yaw, pitch and roll keys move their sticks, in [0, 1]

Member Function Documentation

◆ command()

control::RCCommand bitsim::utils::render::KeyboardRC::command ( real_t dt)

The command for the keys held now, dt [s] after the last call.

◆ OnEvent()

bool bitsim::utils::render::KeyboardRC::OnEvent ( const irr::SEvent & event)
override

◆ reset()

void bitsim::utils::render::KeyboardRC::reset ( )

Put the throttle down and disarm.

◆ reset_requested()

bool bitsim::utils::render::KeyboardRC::reset_requested ( )

True once after R was pressed.

◆ set_key()

void bitsim::utils::render::KeyboardRC::set_key ( irr::EKEY_CODE key,
bool down )

Hold a key down or let it go, as if it were pressed, for tests and scripts.


The documentation for this class was generated from the following files: