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

Fix bug #1 #528

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Fix bug #1 #528

wants to merge 6 commits into from

Conversation

kemen209
Copy link

Use stoi to get int type of motion_multiplier_

kemen209 added 3 commits June 20, 2019 17:40
* 'master' of https://github.com/gtri/scrimmage: (227 commits)
  allowing an external force in the fixed wing model
  added a loop to call close() for all metrics plugins in simcontrol's shutdown() method (gtri#515)
  added more randomness to the entityPlugin shape hash (gtri#514)
  allow setting initial scale of aircraft in a mission file (gtri#511)
  fixed nullptr in draw_sphere (gtri#507)
  added optional argument of enable_gui with ardupilot SITL (gtri#513)
  Update GPS.proto
  Fix could not find plugin ROSAirSim bug (gtri#500)
  updated terrain generation docs
  Update docs to reflect Internal GTRI Mailing List and Fix Link (gtri#485)
  exposed the flush() function so that partial log files can be written in the case of scrimmage crashing
  Added a printer utility in the log directory. Usage comments are in src/log/Print.cpp. This utility is shared among plugins in the simulation and can be invoked to print to both the console and to a file in the log directory called console.log. * PrintDev() * PrintInfo() * PrintWarning() * PrintError()
  fix build issues
  Updated shape docs per issue gtri#438
  Update README.md
  Create BatchExample.py
  Update multiple-local-runs.rst
  Fixing multi-agent bugs in scrimmage/openai
  travis.yml: Push docs to server from Ubuntu 20.04 docker image
  create docker tags for xenial, focal, latest
  ...
@frazierbaker frazierbaker self-requested a review June 14, 2021 18:13
@frazierbaker
Copy link
Collaborator

What was the issue this was intended to fix?

@kemen209
Copy link
Author

kemen209 commented Jun 17, 2021

To avoid implicitly type conversion from double to int. I assume motion_multiplier_ is suppose to be type of int.

@tm132
Copy link
Contributor

tm132 commented Jul 6, 2021

motion_multiplier_ is defined as an int in the header file, so stoi would be correct in this context.

However, we have this in the same file:

motion_multiplier_ = 1;    // TM32: an int?
[......]
double MissionParse::motion_multiplier() { return motion_multiplier_; }   // TM132: a double??

Should it be a double or should it be an int?

* 'master' of https://github.com/gtri/scrimmage:
  Initialize no_bin_logging to false in straight.xml
  Add optional parameter in mission files to ignore bin logging.
* master:
  Initialize no_bin_logging to false in straight.xml
  Add optional parameter in mission files to ignore bin logging.
@kemen209
Copy link
Author

kemen209 commented Oct 8, 2021

According to the following , motion_multiplier should be int.

(1) src/simcontrol/SimControl.cpp
for (int i = 0; i < mp_->motion_multiplier(); i++) {

(2) ./docs/source/overview/xml-tags.rst
:  - ``motion_multiplier`` : set to an integer greater than or equal to 1.

And i made a followi-up commit to change the API to return type int.

And for the motion_multiplier in JSBSimModel.cpp, such as

double motion_multiplier = std::stod(info["motion_multiplier"]);

It's came from the JSBSimModel plugin's xml file, not part of Mission file, only for calculating dt_, just leave it that way for now (or we can fix that too).

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