Skip to content

Commit ff6fe3c

Browse files
committed
fmt + comments
1 parent 600e437 commit ff6fe3c

File tree

1 file changed

+91
-91
lines changed

1 file changed

+91
-91
lines changed

python_client/src/lib.rs

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ impl PyPoulpeRemoteClient {
3434

3535
/// Get the mode of operation
3636
///
37-
/// Args:
38-
/// slave_id (int): The slave id
39-
/// Returns:
40-
/// int: The mode of operation - 1: Profile Position Mode, 3: Profile Velocity Mode, 4: Profile Torque Mode
37+
/// # Args:
38+
/// * slave_id (int): The slave id
39+
/// # Returns:
40+
/// * int: The mode of operation - 1: Profile Position Mode, 3: Profile Velocity Mode, 4: Profile Torque Mode
4141
pub fn get_mode_of_operation(&mut self, slave_id: u16) -> u32 {
4242
match self.client.get_mode_of_operation(slave_id) {
4343
Ok(mode) => mode,
@@ -47,17 +47,17 @@ impl PyPoulpeRemoteClient {
4747

4848
/// Set the mode of operation
4949
///
50-
/// Args:
51-
/// slave_id (int): The slave id
52-
/// mode (int): The mode of operation - 1: Profile Position Mode, 3: Profile Velocity Mode, 4: Profile Torque Mode
50+
/// # Args:
51+
/// * slave_id (int): The slave id
52+
/// * mode (int): The mode of operation - 1: Profile Position Mode, 3: Profile Velocity Mode, 4: Profile Torque Mode
5353
pub fn set_mode_of_operation(&mut self, slave_id: u16, mode: u32) {
5454
self.client.set_mode_of_operation(slave_id, mode);
5555
}
5656

5757
/// Print the mode of operation
5858
///
59-
/// Args:
60-
/// slave_id (int): The slave id
59+
/// # Args:
60+
/// * slave_id (int): The slave id
6161
///
6262
/// Outputs the mode of operation
6363
pub fn print_mode_of_operation(&mut self, slave_id: u16) {
@@ -71,53 +71,53 @@ impl PyPoulpeRemoteClient {
7171

7272
/// Enable the actuators
7373
///
74-
/// Args:
75-
/// slave_id (int): The slave id
74+
/// # Args:
75+
/// * slave_id (int): The slave id
7676
pub fn turn_on(&mut self, slave_id: u16) {
7777
self.client.turn_on(slave_id);
7878
}
7979

8080
/// Disable the actuators
8181
///
82-
/// Args:
83-
/// slave_id (int): The slave id
82+
/// # Args:
83+
/// * slave_id (int): The slave id
8484
pub fn turn_off(&mut self, slave_id: u16) {
8585
self.client.turn_off(slave_id);
8686
}
8787

8888
/// Set the target position
8989
///
90-
/// Args:
91-
/// slave_id (int): The slave id
92-
/// position (list): The target position
90+
/// # Args:
91+
/// * slave_id (int): The slave id
92+
/// * position (list): The target position
9393
pub fn set_target_position(&mut self, slave_id: u16, position: Vec<f32>) {
9494
self.client.set_target_position(slave_id, position);
9595
}
9696

9797
/// Set the velocity limit
9898
///
99-
/// Args:
100-
/// slave_id (int): The slave id
101-
/// velocity_limit (list): Relative velocity limit from 0 to 1
99+
/// # Args:
100+
/// * slave_id (int): The slave id
101+
/// * velocity_limit (list): Relative velocity limit from 0 to 1
102102
pub fn set_velocity_limit(&mut self, slave_id: u16, velocity: Vec<f32>) {
103103
self.client.set_velocity_limit(slave_id, velocity);
104104
}
105105

106106
/// Set the torque limit
107107
///
108-
/// Args:
109-
/// slave_id (int): The slave id
110-
/// torque_limit (list): Relative torque limit from 0 to 1
108+
/// # Args:
109+
/// * slave_id (int): The slave id
110+
/// * torque_limit (list): Relative torque limit from 0 to 1
111111
pub fn set_torque_limit(&mut self, slave_id: u16, torque: Vec<f32>) {
112112
self.client.set_torque_limit(slave_id, torque);
113113
}
114114

115115
/// Get the actual position
116116
///
117-
/// Args:
118-
/// slave_id (int): The slave id
119-
/// Returns:
120-
/// list: The actual position
117+
/// # Args:
118+
/// * slave_id (int): The slave id
119+
/// # Returns:
120+
/// * list: The actual position
121121
pub fn get_position_actual_value(&mut self, slave_id: u16) -> Vec<f32> {
122122
match self.client.get_position_actual_value(slave_id) {
123123
Ok(position) => position,
@@ -127,10 +127,10 @@ impl PyPoulpeRemoteClient {
127127

128128
/// Get the target position
129129
///
130-
/// Args:
131-
/// slave_id (int): The slave id
132-
/// Returns:
133-
/// list: The target position
130+
/// # Args:
131+
/// * slave_id (int): The slave id
132+
/// # Returns:
133+
/// * list: The target position
134134
pub fn get_target_position(&mut self, slave_id: u16) -> Vec<f32> {
135135
match self.client.get_target_position(slave_id) {
136136
Ok(position) => position,
@@ -140,29 +140,29 @@ impl PyPoulpeRemoteClient {
140140

141141
/// Get the target velocity
142142
///
143-
/// Args:
144-
/// slave_id (int): The slave id
145-
/// Returns:
146-
/// list: The target velocity
143+
/// # Args:
144+
/// * slave_id (int): The slave id
145+
/// # Returns:
146+
/// * list: The target velocity
147147
pub fn set_target_velocity(&mut self, slave_id: u16, velocity: Vec<f32>) {
148148
self.client.set_target_velocity(slave_id, velocity);
149149
}
150150

151151
/// Set the target torque
152152
///
153-
/// Args:
154-
/// slave_id (int): The slave id
155-
/// torque (list): The target torque
153+
/// # Args:
154+
/// * slave_id (int): The slave id
155+
/// * torque (list): The target torque
156156
pub fn set_target_torque(&mut self, slave_id: u16, torque: Vec<f32>) {
157157
self.client.set_target_torque(slave_id, torque);
158158
}
159159

160160
/// Get the actual velocity
161161
///
162-
/// Args:
163-
/// slave_id (int): The slave id
164-
/// Returns:
165-
/// list: The actual velocity
162+
/// # Args:
163+
/// * slave_id (int): The slave id
164+
/// # Returns:
165+
/// * list: The actual velocity
166166
pub fn get_velocity_actual_value(&mut self, slave_id: u16) -> Vec<f32> {
167167
match self.client.get_velocity_actual_value(slave_id) {
168168
Ok(velocity) => velocity,
@@ -172,10 +172,10 @@ impl PyPoulpeRemoteClient {
172172

173173
/// Get the torque velocity
174174
///
175-
/// Args:
176-
/// slave_id (int): The slave id
177-
/// Returns:
178-
/// list: The actual torque
175+
/// # Args:
176+
/// * slave_id (int): The slave id
177+
/// # Returns:
178+
/// * list: The actual torque
179179
pub fn get_torque_actual_value(&mut self, slave_id: u16) -> Vec<f32> {
180180
match self.client.get_torque_actual_value(slave_id) {
181181
Ok(torque) => torque,
@@ -185,10 +185,10 @@ impl PyPoulpeRemoteClient {
185185

186186
/// Get the current axis sensor values
187187
///
188-
/// Args:
189-
/// slave_id (int): The slave id
190-
/// Returns:
191-
/// list: The current axis sensor values
188+
/// # Args:
189+
/// * slave_id (int): The slave id
190+
/// # Returns:
191+
/// * list: The current axis sensor values
192192
pub fn get_axis_sensors(&mut self, slave_id: u16) -> Vec<f32> {
193193
match self.client.get_axis_sensors(slave_id) {
194194
Ok(sensors) => sensors,
@@ -198,10 +198,10 @@ impl PyPoulpeRemoteClient {
198198

199199
/// Get the axis sensor zeros in firmware
200200
///
201-
/// Args:
202-
/// slave_id (int): The slave id
203-
/// Returns:
204-
/// list: The axis sensor zero values
201+
/// # Args:
202+
/// * slave_id (int): The slave id
203+
/// # Returns:
204+
/// * list: The axis sensor zero values
205205
pub fn get_axis_sensor_zeros(&mut self, slave_id: u16) -> Vec<f32> {
206206
match self.client.get_axis_sensor_zeros(slave_id) {
207207
Ok(zeros) => zeros,
@@ -211,10 +211,10 @@ impl PyPoulpeRemoteClient {
211211

212212
/// Check if motors are activated
213213
///
214-
/// Args:
215-
/// slave_id (int): The slave id
216-
/// Returns:
217-
/// bool: True if the motor is activated, False otherwise
214+
/// # Args:
215+
/// * slave_id (int): The slave id
216+
/// # Returns:
217+
/// * bool: True if the motor is activated, False otherwise
218218
pub fn get_torque_state(&mut self, slave_id: u16) -> bool {
219219
match self.client.get_torque_state(slave_id) {
220220
Ok(state) => state,
@@ -224,10 +224,10 @@ impl PyPoulpeRemoteClient {
224224

225225
/// Get the state
226226
///
227-
/// Args:
228-
/// slave_id (int): The slave id
229-
/// Returns:
230-
/// int: The state (CiA402 state machine)
227+
/// # Args:
228+
/// * slave_id (int): The slave id
229+
/// # Returns:
230+
/// * int: The state (CiA402 state machine)
231231
pub fn get_state(&mut self, slave_id: u16) -> u32 {
232232
match self.client.get_state(slave_id) {
233233
Ok(state) => state,
@@ -238,8 +238,8 @@ impl PyPoulpeRemoteClient {
238238
/// Print the state
239239
/// Outputs the CiA402 state machine state
240240
///
241-
/// Args:
242-
/// slave_id (int): The slave id
241+
/// # Args:
242+
/// * slave_id (int): The slave id
243243
pub fn print_state(&mut self, slave_id: u16) {
244244
let state = match self.client.get_cia402_state(slave_id) {
245245
Ok(state) => state,
@@ -252,10 +252,10 @@ impl PyPoulpeRemoteClient {
252252

253253
/// Get the error codes
254254
///
255-
/// Args:
256-
/// slave_id (int): The slave id
257-
/// Returns:
258-
/// list: The error codes (see poule_ethercat_controller/src/state_machine.rs)
255+
/// # Args:
256+
/// * slave_id (int): The slave id
257+
/// # Returns:
258+
/// * list: The error codes (see poule_ethercat_controller/src/state_machine.rs)
259259
pub fn get_error_codes(&mut self, slave_id: u16) -> Vec<i32> {
260260
match self.client.get_error_codes(slave_id) {
261261
Ok(codes) => codes,
@@ -265,8 +265,8 @@ impl PyPoulpeRemoteClient {
265265

266266
/// Print the error codes
267267
///
268-
/// Args:
269-
/// slave_id (int): The slave id
268+
/// # Args:
269+
/// * slave_id (int): The slave id
270270
pub fn print_error_codes(&mut self, slave_id: u16) {
271271
let error_codes = match self.client.get_error_codes(slave_id) {
272272
Ok(codes) => codes,
@@ -294,8 +294,8 @@ impl PyPoulpeRemoteClient {
294294

295295
/// Get the connected devices
296296
///
297-
/// Returns:
298-
/// list(tuple): The connected devices (slave ids, device names)
297+
/// # Returns:
298+
/// * list(tuple): The connected devices (slave ids, device names)
299299
pub fn get_connected_devices(&mut self) -> (Vec<u16>, Vec<String>) {
300300
(self.client.ids.clone(), self.client.names.clone())
301301
}
@@ -309,10 +309,10 @@ impl PyPoulpeRemoteClient {
309309

310310
/// Get the motor temperatures
311311
///
312-
/// Args:
313-
/// slave_id (int): The slave id
314-
/// Returns:
315-
/// list: The motor temperatures
312+
/// # Args:
313+
/// * slave_id (int): The slave id
314+
/// # Returns:
315+
/// * list: The motor temperatures
316316
pub fn get_motor_temperatures(&mut self, slave_id: u16) -> Vec<f32> {
317317
match self.client.get_motor_temperatures(slave_id) {
318318
Ok(temps) => temps,
@@ -321,10 +321,10 @@ impl PyPoulpeRemoteClient {
321321
}
322322
/// Get the board temperatures
323323
///
324-
/// Args:
325-
/// slave_id (int): The slave id
326-
/// Returns:
327-
/// list: The board temperatures
324+
/// ## Args:
325+
/// * slave_id (int): The slave id
326+
/// ## Returns:
327+
/// * list: The board temperatures
328328
pub fn get_board_temperatures(&mut self, slave_id: u16) -> Vec<f32> {
329329
match self.client.get_board_temperatures(slave_id) {
330330
Ok(temps) => temps,
@@ -334,8 +334,8 @@ impl PyPoulpeRemoteClient {
334334

335335
/// Do an emergency stop
336336
///
337-
/// Args:
338-
/// slave_id (int): The slave id
337+
/// ## Args:
338+
/// * slave_id (int): The slave id
339339
pub fn emergency_stop(&mut self, slave_id: u16) {
340340
self.client.emergency_stop(slave_id);
341341
}
@@ -344,11 +344,11 @@ impl PyPoulpeRemoteClient {
344344
}
345345

346346
/// Launch the server
347-
///
348-
/// Args:
349-
/// file_name (str): The path to the configuration file (default: ../config/ethercat.yaml
350-
/// Returns:
351-
/// str: The URL address of the server
347+
///
348+
/// ## Args:
349+
/// * file_name (str): The path to the configuration file (default: ../config/ethercat.yaml
350+
/// ## Returns:
351+
/// * str: The URL address of the server
352352
#[pyfunction]
353353
#[pyo3(signature = (file_name=None))]
354354
pub fn launch_server(file_name: Option<&str>) -> String {
@@ -369,11 +369,11 @@ pub fn launch_server(file_name: Option<&str>) -> String {
369369
}
370370

371371
/// Get all slaves connected to the master
372-
///
373-
/// Args:
374-
/// addr (str): The URL address of the master
375-
/// Returns:
376-
/// tuple: The slave ids and device names
372+
///
373+
/// ## Args:
374+
/// * addr (str): The URL address of the master
375+
/// ## Returns:
376+
/// * tuple: The slave ids and device names
377377
#[pyfunction]
378378
pub fn get_all_slaves_in_network(addr: &str) -> (Vec<u16>, Vec<String>) {
379379
let addr_uri = match addr.parse::<Uri>() {

0 commit comments

Comments
 (0)