tu-darmstadt-ros-pkg / hector_quadrotor

hector_quadrotor contains packages related to modeling, control and simulation of quadrotor UAV systems.
Other
386 stars 277 forks source link

Contact sensor on Hector Quadrotor #109

Open Jean-0101 opened 4 years ago

Jean-0101 commented 4 years ago

Hello,

I am trying to add a bump contact sensor to indicate if there is a contact to another object at a time. In other words, I am trying to detect collision. Is there anything implemented on the hector quadrotor or do I have to add a contact sensor? If so, how can I add a contact sensor to the hector quadrotor model? I looked at a lot of tutorials and answers from different sources but could not find anything to fit hector quadrotor demo. I would be happy if someone helps.

Best

Martin-Oehler commented 4 years ago

You can add a bumber plugin to the robot urdf, see here.

Jean-0101 commented 4 years ago

Hello Martin. Thank you. I will add this bumper plugin to the robot urdf.

Normally, to add a sensor to a robot model, all we need to do is to add this plugin to the robot's main urdf file? In this case, on Hector Quadrotor Demo, there are plenty of urdf files. Which one is the main urdf file that I need to change?

quadrotor_sensors.gazebo.xacro on https://github.com/tu-darmstadt-ros-pkg/hector_quadrotor/blob/kinetic-devel/hector_quadrotor_gazebo/urdf/quadrotor_sensors.gazebo.xacro

or some other file?

And there is also the case that as far as I understand, we need to add the new plugin to the xacro file and then it is converted to urdf. Do we need any additional files to add like a cpp file for the sensor?

Jean-0101 commented 4 years ago

I changed the quadrotor_sensors.gazebo.xacro file and added the contact_bumper sensor as follows, saved the file, ran the simulation but could not see a new sensor added when I enter rostopic list


<?xml version="1.0"?>

100.0 base_link $(arg base_link_frame) raw_imu 0 0 0 0 0.5 0.5 0.5 0.35 0.35 0.3 0.1 0.1 0.1 0.05 0.05 0.015 10.0 base_link $(arg base_link_frame) pressure_height altimeter 0 10.0 0.1 10.0 base_link $(arg base_link_frame) true contact_bumper 0 0 0 0.0 0.0 0.0 1.3e-2 1.3e-2 1.3e-2 10.0 base_link $(arg base_link_frame) magnetic 0 0 0 0.0 0.0 0.0 1.3e-2 1.3e-2 1.3e-2 4.0 base_link $(arg base_link_frame) fix fix_velocity 49.860246 8.687077 5.0 5.0 5.0 0.01 0.01 0.01 0 0 0 0.05 0.05 0.05 100.0 base_link ground_truth/state 0.0 $(arg world_frame) true 30.0 collision gripper_contact_sensor_state gripper
Jean-0101 commented 4 years ago

After changing the quadrotor_base.urdf.xacro file, I converted it into quadrotor_base.urdf then tried to change into quadrotor_base.sdf file but it says permission denied. Is the quadrotor_base.sdf file protected? How can we add sensors to the quadrotor model?

I would be glad if I can add a contact sensor to detect collision. It will be very helpful for my maser thesis in machine learning.

Best regards

Martin-Oehler commented 4 years ago

You do not have to convert the xacro to urdf or sdf, the xacro is converted during execution. You can add the sensor to any xacro, that is loaded. The one you chose should be fine. I can not give you any advice on the bumper plugin, because I have never used it.

If the question is not directly related to hector_quadrotor, you can ask it at ROS Answers.

Jean-0101 commented 4 years ago

So adding the necessary sensor to the quadrotor_base.urdf.xacro file should do the work, I won't need to do anything else. Then I will be able to see the sensor on rostopic list right?

I asked the question here because I was not sure which xacro file to add the sensor as it is related with the general structure of the project, you say quadrotor_base.urdf.xacro file would be fine. Let me try and tell the result.

Thank you again

Jean-0101 commented 4 years ago

Here is the quadrotor_base.urdf.xacro file. I added the sensor plugin at two places just to be sure

<?xml version="1.0"?>

true ${update_rate} ${name}_bumper world true ${update_rate} ${name}_bumper world

After that I saved the project and run with roslaunch hector_quadrotor_demo indoor_slam_gazebo.launch command. There was no difference with the sensor list. I closed the project and typed

catkin_make source devel/setup.bash

Then I re run the project. The final list of the sensors are as follows

user:~$ rostopic list /aerodynamics/wrench /altimeter /clock /cmd_vel /command/motor /command/twist /command/wrench /fix /fix_velocity /front_cam/camera/camera_info /front_cam/camera/image /front_cam/camera/image/compressed /front_cam/camera/image/compressed/parameter_descriptions /front_cam/camera/image/compressed/parameter_updates /front_cam/camera/image/compressedDepth /front_cam/camera/image/compressedDepth/parameter_descriptions /front_cam/camera/image/compressedDepth/parameter_updates /front_cam/camera/image/theora /front_cam/camera/image/theora/parameter_descriptions /front_cam/camera/image/theora/parameter_updates /front_cam/parameter_descriptions /front_cam/parameter_updates /gazebo/link_states /gazebo/model_states /gazebo/parameter_descriptions /gazebo/parameter_updates /gazebo/set_link_state /gazebo/set_model_state /ground_truth/state /ground_truth_to_tf/euler /ground_truth_to_tf/pose /joint_states /magnetic /motor_pwm /motor_status /pressure_height /propulsion/wrench /quadro/trigger /raw_imu /rosout /rosout_agg /scan /sonar_height /supply /tf /tf_static /wind

Again the contact sensor was not there. Can it be because I am working on the constructsim environment or something else?

Martin-Oehler commented 4 years ago

Your issue is probably related to your usage of the bumper plugin. You might want to look into, if you are using it correctly. However, I can not help you any further in this regard.

Jean-0101 commented 4 years ago

Alright Martin. Vielen dank! :)