Skip to content

Conversation

@GoGoCom
Copy link

@GoGoCom GoGoCom commented Dec 14, 2025

Hi! Machorone!
How are you!
Recently I added two functions such as a round turn left and right named runRight, runLeft.
It will be good to speed up to run.
Thanks!

I added two functions such as a round turn left and right named runRight, runLeft.
Copy link
Contributor

@kouosi kouosi left a comment

Choose a reason for hiding this comment

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

you can achieve runRight and runLeft with turnRight and turnLeft i don't see what this pr does more.

bool success = moveForward(numHalfSteps);
return success ? "" : CRASH;
} else if (function == "turnRight" || function == "turnRight90") {
} else if (function == "runRight" ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (function == "runRight" ) {
} else if (function == "runRight") {

} else if (function == "runRight" ) {
turn(Movement::RUN_RIGHT);
return "";
} else if (function == "runLeft" ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (function == "runLeft" ) {
} else if (function == "runLeft") {

} else if (function == "runLeft" ) {
turn(Movement::RUN_LEFT);
return "";
} else if (function == "turnBack" ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (function == "turnBack" ) {
} else if (function == "turnBack") {

turn(Movement::TURN_RIGHT_90);
return "";
} else if (function == "turnLeft" || function == "turnLeft90") {
} else if (function == "turnLeft" || function == "turnLeft90" ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (function == "turnLeft" || function == "turnLeft90" ) {
} else if (function == "turnLeft" || function == "turnLeft90") {

} else if (function == "turnBack" ) {
turn(Movement::TURN_RIGHT_180);
return "";
} else if (function == "turnRight" || function == "turnRight90" ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (function == "turnRight" || function == "turnRight90" ) {
} else if (function == "turnRight" || function == "turnRight90") {

double m_movementProgress;
double m_movementStepSize;
QSlider *m_speedSlider;
int m_sliderValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
int m_sliderValue;
int m_sliderValue;

}
if (isWall(semiPos, semiDir)) {
}
//m_runOutput->appendPlainText( QVariant(halfStepsAhead).toString() + "-(" + QVariant(semiPos.x).toString() + " , " + QVariant(semiPos.y).toString() + "):" +QVariant( (int) semiDir ).toString() );
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment.

@GoGoCom
Copy link
Author

GoGoCom commented Dec 24, 2025 via email

Copy link
Owner

@mackorone mackorone left a comment

Choose a reason for hiding this comment

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

Thanks @GoGoCom for submitting this PR and thanks @kouosi for doing a preliminary review! And sorry for the delay, I've been busy due to the holidays.

I left some inline comments, please address and run clang-format --style=google before re-submitting.

My main feedback is to exclude any changes that aren't required for implementing curve turns. Feel free to submit additional PRs for the other changes.

Comment on lines +120 to +121
void runRight();
void runLeft();
Copy link
Owner

Choose a reason for hiding this comment

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

Let's rename these to curveTurnRight and curveTurnLeft for explicitness

* **Action:** Turn the robot forty-five degrees to the left
* **Response:** `ack` once the movement completes

#### `runRight`
Copy link
Owner

Choose a reason for hiding this comment

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

Please update this name (see above)

* **Action:** Round turn the robot ninty degrees to the right
* **Response:** `ack` once the movement completes

#### `runLeft`
Copy link
Owner

Choose a reason for hiding this comment

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

Please update this name (see above)

Comment on lines +296 to +299
QStringList SplitStr = path.split("/");
QString TitleStr = SplitStr.takeLast();
this->setWindowTitle("mms : "+TitleStr);

Copy link
Owner

Choose a reason for hiding this comment

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

This looks like an unrelated change. Can you split it out into its own pull request? Same goes for similar changes below.

Comment on lines +730 to +732

// for mouse speed control
m_sliderValue = m_speedSlider->value();
Copy link
Owner

Choose a reason for hiding this comment

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

We shouldn't need to redundantly store the slider value here

Comment on lines +1132 to +1134
turn(Movement::TURN_RIGHT_180);
return "";
} else if (function == "turnRight" || function == "turnRight90" ) {
Copy link
Owner

Choose a reason for hiding this comment

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

Let's keep this PR strictly scoped to curve turns. Please split this into its own PR.

Coordinate currentTranslation = startingTranslation * (1.0 - fraction) + destinationTranslation * fraction;
Angle currentRotation = startingRotation * (1.0 - fraction) + destinationRotation * fraction;

// Calculate the current translation and rotation for a curv turn
Copy link
Owner

Choose a reason for hiding this comment

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

This function is getting a bit too big. Can you create a separate helper function for the curve turn logic?

Comment on lines +1530 to +1548
// increase the speed by the distance that will be travelled
switch(numHalfSteps) {
case 1:
case 2:
m_speedSlider->setValue(m_sliderValue);
break;
case 3 :
case 4 :
m_speedSlider->setValue(m_sliderValue*1.25);
break;
case 5:
case 6:
m_speedSlider->setValue(m_sliderValue*1.5);
break;
default :
m_speedSlider->setValue(m_sliderValue*2.0);
break;
}
// TODO: upforgrabs
Copy link
Owner

Choose a reason for hiding this comment

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

This is an interesting change but probably belongs as its own PR, because I'm not convinced programmatically setting the speed slider is wise. (There might be other ways to accomplish the goal of making the mouse acceleration more realistic and apparent.)

@GoGoCom
Copy link
Author

GoGoCom commented Dec 30, 2025 via email

@mackorone
Copy link
Owner

@GoGoCom thanks for the kind words! I won't have time to clean up and incorporate this PR for at least a few weeks. If you'd like to get it merged before then, do your best to address my inline comments and I can review your changes.

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.

3 participants