motor_node.cc
Go to the documentation of this file.
1 
31 #include <dynamic_reconfigure/server.h>
32 #include <ros/ros.h>
33 #include "std_msgs/String.h"
34 #include <time.h>
35 #include <ubiquity_motor/PIDConfig.h>
39 #include <boost/thread.hpp>
40 #include <iostream>
41 #include <string>
43 
44 static const double BILLION = 1000000000.0;
45 
49 
50 // TODO: Enhancement - Make WHEEL_SLIP_THRESHOLD be a ROS param
51 #define WHEEL_SLIP_THRESHOLD (0.08) // Rotation below which we null excess wheel torque in 4wd drive_type
53 
54 // Until we have a holdoff for MCB message overruns we do this delay to be cautious
55 // Twice the period for status reports from MCB
57 
58 // Dynamic reconfiguration callback for setting ROS parameters dynamically
59 void PID_update_callback(const ubiquity_motor::PIDConfig& config,
60  uint32_t level) {
61  if (level == 0xFFFFFFFF) {
62  return;
63  }
64 
65  if (level == 1) {
66  g_firmware_params.pid_proportional = config.PID_P;
67  } else if (level == 2) {
68  g_firmware_params.pid_integral = config.PID_I;
69  } else if (level == 4) {
70  g_firmware_params.pid_derivative = config.PID_D;
71  } else if (level == 8) {
72  g_firmware_params.pid_denominator = config.PID_C;
73  } else if (level == 16) {
75  } else if (level == 32) {
76  g_firmware_params.pid_velocity = config.PID_V;
77  } else if (level == 64) {
78  g_firmware_params.max_pwm = config.MAX_PWM;
79  } else {
80  ROS_ERROR("Unsupported dynamic_reconfigure level %u", level);
81  }
82 }
83 
84 // The system_control topic is used to be able to stop or start communications from the MCB
85 // and thus allow live firmware updates or other direct MCB serial communications to happen
86 // without the main control code trying to talk to the MCB
87 void SystemControlCallback(const std_msgs::String::ConstPtr& msg) {
88  ROS_DEBUG("System control msg with content: '%s']", msg->data.c_str());
89 
90  // Manage the complete cut-off of all control to the MCB
91  // Typically used for firmware upgrade, but could be used for other diagnostics
92  if (msg->data.find(MOTOR_CONTROL_CMD) != std::string::npos) {
93  if (msg->data.find(MOTOR_CONTROL_ENABLE) != std::string::npos) {;
94  if (g_node_params.mcbControlEnabled == 0) { // Only show message if state changes
95  ROS_INFO("Received System control msg to ENABLE control of the MCB");
96  }
98  } else if (msg->data.find(MOTOR_CONTROL_DISABLE) != std::string::npos) {
99  if (g_node_params.mcbControlEnabled != 0) { // Only show message if state changes
100  ROS_INFO("Received System control msg to DISABLE control of the MCB");
101  }
103  }
104  }
105 
106  // Manage a motor speed override used to allow collision detect motor stopping
107  if (msg->data.find(MOTOR_SPEED_CONTROL_CMD) != std::string::npos) {
108  if (msg->data.find(MOTOR_CONTROL_ENABLE) != std::string::npos) {;
109  if (g_node_params.mcbSpeedEnabled == 0) { // Only show message if state changes
110  ROS_INFO("Received System control msg to ENABLE control of motor speed");
111  }
113  } else if (msg->data.find(MOTOR_CONTROL_DISABLE) != std::string::npos) {
114  if (g_node_params.mcbSpeedEnabled != 0) { // Only show message if state changes
115  ROS_INFO("Received System control msg to DISABLE control of motor speed");
116  }
118  }
119  }
120 }
121 
122 // initMcbParameters()
123 //
124 // Setup MCB parameters that are from host level options or settings
125 //
126 void initMcbParameters(std::unique_ptr<MotorHardware> &robot )
127 {
128  // A full mcb initialization requires high level system overrides to be disabled
131 
132  // Force future calls to sendParams() to update current pid parametes on the MCB
133  robot->forcePidParamUpdates();
134 
135  // Determine the wheel type to be used by the robot base
136  int32_t wheel_type = MotorMessage::OPT_WHEEL_TYPE_STANDARD;
137  if (g_node_params.wheel_type == "firmware_default") {
138  // Here there is no specification so the firmware default will be used
139  ROS_INFO("Default wheel_type of 'standard' will be used.");
141  } else {
142  // Any other setting leads to host setting the wheel type
143  if (g_node_params.wheel_type == "standard") {
145  ROS_INFO("Host is specifying wheel_type of '%s'", "standard");
146  } else if (g_node_params.wheel_type == "thin"){
148  ROS_INFO("Host is specifying wheel_type of '%s'", "thin");
149 
150  // If thin wheels and no drive_type is in yaml file we will use 4wd
151  if (g_node_params.drive_type == "firmware_default") {
152  ROS_INFO("Default to drive_type of 4wd when THIN wheels unless option drive_type is set");
153  g_node_params.drive_type = "4wd";
154  }
155  } else {
156  ROS_WARN("Invalid wheel_type of '%s' specified! Using wheel type of standard",
157  g_node_params.wheel_type.c_str());
158  g_node_params.wheel_type = "standard";
160  }
161  }
162  // Write out the wheel type setting to hardware layer
163  robot->setWheelType(wheel_type);
164  robot->wheel_type = wheel_type;
166 
167  // Determine the wheel gear ratio to be used by the robot base
168  // Firmware does not use this setting so no message to firmware is required
169  // This gear ratio is contained in the hardware layer so if this node got new setting update hardware layer
170  robot->setWheelGearRatio(g_node_params.wheel_gear_ratio);
171  ROS_INFO("Wheel gear ratio of %5.3f will be used.", g_node_params.wheel_gear_ratio);
172 
173  // Determine the drive type to be used by the robot base
174  int32_t drive_type = MotorMessage::OPT_DRIVE_TYPE_STANDARD;
175  if (g_node_params.drive_type == "firmware_default") {
176  // Here there is no specification so the firmware default will be used
177  ROS_INFO("Default drive_type of 'standard' will be used.");
179  } else {
180  // Any other setting leads to host setting the drive type
181  if (g_node_params.drive_type == "standard") {
183  ROS_INFO("Host is specifying drive_type of '%s'", "standard");
184  } else if (g_node_params.drive_type == "4wd"){
186  ROS_INFO("Host is specifying drive_type of '%s'", "4wd");
187  } else {
188  ROS_WARN("Invalid drive_type of '%s' specified! Using drive type of standard",
189  g_node_params.drive_type.c_str());
190  g_node_params.drive_type = "standard";
192  }
193  }
194  // Write out the drive type setting to hardware layer
195  robot->setDriveType(drive_type);
196  robot->drive_type = drive_type;
198 
199  int32_t wheel_direction = 0;
200  if (g_node_params.wheel_direction == "firmware_default") {
201  // Here there is no specification so the firmware default will be used
202  ROS_INFO("Firmware default wheel_direction will be used.");
203  } else {
204  // Any other setting leads to host setting the wheel type
205  if (g_node_params.wheel_direction == "standard") {
206  wheel_direction = MotorMessage::OPT_WHEEL_DIR_STANDARD;
207  ROS_INFO("Host is specifying wheel_direction of '%s'", "standard");
208  } else if (g_node_params.wheel_direction == "reverse"){
209  wheel_direction = MotorMessage::OPT_WHEEL_DIR_REVERSE;
210  ROS_INFO("Host is specifying wheel_direction of '%s'", "reverse");
211  } else {
212  ROS_WARN("Invalid wheel_direction of '%s' specified! Using wheel direction of standard",
214  g_node_params.wheel_direction = "standard";
215  wheel_direction = MotorMessage::OPT_WHEEL_DIR_STANDARD;
216  }
217  // Write out the wheel direction setting
218  robot->setWheelDirection(wheel_direction);
220  }
221 
222  // Tell the controller board firmware what version the hardware is at this time.
223  // TODO: Read from I2C. At this time we only allow setting the version from ros parameters
224  if (robot->firmware_version >= MIN_FW_HW_VERSION_SET) {
225  ROS_INFO_ONCE("Firmware is version %d. Setting Controller board version to %d",
226  robot->firmware_version, g_firmware_params.controller_board_version);
227  robot->setHardwareVersion(g_firmware_params.controller_board_version);
228  ROS_DEBUG("Controller board version has been set to %d",
231  }
232 
233  // Suggest to customer to have current firmware version
234  if (robot->firmware_version < MIN_FW_SUGGESTED) {
235  ROS_ERROR_ONCE("Firmware is version V%d. We strongly recommend minimum firmware version of at least V%d",
236  robot->firmware_version, MIN_FW_SUGGESTED);
238  } else {
239  ROS_INFO_ONCE("Firmware is version V%d. This meets the recommend minimum firmware versionof V%d",
240  robot->firmware_version, MIN_FW_SUGGESTED);
242  }
243 
244  // Certain 4WD robots rely on wheels to skid to reach final positions.
245  // For such robots when loaded down the wheels can get in a state where they cannot skid.
246  // This leads to motor overheating. This code below sacrifices accurate odometry which
247  // is not achievable in such robots anyway to relieve high wattage drive power when zero velocity.
249  if ((robot->firmware_version >= MIN_FW_WHEEL_NULL_ERROR) && (g_node_params.drive_type == "4wd")) {
251  ROS_INFO("Wheel slip nulling will be enabled for this 4wd system when velocity remains at zero.");
252  }
253 
254  // Tell the MCB board what the port that is on the Pi I2c says on it (the mcb cannot read it's own switchs!)
255  // We could re-read periodically but perhaps only every 5-10 sec but should do it from main loop
256  if (robot->firmware_version >= MIN_FW_OPTION_SWITCH && robot->hardware_version >= MIN_HW_OPTION_SWITCH) {
257  g_firmware_params.option_switch = robot->getOptionSwitch();
258  ROS_INFO("Setting firmware option register to 0x%x.", g_firmware_params.option_switch);
259  robot->setOptionSwitchReg(g_firmware_params.option_switch);
261  }
262 
263  if (robot->firmware_version >= MIN_FW_SYSTEM_EVENTS) {
264  // Start out with zero for system events
265  robot->setSystemEvents(0); // Clear entire system events register
266  robot->system_events = 0;
268  }
269 
270  // Setup other firmware parameters that could come from ROS parameters
271  if (robot->firmware_version >= MIN_FW_ESTOP_SUPPORT) {
272  robot->setEstopPidThreshold(g_firmware_params.estop_pid_threshold);
274  robot->setEstopDetection(g_firmware_params.estop_detection);
276  }
277 
278  if (robot->firmware_version >= MIN_FW_MAX_SPEED_AND_PWM) {
279  robot->setMaxFwdSpeed(g_firmware_params.max_speed_fwd);
281  robot->setMaxRevSpeed(g_firmware_params.max_speed_rev);
283  }
284 
285  return;
286 }
287 
288 int main(int argc, char* argv[]) {
289  ros::init(argc, argv, "motor_node");
290  ros::NodeHandle nh;
291 
295 
297 
298  int lastMcbEnabled = 1;
299 
300  // Until we have a holdoff for MCB message overruns we do this delay to be cautious
301  // Twice the period for status reports from MCB
303 
304  std::unique_ptr<MotorHardware> robot = nullptr;
305  // Keep trying to open serial
306  {
307  int times = 0;
308  while (ros::ok() && robot.get() == nullptr) {
309  try {
311  }
312  catch (const serial::IOException& e) {
313  if (times % 30 == 0)
314  ROS_FATAL("Error opening serial port %s, trying again", g_serial_params.serial_port.c_str());
315  }
316  ctrlLoopDelay.sleep();
317  times++;
318  }
319  }
320 
321  controller_manager::ControllerManager cm(robot.get(), nh);
322 
323  // Subscribe to the topic with overall system control ability
325 
327  spinner.start();
328 
329  dynamic_reconfigure::Server<ubiquity_motor::PIDConfig> server;
330  dynamic_reconfigure::Server<ubiquity_motor::PIDConfig>::CallbackType f;
331 
332  f = boost::bind(&PID_update_callback, _1, _2);
333  server.setCallback(f);
334 
335  robot->setParams(g_firmware_params);
336  robot->requestFirmwareVersion();
337 
338  // wait for reply then we know firmware version
340 
341  // Make sure firmware is listening
342  {
343  robot->diag_updater.broadcast(0, "Establishing communication with motors");
344  // Start times counter at 1 to prevent false error print (0 % n = 0)
345  int times = 1;
346  while (ros::ok() && robot->firmware_version == 0) {
347  if (times % 30 == 0)
348  ROS_ERROR("The Firmware not reporting its version");
349  robot->requestFirmwareVersion();
350  robot->readInputs(0);
352  times++;
353  }
354  }
355 
356  if (robot->firmware_version >= MIN_FW_FIRMWARE_DATE) {
357  // If supported by firmware also request date code for this version
358  ROS_INFO("Requesting Firmware daycode ");
359  robot->requestFirmwareDate();
360  }
361 
362  // Setup MCB parameters that are defined by host parameters in most cases
363  ROS_INFO("Initializing MCB");
364  initMcbParameters(robot);
365  ROS_INFO("Initialization of MCB completed.");
366 
367  if (robot->firmware_version >= MIN_FW_SYSTEM_EVENTS) {
368  // Start out with zero for system events
369  robot->setSystemEvents(0); // Clear entire system events register
370  robot->system_events = 0;
372  }
373 
374  // Send out the refreshable firmware parameters, most are the PID terms
375  // We must be sure num_fw_params is set to the modulo used in sendParams()
376  for (int i = 0; i < robot->num_fw_params; i++) {
378  robot->sendParams();
379  }
380 
381  float expectedCycleTime = ctrlLoopDelay.expectedCycleTime().toSec();
382  ros::Duration minCycleTime = ros::Duration(0.75 * expectedCycleTime);
383  ros::Duration maxCycleTime = ros::Duration(1.25 * expectedCycleTime);
384 
385  // Clear any commands the robot has at this time
386  robot->clearCommands();
387 
388  double leftLastWheelPos = 0.0;
389  double rightLastWheelPos = 0.0;
390  double leftWheelPos = 0.0;
391  double rightWheelPos = 0.0;
392  robot-> getWheelJointPositions(leftLastWheelPos, rightWheelPos);
393  ros::Duration zeroVelocityTime(0.0);
394 
395  // Define a period where if wheels are under stress for this long we back off stress
396  ros::Duration wheelSlipNullingPeriod(2.0);
397  int wheelSlipEvents = 0;
398 
399  ROS_INFO("Starting motor control node now");
400 
401  // Implement a speed reset while ESTOP is active and a delay after release
402  double estopReleaseDeadtime = 0.8;
403  double estopReleaseDelay = 0.0;
404 
405  // Setup to be able to do periodic operations based on elapsed times
406  ros::Time current_time;
407  ros::Duration sysMaintPeriod(60.0); // A periodic MCB maintenance operation
408  ros::Duration jointUpdatePeriod(0.25); // A periodic time to update joint velocity
409 
410  ros::Time last_loop_time = ros::Time::now();
411  ros::Duration elapsed_loop_time;
412  ros::Time last_sys_maint_time = last_loop_time;
413  ros::Time last_joint_time = last_loop_time;
414  ctrlLoopDelay.sleep(); // Do delay to setup periodic loop delays
415  uint32_t loopIdx = 0;
416 
417  while (ros::ok()) {
418  current_time = ros::Time::now();
419  elapsed_loop_time = current_time - last_loop_time;
420  last_loop_time = current_time;
421  loopIdx += 1;
422 
423  // Speical handling if motor control is disabled. skip the entire loop
424  if (g_node_params.mcbControlEnabled == 0) {
425  // Check for if we are just starting to go into idle mode and release MCB
426  if (lastMcbEnabled == 1) {
427  ROS_WARN("Motor controller going offline and closing MCB serial port");
428  robot->closePort();
429  }
430  lastMcbEnabled = 0;
431  ctrlLoopDelay.sleep(); // Allow controller to process command
432  continue;
433  }
434 
435  if (lastMcbEnabled == 0) { // Were disabled but re-enabled so re-setup mcb
436  bool portOpenStatus;
437  lastMcbEnabled = 1;
438  ROS_WARN("Motor controller went from offline to online!");
439  portOpenStatus = robot->openPort(); // Must re-open serial port
440  if (portOpenStatus == true) {
441  robot->setSystemEvents(0); // Clear entire system events register
442  robot->system_events = 0;
444 
445  // Setup MCB parameters that are defined by host parameters in most cases
446  initMcbParameters(robot);
447  ROS_WARN("Motor controller has been re-initialized as we go back online");
448  } else {
449  // We do not have recovery from this situation and it seems not possible
450  ROS_ERROR("ERROR in re-opening of the Motor controller!");
451  }
452  }
453 
454  // Determine and set wheel velocities in rad/sec from hardware positions in rads
455  ros::Duration elapsed_time = current_time - last_joint_time;
456  if (elapsed_time > jointUpdatePeriod) {
457  last_joint_time = ros::Time::now();
458  double leftWheelVel = 0.0;
459  double rightWheelVel = 0.0;
460  robot-> getWheelJointPositions(leftWheelPos, rightWheelPos);
461  leftWheelVel = (leftWheelPos - leftLastWheelPos) / elapsed_time.toSec();
462  rightWheelVel = (rightWheelPos - rightLastWheelPos) / elapsed_time.toSec();
463  robot->setWheelJointVelocities(leftWheelVel, rightWheelVel); // rad/sec
464  leftLastWheelPos = leftWheelPos;
465  rightLastWheelPos = rightWheelPos;
466 
467  // Publish motor state at this time
468  robot->publishMotorState();
469 
470  // Implement static wheel slippage relief
471  // Deal with auto-null of MCB wheel setpoints if wheel slip nulling is enabled
472  // We null wheel torque if wheel speed has been very low for a long time
473  // This would be even better if we only did this when over a certain current is heating the wheel
474  if (g_wheel_slip_nulling != 0) {
475  if (robot->areWheelSpeedsLower(WHEEL_SLIP_THRESHOLD) != 0) {
476  zeroVelocityTime += jointUpdatePeriod; // add to time at zero velocity
477  if (zeroVelocityTime > wheelSlipNullingPeriod) {
478  // null wheel error if at zero velocity for the nulling check period
479  // OPTION: We could also just null wheels at high wheel power
480  ROS_DEBUG("Applying wheel slip relief now with slip period of %4.1f sec ",
481  wheelSlipNullingPeriod.toSec());
482  wheelSlipEvents += 1;
483  robot->nullWheelErrors();
484  zeroVelocityTime = ros::Duration(0.0); // reset time we have been at zero velocity
485  }
486  } else {
487  zeroVelocityTime = ros::Duration(0.0); // reset time we have been at zero velocity
488  }
489  }
490  }
491 
492  // Read in and process all serial packets that came from the MCB.
493  // The MotorSerial class has been receiving and queing packets from the MCB
494  robot->readInputs(loopIdx);
495 
496  // Here is the update call that ties our motor node to the standard ROS classes.
497  // We will supply a brief overview of how this ROS robot interfaces to our hardware.
498  // At the top is the controller_manager and just below it is hardware_interface
499  // The ROS DiffDriveController works with one 'joint' for each wheel.
500  // to know and publish /odom and generate the odom to base_footprint in /tf topic
501  //
502  // Refer to motor_hardware.cc code and study any interfaces to the joints_ array
503  // where there is one 'joint' for each wheel.
504  // The joints_ used by ROS DiffDriveController have these 3 key members:
505  // position - We incrementally update wheel position (from encoders)
506  // velocity - We set desired wheel velocity in Rad/Sec
507  // velocity_command - We are told what speeds to set our MCB hardware with from this
508 
509  if ((minCycleTime < elapsed_loop_time) && (elapsed_loop_time < maxCycleTime)) {
510  cm.update(current_time, elapsed_loop_time); // Key update to controller_manager
511  }
512  else {
513  ROS_WARN("Resetting controller due to time jump %f seconds",
514  elapsed_loop_time.toSec());
515  cm.update(current_time, ctrlLoopDelay.expectedCycleTime(), true);
516  robot->clearCommands();
517  }
518  robot->setParams(g_firmware_params);
519  robot->sendParams();
520 
521  // Periodically watch for MCB board having been reset which is an MCB system event
522  // This is also a good place to refresh or show status that may have changed
523  elapsed_time = current_time - last_sys_maint_time;
524  if ((robot->firmware_version >= MIN_FW_SYSTEM_EVENTS) && (elapsed_time > sysMaintPeriod)) {
525  robot->requestSystemEvents();
527  last_sys_maint_time = ros::Time::now();
528 
529  // See if we are in a low battery voltage state
530  std::string batStatus = "OK";
531  if (robot->getBatteryVoltage() < g_firmware_params.battery_voltage_low_level) {
532  batStatus = "LOW!";
533  }
534 
535  // Post a status message for MCB state periodically. This may be nice to do more on as required
536  ROS_INFO("Battery = %5.2f volts [%s], MCB system events 0x%x, PidCtrl 0x%x, WheelType '%s' DriveType '%s' GearRatio %6.3f",
537  robot->getBatteryVoltage(), batStatus.c_str(), robot->system_events, robot->getPidControlWord(),
538  (robot->wheel_type == MotorMessage::OPT_WHEEL_TYPE_THIN) ? "thin" : "standard",
539  g_node_params.drive_type.c_str(), robot->getWheelGearRatio());
540 
541  // If we detect a power-on of MCB we should re-initialize MCB
542  if ((robot->system_events & MotorMessage::SYS_EVENT_POWERON) != 0) {
543  ROS_WARN("Detected Motor controller PowerOn event!");
544  robot->setSystemEvents(0); // Clear entire system events register
545  robot->system_events = 0;
547 
548  // Setup MCB parameters that are defined by host parameters in most cases
549  initMcbParameters(robot);
550  ROS_WARN("Motor controller has been re-initialized");
551  }
552 
553  // a periodic refresh of wheel type which is a safety net due to it's importance.
554  // This can be removed when a solid message protocol is developed
555  if (robot->firmware_version >= MIN_FW_WHEEL_TYPE_THIN) {
556  // Refresh the wheel type setting
557  robot->setWheelType(robot->wheel_type);
559  }
560  // a periodic refresh of drive type which is a safety net due to it's importance.
561  if (robot->firmware_version >= MIN_FW_DRIVE_TYPE) {
562  // Refresh the drive type setting
563  robot->setDriveType(robot->drive_type);
565  }
566  }
567 
568  // Update motor controller speeds unless global disable is set, perhaps for colision safety
569  if (robot->getEstopState()) {
570  robot->writeSpeedsInRadians(0.0, 0.0); // We send zero velocity when estop is active
571  estopReleaseDelay = estopReleaseDeadtime;
572  } else {
573  if (estopReleaseDelay > 0.0) {
574  // Implement a delay after estop release where velocity remains zero
575  estopReleaseDelay -= (1.0/g_node_params.controller_loop_rate);
576  robot->writeSpeedsInRadians(0.0, 0.0);
577  } else {
578  if (g_node_params.mcbSpeedEnabled != 0) { // A global disable used for safety at node level
579  robot->writeSpeeds(); // Normal operation using current system speeds
580  } else {
581  robot->writeSpeedsInRadians(0.0, 0.0);
582  }
583  }
584  }
585 
586  robot->diag_updater.update();
587  ctrlLoopDelay.sleep(); // Allow controller to process command
588  }
589 
590  return 0;
591 }
ROS_TOPIC_SYSTEM_CONTROL
#define ROS_TOPIC_SYSTEM_CONTROL
Definition: motor_parameters.h:37
controller_manager::ControllerManager
MotorMessage::OPT_WHEEL_TYPE_STANDARD
@ OPT_WHEEL_TYPE_STANDARD
Definition: motor_message.h:197
NodeParams::wheel_type
std::string wheel_type
Definition: motor_parameters.h:195
MOTOR_CONTROL_CMD
#define MOTOR_CONTROL_CMD
Definition: motor_parameters.h:38
msg
msg
FirmwareParams::estop_detection
int32_t estop_detection
Definition: motor_parameters.h:66
ros::Rate::expectedCycleTime
Duration expectedCycleTime() const
ROS_ERROR_ONCE
#define ROS_ERROR_ONCE(...)
MotorMessage::OPT_DRIVE_TYPE_4WD
@ OPT_DRIVE_TYPE_4WD
Definition: motor_message.h:196
FirmwareParams::pid_proportional
int32_t pid_proportional
Definition: motor_parameters.h:58
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
MIN_FW_MAX_SPEED_AND_PWM
#define MIN_FW_MAX_SPEED_AND_PWM
Definition: motor_message.h:46
ros.h
NodeParams::controller_loop_rate
double controller_loop_rate
Definition: motor_parameters.h:194
time.h
NodeParams::wheel_direction
std::string wheel_direction
Definition: motor_parameters.h:196
ros::AsyncSpinner
NodeParams::drive_type
std::string drive_type
Definition: motor_parameters.h:198
motor_parameters.h
MIN_FW_ESTOP_SUPPORT
#define MIN_FW_ESTOP_SUPPORT
Definition: motor_message.h:44
FirmwareParams::pid_velocity
int32_t pid_velocity
Definition: motor_parameters.h:61
MIN_FW_SUGGESTED
#define MIN_FW_SUGGESTED
Definition: motor_message.h:62
MotorMessage::OPT_WHEEL_DIR_REVERSE
@ OPT_WHEEL_DIR_REVERSE
Definition: motor_message.h:195
MIN_FW_WHEEL_NULL_ERROR
#define MIN_FW_WHEEL_NULL_ERROR
Definition: motor_message.h:59
FirmwareParams::option_switch
int32_t option_switch
Definition: motor_parameters.h:74
MIN_FW_SYSTEM_EVENTS
#define MIN_FW_SYSTEM_EVENTS
Definition: motor_message.h:55
controller_manager.h
MIN_FW_OPTION_SWITCH
#define MIN_FW_OPTION_SWITCH
Definition: motor_message.h:56
ros::ok
ROSCPP_DECL bool ok()
FirmwareParams::battery_voltage_low_level
float battery_voltage_low_level
Definition: motor_parameters.h:78
f
f
FirmwareParams::max_speed_rev
int32_t max_speed_rev
Definition: motor_parameters.h:69
spinner
void spinner()
FirmwareParams::max_speed_fwd
int32_t max_speed_fwd
Definition: motor_parameters.h:68
serial::IOException
Definition: serial.h:688
FirmwareParams::pid_derivative
int32_t pid_derivative
Definition: motor_parameters.h:60
initMcbParameters
void initMcbParameters(std::unique_ptr< MotorHardware > &robot)
Definition: motor_node.cc:126
MotorMessage::OPT_DRIVE_TYPE_STANDARD
@ OPT_DRIVE_TYPE_STANDARD
Definition: motor_message.h:198
ROS_DEBUG
#define ROS_DEBUG(...)
CommsParams
Definition: motor_parameters.h:175
FirmwareParams::estop_pid_threshold
int32_t estop_pid_threshold
Definition: motor_parameters.h:67
PID_update_callback
void PID_update_callback(const ubiquity_motor::PIDConfig &config, uint32_t level)
Definition: motor_node.cc:59
ROS_INFO_ONCE
#define ROS_INFO_ONCE(...)
NodeParams::mcbSpeedEnabled
int mcbSpeedEnabled
Definition: motor_parameters.h:201
NodeParams::wheel_gear_ratio
double wheel_gear_ratio
Definition: motor_parameters.h:197
MIN_FW_FIRMWARE_DATE
#define MIN_FW_FIRMWARE_DATE
Definition: motor_message.h:48
NodeParams::mcbControlEnabled
int mcbControlEnabled
Definition: motor_parameters.h:200
MOTOR_CONTROL_DISABLE
#define MOTOR_CONTROL_DISABLE
Definition: motor_parameters.h:40
ROS_WARN
#define ROS_WARN(...)
SystemControlCallback
void SystemControlCallback(const std_msgs::String::ConstPtr &msg)
Definition: motor_node.cc:87
ros::NodeHandle::subscribe
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
motor_hardware.h
MotorHardware
Definition: motor_hardware.h:133
ros::Rate::sleep
bool sleep()
ROS_FATAL
#define ROS_FATAL(...)
FirmwareParams::pid_integral
int32_t pid_integral
Definition: motor_parameters.h:59
FirmwareParams::controller_board_version
int32_t controller_board_version
Definition: motor_parameters.h:65
MOTOR_SPEED_CONTROL_CMD
#define MOTOR_SPEED_CONTROL_CMD
Definition: motor_parameters.h:41
MotorMessage::OPT_WHEEL_TYPE_THIN
@ OPT_WHEEL_TYPE_THIN
Definition: motor_message.h:194
g_node_params
static NodeParams g_node_params
Definition: motor_node.cc:48
MotorMessage::OPT_WHEEL_DIR_STANDARD
@ OPT_WHEEL_DIR_STANDARD
Definition: motor_message.h:199
WHEEL_SLIP_THRESHOLD
#define WHEEL_SLIP_THRESHOLD
Definition: motor_node.cc:51
main
int main(int argc, char *argv[])
Definition: motor_node.cc:288
CommsParams::serial_port
std::string serial_port
Definition: motor_parameters.h:176
motor_message.h
g_wheel_slip_nulling
int g_wheel_slip_nulling
Definition: motor_node.cc:52
MIN_FW_DRIVE_TYPE
#define MIN_FW_DRIVE_TYPE
Definition: motor_message.h:61
ros::Time
FirmwareParams
Definition: motor_parameters.h:57
NodeParams
Definition: motor_parameters.h:193
MotorMessage::SYS_EVENT_POWERON
@ SYS_EVENT_POWERON
Definition: motor_message.h:226
MIN_HW_OPTION_SWITCH
#define MIN_HW_OPTION_SWITCH
Definition: motor_hardware.h:57
ROS_ERROR
#define ROS_ERROR(...)
BILLION
static const double BILLION
Definition: motor_node.cc:44
mcbStatusPeriodSec
ros::Duration mcbStatusPeriodSec(0.02)
FirmwareParams::max_pwm
int32_t max_pwm
Definition: motor_parameters.h:70
ros::Rate
ros::Duration::sleep
bool sleep() const
DurationBase< Duration >::toSec
double toSec() const
g_serial_params
static CommsParams g_serial_params
Definition: motor_node.cc:47
MIN_FW_HW_VERSION_SET
#define MIN_FW_HW_VERSION_SET
Definition: motor_message.h:45
FirmwareParams::pid_denominator
int32_t pid_denominator
Definition: motor_parameters.h:62
ROS_INFO
#define ROS_INFO(...)
ros::Duration
controller_manager::ControllerManager::update
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)
FirmwareParams::pid_moving_buffer_size
int32_t pid_moving_buffer_size
Definition: motor_parameters.h:63
MIN_FW_WHEEL_TYPE_THIN
#define MIN_FW_WHEEL_TYPE_THIN
Definition: motor_message.h:54
MOTOR_CONTROL_ENABLE
#define MOTOR_CONTROL_ENABLE
Definition: motor_parameters.h:39
g_firmware_params
static FirmwareParams g_firmware_params
Definition: motor_node.cc:46
ros::NodeHandle
ros::Subscriber
ros::Time::now
static Time now()


ubiquity_motor
Author(s):
autogenerated on Thu Nov 16 2023 03:30:55