ROS2 Foxy: Package 'joy' not found`

I am trying to control my home lab robot using a BT Gamepad. I found a library here:

That supports my PS controller.

The problem is no matter what I try I cannot see to install the “joy” pkg?

ubuntu@ubuntu:~/ros2_ws$ sudo apt install -y ros-foxy-joy*

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ros-foxy-joy' for glob 'ros-foxy-joy*'
Note, selecting 'ros-foxy-joy-dbgsym' for glob 'ros-foxy-joy*'
Note, selecting 'ros-foxy-joy-linux-dbgsym' for glob 'ros-foxy-joy*'
Note, selecting 'ros-foxy-joy-teleop' for glob 'ros-foxy-joy*'
Note, selecting 'ros-foxy-joy-linux' for glob 'ros-foxy-joy*'
ros-foxy-joy is already the newest version (3.0.0-2focal.20211112.214147).
ros-foxy-joy-dbgsym is already the newest version (3.0.0-2focal.20211112.214147).
ros-foxy-joy-linux is already the newest version (3.0.0-2focal.20211112.213818).
ros-foxy-joy-linux-dbgsym is already the newest version (3.0.0-2focal.20211112.213818).
ros-foxy-joy-teleop is already the newest version (1.2.1-1focal.20211112.201933).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

rosdep update


reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml


Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/ubuntu/.ros/rosdep/sources.cache

rosdep install -a
#All required rosdeps installed successfully

source ~/ros2_foxy/ros2-linux/setup.bash

ros2 run joy joy_node
Package 'joy' not found

The problem was:

source /opt/ros/foxy/setup.bash
# I did not source this one

source ~/ros2_foxy/ros2-linux/setup.bash
source ~/ros2_ws/install/setup.bash

Guess I am confused which ones need sourcing when and will have to learn more about this!

Hi @Teknetik , welcome to the community!

I am glad you found the solution to your problem. The reason why you have to source /opt/ros/foxy/setup.bash is because that is where the ROS installation is in your system, and the joy package was installed as a binary (sudo apt install -y ros-foxy-joy*). All packages installed this way end up in that directory.

The other workspaces are created manually, so you would source those when you want to work with packages that you make in them.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.