-
Notifications
You must be signed in to change notification settings - Fork 27
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
modify manipulation states to add timeout and other parameters #11
Open
dcconner
wants to merge
3
commits into
FlexBE:master
Choose a base branch
from
CNURobotics:modified_manipulation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,30 +15,40 @@ | |||||
class GetJointValuesState(EventState): | ||||||
''' | ||||||
Retrieves current values of specified joints. | ||||||
Joints are specified by parameter list. | ||||||
|
||||||
-- joints string[] List of desired joint names. | ||||||
-- joints string[] List of desired joint names. | ||||||
-- timeout double Timeout value (optional) | ||||||
-- joint_states_topic string Optional name of joint states topic | ||||||
(default: /joint_states) | ||||||
|
||||||
#> joint_values float[] List of current joint values. | ||||||
|
||||||
<= retrieved Joint values are available. | ||||||
<= timeout Joint values are not available. | ||||||
|
||||||
''' | ||||||
|
||||||
def __init__(self, joints): | ||||||
def __init__(self, joints, timeout=None, joint_states_topic='/joint_states'): | ||||||
''' | ||||||
Constructor | ||||||
''' | ||||||
super(GetJointValuesState, self).__init__(outcomes=['retrieved'], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed; pushed change |
||||||
output_keys=['joint_values']) | ||||||
self._topic = '/joint_states' | ||||||
|
||||||
self._topic = joint_states_topic | ||||||
self._sub = ProxySubscriberCached({self._topic: JointState}) | ||||||
|
||||||
self._joints = joints | ||||||
self._joint_values = list() | ||||||
|
||||||
|
||||||
self._timeout = timeout | ||||||
|
||||||
|
||||||
def execute(self, userdata): | ||||||
if (self._return_code is not None): | ||||||
# Handle blocked transition or error during on_enter | ||||||
return self._return_code | ||||||
|
||||||
while self._sub.has_buffered(self._topic): | ||||||
msg = self._sub.get_from_buffer(self._topic) | ||||||
for i in range(len(msg.name)): | ||||||
|
@@ -48,12 +58,20 @@ def execute(self, userdata): | |||||
|
||||||
if all(v is not None for v in self._joint_values): | ||||||
userdata.joint_values = self._joint_values | ||||||
self._return_code = 'retrieved' | ||||||
return 'retrieved' | ||||||
|
||||||
|
||||||
if (self._timeout is not None and \ | ||||||
(Time.now()-self._start_time) > rospy.Duration(self._timeout) ): | ||||||
self._return_code = 'timeout' | ||||||
return 'timeout' | ||||||
|
||||||
def on_enter(self, userdata): | ||||||
self._sub.enable_buffer(self._topic) | ||||||
self._joint_values = [None] * len(self._joints) | ||||||
self._return_code = None | ||||||
self._start_time = rospy.Time.now() | ||||||
userdata.joint_values = None | ||||||
|
||||||
def on_exit(self, userdata): | ||||||
self._sub.disable_buffer(self._topic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/get_joint_values_dyn_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.get_joint_values_dyn_state | ||
class: GetJointValuesDynState | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/get_joint_values_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.get_joint_values_state | ||
class: GetJointValuesState | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/get_joints_from_srdf_group_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.get_joints_from_srdf_group | ||
class: GetJointsFromSrdfGroup | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/get_joints_from_srdf_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.get_joints_from_srdf_state | ||
class: GetJointsFromSrdfState | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/joint_state_to_moveit_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.joint_state_to_moveit | ||
class: JointStateToMoveit | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/moveit_to_joints_dyn_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.moveit_to_joints_dyn_state | ||
class: MoveitToJointsDynState | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/moveit_to_joints_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.moveit_to_joints_state | ||
class: MoveitToJointsState | ||
|
||
import_only: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<launch> | ||
<arg name="path" value="$(find flexbe_manipulation_states)/tests" /> | ||
|
||
<!-- Run with simulation. --> | ||
|
||
<include file="$(find flexbe_testing)/launch/flexbe_testing.launch"> | ||
<arg name="compact_format" value="true" /> | ||
<arg name="testcases" value=" | ||
|
||
$(arg path)/get_joint_values_dyn_state_import.test | ||
$(arg path)/get_joints_from_srdf_group_state_import.test | ||
$(arg path)/get_joints_from_srdf_state_import.test | ||
$(arg path)/get_joint_values_state_import.test | ||
$(arg path)/joint_state_to_moveit_state_import.test | ||
$(arg path)/moveit_to_joints_dyn_state_import.test | ||
$(arg path)/moveit_to_joints_state_import.test | ||
$(arg path)/srdf_state_to_moveit_execute_trajectory_state_import.test | ||
$(arg path)/srdf_state_to_moveit_state_import.test | ||
|
||
" /> | ||
</include> | ||
</launch> |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/srdf_state_to_moveit_execute_trajectory_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.srdf_state_to_moveit_execute_trajectory | ||
class: SrdfStateToMoveitExecute | ||
|
||
import_only: True |
5 changes: 5 additions & 0 deletions
5
flexbe_manipulation_states/tests/srdf_state_to_moveit_state_import.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_manipulation_states.srdf_state_to_moveit | ||
class: SrdfStateToMoveit | ||
|
||
import_only: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_utility_states.publish_pose_state | ||
class: PublishPoseState | ||
|
||
import_only: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Declare state to be tested | ||
path: flexbe_utility_states.publish_twist_state | ||
class: PublishTwistState | ||
|
||
import_only: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed; pushed change