libcreate driver minor changes/additions#29
libcreate driver minor changes/additions#29betaupsx86 wants to merge 2 commits intoAutonomyLab:masterfrom
Conversation
Added Cliff sensor signal readings. Cliff detection divided in Left, Front Left, Front Right, Right to give more info to the user. Right and Left Wheeldrop also divided for the sake of completion.
| } | ||
| } | ||
|
|
||
| bool Create::isCliff() const { |
There was a problem hiding this comment.
I think keeping this function is still useful. For instance, if the user is only interested in detecting a cliff for the purposes of stopping the robot (and does not care if it is left or right). But now the implementation can change:
return (isCliffLeft() || isCliffFrontLeft() || isCliffFrontRight() || isCliffRight());| } | ||
| } | ||
|
|
||
| bool Create::isWheeldrop() const { |
There was a problem hiding this comment.
Similar to the cliff API, I think this should be kept in addition to the new function calls:
return (isLeftWheeldrop() || isRightWheeldrop());There was a problem hiding this comment.
True I was thinking on terms of create_autonomy where we want to expose everything to the ROS environment and there is little need for isCliff or isWheeldrop. I shall add those functions back since libcreate can be used independently from ROS.
| * \return true if a left or right wheeldrop is detected, false otherwise. | ||
| /* True if a left wheeldrop is detected. | ||
| */ | ||
| bool isLeftWheel() const; |
There was a problem hiding this comment.
I think renaming to isLeftWheeldrop() is more informative.
| /* True if a right wheeldrop is detected. | ||
| */ | ||
| bool isWheeldrop() const; | ||
| bool isRightWheel() const; |
There was a problem hiding this comment.
Simliarly: isRightWheeldrop()
| return serial->send(cmd, 2); | ||
| } | ||
|
|
||
| bool Create::isLeftWheel() const { |
| } | ||
| } | ||
|
|
||
| uint16_t Create::getCliffSignalLeft() const { |
There was a problem hiding this comment.
Please fix the indentation of these functions to match the rest of the file.
| } | ||
|
|
||
| uint16_t Create::getCliffSignalLeft() const { | ||
| if (data->isValidPacketID(ID_CLIFF_LEFT_SIGNAL)) { |
There was a problem hiding this comment.
Have you tested this functionality? I don't expect ID_CLIFF_LEFT_SIGNAL to be evaluated as a valid packet since it is not added as a packet to request for any protocol in data.cpp:13. You can add them to that constructor for protocols V_2 | V_3, but beware the warning regarding flooding the serial. After you've made the changes you should be able to check if there are problems on the serial with calls to Create::getNumCorruptPackets().
There was a problem hiding this comment.
Thanks! I completely missed that. I assumed it was valid since it was defined on the headers. I'm going to try to add them to the protocols, but I won't have a Create 2 base to test them for at least a month. Maybe I should refrain from exposing the cliff signals until then.
There was a problem hiding this comment.
I can test your changes as well when your ready.
Minor changes/additions to libcreate driver. Cliff Sensors, Wheeldrops