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 documentation for installation and python module #27

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

paulbourelly999
Copy link
Contributor

@paulbourelly999 paulbourelly999 commented Jun 5, 2024

PR Details

Description

This PR adds documentation for installing/importing CARMA Time Library

Related GitHub Issue

Related Jira Key

Motivation and Context

For internal and external use/extension of library

How Has This Been Tested?

NA

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -62,7 +62,7 @@ if (${BUILD_PYTHON_BINDINGS})
FILE(COPY carma_clock_py/python_wrapper_test.py DESTINATION .)
add_test(NAME test_carma_clock_python_module_binding COMMAND ${PYTHON_EXECUTABLE} python_wrapper_test.py )
# set cpack depedencies
set(CPACK_DEBIAN_PACKAGE_DEPENDS carma-clock-1 python3-dev)
set(CPACK_DEBIAN_PACKAGE_DEPENDS python3-dev)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something I noticed. This is the carma-clock-1 package. It can't depend on itself

.def("nowInSeconds", &fwha_stol::lib::time::CarmaClock::nowInSeconds)
.def("nowInMilliseconds", &fwha_stol::lib::time::CarmaClock::nowInMilliseconds)
.def("update", &fwha_stol::lib::time::CarmaClock::update, py::arg("current_time"))
.def("is_simulation_mode", &fwha_stol::lib::time::CarmaClock::is_simulation_mode)
.def("wait_for_initialization",&fwha_stol::lib::time::CarmaClock::wait_for_initialization)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Formatting changes

PYBIND11_MODULE(libcarma_clock, m) {
PYBIND11_MODULE(libcarma_clock, m)
{
m.doc() = R"(CARMA Time Module provides the CarmaClock object, which is a
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New module documentation string.

necessary to have control over each increment in time. An example of a use
case is in a simulation environment where time may progress non-linearly.
The CarmaClock constructor takes a boolean parameter to indicate whether
to directlzy make calls to system time or to use its internal store value
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in directlzy

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
# Get ubuntu distribution code name. All STOL APT debian packages are pushed to S3 bucket based on distribution codename.
. /etc/lsb-release
# add the STOL APT repository
echo "deb [trusted=yes] http://s3.amazonaws.com/stol-apt-repository ${DISTRIB_CODENAME} main" > /etc/apt/sources.list.d/stol-apt-repository.list
Copy link
Contributor

Choose a reason for hiding this comment

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

When I run this command, it shows this:

echo "deb [trusted=yes] http://s3.amazonaws.com/stol-apt-repository ${DISTRIB_CODENAME} main" > /etc/apt/sources.list.d/stol-apt-repository.list
bash: /etc/apt/sources.list.d/stol-apt-repository.list: Permission denied

Copy link
Contributor

Choose a reason for hiding this comment

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

Same with sudo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you may need to go sudo -i and then run it.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh you are right. can we include that for dummies like me

README.md Show resolved Hide resolved
Comment on lines +78 to +80
TODO How the library is configured

TODO Move this configuration logic into a time manager tool in a separate library.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we planning to address TODO in this PR or leave for next?

Copy link
Contributor Author

@paulbourelly999 paulbourelly999 Jun 6, 2024

Choose a reason for hiding this comment

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

Not in here. Not even sure what Rob was referring to with this.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, then should we just remove it.

py::class_<fwha_stol::lib::time::CarmaClock>(m, "CarmaClock")
.def(py::init<bool>(), py::arg("simulation_mode")=false)
.def(py::init<bool>(), py::arg("simulation_mode") = false)
Copy link
Contributor

Choose a reason for hiding this comment

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

optional, but apparently we can also add method documentation like this

    py::class_<fwha_stol::lib::time::CarmaClock>(m, "CarmaClock")
        .def(py::init<bool>(), py::arg("simulation_mode") = false)
        .def("nowInSeconds", &fwha_stol::lib::time::CarmaClock::nowInSeconds, "Get current time in seconds.")
        .def("nowInMilliseconds", &fwha_stol::lib::time::CarmaClock::nowInMilliseconds, "Get current time in milliseconds.")
        .def("update", &fwha_stol::lib::time::CarmaClock::update, py::arg("current_time"), "Update the internal clock with the current time.")
        .def("is_simulation_mode", &fwha_stol::lib::time::CarmaClock::is_simulation_mode, "Check if in simulation mode.")
        .def("wait_for_initialization", &fwha_stol::lib::time::CarmaClock::wait_for_initialization, "Wait for initialization to complete ??? what does it actually do???")
        .def("sleep_until", &fwha_stol::lib::time::CarmaClock::sleep_until, py::arg("future_time"), "Sleep until a specified future time. ??? does ms or s matter here???")
        .def("sleep_for", &fwha_stol::lib::time::CarmaClock::sleep_for, py::arg("time_to_sleep"), "Sleep for a specified duration ??? ms or s ???.");

Copy link

sonarcloud bot commented Jun 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

# Get ubuntu distribution code name. All STOL APT debian packages are pushed to S3 bucket based on distribution codename.
. /etc/lsb-release
# add the STOL APT repository
echo "deb [trusted=yes] http://s3.amazonaws.com/stol-apt-repository ${DISTRIB_CODENAME} main" > /etc/apt/sources.list.d/stol-apt-repository.list
Copy link
Contributor

Choose a reason for hiding this comment

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

oh you are right. can we include that for dummies like me

Comment on lines +78 to +80
TODO How the library is configured

TODO Move this configuration logic into a time manager tool in a separate library.
Copy link
Contributor

Choose a reason for hiding this comment

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

okay, then should we just remove it.

@paulbourelly999 paulbourelly999 merged commit e0a9434 into develop Jun 6, 2024
31 checks passed
@paulbourelly999 paulbourelly999 deleted the fix-add-installation-usage-documentation branch June 6, 2024 20:10
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