Autonomous-Racing-PG / ar-tu-do

ROS & Gazebo project for 1/10th scale self-driving race cars
89 stars 36 forks source link

joystick mapping for xbox360 and ps3 gamepads #137

Closed StefanJVA closed 5 years ago

StefanJVA commented 5 years ago

Somehow the ps3 mappings on my pc seem to be different from the ones on the actual car. Therefore we have to make the ps3 mappings on Friday. So don't merge this yet! However the code can be reviewed any time.

marian42 commented 5 years ago

Now that we have set the correct values for three different controllers, it is apparent that only the axis numbers change, while everything else stays the same. I think the best approach would be to store the axis assignments like this:

struct JoystickMapping
{
    int steeringAxis;
    int accelerationAxis;
    int decelerationAxis;
    int deadMansSwitchButton;
}

You could then define three constant values of that struct and select one at runtime.

StefanJVA commented 5 years ago

Now that we have set the correct values for three different controllers, it is apparent that only the axis numbers change, while everything else stays the same. I think the best approach would be to store the axis assignments like this:

struct JoystickMapping
{
    int steeringAxis;
    int accelerationAxis;
    int decelerationAxis;
    int deadMansSwitchButton;
}

You could then define three constant values of that struct and select one at runtime.

I have spend 30 minutes fixing every suggestion that was made, only to arrive at this comment, which makes everything obsolete anyway. FML :(