Skip to content

Commit

Permalink
Merge pull request #81 from machinekoder/machinekit-updates
Browse files Browse the repository at this point in the history
Updates from upstream Machinekit
  • Loading branch information
ArcEye authored Jun 29, 2017
2 parents 30cb027 + 17178e5 commit f4481f5
Show file tree
Hide file tree
Showing 20 changed files with 209 additions and 48 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build
node_modules
objects
generated
machinetalk
doc_base
/node_modules
/objects
/generated
/machinetalk
/doc_base
35 changes: 29 additions & 6 deletions src/README.msgid
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ msgid's have to be unique across all messages and all proto files. This must be

The absolute value of the msgid option is irrelevant as it is only used as a key; uniqueness counts. msgid's need not be sequential.

It is helpful to use message id' less than say a few thousand because
it will be transported in a limited-size field in the multiframe ring
(a uint32_t), and there should be bits available for other purposes
like specifying the encoding (protobuf, or a deserialized nanopb C
struct).
Any msgid value must be between 1 and msgidType.MSGID_MAX. This is
checked at startup time in libmkproto and will result in an assert if
violated. Values above MSGID_MAX to 4095 are reserved message ID
values, see enum msgidType in types.proto .The reason is the
limited-size field (12 bits) in the multiframe ring flag (see
mfields_t).

Convention for adding msgid's:
------------------------------
Expand All @@ -38,7 +39,7 @@ e.g. canon.proto:
config.proto:
// msgid base: 200

ans so forth.
and so forth.

To tag a message with a msgid, proceed like so (using canon.proto as example):

Expand All @@ -56,4 +57,26 @@ message Emc_Traj_Set_G5x {
required OriginIndex g5x_index = 20;
}

Accessing the msgid if the message name is known:
-------------------------------------------------

Google Protobuf, Python bindings:

def msgid(m):
return m.DESCRIPTOR.GetOptions().Extensions[nanopb_msgopt].msgid


Google Protobuf, C++ bindings:

uint32 msgid(const ::google::protobuf::Message &m)
{
const ::google::protobuf::MessageOptions& options = m.GetDescriptor()->options();
return options.GetExtension(nanopb_msgopt).msgid();
}

Nanopb:

use the <messagename>_msgid symbol which defines an integer constant

NB: due to the use of 'package machinetalk;', for example, the nanopb symbol for
message 'Container' is 'pb_Container_msgid'
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/canon.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";

// see README.msgid
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/config.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";

// see README.msgid
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/emcclass.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";

// see README.msgid
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/firmware.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
/** firmware descriptor for hostmot2
The message Firmware encodes the detail which used to be hardcoded in the low-level hostmot2 driver
in the struct hm2_lowlevel_io_struct.
Expand Down
23 changes: 23 additions & 0 deletions src/machinetalk/protobuf/jplan.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto2";
package machinetalk;

// see README.msgid
// msgid base: 350

import "machinetalk/protobuf/nanopb.proto";


message JplanJoint {
option (nanopb_msgopt).msgid = 352;

optional double pos_cmd = 1;
optional double max_vel = 2;
optional double max_acc = 3;
optional bool enable = 4; // enable/disable this joint
};

message JplanCommand {
option (nanopb_msgopt).msgid = 354;

repeated JplanJoint joint = 2 [(nanopb).max_count = 10];;
};
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/log.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
package machinetalk;
// see README.msgid
// msgid base: 400
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/message.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
// use a self-describing format as suggested in protobuf docs
// and on the mailing list

Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/motcmds.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
package machinetalk;

// see README.msgid
Expand Down
32 changes: 23 additions & 9 deletions src/machinetalk/protobuf/object.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
// everything we know about objects, including HAL objects

// see README.msgid
Expand Down Expand Up @@ -137,6 +138,8 @@ message Function {
optional fixed32 runtime = 5;
optional fixed32 maxtime = 6;
optional bool reentrant = 7;
optional HalFunctType type = 8;
optional bool maxtime_increased = 9;
}

message Thread {
Expand Down Expand Up @@ -174,6 +177,7 @@ message Component {

repeated Pin pin = 16;
repeated Param param = 17;
repeated Function funct = 19;

// do not create the component on MT_HALRCOMP_BIND if the component does not exist
optional bool no_create = 18;
Expand All @@ -192,10 +196,16 @@ message Ring {
optional bool rtapi_shm = 7;
optional sfixed32 reader = 8;
optional sfixed32 writer = 9;
optional sfixed32 size = 10;
optional sfixed32 total_size = 10;
optional sfixed32 scratchpad = 11;
optional sfixed32 ring_shmkey = 12;
optional fixed32 encodings = 13;
// optional socketType haltalk_zeromq_stype = 14;
// optional bool haltalk_adopt = 15;
// optional bool haltalk_announce = 16;
// optional bool haltalk_writes = 17;
// optional fixed32 paired_handle = 18;
}

message Member {

option (nanopb_msgopt).msgid = 711;
Expand Down Expand Up @@ -249,13 +259,13 @@ message Vtable {
option (nanopb_msgopt).msgid = 714;

optional string name = 1; // [(nanopb).max_size = 41];
optional fixed32 context = 2;
optional sfixed32 comp_id = 4;
optional sfixed32 instance_id = 5;
optional fixed32 handle = 6;
optional sfixed32 refcount = 7;
optional sfixed32 version = 8;
optional fixed64 vtable = 9;
optional fixed32 handle = 2;
optional sfixed32 owner_id = 3;

optional fixed32 context = 5;
optional sfixed32 refcount = 6;
optional sfixed32 version = 7;
optional fixed64 vtable = 8;
}

message Inst {
Expand All @@ -267,5 +277,9 @@ message Inst {
optional fixed32 inst_id = 3;
optional fixed32 inst_size = 4;
optional fixed64 vtable = 5;

repeated Pin pin = 16;
repeated Param param = 17;
repeated Function funct = 19;
}

1 change: 1 addition & 0 deletions src/machinetalk/protobuf/preview.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
package machinetalk;

// see README.msgid
Expand Down
46 changes: 46 additions & 0 deletions src/machinetalk/protobuf/ros.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
syntax = "proto2";
package machinetalk; // this should probably better be ros or pb:ros;

// see README.msgid
// msgid base: 370

import "machinetalk/protobuf/nanopb.proto";

// http://docs.ros.org/jade/api/std_msgs/html/msg/Header.html
message Time {
option (nanopb_msgopt).msgid = 371;

optional uint32 secs = 1;
optional uint32 nsecs = 2;
};

message Header {
option (nanopb_msgopt).msgid = 372;

optional uint32 seq = 1;
optional Time stamp = 2;
optional string frame_id = 3 [(nanopb).max_size = 20];
}

// http://docs.ros.org/indigo/api/trajectory_msgs/html/msg/JointTrajectoryPoint.html
message JointTrajectoryPoint {
option (nanopb_msgopt).msgid = 373;

repeated double positions = 1 [(nanopb).max_count = 10];
repeated double velocities = 2 [(nanopb).max_count = 10];
repeated double accelerations = 3 [(nanopb).max_count = 10];
repeated double effort = 4 [(nanopb).max_count = 10];
optional double time_from_start = 5;

optional double duration = 7; // of this segment, secs
optional uint32 serial = 8; // segment being worked on
};

// http://docs.ros.org/jade/api/trajectory_msgs/html/msg/JointTrajectory.html
message JointTrajectory {
option (nanopb_msgopt).msgid = 374;

optional Header header = 1;
repeated string joint_names = 2;
repeated JointTrajectoryPoint points = 3;
};
3 changes: 2 additions & 1 deletion src/machinetalk/protobuf/rtapi_message.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";
import "machinetalk/protobuf/value.proto";

Expand All @@ -14,7 +15,7 @@ message RTAPI_Message {
required int32 msglevel = 10; // [default = RTAPI_MSG_DBG];

required string format = 20 [default = "*** uninitialized ***",
(nanopb).max_size = 100];
(nanopb).max_size = 100];

// if this list of scalars is non-empty,
// this implies sprintf(text, <arg>) should be applied
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/rtapicommand.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";
// see README.msgid
// msgid base: 900
Expand Down
2 changes: 2 additions & 0 deletions src/machinetalk/protobuf/status.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
import "machinetalk/protobuf/nanopb.proto";
import "machinetalk/protobuf/types.proto";
import "machinetalk/protobuf/preview.proto";
Expand Down Expand Up @@ -398,6 +399,7 @@ message EmcStatusMotion {
optional RCS_STATUS state = 47; /// Current command execution status.
optional double max_velocity = 48; /// Maximum velocity override.
optional double max_acceleration = 49; /// TODO remove
optional double rapidrate = 50; /// Current rapid override.
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/task.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
// interpreter protocol messages


Expand Down
1 change: 1 addition & 0 deletions src/machinetalk/protobuf/test.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
syntax = "proto2";
// use any of the below for testing and experimentation.

import "machinetalk/protobuf/emcclass.proto";
Expand Down
Loading

0 comments on commit f4481f5

Please sign in to comment.