wilselby / ROS_quadrotor_simulator

Quadrotor simulator using ROS, Gazebo, and RVIZ
270 stars 125 forks source link

Joystick trouble #11

Closed aaravrav142 closed 6 years ago

aaravrav142 commented 6 years ago

Hi, I have successfully installed the package and everything seems to work fine. However, I am unable to get any response from the xbox 360 joystick to take off and land the quadroter. I have correctly configured the joystick and added the param /dev/input/js0 (for my case). When running the rosrun joy_node joy the joystick responds to the buttons, but not in the simulator. I am not sure how to fix this. I cant seem to find where the buttons are configured for the quadroter. Is it activated using a deadman switch? Please help. Thanks

wilselby commented 6 years ago

The joy.cpp file (https://github.com/wilselby/ROS_quadrotor_simulator/blob/master/quad_joystick_interface/src/joy.cpp) is where you can see which commands are tied to which controller buttons/joysticks.

Check the output of the command/roll_pitch_yawrate_thrust and command/trajectory topics and see if the commands are being published properly.

aaravrav142 commented 6 years ago

Hi, I reinstalled everything and still the problem persists. When running..

$ rostopic echo /quad/command/roll_pitch_yawrate_thrust 
WARNING: no messages received and simulated time is active.
Is /clock being published?

Also there is no camera image being published. There are no errors when launch the gazebo simulations

$ roslaunch quad_gazebo quad_joystick_empty_world.launch 
... logging to /home/alex-d/.ros/log/6d6e18c8-97a9-11e7-8942-b8ca3a7f11aa/roslaunch-alex-2468.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://alex:40706/

SUMMARY
========

PARAMETERS
 * /quad/attitude_controller_node/inertia/xx: 0.05
 * /quad/attitude_controller_node/inertia/xy: 0.0
 * /quad/attitude_controller_node/inertia/xz: 0.0
 * /quad/attitude_controller_node/inertia/yy: 0.05
 * /quad/attitude_controller_node/inertia/yz: 0.0
 * /quad/attitude_controller_node/inertia/zz: 0.24
 * /quad/attitude_controller_node/mass: 1.4
 * /quad/attitude_controller_node/p_PID/D: 1.5
 * /quad/attitude_controller_node/p_PID/I: 0.5
 * /quad/attitude_controller_node/p_PID/I_max: 2.0
 * /quad/attitude_controller_node/p_PID/P: 2.5
 * /quad/attitude_controller_node/pitch_PID/D: 1.5
 * /quad/attitude_controller_node/pitch_PID/I: 0.5
 * /quad/attitude_controller_node/pitch_PID/I_max: 2.0
 * /quad/attitude_controller_node/pitch_PID/P: 5
 * /quad/attitude_controller_node/q_PID/D: 1.5
 * /quad/attitude_controller_node/q_PID/I: 0.5
 * /quad/attitude_controller_node/q_PID/I_max: 2.0
 * /quad/attitude_controller_node/q_PID/P: 2.5
 * /quad/attitude_controller_node/r_PID/D: 0.5
 * /quad/attitude_controller_node/r_PID/I: 0.5
 * /quad/attitude_controller_node/r_PID/I_max: 2.0
 * /quad/attitude_controller_node/r_PID/P: 5
 * /quad/attitude_controller_node/roll_PID/D: 1.5
 * /quad/attitude_controller_node/roll_PID/I: 0.5
 * /quad/attitude_controller_node/roll_PID/I_max: 2.0
 * /quad/attitude_controller_node/roll_PID/P: 5
 * /quad/attitude_controller_node/rotor_configuration/0/angle: 0
 * /quad/attitude_controller_node/rotor_configuration/0/arm_length: 0.15
 * /quad/attitude_controller_node/rotor_configuration/0/direction: -1.0
 * /quad/attitude_controller_node/rotor_configuration/0/rotor_force_constant: 2.39e-05
 * /quad/attitude_controller_node/rotor_configuration/0/rotor_moment_constant: 0.016
 * /quad/attitude_controller_node/rotor_configuration/1/angle: 1.57079632679
 * /quad/attitude_controller_node/rotor_configuration/1/arm_length: 0.15
 * /quad/attitude_controller_node/rotor_configuration/1/direction: 1.0
 * /quad/attitude_controller_node/rotor_configuration/1/rotor_force_constant: 2.39e-05
 * /quad/attitude_controller_node/rotor_configuration/1/rotor_moment_constant: 0.016
 * /quad/attitude_controller_node/rotor_configuration/2/angle: 3.14159265359
 * /quad/attitude_controller_node/rotor_configuration/2/arm_length: 0.15
 * /quad/attitude_controller_node/rotor_configuration/2/direction: -1.0
 * /quad/attitude_controller_node/rotor_configuration/2/rotor_force_constant: 2.39e-05
 * /quad/attitude_controller_node/rotor_configuration/2/rotor_moment_constant: 0.016
 * /quad/attitude_controller_node/rotor_configuration/3/angle: -1.57079632679
 * /quad/attitude_controller_node/rotor_configuration/3/arm_length: 0.15
 * /quad/attitude_controller_node/rotor_configuration/3/direction: 1.0
 * /quad/attitude_controller_node/rotor_configuration/3/rotor_force_constant: 2.39e-05
 * /quad/attitude_controller_node/rotor_configuration/3/rotor_moment_constant: 0.016
 * /quad/attitude_controller_node/yaw_PID/D: 0.5
 * /quad/attitude_controller_node/yaw_PID/I: 0.5
 * /quad/attitude_controller_node/yaw_PID/I_max: 2.0
 * /quad/attitude_controller_node/yaw_PID/P: 5
 * /robot_description: <?xml version="1....
 * /rosdistro: indigo
 * /rosversion: 1.11.21
 * /tf_prefix: 
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    spawn_quad (gazebo_ros/spawn_model)
  /quad/
    attitude_controller_node (quad_control/attitude_controller_node)
    joy_node (joy/joy_node)
    quad_joystick_interface (quad_joystick_interface/quad_joystick_interface)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[gazebo-1]: started with pid [2545]
process[gazebo_gui-2]: started with pid [2551]
process[spawn_quad-3]: started with pid [2556]
process[quad/joy_node-4]: started with pid [2559]
process[quad/quad_joystick_interface-5]: started with pid [2561]
process[quad/attitude_controller_node-6]: started with pid [2588]
Gazebo multi-robot simulator, version 2.2.3
Copyright (C) 2012-2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Gazebo multi-robot simulator, version 2.2.3
Copyright (C) 2012-2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[ INFO] [1505214270.637398249]: Attitude_controller_node Paramters Initialized.
Msg Waiting for master.[ INFO] [1505214270.714492003]: Finished loading Gazebo ROS API Plugin.
Msg Waiting for master[ INFO] [1505214270.714825889]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...

Msg Connected to gazebo master @ http://127.0.0.1:11345
Msg Publicized address: 133.87.124.182
spawn_model script started
[INFO] [WallTime: 1505214271.174115] [0.000000] Loading model xml from ros parameter
[INFO] [WallTime: 1505214271.176672] [0.000000] Waiting for service /gazebo/spawn_urdf_model
[INFO] [WallTime: 1505214271.481212] [0.000000] Calling service /gazebo/spawn_urdf_model
[INFO] [WallTime: 1505214271.627512] [0.000000] Spawn status: SpawnModel: Successfully spawned model

Msg Connected to gazebo master @ http://127.0.0.1:11345
Msg Publicized address: 133.87.124.182
[spawn_quad-3] process has finished cleanly
log file: /home/alex-d/.ros/log/6d6e18c8-97a9-11e7-8942-b8ca3a7f11aa/spawn_quad-3*.log

I do not understand how to solve this problem. Thanks

wilselby commented 6 years ago

Hello, Can you verify that the simulation isn't paused? Also, check the topic quad/joy and see if anything is published.

Lastly, try the basic joy package tutorial to make sure your controller is properly configured and working.

aaravrav142 commented 6 years ago

Hi,

Thanks a lot. My bad. I should I have checked whether the simulation was running or not. It was on pause by default and I was struggling. Everything working fine now. One question. When using the joystick the movements of the quadcopter are very strong. How to smooth out the motions using the controller. Its very difficult to control using the controller. Also how did you made the waypoints txt when flying the vehicle. Did you register autonomously all the points. Please teach me. Thanks

wilselby commented 6 years ago

No worries! Glad you got it working.

You can modify the PID values in the .yaml files to change the response to the joystick values. Here's one for example for the attitude controllers.

You could also change the max joystick outputs in this file.

As for the waypoints .txt files, I made those manually. I opened up Gazebo on pause with the quadrotor in the desired world file. I then used the Gazebo GUI to move the quadrotor around and recorded the positions displayed by Gazebo. I then put those values into a .txt file. You may have to play around with the timing some once you get the initial .txt file working.