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

Ros2 migration behavior/arm #695

Merged
merged 18 commits into from
Mar 21, 2023
Merged

Ros2 migration behavior/arm #695

merged 18 commits into from
Mar 21, 2023

Conversation

ana-GT
Copy link
Contributor

@ana-GT ana-GT commented Mar 7, 2023

Conversion was straightforward, with the exception of a few issues that I marked TODO:

  1. arm/tools/arm_tool.cc, line 168: The arm_tool is initialized using the AnonymousName option, which is not yet available in ROS2, although there seems to be active work on it (as of this week).
  2. arm/src/arm_nodelet.cc, lines 491-493: Some functions were not ported, as they no longer seem applicable in ROS2, such as GetPrivateHandle(), Listen function for reconfiguring parameters and its corresponding reconfigure_callback function.
  3. arm/src/arm_nodelet.cc: Line 546: A subscriber for TOPIC_JOINT_GOALS is created, originally with latch=true, however this topic is not in the LatchedTopic list, so if we use the FF_CREATE_SUBSCRIBER, the topic will not be latched.

@trey0
Copy link
Contributor

trey0 commented Mar 7, 2023

  1. arm/tools/arm_tool.cc, line 168: The arm_tool is initialized using the AnonymousName option, which is not yet available in ROS2, although there seems to be active work on it (as of this week).

As far as I understand, the AnonymousName option appends a random number to the end of the node name at initialization time, which we could do manually at [1]. I see you also changed the node name from "control" to "arm_tool", which seems like an improvement.

[1]

auto nh = std::make_shared<rclcpp::Node>("arm_tool");

@trey0
Copy link
Contributor

trey0 commented Mar 7, 2023

  1. arm/src/arm_nodelet.cc: Line 546: A subscriber for TOPIC_JOINT_GOALS is created, originally with latch=true, however this topic is not in the LatchedTopic list, so if we use the FF_CREATE_SUBSCRIBER, the topic will not be latched.

@marinagmoreira and @kbrowne15 recently merged a3ae212 on develop, which makes this publisher non-latching.

I'm not sure why it was originally marked latching. The latching option would have the effect of automatically resending the joint goals if somehow the arm nodelet joined late after the goals were originally published, but I don't think that's really desired (could lead to an unintended "zombie command").

@marinagmoreira marinagmoreira self-requested a review March 9, 2023 16:22
@marinagmoreira
Copy link
Member

So I tested the arm behavior in simulation and it works. But let's hold on merging this until we make a decision on the services since it affects it.
I commented out the services test because as a gtest, it's really hard to test it since the server and client are started from the same main, and that opens a can of worms for the sync service problem. That's why the service test passed in the past, even if we couldn't use it for components.
I'll keep on tinkering with the service test to see if I can make it work with a multithreaded executor since we might want to have the server and client under the same container and if this doesn't work, that's just problems down the line.. just don't want to sink even more time into it :(..

TOPIC_JOINT_GOALS, 1);
sub_joint_states_ = FF_CREATE_SUBSCRIBER(nh, sensor_msgs::JointState, TOPIC_JOINT_STATES, 1,
std::bind(&ArmComponent::JointStateCallback, this, std::placeholders::_1));
// TODO(ana): This had a latch=true argument, but TOPIC_JOINT_GOALS is NOT in the LatchedTopic list
Copy link
Member

Choose a reason for hiding this comment

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

According to the analysis in #628, this does not need to be latched

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! See my comment above. This topic is no longer latching in develop, although maybe it was latching on whatever baseline version @ana-GT started from. Probably the correct action is to remove the comment.

@marinagmoreira marinagmoreira requested a review from bcoltin March 21, 2023 00:22
Copy link
Member

@bcoltin bcoltin left a comment

Choose a reason for hiding this comment

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

Thanks Ana and Marina!

DISTAL_SERVO, // Distal joint servo
GRIPPER_SERVO, // Gripper joint servo
ALL_SERVOS // Proximal, Distal and Gripper servos
};

// Joint information, where HUMAN = SCALE * DRIVER + OFFSET
struct JointInfo {
Copy link
Member

Choose a reason for hiding this comment

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

Now that we aren't using tol (I'm pretty sure) except to set it but never look at it, I would just delete it from JointInfo to make things more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds like a change to apply/test on develop first?

Copy link
Member

Choose a reason for hiding this comment

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

I thought it only applies here due to changes in how the parameter server works, but correct me if I'm wrong Marina.

Copy link
Member

@marinagmoreira marinagmoreira Mar 21, 2023

Choose a reason for hiding this comment

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

In order to maintain functionality with the previous version the tol with GetTolerance() still only gets updated in certain state modes, which maintains the need for the tol variable :)

@marinagmoreira marinagmoreira merged commit 021795c into nasa:ros2 Mar 21, 2023
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.

4 participants