Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/viam/sdk/tests/mocks/mock_robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ std::vector<ResourceName> mock_proto_resource_names_response() {
std::vector<RobotClient::frame_system_config> mock_config_response() {
RobotClient::frame_system_config config;
WorldState::transform t;
t.reference_frame = "some-reference-frame";
pose_in_frame pif("reference0", default_pose());
t.pose_in_observer_frame = pif;
t.name = "some-reference-frame";
t.parent = "some-reference-frame";
t.pose = default_pose();
config.frame = t;
config.kinematics = {{"fake-key", 1.0}};

RobotClient::frame_system_config config1;
WorldState::transform t1;
t1.reference_frame = "another-reference-frame";
pose_in_frame pif1("reference1", default_pose(1));
t1.pose_in_observer_frame = pif1;
t1.name = "another-reference-frame";
t1.parent = "another-reference-frame";
t1.pose = default_pose(1);
config1.frame = t1;
config1.kinematics = {{"new-fake-key", 2.0}};

Expand All @@ -162,12 +162,13 @@ std::vector<RobotClient::frame_system_config> mock_config_response() {
std::vector<FrameSystemConfig> mock_proto_config_response() {
FrameSystemConfig config;
common::v1::Transform t;
*t.mutable_reference_frame() = "some-reference-frame";
*t.mutable_name() = "some-reference-frame";
Pose pose = default_proto_pose();
PoseInFrame pif;
*pif.mutable_reference_frame() = "reference0";
*pif.mutable_pose() = pose;
*t.mutable_pose_in_observer_frame() = pif;
*t.mutable_parent() = "some-reference-frame";
*t.mutable_pose() = pose;
*config.mutable_frame() = t;
google::protobuf::Struct s;
google::protobuf::Value v;
Expand All @@ -178,12 +179,13 @@ std::vector<FrameSystemConfig> mock_proto_config_response() {

FrameSystemConfig config1;
common::v1::Transform t1;
*t1.mutable_reference_frame() = "another-reference-frame";
*t1.mutable_name() = "another-reference-frame";
Pose pose1 = default_proto_pose(1);
PoseInFrame pif1;
*pif1.mutable_reference_frame() = "reference1";
*pif1.mutable_pose() = pose1;
*t1.mutable_pose_in_observer_frame() = pif1;
*t1.mutable_parent() = "another-reference-frame";
*t1.mutable_pose() = pose1;
*config1.mutable_frame() = t1;
google::protobuf::Struct s1;
google::protobuf::Value v1;
Expand Down
5 changes: 3 additions & 2 deletions src/viam/sdk/tests/test_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ using namespace viam::sdk;

WorldState mock_world_state() {
WorldState::transform transform;
transform.reference_frame = "fake-reference-frame";
transform.pose_in_observer_frame = pose_in_frame("fake", {{2, 3, 4}, {5, 6, 7}, 8});
transform.name = "fake-reference-frame";
transform.parent = "fake-parent-frame";
transform.pose = {{2, 3, 4}, {5, 6, 7}, 8};
WorldState::geometries_in_frame obstacle;
obstacle.reference_frame = "ref";

Expand Down
28 changes: 14 additions & 14 deletions src/viam/sdk/tests/test_robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ BOOST_AUTO_TEST_CASE(test_frame_system_config) {
auto proto1 = protos[0];
auto proto2 = protos[1];

BOOST_CHECK_EQUAL(config1.frame.reference_frame, proto1.frame().reference_frame());
BOOST_CHECK_EQUAL(config1.frame.pose_in_observer_frame.pose.coordinates.x,
proto1.frame().pose_in_observer_frame().pose().x());
BOOST_CHECK_EQUAL(config1.frame.pose_in_observer_frame.pose.orientation.o_x,
proto1.frame().pose_in_observer_frame().pose().o_x());
BOOST_CHECK_EQUAL(config1.frame.pose_in_observer_frame.pose.theta,
proto1.frame().pose_in_observer_frame().pose().theta());
BOOST_CHECK_EQUAL(config1.frame.name, proto1.frame().name());
BOOST_CHECK_EQUAL(config1.frame.pose.coordinates.x,
proto1.frame().pose().x());
BOOST_CHECK_EQUAL(config1.frame.pose.orientation.o_x,
proto1.frame().pose().o_x());
BOOST_CHECK_EQUAL(config1.frame.pose.theta,
proto1.frame().pose().theta());
BOOST_CHECK_EQUAL(to_proto(config1.kinematics).SerializeAsString(),
proto1.kinematics().SerializeAsString());

BOOST_CHECK_EQUAL(config2.frame.reference_frame, proto2.frame().reference_frame());
BOOST_CHECK_EQUAL(config2.frame.pose_in_observer_frame.pose.coordinates.x,
proto2.frame().pose_in_observer_frame().pose().x());
BOOST_CHECK_EQUAL(config2.frame.pose_in_observer_frame.pose.orientation.o_x,
proto2.frame().pose_in_observer_frame().pose().o_x());
BOOST_CHECK_EQUAL(config2.frame.pose_in_observer_frame.pose.theta,
proto2.frame().pose_in_observer_frame().pose().theta());
BOOST_CHECK_EQUAL(config2.frame.name, proto2.frame().name());
BOOST_CHECK_EQUAL(config2.frame.pose.coordinates.x,
proto2.frame().pose().x());
BOOST_CHECK_EQUAL(config2.frame.pose.orientation.o_x,
proto2.frame().pose().o_x());
BOOST_CHECK_EQUAL(config2.frame.pose.theta,
proto2.frame().pose().theta());
BOOST_CHECK_EQUAL(to_proto(config2.kinematics).SerializeAsString(),
proto2.kinematics().SerializeAsString());
});
Expand Down
Loading