Added new arduino code
This commit is contained in:
@ -101,7 +101,6 @@ return_type DiffDriveArduino::read(const rclcpp::Time & /* time */, const rclcpp
|
||||
double deltaSeconds = diff.count();
|
||||
time_ = new_time;
|
||||
|
||||
|
||||
if (!arduino_.connected())
|
||||
{
|
||||
return return_type::ERROR;
|
||||
@ -112,31 +111,17 @@ return_type DiffDriveArduino::read(const rclcpp::Time & /* time */, const rclcpp
|
||||
// Force the wheel position
|
||||
l_wheel_.pos = l_wheel_.pos + l_wheel_.vel * deltaSeconds;
|
||||
r_wheel_.pos = r_wheel_.pos + r_wheel_.vel * deltaSeconds;
|
||||
|
||||
|
||||
|
||||
return return_type::OK;
|
||||
|
||||
|
||||
return return_type::OK;
|
||||
}
|
||||
|
||||
return_type DiffDriveArduino::write(const rclcpp::Time & /* time */, const rclcpp::Duration & /* period */)
|
||||
{
|
||||
|
||||
if (!arduino_.connected())
|
||||
{
|
||||
return return_type::ERROR;
|
||||
}
|
||||
|
||||
arduino_.setMotorValues(l_wheel_.cmd, r_wheel_.cmd);
|
||||
|
||||
|
||||
|
||||
|
||||
return return_type::OK;
|
||||
|
||||
|
||||
|
||||
return return_type::OK;
|
||||
}
|
||||
|
||||
} // namespace diffdrive_arduino
|
||||
|
||||
Reference in New Issue
Block a user