ZebraDevs / fetch_gazebo

Gazebo simulator for Fetch
101 stars 89 forks source link

[fetch_gazebo] Add option to launch teleop node #105

Open 708yamaguchi opened 3 years ago

708yamaguchi commented 3 years ago

In this pull request, I add launch_teleop arg to fetch.launch.xml like fetch.launch in fetch_bringup. https://github.com/fetchrobotics/fetch_robots/blob/melodic-devel/fetch_bringup/launch/fetch.launch

This pull request allows us to operate the fetch in gazebo with joystick.

Example usage (with the joystick USB-connected):

roslaunch fetch_gazebo playground.launch joy_device:="/dev/input/js0"
NuBot-Cc commented 3 years ago

In this pull request, I add launch_teleop arg to fetch.launch.xml like fetch.launch in fetch_bringup. https://github.com/fetchrobotics/fetch_robots/blob/melodic-devel/fetch_bringup/launch/fetch.launch

This pull request allows us to operate the fetch in gazebo with joystick.

Example usage (with the joystick USB-connected):

roslaunch fetch_gazebo playground.launch joy_device:="/dev/input/js0"

hi~,I am trying to control the fetch with joystick in gazebo simulation. but it could not work though I follow your method to modify the ### fetch.launch.xml. Could you use the joystick to control Fetch in gazebo demo? Maybe I did not notice some step. Hope you reply. Thank you!

708yamaguchi commented 3 years ago

@treeofsun-god Thank you for using my pull request and sorry for the lack of explanation.

My environment is ROS melodic. To create the workspace, I did the following steps.

mkdir ~/fetch_gazebo_teleop_ws/src/ -p
cd ~/fetch_gazebo_teleop_ws/src/
# Here, copy the following .rosinstall
wstool update
rosdep install --from-paths . --ignore-src -y -r
cd ..
source /opt/ros/melodic/setup.bash
catkin build

.rosinstall which I used in the above:

- git:
    local-name: 708yamaguchi/fetch_gazebo
    uri: https://github.com/708yamaguchi/fetch_gazebo.git
    version: add-teleop

Then, I executed playground.launch like below:

source /opt/ros/melodic/setup.bash
source ~/fetch_gazebo_teleop_ws/devel/setup.bash
roslaunch fetch_gazebo playground.launch joy_device:="/dev/input/js0"

When using this launch file, please make sure that

If joy teleop is succeeded, you can see the /joy topic like below:

# Move forward
$ rostopic echo /joy
header:
  seq: 467
  stamp:
    secs: 37
    nsecs: 152000000
  frame_id: ''
axes: [-0.0, -0.0, 0.0, 1.0, -0.0, 0.0]
buttons: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
---

Thanks,