Skip to content

ezrassor_joy_translator

Tiger Sachse edited this page Sep 13, 2020 · 8 revisions

Summary

Joy converts gamepad actions (like button presses) into ROS messages. These messages are then translated by the ezrassor_joy_translator into the appropriate message types required for the rest of the EZ-RASSOR system.

Inputs/Outputs

The following is a list of topic inputs and outputs, with each topic's type shown in brackets:

INPUTS
node <- /joy [sensor_msgs/Joy]

OUTPUTS
node -> /autonomous_toggles [std_msgs/Int8]
node -> wheel instructions topic configured at launch [geometry_msgs/Twist]
node -> front arm instructions topic configured at launch [std_msgs/Float32]
node -> back arm instructions topic configured at launch [std_msgs/Float32]
node -> front drum instructions topic configured at launch [std_msgs/Float32]
node -> back drum instructions topic configured at launch [std_msgs/Float32]

Scripts

initialize_joy

This script will change the EZ-RASSOR's default joystick to your active joystick. To run this script, call it with rosrun like this:

rosrun ezrassor_joy_translator initialize_joy

Afterwards, follow the instructions on your screen to set your default joystick. Note that this script only works in installed environments (e.g. when you have fully installed the EZ-RASSOR project, or at minimum when you have installed this specific package). If you are modifying the code in ezrassor_joy_translator and don't have this package permanently installed: pass your joystick number to the launch files you are working with instead to ensure your controller works.

Launch Files

joy_translator.launch

This launch file spins up a single joy translator node. This node is configured via arguments at launch which are passed to the node as namespaced ROS parameters. All possible arguments are listed below:

joystick
The joystick number of the joystick that Joy listens to. Defaults to 0.
wheel_instructions_topic
The topic that wheel instructions are published to.
front_arm_instructions_topic
The topic that front arm instructions are published to.
back_arm_instructions_topic
The topic that back arm instructions are published to.
front_drum_instructions_topic
The topic that front drum instructions are published to.
back_drum_instructions_topic
The topic that back drum instructions are published to.

Examples

Launch a joy translator that publishes directly to the topics that the simulation typically reads from:

roslaunch ezrassor_joy_translator joy_translator.launch \
    wheel_instructions_topic:=wheel_instructions \
    front_arm_instructions_topic:=front_arm_instructions \
    back_arm_instructions_topic:=back_arm_instructions \
    front_drum_instructions_topic:=front_drum_instructions \
    back_drum_instructions_topic:=back_drum_instructions

Launch a joy translator that listens to joystick /dev/input/js1 and publishes to manual_*_instructions topics:

roslaunch ezrassor_joy_translator joy_translator.launch \
    joystick:=1 \
    wheel_instructions_topic:=manual_wheel_instructions \
    front_arm_instructions_topic:=manual_front_arm_instructions \
    back_arm_instructions_topic:=manual_back_arm_instructions \
    front_drum_instructions_topic:=manual_front_drum_instructions \
    back_drum_instructions_topic:=manual_back_drum_instructions