-
Notifications
You must be signed in to change notification settings - Fork 6
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
Auto snapshot bot #250
base: master
Are you sure you want to change the base?
Auto snapshot bot #250
Conversation
…got rid of comma-related horror in BOB_PACKED
… than stack object
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.
Looks good! And I'm sure this code will come in handy...
include/vicon/udp.h
Outdated
name.c_str(), | ||
timeoutDuration); | ||
return std::make_unique<ObjectReference<ObjectDataType>>( | ||
*this, name.c_str(), timeoutDuration); |
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 suppose an alternative would be leave the return value for getObjectReference()
as ObjectReference<...>
and just turn into a pointer like so:
myPtr = std::make_unique<ObjectReference<ObjectDataType>>(vicon.getObjectReference(...));
It's not important though
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.
so would that copy the version on the stack into the heap? I don't quite understand how you can std::make_unique
a stack object
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. You'd be just invoking the copy/move ctor for ObjectReference
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.
After having re-reviewed this 11 months later I think an optional
might be a better option here.
|
||
// Start moving towards it | ||
m_TankPID->moveTo(*m_CurrentTrainingRouteWaypoint); | ||
LOGD << "Moving to waypoint (" << m_CurrentTrainingRouteWaypoint->x() << ", " << m_CurrentTrainingRouteWaypoint->y() << ")"; |
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 think I overloaded operator<<()
for Vector2
so this could be:
LOGD << "Moving to waypoint " << m_CurrentTrainingRouteWaypoint;
LOGI << "Vicon: Found new object: " << data.objectName; | ||
pos = m_ObjectData.emplace(data.objectName, ObjectDataType { data.objectName }).first; | ||
LOGI << "Vicon: Found new object: " << data.objectName.data(); | ||
pos = m_ObjectData.emplace(data.objectName, ObjectDataType { data.objectName.data() }).first; |
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 suppose we could add a getName()
convenience function that returns a const char *
just to make it more explicit
…or automatically driving to start of route
…bob_robotics into auto_snapshot_bot
This reverts fbe5bb6. It makes more sense just to return a plain old ObjectReference. In snapshot_bot, we can wrap it in an optional<> to achieve the desired functionality.
This needs testing with a calibrated Vicon system but otherwise, I think it's working:
BOB_PACKED
macro using some__VA_ARGS__
Vicon::UDP::getObjectReference
to return astd::unique_ptr
to a reference objectVicon::UDP
to usestd::array<char, 24>
to store names - seems a bit nicer but stil requires some nastiness