Skip to content

Pratham Sood Firmware Training Oct 2021#399

Open
prathams417 wants to merge 2 commits into
uwrobotics:masterfrom
prathams417:master
Open

Pratham Sood Firmware Training Oct 2021#399
prathams417 wants to merge 2 commits into
uwrobotics:masterfrom
prathams417:master

Conversation

@prathams417

Copy link
Copy Markdown

No description provided.

@cindyli-13 cindyli-13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your training mostly looks good! Just some minor fixes needed


add_library (TutorialServo STATIC)
target_sources (TutorialServo PRIVATE src/TutorialServo.cpp)
target_link_libraries (tutorial-servo-can-control PRIVATE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You shouldn't need this line since it's repeated in line 12

}

void TutorialServo::setPositionInDegrees( const float degrees){
if (degrees >= m_servoRangeInDegrees && degrees >= 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (degrees >= m_servoRangeInDegrees && degrees >= 0)
if (degrees <= m_servoRangeInDegrees && degrees >= 0)

Comment thread test-apps/tutorial-servo-can-control/src/TutorialServo.cpp
@cindyli-13

Copy link
Copy Markdown
Member

Make sure to also follow the "Clang-Format" section of the readme and format your files

@cindyli-13 cindyli-13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's just one small issue, but everything else looks good. Were you able apply clang format?

void TutorialServo::setPositionInDegrees( const float degrees){
if (degrees <= m_servoRangeInDegrees && degrees >= 0)
{
m_servoPwmOut.pulsewidth((degrees/m_servoRangeInDegrees)*(m_maxPulsewidthInMs-m_minPulsewidthInMs));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what if m_minPulsewidthInMs is nonzero? you'll need the constant offset so that 0 degrees maps to m_minPulsewidthInMs

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