psr_21-22 icon indicating copy to clipboard operation
psr_21-22 copied to clipboard

PS3 joystick not working with Rviz

Open Sarxell opened this issue 3 years ago • 12 comments

Good afternoon @miguelriemoliveira , I was trying to win your record with the ps3 joystick but a problem occurred.

Starting, I did the following command: roslaunch turtlebot3_fake turtlebot3_fake.launch And in another terminal: roslaunch teleop_twist_joy teleop.launch

Where I receive the following warning: [ WARN] [1641932662.289011177]: Couldn't set gain on joystick force feedback: Bad file descriptor

I also went to see the rqt_graph that gave me the following image:

Screenshot from 2022-01-11 20-38-25

I think everything looks fine and the robot doesn't move, I used the keyboard launch file and everything works well.

After that I went to see if the joystick was detected I wrote in the terminal: ls /dev/input/

and I received:

by-id    event13  event2   event8
by-path  event14  event20  event9
event0   event15  event3   js0
event1   event16  event4   mice
event10  event17  event5   mouse0
event11  event18  event6   mouse1
event12  event19  event7

So that means that it does detect the joystick, in the js0. I decided to test it, I used: sudo jstest /dev/input/js0

And I got a positive response, the buttons and joystick all changed values when I used the joystick

I don't know what else to try, does the professor have some tips to solve this problem?

Thank you, Sara

Sarxell avatar Jan 11 '22 20:01 Sarxell

I forgot to add: When I see the : rostopic echo /joy

The values also change! I receive something like this:

header: 
  seq: 13951
  stamp: 
    secs: 1641934124
    nsecs: 932691384
  frame_id: "/dev/input/js0"
axes: [0.2784116566181183, 1.0, 0.0, -0.0, -0.0, 1.0]
buttons: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---
header: 
  seq: 13952
  stamp: 
    secs: 1641934124
    nsecs: 942653517
  frame_id: "/dev/input/js0"
axes: [0.3962130844593048, 1.0, 0.0, -0.0, -0.0, 1.0]
buttons: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Sarxell avatar Jan 11 '22 20:01 Sarxell

Hi @Sarxell ,

From what you say you are using the fake turtlebot node. That is for ex1 only. Then we move on to gazebo, ans that's the simulator we will use.

The manual race is ex9. Did you get this far?

About the joystick, you can use the ros joystick driver node to replace the teleop, which seems to be well configured in the image above. Also, because you do a ros topic echo and the message content changes as you move the joystick, the joystick configuration should be fine.

So my guess is focus on putting the system working on gazebo.

Let me know how it went.

miguelriemoliveira avatar Jan 12 '22 09:01 miguelriemoliveira

Hi @miguelriemoliveira ,

Okay , I changed the robot to the gazebo simulator. Right now my rqt_graph looks like this: Screenshot from 2022-01-12 10-05-05

When I do: rostopic echo /joy

The joystick continues working but my robot still doesn't move

Sarxell avatar Jan 12 '22 10:01 Sarxell

does the robot move when you use the teleop?

miguelriemoliveira avatar Jan 12 '22 10:01 miguelriemoliveira

Also, notice p_spombinho/cmd_vel is not being subscribed by any node.

miguelriemoliveira avatar Jan 12 '22 10:01 miguelriemoliveira

Yes, it moves when I use the teleop, I also was trying now with the android and it works, so I guess I will stick to that! About not being subscribed it's weird because it also happens with the keyboard and the android and it still works (?) I will try to change it

Sarxell avatar Jan 12 '22 10:01 Sarxell

I'm sorry I didn't show the rqt_graph completed Screenshot from 2022-01-12 10-49-06 !

He is subscribed by gazebo, the rqt_graph is just very ugly

Sarxell avatar Jan 12 '22 10:01 Sarxell

hum, your rqt graph is strange... gazebo receives the cmd_vel as it was supposed to occur, but no node is publishing it???

Click the debug and other checkboxes to see if they appear

miguelriemoliveira avatar Jan 12 '22 11:01 miguelriemoliveira

In that rqt_graph I wasn't moving the robot, it was just to show that the gazebo was subscribed to the cmd_vel, I forgot to say that, sorry

With the android connected , I get the following rqt_graph: Screenshot from 2022-01-12 11-55-25

Sarxell avatar Jan 12 '22 12:01 Sarxell

and with the joystick connected, what graph do you have?

miguelriemoliveira avatar Jan 12 '22 12:01 miguelriemoliveira

With the joystick I have this rqt_graph:

Screenshot from 2022-01-12 12-10-38

Sarxell avatar Jan 12 '22 12:01 Sarxell

Seems to be working fine. Not sure what is wrong ...

Can you bring your joystick to the practical class?

miguelriemoliveira avatar Jan 13 '22 13:01 miguelriemoliveira