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

Add a GenericRawToTwist Task #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

planthaber
Copy link
Member

Some robotes are better operated by twists, but I wonder if we should add a decent base/commands/Twist to base/types.

@@ -74,6 +74,42 @@ task_context "GenericRawToMotion2D" do
port_driven :raw_command
end

# This task converts controldev/RawCommand to base/Twist
# with configurable axes, ranges and deadzones
task_context "GenericRawToTwist" do
Copy link
Member

Choose a reason for hiding this comment

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

  • Use comments for documentation (just put the doc as a comment on top of the property/port)
  • Let's maybe try to reduce the number of properties ... Could rename max_* into scale_* and then one can set a negative scale to get an inversion (no code change apart from the removal of invert_)
  • use static inline functions instead of macros. No need to set the target within the function, just return the value and set it from the updateHook

Copy link
Member Author

Choose a reason for hiding this comment

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

The task was mainly copied from GenericRawToMotion2D (https://github.com/rock-drivers/drivers-orogen-controldev/blob/master/controldev.orogen#L55), including the documentation and property names, I kept the naming scheme for the properties instead of introducing new ones (for a similar task).

Using a static inline function would need to provide all used properties and parameters in the call, currently they are generated by the macro:
_##AXISNAME.get()
_##AXISNAME##_deadzone
invert##AXISNAME
max##AXISNAME

When adding more parameters to the function call, the code would imo become more confusing and more copy/paste error prone. But I don't have strong feelings about that.

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