naoki-mizuno / ds4_driver

DualShock 4 driver for both ROS1 and ROS2
http://wiki.ros.org/ds4_driver
85 stars 53 forks source link

ModuleNotFoundError: No module named 'ds4_driver' #28

Closed robotphil closed 2 years ago

robotphil commented 2 years ago

Hello, I am having a bit of trouble running this node in ROS. I've had the issue on a couple of different computers now so I feel like I am missing something.

I issue the following command: roslaunch ds4_driver demo.launch

and I get the following output

*... logging to /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/roslaunch-phil-Inspiron-3505-35204.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://phil-Inspiron-3505:33449/

SUMMARY
========

PARAMETERS
 * /ds4_driver/autorepeat_rate: 0.0
 * /ds4_driver/deadzone: 0.1
 * /ds4_driver/device_addr: 
 * /ds4_driver/use_standard_msgs: False
 * /rosdistro: noetic
 * /rosversion: 1.15.14

NODES
  /
    demo (ds4_driver/demo.py)
    ds4_driver (ds4_driver/ds4_driver_node.py)
    ds4_to_imu (tf2_ros/static_transform_publisher)

auto-starting new master
process[master]: started with pid [35212]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 1d42605c-9696-11ec-8389-39ca2d45ed29
process[rosout-1]: started with pid [35222]
started core service [/rosout]
process[demo-2]: started with pid [35229]
process[ds4_driver-3]: started with pid [35230]
process[ds4_to_imu-4]: started with pid [35231]
Traceback (most recent call last):
  File "/home/phil/catkin_ws/devel/lib/ds4_driver/ds4_driver_node.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/phil/catkin_ws/src/ds4_driver/nodes/ds4_driver_node.py", line 3, in <module>
    from ds4_driver.logger import Logger
ModuleNotFoundError: No module named 'ds4_driver'
_[ds4_driver-3] process has died [pid 35230, exit code 1, cmd /home/phil/catkin_ws/devel/lib/ds4_driver/ds4_driver_node.py __name:=ds4_driver __log:=/home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/ds4_driver-3.log].
log file: /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/ds4_driver-3*.log
Traceback (most recent call last):_
  File "/home/phil/catkin_ws/devel/lib/ds4_driver/demo.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/phil/catkin_ws/src/ds4_driver/nodes/demo.py", line 4, in <module>
    from ds4_driver.msg import Feedback, Status
ModuleNotFoundError: No module named 'ds4_driver'
_[demo-2] process has died [pid 35229, exit code 1, cmd /home/phil/catkin_ws/devel/lib/ds4_driver/demo.py __name:=demo __log:=/home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/demo-2.log].
log file: /home/phil/.ros/log/1d42605c-9696-11ec-8389-39ca2d45ed29/demo-2*.log*_

I am using a fresh copy of Ubuntu 20.04.4, running ROS Noetic installed plus Gazebo. This is the only thing I've installed on this system so far.

When installing ds4_drv I followed the instructions on the noetic branch, downloading the ds4drv driver exactly how it says in the instructions, and ran into no problems in doing so.

I git cloned the noetic branch of ds4_driver directly to my src folder and used catkin_make to compile. There were no issues on compilation.

I am not quite sure what is going on, I suspected it was a problem with my python setup but I am not quite experienced enough in python to understand what is going on. I thought starting completely fresh would help but the problem persists.

naoki-mizuno commented 2 years ago

Could you share the output of the following commands?

echo $ROS_PACKAGE_PATH
rosmsg show ds4_driver/Status
robotphil commented 2 years ago

So embarrassingly, after putting this project down for a couple of days it seems like the problem has fixed itself, perhaps I needed to restart the system for Python to fully get set up - the fresh install seems to have done the trick. In any case, here is the output:

$ echo $ROS_PACKAGE_PATH /home/phil/catkin_ws/src:/opt/ros/noetic/share

$ rosmsg show ds4_driver/Status std_msgs/Header header uint32 seq time stamp string frame_id float32 axis_left_x float32 axis_left_y float32 axis_right_x float32 axis_right_y float32 axis_l2 float32 axis_r2 int32 button_dpad_up int32 button_dpad_down int32 button_dpad_left int32 button_dpad_right int32 button_cross int32 button_circle int32 button_square int32 button_triangle int32 button_l1 int32 button_l2 int32 button_l3 int32 button_r1 int32 button_r2 int32 button_r3 int32 button_share int32 button_options int32 button_trackpad int32 button_ps sensor_msgs/Imu imu std_msgs/Header header uint32 seq time stamp string frame_id geometry_msgs/Quaternion orientation float64 x float64 y float64 z float64 w float64[9] orientation_covariance geometry_msgs/Vector3 angular_velocity float64 x float64 y float64 z float64[9] angular_velocity_covariance geometry_msgs/Vector3 linear_acceleration float64 x float64 y float64 z float64[9] linear_acceleration_covariance float32 battery_percentage int32 battery_full_charging ds4_driver/Trackpad touch0 uint16 id int32 active float32 x float32 y ds4_driver/Trackpad touch1 uint16 id int32 active float32 x float32 y int32 plug_usb int32 plug_audio int32 plug_mic

naoki-mizuno commented 2 years ago

Awesome! Thanks for the follow up!