Gamepad Controller to code?

Typically: "How do I... ", "How can I... " questions
Post Reply
SomeT
Posts: 13
Joined: 08 Nov 2020, 21:38

Gamepad Controller to code?

Post by SomeT »

For a robot with wheels say the Pioneer P3-DX robot, in the simulation is it possible to take over the robots movements and drive it like a car almost, by using a gamepad controller? If so how would I do that first of all?

Secondly is it possible for this software to convert the movements of the gamepad controller and translate them into code? Any code is fine, kind of like a macro in a sense, it records movements via the gamepad and at least records the movements in some capacity?

coppelia
Site Admin
Posts: 10364
Joined: 14 Dec 2012, 00:25

Re: Gamepad Controller to code?

Post by coppelia »

Hello,

yes, you can connect different types of controllers to CoppeliaSim. For instance you can connect a haptic device and interact with the scene content via the model models/other/interface to haptic device.ttm.

Via ROS, you can also quite immediately connect CoppeliaSim to a gamepad.

But in general the procedure to interact/connect to a external device is often the same. Two possibilities:
  • you write a plugin wrapping the device's library. With that plugin, you can then communicate with the device library from within CoppeliaSim
  • you write an external application that interacts with the device, and have that application exchange data with CoppeliaSim via ROS, the remote API, socket communication, etc.
You can also directly use the serial port from CoppeliaSim to interact with some hardware.

On windows, there is a simple plugin example that allows you to interact with a joystick.

Translating the movement data of a gamepad into code? Yes, this is of course possible, but you'll have to write the code that generates the code... better would be to simply record a set of signals every x ms, store the data in a table/file, etc. Later you could play it back easily.

Cheers

Post Reply