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

Mo prim testing #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Mo prim testing #3

wants to merge 4 commits into from

Conversation

AlfredMoore
Copy link

@AlfredMoore AlfredMoore commented Feb 12, 2025

Add test_move_angle.py
Add test_reset.py
Solve "publish at least twice" problem in test_move_angle.py by adding latch=True option in published in test_move_angle.py

Explain:
I use rostopic echo /parser/command to monitor what is being published in our test file and find that if publish once, nothing is published. So the problem comes from command publisher in our test file. The latch option will make sure publishing successfully.

From ROS wiki:

  • latch [optional]
  • Enables "latching" on a connection. When a connection is latched, the last message published is saved and automatically sent to any future subscribers that connect. This is useful for slow-changing to static data like a map. Note that if there are multiple publishers on the same topic, instantiated in the same node, then only the last published message from that node will be sent, as opposed to the last published message from each publisher on that single topic.

Copy link
Collaborator

@schromya schromya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latch parameter works amazingly! Thanks for solving that! Just left a few small comments, mainly just to improve readability.

@@ -0,0 +1,44 @@
"""
This currently does NOT work.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this comment :)

# send at least 2.
N = 1
print("************** N =", N)
for i in range(N):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind removing the loop for readability?

for i in range(N):
# default RESET angle [0., -0.34, 0., -1.66, 0., 1.32, 0.8]

test_pose = [0., -0.3, 0., -1.66, 0., 1.32, 0.8]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason there is 2 of these?

@@ -0,0 +1,56 @@
"""
This currently does NOT work.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this comment :)



def test_reset():
pub = rospy.Publisher('/parser/command', Command, queue_size=1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently doesn't move the bot since it doesn't have the latch parameter.


# For some reason, a single message does not go through so need to
# send at least 2.
for i in range(1):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the loop for readability?

poses.poses = [p0 ] # Home position

action = Action(type=Action.RESET, # RESET
poses=poses,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command doesn't need any poses so I would just remove this and lines 20-35.

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.

2 participants