forked from USC-ACTLab/libmotioncapture
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The mock type replaces the older "testmocap", is available in each build and allows to set static rigid bodies or point clouds which will be returned at a fixed frequency.
- Loading branch information
Showing
5 changed files
with
123 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "libmotioncapture/mock.h" | ||
|
||
#include <thread> | ||
|
||
namespace libmotioncapture { | ||
|
||
class MotionCaptureMockImpl{ | ||
public: | ||
MotionCaptureMockImpl() | ||
{ | ||
} | ||
|
||
public: | ||
float dt; | ||
}; | ||
|
||
MotionCaptureMock::MotionCaptureMock( | ||
float dt, | ||
const std::vector<RigidBody>& objects, | ||
const PointCloud& pointCloud) | ||
{ | ||
pImpl = new MotionCaptureMockImpl; | ||
pImpl->dt = dt; | ||
for (const auto& obj : objects) { | ||
rigidBodies_.insert(std::make_pair(obj.name(), obj)); | ||
} | ||
pointcloud_ = pointCloud; | ||
} | ||
|
||
void MotionCaptureMock::waitForNextFrame() | ||
{ | ||
std::this_thread::sleep_for(std::chrono::milliseconds((int)(pImpl->dt * 1000))); | ||
} | ||
|
||
const std::map<std::string, RigidBody>& MotionCaptureMock::rigidBodies() const | ||
{ | ||
return rigidBodies_; | ||
} | ||
|
||
const PointCloud& MotionCaptureMock::pointCloud() const | ||
{ | ||
return pointcloud_; | ||
} | ||
|
||
MotionCaptureMock::~MotionCaptureMock() | ||
{ | ||
delete pImpl; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.