gazebo ros Segmentation error with publishing arrays
Hello my name is Bukmop and this is my first post here.
I am trying to work with a robot in gazebo and ROS and changing a existing gazeboros plugin (gazeborosdiffdrive). Now I am facing some problems which don`t really understand.
Preamble:
I am using the code frame from moorerobots and the gazebo_ros plugins (links bellow). My actual code is in GitHub for everyone to access. Furthermore I made a video of the problem I want to solve.
mybot frame: http://moorerobots.com/blog/post/1
original gazeboros packages: https://github.com/ros-simulation/gazeboros_pkgs
The GitHub code: https://github.com/Bukmop123/mybot/tree/mybot-Segmentation-error
Youtube video: https://youtu.be/3iKQuljNhA8
Ubuntu 16.04
gazebo version 7.8.1
ros kinetic
Goal of this work
Basically I have a robot with two Joints and I want set force on these joints and read the actual force and velocity on these Joints. The raw coding is done and it seems to work the way I want it to.
Problem description
When I am starting the code there is different behavior of the launch process as you can see in the video. Here are the relevant parts:
- 0.20 min : ok
- 0.56 min : Aborted
- 1.14 min : Segmentation
- 2.03 min : ok
- 2.19 min : Segmentation
- 2.49 min : ok
- 3.08 min : Segmentation
- 3.08 min : Segmentation
- 3.24 min : Segmentation
- 4.01 min : Segmentation and no Gui
- 4.18 min : Segmentation
- 4.39 min : ok
- 5.08 min : Segmentation
- 5.25 min : ok
- 6.02 min : ok
- 6.34 min : ok
- 6.55 min : Segmentation
- 7.07 min : Aborted
- 7.28 min : ok
error notes
17. 6.55 min : Segmentation:
Segmentation fault (core dumped)
[gazebo-2] process has died [pid 26423, exit code 139, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -e ode /home/robot/mybot_ws/src/mybot_gazebo/worlds/mybot.world __name:=gazebo __log:=/home/robot/.ros/log/3c2d321c-6888-11e7-9455-c038966d7861/gazebo-2.log].
log file: /home/robot/.ros/log/3c2d321c-6888-11e7-9455-c038966d7861/gazebo-2*.log
18. 7.07 min : Aborted:
Aborted (core dumped)
[gazebo-2] process has died [pid 26910, exit code 134, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -e ode /home/robot/mybot_ws/src/mybot_gazebo/worlds/mybot.world __name:=gazebo __log:=/home/robot/.ros/log/46fbdc8e-6888-11e7-9455-c038966d7861/gazebo-2.log].
log file: /home/robot/.ros/log/46fbdc8e-6888-11e7-9455-c038966d7861/gazebo-2*.log
[gazebo_gui-3] process has died [pid 26921, exit code 255, cmd /opt/ros/kinetic/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/home/robot/.ros/log/46fbdc8e-6888-11e7-9455-c038966d7861/gazebo_gui-3.log].
log file: /home/robot/.ros/log/46fbdc8e-6888-11e7-9455-c038966d7861/gazebo_gui-3*.log
Observations
The Segmentation errors seems to be less when I use the modified differentialdrivecontroller but they still appear (2 of 10 maybe ). There seems to be no errors when I use the original differentialdrivecontroller so the mistake should be somewhere in the code.
Note: You can switch the controller of the joints in mybot.xacro line 9 to 10.
mybot/mybotws/src/mybotdescription/urdf/mybot.xacro
<xacro:include filename="$(find mybot_description)/urdf/ros_joint_interface_mybot.gazebo" />
<!--xacro:include filename="$(find mybot_description)/urdf/ros_diff_drive_mybot.gazebo" /-->
<!--xacro:include filename="$(find mybot_description)/urdf/ros_diff_drive_mybot2.gazebo" /-->
My thoughts
I don`t really understand this behavior but the launching process gets more buggy when I inserted the "jointforcepublisher_" to the code. Perhaps something the double arrays make some problems during the publishing but the subscribing seems not to bee that buggy.
mybot/gazeborospkgsws/src/gazeboplugins/src/gazeborosjointinterfacemybot.cpp line: 163
joint_force_publisher_ = gazebo_ros_->node()->advertise<gazebo_plugins::msgVectorDouble>("oDiff_jointForce",1000);
Question
So my questions would be where is the mistake in my code and why is the gazebo launching process so "dynamic"?
Edit 17.07.2017 I am using in the program a self made message type with double arrays for publishing and subscribing. When I comment out all the publishing code then I get the "normal" behavior with just 1 or 2 segmentation errors of 10. The same as with the original differential drive program.
When I comment in just the initialization of the publisher then there is the "bad" behavior with a lot segmentation errors (~6 of 10).
mybot/gazeborospkgsws/src/gazeboplugins/src/gazeborosjointinterfacemybot.cpp line: 163 and 171
joint_force_publisher_ = gazebo_ros_->node()->advertise<gazebo_plugins::msgVectorDouble>("oDiff_jointForce", 1000);
wheel_velocity_publisher_ = gazebo_ros_->node()->advertise<gazebo_plugins::msgVectorDouble>("oDiff_wheelVelocity", 1000);
This is the declaration of msgVectorDouble.msg
Header header
string[] name
float64[] vecDouble
Question (upgraded)
So my questions would be where is the mistake in my code and why is the gazebo launching process so "dynamic". Also: why does just the initialization of the publisher causes the change of the behavior with more segmentation errors?
Greetings Bukmop
Asked by Bukmop on 2017-07-14 09:03:14 UTC
Comments