Skip to content

Commit

Permalink
Add type config option and possibility to use pedals (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
mebbaid authored Sep 19, 2024
1 parent f3c7e66 commit 05af78f
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 110 deletions.
6 changes: 4 additions & 2 deletions src/JoypadModule/app/dcmWalkingJoypad/joypad.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name joypad
period 0.05

type gamepad

# Joypad options
deadzone 0.05
fullscale 1.0

forwardAxis 0
rotationAxis 1
forwardAxis 1
rotationAxis 0
sideAxis 2
prepareButton 0 # A Button
startButton 1 # B Button
Expand Down
6 changes: 4 additions & 2 deletions src/JoypadModule/app/dcmWalkingJoypad/keyboard.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name joypad
period 0.05

type keyboard

# Joypad options
deadzone 0.0
fullscale 1.0
forwardAxis 0
rotationAxis 1
forwardAxis 1
rotationAxis 0
sideAxis 2
prepareButton 0 # A Button
startButton 1 # B Button
Expand Down
40 changes: 40 additions & 0 deletions src/JoypadModule/app/dcmWalkingJoypad/pedals.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name joypad
period 0.05

type pedals


# Joypad options
deadzone 0.2
fullscale 1.0

connectPortsSeparately true

# copied from gamepad.ini for now
forwardAxis 1
rotationAxis 2
sideAxis 0


# Port names
rpcServerPort_name /walking-coordinator/rpc
rpcClientPort_name /rpc

# The goal is the desired position of the robot CoM. The desired position is a
# vector containing the x and the y coordinate expressed in a frame rigidly
# attached to the robot.
# The x-axis points forward
# The y-axis points on the left
robotGoalInputPort_name /walking-coordinator/goal:i
robotGoalOutputPort_name /goal:o

[JOYPAD_DEVICE]
# Polydriver options
# remote depends on the name of the joypad (xbox ps4 ...)

# device JoypadControlClient
# local /joypadInput
# remote /joypadDevice/xbox

device SDLJoypad
sticks 0
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ namespace WalkingControllers
std::string m_robotGoalOutputPortName; /**< Name of the robotGoal port (opened by the joypad module) */
std::string m_robotGoalInputPortName; /**< Name of the robotGoal port (opened by the walking module) */

std::string m_joypadType; /**< Type of the joypad. pedals, gamepad, etc. */

/**
* Standard deadzone function.
* @param input input of the deadzone
* @return 0 if the abs(input) < abs(deadzone) otherwise return the input scaled.
*/
double deadzone(const double &input);

void sendGoal(const double linearVelocity, const double lateralVelocity, const double angularVelocity);

public:

/**
Expand Down
Loading

0 comments on commit 05af78f

Please sign in to comment.