-
Notifications
You must be signed in to change notification settings - Fork 2
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
104 Vehicle interface with ultrasonic sensor #149
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't review the code as its largely the same as #76 but @hannahvsawiuk should look over the changes and just make sure that there aren't any issues.
Good job on the ultrasonic sensors.
@@ -0,0 +1,10 @@ | |||
# PropBot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! thanks for adding this
////////////////////////////////////////////////////////// | ||
// Code Example: Read the sensor at the default address // | ||
////////////////////////////////////////////////////////// | ||
int read_the_sensor_example(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this function is called on the 1st line of the loop function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename it so it doesn't have example
maybe read_ultrasonic_sensor()
instead of having a different folder, can we just have a flag somewhere in the code? this diff is hard to look through because it has a lot of new code that is the same as the other stuff |
vehicle_interface/main/UCMotor.cpp
Outdated
return currentstep; | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are the same files, i am unsure of why it is appearing as changed
vehicle_interface/main/main.ino
Outdated
////////////////////////////////////////////////////////// | ||
// Code Example: Read the sensor at the default address // | ||
////////////////////////////////////////////////////////// | ||
int read_the_sensor_example(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, do not include any functions aside from setup
and loop
in main to keep things clean. Please move to a seperate .cpp
file with the prototypes in a corresponding .h
file. Also better for future unit testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot include those functions in a separate .cpp file. If I do that, the library function(SoftI2CMaster.h) will be crashed. I know this sounds weird, I tried to debug that but it still doesn't work.
@@ -4,6 +4,11 @@ | |||
// Pins defined by the UCMotor header | |||
#include "UCMotor.h" | |||
|
|||
//Pin definitions for the ultrasonic sensor(MB1202) | |||
#define SCL_PIN 5 //Default SDA is Pin5 PORTC for the UNO -- you can set this to any tristate pin | |||
#define SCL_PORT PORTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
|
||
|
||
/** | ||
* @brief fetches RC commands and returns motor commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm I would rebase from master
. I believe this is outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the changes to main.ino
I requested
@zhaoshengEE I think it would be better if we had seperate dirs for the different modules. Once you make the changes to |
vehicle_interface/main/main.ino
Outdated
@@ -60,11 +64,80 @@ void sendCommandMini(UC_DCMotor * uc_motor, wheel_motor_command_t command) { | |||
|
|||
void loop() | |||
{ | |||
int distance = read_the_sensor_example(); | |||
if (distance > 25){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this value a define somewhere
vehicle_interface/main/main.ino
Outdated
@@ -60,11 +64,80 @@ void sendCommandMini(UC_DCMotor * uc_motor, wheel_motor_command_t command) { | |||
|
|||
void loop() | |||
{ | |||
int distance = read_the_sensor_example(); | |||
if (distance > 25){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just change this to if (ultrasonic_sensor_range() > MAX_RANGE
or smth like that
vehicle_interface/main/rc_commands.h
Outdated
/* Function prototypes for rc commands */ | ||
Array<wheel_motor_command_t, NUM_WHEELS> fetch_rc_commands(void); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
No description provided.