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

Updating docs #666

Merged
merged 46 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
766ac37
Update version
Richard-Stump Apr 8, 2023
da562a0
Merge branch 'develop-pros-4' into release/4.0.3
noam987 Apr 11, 2023
f68ed61
:bug: Fix pros::E_TEXT_LARGE_CENTER Simple Name
WillXuCodes Apr 11, 2023
661ca2c
🔖 Release 4.0.3
WillXuCodes Apr 11, 2023
02cf79b
Update version numbers
noam987 Oct 18, 2023
d038328
Merge branch 'master-pros-4' into develop-pros-4
noam987 Oct 18, 2023
daa0384
🐛Motor bug fixes and add new set_gearing (#611)
noam987 Oct 24, 2023
79e7348
✨Add list_files function (#612)
noam987 Oct 25, 2023
cd22c8c
:sparkles: ADI Get Port (#613)
phinc23 Oct 26, 2023
d690f56
🐛Vex link default override (#614)
phinc23 Oct 26, 2023
fd33eea
✨Field Control State Getter (#608)
CChheerryyll Oct 27, 2023
360a368
Added vexFileSync when writing to files (#619)
aberiggs Dec 1, 2023
9778296
🐛Fix rotation sensor reversed port (#618)
Cooper7196 Jan 12, 2024
3bd9d77
🐛 Field Control Getter Return Value (#627)
CChheerryyll Jan 22, 2024
0b246ea
✨default the VFS to the sd card (#621)
noam987 Jan 26, 2024
1e4bd3c
Fix motor voltage limit port mutex returning
Gavin-Niederman Mar 8, 2024
c180756
Initial implementation for get_all_devices
aberiggs Mar 25, 2024
0b1e3d1
Remove use of templating
aberiggs Mar 28, 2024
5f65677
🐛Fix motor voltage limit port mutex returning
noam987 Apr 10, 2024
4e2730a
modify gps functions
CChheerryyll Apr 15, 2024
2cc4ed6
add example code to gps header files
CChheerryyll Apr 16, 2024
e0d3756
revert api.h and version
CChheerryyll Apr 17, 2024
748c5f2
add newline at end of gps.c
CChheerryyll Apr 17, 2024
cfd4e5b
add newline at end of version
CChheerryyll Apr 17, 2024
e650070
Completed get_all_devices member function for all critical devices
aberiggs Apr 26, 2024
c1c626c
✨Get devices vector. Removes explict for devices
noam987 Apr 26, 2024
ff03840
✨GPS rewrite
noam987 Apr 30, 2024
acaedbe
Fix compile issues
noam987 May 4, 2024
4f38205
🐛Fix linking issues with the competition modes
Gracelu128 May 4, 2024
3279716
🐛ADI mutex fix (#633)
R11G May 4, 2024
0636b48
✨Adds static getters for some devices (#653)
noam987 May 4, 2024
3301261
📝 PROS 4: Documentation Fixes for optical and distance sensor (#654)
Gracelu128 May 4, 2024
0b98d82
Merge branch 'pros-4/docs' into develop-pros-4
noam987 May 5, 2024
7a66f2f
🐛Fixed Imu::is_calibrating function for PROS 4 #626 (#629)
Gracelu128 May 5, 2024
0cfcf55
🐛Remove = overload from motor groups (#656)
noam987 May 5, 2024
146ae69
Update version numbers (#658)
noam987 May 6, 2024
db9ea0b
🐛Fix imu get device typo (#659)
Rocky14683 May 7, 2024
4918aaa
📝 Fix typo in main.h (#662)
Rocky14683 May 15, 2024
b55f1d1
Add documentation to literals
noam987 May 18, 2024
1d922a6
📝 Fix typo in main.cpp (#663)
Rocky14683 May 18, 2024
ee6456a
🐛Converts appending, and constructors to take in AbstractMotor& inste…
noam987 May 18, 2024
f71e3c8
📝Docs + implementation forgotten for rotation sensor (#665)
aberiggs May 18, 2024
ae72c55
Merge branch 'develop-pros-4' into pros-4/literals-docs
noam987 May 18, 2024
6aaec76
Merge pull request #664 from purduesigbots/pros-4/literals-docs
phinc23 May 19, 2024
b7ebb39
Merge branch 'pros-4/docs' into merge-conflicts
phinc23 May 19, 2024
aad5099
Fix compile issues
noam987 May 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

#define PROS_VERSION_MAJOR 4
#define PROS_VERSION_MINOR 0
#define PROS_VERSION_PATCH 6
#define PROS_VERSION_STRING "4.0.6"

#define PROS_VERSION_PATCH 7
#define PROS_VERSION_STRING "4.0.7"

#include "pros/adi.h"
#include "pros/colors.h"
Expand Down
2 changes: 1 addition & 1 deletion include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* For instance, E_CONTROLLER_MASTER has a shorter name: CONTROLLER_MASTER.
* E_CONTROLLER_MASTER is pedantically correct within the PROS styleguide, but
* not convienent for most student programmers.
* not convenient for most student programmers.
*/
#define PROS_USE_SIMPLE_NAMES

Expand Down
40 changes: 40 additions & 0 deletions include/pros/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,48 @@ class Device {
*/
pros::DeviceType get_plugged_type() const;


/**
* Gets the type of device on a given port.
*
* This function uses the following values of errno when an error state is
* reached:
* EACCES - Mutex of port cannot be taken (access denied).
*
* \param port The V5 port number from 1-21
*
* \return The device type as an enum.
*
* \b Example
* \code
* #define DEVICE_PORT 1
*
* void opcontrol() {
* while (true) {
* DeviceType dt = pros::Device::get_plugged_type(DEVICE_PORT);
* printf("device plugged type: {plugged type: %d}\n", dt);
* delay(20);
* }
* }
* \endcode
*/
static pros::DeviceType get_plugged_type(std::uint8_t port);

/**
* Gets all devices of a given device type.
*
* \param device_type The pros::DeviceType enum that matches the type of device desired.
*
* \return A vector of Device objects for the given device type.
*
* \b Example
* \code
* void opcontrol() {
* std::vector<Device> motor_devices = pros::Device::get_all_devices(pros::DeviceType::motor); // All Device objects are motors
* }
* \endcode
*/

static std::vector<Device> get_all_devices(pros::DeviceType device_type = pros::DeviceType::undefined);

protected:
Expand Down
76 changes: 50 additions & 26 deletions include/pros/distance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
* \defgroup cpp-distance VEX Distance Sensor C++ API
*/

Expand All @@ -34,7 +34,7 @@ class Distance : public Device {
/**
* \addtogroup cpp-distance
* @{
*/
*/
public:
/**
* Creates a Distance Sensor object for the given port.
Expand All @@ -58,9 +58,7 @@ class Distance : public Device {
*/
Distance(const std::uint8_t port);

Distance(const Device& device)
: Distance(device.get_port()) {};

Distance(const Device& device) : Distance(device.get_port()){};
/**
* Get the currently measured distance from the sensor in mm
*
Expand All @@ -75,9 +73,9 @@ class Distance : public Device {
* \b Example
* \code
* #define DISTANCE_PORT 1
*
*
* void opcontrol() {
Distance distance(DISTANCE_PORT);
Distance distance(DISTANCE_PORT);
* while (true) {
* printf("Distance confidence: %d\n", distance.get());
* delay(20);
Expand All @@ -87,8 +85,6 @@ class Distance : public Device {
*/
virtual std::int32_t get();

static std::vector<Distance> get_all_devices();

/**
* Get the currently measured distance from the sensor in mm.
* \note This function is identical to get().
Expand All @@ -104,9 +100,9 @@ class Distance : public Device {
* \b Example
* \code
* #define DISTANCE_PORT 1
*
*
* void opcontrol() {
Distance distance(DISTANCE_PORT);
Distance distance(DISTANCE_PORT);
* while (true) {
* printf("Distance confidence: %d\n", distance.get_distance());
* delay(20);
Expand All @@ -116,6 +112,21 @@ class Distance : public Device {
*/
virtual std::int32_t get_distance();

/**
* Gets all distance sensors.
*
* \return A vector of Distance sensor objects.
*
* \b Example
* \code
* void opcontrol() {
* std::vector<Distance> distance_all = pros::Distance::get_all_devices(); // All distance sensors that are
* connected
* }
* \endcode
*/
static std::vector<Distance> get_all_devices();

/**
* Get the confidence in the distance reading
*
Expand All @@ -134,9 +145,9 @@ class Distance : public Device {
* \b Example
* \code
* #define DISTANCE_PORT 1
*
*
* void opcontrol() {
Distance distance(DISTANCE_PORT);
Distance distance(DISTANCE_PORT);
* while (true) {
* printf("Distance confidence: %d\n", distance.get_confidence());
* delay(20);
Expand Down Expand Up @@ -164,9 +175,9 @@ class Distance : public Device {
* \b Example
* \code
* #define DISTANCE_PORT 1
*
*
* void opcontrol() {
Distance distance(DISTANCE_PORT);
Distance distance(DISTANCE_PORT);
* while (true) {
* printf("Distance confidence: %d\n", distance.get_object_size());
* delay(20);
Expand All @@ -186,10 +197,10 @@ class Distance : public Device {
*
* \return The velocity value or PROS_ERR if the operation failed, setting
* errno.
*
*
* \b Example
* \code
*
*
* void opcontrol() {
* Distance distance(DISTANCE_PORT);
* while (true) {
Expand All @@ -201,23 +212,36 @@ class Distance : public Device {
*/
virtual double get_object_velocity();

/**
* This is the overload for the << operator for printing to streams
*
* Prints in format(this below is all in one line with no new line):
* Distance [port: (port number), distance: (distance), confidence: (confidence),
* object size: (object size), object velocity: (object velocity)]
*/
/**
* This is the overload for the << operator for printing to streams
*
* Prints in format(this below is all in one line with no new line):
* Distance [port: (port number), distance: (distance), confidence: (confidence),
* object size: (object size), object velocity: (object velocity)]
*/
friend std::ostream& operator<<(std::ostream& os, pros::Distance& distance);

private:
///@}
};

namespace literals {
/**
* Constructs a Distance sensor object from a literal ending in _dist via calling the constructor
*
* \return a pros::Distance for the corresponding port
*
* \b Example
* \code
* using namespace pros::literals;
* void opcontrol() {
* pros::Distance dist = 2_dist; //Makes an dist object on port 2
* }
* \endcode
*/
const pros::Distance operator"" _dist(const unsigned long long int d);
} // namespace literals
}
} // namespace v5
} // namespace pros

#endif
13 changes: 13 additions & 0 deletions include/pros/gps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ class Gps : public Device {
*/
virtual std::int32_t set_offset(double xOffset, double yOffset) const;

/**

* Gets all GPS sensors.
*
* \return A vector of Gps sensor objects.
*
* \b Example
* \code
* void opcontrol() {
* std::vector<Gps> gps_all = pros::Gps::get_all_devices(); // All GPS sensors that are connected
* }
* \endcode
*/
static std::vector<Gps> get_all_devices();

/**
Expand Down
29 changes: 28 additions & 1 deletion include/pros/imu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class Imu : public Device {
* \endcode
*/

Imu(const std::uint8_t port) : Device(port, DeviceType::imu) {};

Imu(const std::uint8_t port) : Device(port, DeviceType::imu){};

Imu(const Device& device) : Imu(device.get_port()){};

Expand Down Expand Up @@ -190,6 +190,20 @@ class Imu : public Device {
*/
virtual std::int32_t set_data_rate(std::uint32_t rate) const;


/**
* Gets all IMU sensors.
*
* \return A vector of Imu sensor objects.
*
* \b Example
* \code
* void opcontrol() {
* std::vector<Imu> imu_all = pros::Imu::get_all_devices(); // All IMU sensors that are connected
* }
* \endcode
*/

static std::vector<Imu> get_all_devices();

/**
Expand Down Expand Up @@ -1040,6 +1054,19 @@ class Imu : public Device {
};

namespace literals {
/**
* Constructs a Imu from a literal ending in _imu via calling the constructor
*
* \return a pros::Imu for the corresponding port
*
* \b Example
* \code
* using namespace pros::literals;
* void opcontrol() {
* pros::Imu imu = 2_imu; //Makes an IMU object on port 2
* }
* \endcode
*/
const pros::Imu operator"" _imu(const unsigned long long int i);
} // namespace literals

Expand Down
Loading