22
33from viam .components .gantry import GantryClient
44from viam .components .gantry .service import GantryRPCService
5- from viam .proto .common import DoCommandRequest , DoCommandResponse , GetGeometriesRequest , GetGeometriesResponse
5+ from viam .proto .common import DoCommandRequest , DoCommandResponse , GetGeometriesRequest , GetGeometriesResponse , GetKinematicsRequest , GetKinematicsResponse , KinematicsFileFormat
66from viam .proto .component .gantry import (
77 GantryServiceStub ,
88 GetLengthsRequest ,
@@ -64,6 +64,11 @@ async def test_extra(self):
6464 await self .gantry .move_to_position ([1 , 2 , 3 ], [4 , 5 , 6 ], extra = extra )
6565 assert self .gantry .extra == extra
6666
67+ async def test_get_kinematics (self ):
68+ format , data = await self .gantry .get_kinematics ()
69+ assert format == self .gantry .kinematics [0 ]
70+ assert data == self .gantry .kinematics [1 ]
71+
6772 async def test_timeout (self ):
6873 assert self .gantry .timeout is None
6974
@@ -160,6 +165,15 @@ async def test_do(self):
160165 result = struct_to_dict (response .result )
161166 assert result == {"command" : command }
162167
168+ async def test_get_kinematics (self ):
169+ async with ChannelFor ([self .service ]) as channel :
170+ client = GantryServiceStub (channel )
171+ request = GetKinematicsRequest (name = self .gantry .name )
172+ response : GetKinematicsResponse = await client .GetKinematics (request , timeout = 1.1 )
173+ assert response .format == self .gantry .kinematics [0 ]
174+ assert response .kinematics_data == self .gantry .kinematics [1 ]
175+ assert self .gantry .timeout == loose_approx (1.1 )
176+
163177 async def test_get_geometries (self ):
164178 async with ChannelFor ([self .service ]) as channel :
165179 client = GantryServiceStub (channel )
@@ -234,8 +248,16 @@ async def test_extra(self):
234248 await client .move_to_position ([1 , 2 , 3 ], [4 , 5 , 6 ], extra = extra )
235249 assert self .gantry .extra == extra
236250
251+ async def test_get_kinematics (self ):
252+ async with ChannelFor ([self .service ]) as channel :
253+ client = GantryClient (self .gantry .name , channel )
254+ format , data = await client .get_kinematics (timeout = 1.1 )
255+ assert format == self .gantry .kinematics [0 ]
256+ assert data == self .gantry .kinematics [1 ]
257+ assert self .gantry .timeout == loose_approx (1.1 )
258+
237259 async def test_get_geometries (self ):
238260 async with ChannelFor ([self .service ]) as channel :
239261 client = GantryClient (self .gantry .name , channel )
240262 geometries = await client .get_geometries ()
241- assert geometries == GEOMETRIES
263+ assert geometries == GEOMETRIES
0 commit comments