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

[Spinal][PwmTest] workaround to send pwm value to each servo independependently #613

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

sugihara-16
Copy link
Contributor

What is this

Change some structure of the PWM test to support motor-by-motor check

Usage

  • Send PWM value (0.55) to all motors simultaneously
    • rostopic pub -1 /pwm_test spinal/PwmTest "motor_index: [] pwms: [0.55]"
  • Send PWM value (motor 0 → 0.55, motor 2 → 0.65) independently
    • rostopic pub -1 /pwm_test spinal/PwmTest "motor_index: [0,2] pwms: [0.55, 0.65]"
  • Escape from PWM test mode
    • rostopic pub -1 /pwm_test spinal/PwmTest "motor_index: [] pwms: []"

@sugihara-16
Copy link
Contributor Author

sugihara-16 commented Jun 19, 2024

@tongtybj This PR doesn't depend on any other features, so could you please check and merge this?

@tongtybj
Copy link
Collaborator

LGTM.

But I do think it would be better to refactor Pwms.msg rather than defining a new message. On the other hand, I also understand this will effect the whole system if we change the structure of Pwms.msg.
Therefore, current solution is still temporary, right?

@sugihara-16
Copy link
Contributor Author

In my understanding, Pwms.msg is for state message rather than for command, and I guess this is the reason why the current system doesn't use Pwms.msg for PWM test, right?
If so, I think the best solution is to provide status messages and command messages independently as well as the case of servo control. How do you think about it?

@tongtybj
Copy link
Collaborator

provide status messages and command messages independently

I was told that creating original message type is a stupid way, and using the standard message type such as std_msgs, geometry_msgs is the clever way. Considering the limited bandwidth of communication between PC and MCU, we have to define some original light-weight message types. But the number of original message type should be kept to the minimum. Therefore, if two different topics have very similoar contents, it is better to use a common message type.

I guess this is the reason why the current system doesn't use Pwms.msg for PWM test, right?

It is just becuase I didn't realize the need of sending different PWM values to different motor...

@sugihara-16
Copy link
Contributor Author

OK, so the best way you think is using Pwms.msg for both status and command topics, right?

@tongtybj
Copy link
Collaborator

That only applies to half.

The best solution I suggest is to use PwmTest.msg (of couse, rename it to Pwm.msg or something like that ) for both status and command topics.

@sugihara-16
Copy link
Contributor Author

All right, I'll modify some parts as you have suggested.

@tongtybj
Copy link
Collaborator

I'm sorry I didn't explain it enough...
I just want to share a consensus with you about the design message type.
Just I said, refactor of Pwms.msg would induce a large change to our system.
We can consider it as a future work when we decide to refactor the whole system.

I will merge this PR with current version.

@sugihara-16
Copy link
Contributor Author

All right, everything is clear.
Thank you for your suggestions!

@tongtybj tongtybj merged commit d0be362 into jsk-ros-pkg:master Jun 19, 2024
6 checks passed
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