Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the rosgraph_manipulator script generic and configurable with a yaml file #4

Merged
merged 3 commits into from
Apr 15, 2021

Conversation

ipa-nhg
Copy link
Contributor

@ipa-nhg ipa-nhg commented Nov 6, 2020

related to #3

I am still not 100% happy, there is still one line that isn't generic 😢 https://github.com/tud-cor/mc_rosgraph_manipulator/blob/75f853a6967b4b5428a01da70c2a77bacd0dd1e6/src/mc_rosgraph_manipulator/rosgraph_manipulator.py#L21

@marioney could you please give a try to this version? at least it is a good step forward

@chcorbato
Copy link
Collaborator

@marioney can you test this and merge if it is ok for our current work with the MODELS paper?

@marioney
Copy link
Collaborator

marioney commented Apr 8, 2021

I've just tried this, but I'm getting this error

[INFO] [1617893233.302706, 51.079000]: Connected to move_base server and sending Nav Goal
[ERROR] [1617893233.304733, 51.080000]: Exception in your execute callback: 'AnyMsg' object has no attribute 'target_pose'
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/actionlib/simple_action_server.py", line 289, in executeLoop
    self.execute_callback(goal)
  File "/home/mario/ros/metacontrol_ws/src/mc_rosgraph_manipulator/src/mc_rosgraph_manipulator/rosgraph_manipulator.py", line 107, in reconfiguration_action_cb
    self._action_client.send_goal( self.last_saved_goal )
  File "/opt/ros/melodic/lib/python2.7/dist-packages/actionlib/simple_action_client.py", line 92, in send_goal
    self.gh = self.action_client.send_goal(goal, self._handle_transition, self._handle_feedback)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/actionlib/action_client.py", line 553, in send_goal
    return self.manager.init_goal(goal, transition_cb, feedback_cb)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/actionlib/action_client.py", line 466, in init_goal
    self.send_goal_fn(action_goal)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 882, in publish
    self.impl.publish(data)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 1066, in publish
    serialize_message(b, self.seq, message)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message
    msg.serialize(b)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/move_base_msgs/msg/_MoveBaseActionGoal.py", line 147, in serialize
    buff.write(_get_struct_3I().pack(_x.goal.target_pose.header.seq, _x.goal.target_pose.header.stamp.secs, _x.goal.target_pose.header.stamp.nsecs))
AttributeError: 'AnyMsg' object has no attribute 'target_pose'

@ipa-nhg did you get something similar?

@ipa-nhg
Copy link
Contributor Author

ipa-nhg commented Apr 8, 2021

try with:

rospy.Subscriber(self.save_action+'/goal', move_base_msgs.msg.MoveBaseActionGoal, self.callback)

instead of:

https://github.com/tud-cor/mc_rosgraph_manipulator/blob/75f853a6967b4b5428a01da70c2a77bacd0dd1e6/src/mc_rosgraph_manipulator/rosgraph_manipulator.py#L78

NOTE: I typed the line from memory, if fails please check that the message type exists...

@marioney
Copy link
Collaborator

marioney commented Apr 8, 2021

I've found a way to solve this, by using importlib and then import the module specified on the .yaml so it stays more general

@ipa-nhg can you give write access to https://github.com/ipa-nhg/mc_rosgraph_manipulator so I can get my changes there.

@ipa-nhg
Copy link
Contributor Author

ipa-nhg commented Apr 9, 2021

The option "Allow edits by maintainers" is marked for this PR, you should be able to push to my branch GenericRosGraphManipulator

If you are not maintainer then just open a new PR with your changes on top of mines and this PR will be automatically closed once you merge the one that supersedes this. I think it is the cleanest way.

Uses importlib instead
Imports the corresponding module from the .yaml file to make it more general
@marioney
Copy link
Collaborator

marioney commented Apr 15, 2021

The option "Allow edits by maintainers" is marked for this PR, you should be able to push to my branch GenericRosGraphManipulator

I just pushed the changes I mentioned before to GenericRosGraphManipulator This version is working for me.

@ipa-nhg can you check them, if you agree with them, we can do the merge.

@ipa-nhg
Copy link
Contributor Author

ipa-nhg commented Apr 15, 2021

LGTM 👍🏽

@marioney Thanks a lot! you can merge the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants