Revision dec96050
Made libscout compile. Changed behavior.cpp to set motors to the same speed in order to test simulator code.
scout/libscout/src/behavior.cpp | ||
---|---|---|
44 | 44 |
* \param argv The array of command line arguments |
45 | 45 |
**/ |
46 | 46 |
int main(int argc, char **argv){ |
47 |
/* Todo: Replace this tester code */ |
|
48 |
/* Creates a simple publisher/subscriber node to test simulator |
|
49 |
* for motors interface |
|
50 |
*/ |
|
51 |
|
|
52 |
/* Initialize ROS */ |
|
53 |
ros::init(argc, argv, "libscout"); |
|
54 |
/* Initialize Scout library */ |
|
47 | 55 |
init(LIB_ALL, argc, argv); |
48 |
/** \todo remove this test code **/ |
|
49 |
// motors_set(100, MOTOR_ALL); |
|
50 |
ROS_INFO("%d", motors_query(MOTOR_FL)); |
|
51 |
|
|
52 |
ROS_SPIN( |
|
56 |
|
|
57 |
/* Some nodehandle to something. I'd tell you what except its called n_ |
|
58 |
* so it wouldnt reflect in the rest of the code. |
|
59 |
*/ |
|
60 |
ros::NodeHandle n_; |
|
61 |
|
|
62 |
ros::Publisher motors_set = n_.advertise<motors::set_motors>("Stuff", 1000); |
|
63 |
|
|
64 |
ros::Rate loop_rate(10); |
|
65 |
|
|
66 |
while(ros::ok()){ |
|
67 |
motors::set_motors msg; |
|
68 |
|
|
69 |
/* Set message fields */ |
|
70 |
msg.fl_speed = 125; |
|
71 |
msg.bl_speed = 125; |
|
72 |
msg.fr_speed = 125; |
|
73 |
msg.br_speed = 125; |
|
74 |
msg.which = 0; |
|
75 |
msg.units = MOTOR_ABSOLUTE; |
|
76 |
|
|
77 |
/* publish */ |
|
78 |
motors_set.publish(msg); |
|
79 |
|
|
80 |
ros::spinOnce(); |
|
81 |
|
|
82 |
loop_rate.sleep(); |
|
83 |
} |
|
84 |
|
|
53 | 85 |
return 0; |
54 |
} |
|
86 |
} |
Also available in: Unified diff