iotbot_node.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
2 #include <ros/console.h>
3 
4 #include "IOTBot.h"
5 
11 int main(int argc, char** argv)
12 {
13  ros::init(argc, argv, "iotbot_node");
14  iotbot::ChassisParams chassisParams;
15  iotbot::MotorParams motorParams;
16 
17  // Assign motor channels to motor/wheel mounting
18  ros::NodeHandle nh("~");
19 
20  nh.param("track", chassisParams.track, 0.3f);
21  nh.param("wheelBase", chassisParams.wheelBase, 0.3f);
22  nh.param("wheelDiameter", chassisParams.wheelDiameter, 0.15f);
23  nh.param("chFrontLeft", chassisParams.chFrontLeft, 2);
24  nh.param("chFrontRight", chassisParams.chFrontRight, 1);
25  nh.param("chRearLeft", chassisParams.chRearLeft, 3);
26  nh.param("chRearRight", chassisParams.chRearRight, 0);
27  nh.param("direction", chassisParams.direction, -1);
28  nh.param("enableYMotion", chassisParams.enableYMotion, 0);
29  nh.param("gearRatio", motorParams.gearRatio, 70.f);
30  nh.param("encoderRatio", motorParams.encoderRatio, 64.f);
31  nh.param("rpmMax", motorParams.rpmMax, 140.f);
32  nh.param("controlFrequency", motorParams.controlFrequency, 16000);
33  nh.param("kp", motorParams.kp, 1.f);
34  nh.param("ki", motorParams.ki, 0.f);
35  nh.param("kd", motorParams.kd, 0.f);
36  nh.param("lowPassInputFilter", motorParams.lowPassInputFilter, 1.f);
37  nh.param("lowPassEncoderTicks", motorParams.lowPassEncoderTicks, 1.f);
38 
39  iotbot::IOTBot robot(chassisParams, motorParams);
40  robot.run();
41 }
iotbot::MotorParams::rpmMax
float rpmMax
Definition: IOTBot.h:30
iotbot::MotorParams::lowPassEncoderTicks
float lowPassEncoderTicks
Definition: IOTBot.h:36
iotbot::ChassisParams
Definition: IOTBot.h:77
iotbot::MotorParams::controlFrequency
int controlFrequency
Definition: IOTBot.h:31
iotbot::ChassisParams::chRearLeft
int chRearLeft
Definition: IOTBot.h:84
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
iotbot::MotorParams::ki
float ki
Definition: IOTBot.h:33
IOTBot.h
ros.h
iotbot::ChassisParams::chRearRight
int chRearRight
Definition: IOTBot.h:85
iotbot::MotorParams::kp
float kp
Definition: IOTBot.h:32
iotbot::MotorParams::kd
float kd
Definition: IOTBot.h:34
iotbot::MotorParams::gearRatio
float gearRatio
Definition: IOTBot.h:28
iotbot::ChassisParams::wheelDiameter
float wheelDiameter
Definition: IOTBot.h:81
console.h
iotbot::ChassisParams::wheelBase
float wheelBase
Definition: IOTBot.h:80
iotbot::ChassisParams::chFrontLeft
int chFrontLeft
Definition: IOTBot.h:82
iotbot::MotorParams
Definition: IOTBot.h:26
iotbot::IOTBot
Definition: IOTBot.h:108
iotbot::ChassisParams::direction
int direction
Definition: IOTBot.h:86
main
int main(int argc, char **argv)
ROS node for the IOT2050 robot shield, Version 2.
Definition: iotbot_node.cpp:11
iotbot::MotorParams::lowPassInputFilter
float lowPassInputFilter
Definition: IOTBot.h:35
ros::NodeHandle::param
T param(const std::string &param_name, const T &default_val) const
iotbot::IOTBot::run
void run()
Definition: IOTBot.cpp:70
iotbot::ChassisParams::enableYMotion
int enableYMotion
Definition: IOTBot.h:87
iotbot::ChassisParams::chFrontRight
int chFrontRight
Definition: IOTBot.h:83
iotbot::MotorParams::encoderRatio
float encoderRatio
Definition: IOTBot.h:29
iotbot::ChassisParams::track
float track
Definition: IOTBot.h:79
ros::NodeHandle


iotbot
Author(s): Stefan May (EduArt Robotik)
autogenerated on Wed May 24 2023 02:13:39